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.

26176 lines
696KB

  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, can be @var{2nd}, @var{4th} or @var{8th}.
  413. Default is @var{4th}.
  414. @end table
  415. @section acrusher
  416. Reduce audio bit resolution.
  417. This filter is bit crusher with enhanced functionality. A bit crusher
  418. is used to audibly reduce number of bits an audio signal is sampled
  419. with. This doesn't change the bit depth at all, it just produces the
  420. effect. Material reduced in bit depth sounds more harsh and "digital".
  421. This filter is able to even round to continuous values instead of discrete
  422. bit depths.
  423. Additionally it has a D/C offset which results in different crushing of
  424. the lower and the upper half of the signal.
  425. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  426. Another feature of this filter is the logarithmic mode.
  427. This setting switches from linear distances between bits to logarithmic ones.
  428. The result is a much more "natural" sounding crusher which doesn't gate low
  429. signals for example. The human ear has a logarithmic perception,
  430. so this kind of crushing is much more pleasant.
  431. Logarithmic crushing is also able to get anti-aliased.
  432. The filter accepts the following options:
  433. @table @option
  434. @item level_in
  435. Set level in.
  436. @item level_out
  437. Set level out.
  438. @item bits
  439. Set bit reduction.
  440. @item mix
  441. Set mixing amount.
  442. @item mode
  443. Can be linear: @code{lin} or logarithmic: @code{log}.
  444. @item dc
  445. Set DC.
  446. @item aa
  447. Set anti-aliasing.
  448. @item samples
  449. Set sample reduction.
  450. @item lfo
  451. Enable LFO. By default disabled.
  452. @item lforange
  453. Set LFO range.
  454. @item lforate
  455. Set LFO rate.
  456. @end table
  457. @section acue
  458. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  459. filter.
  460. @section adeclick
  461. Remove impulsive noise from input audio.
  462. Samples detected as impulsive noise are replaced by interpolated samples using
  463. autoregressive modelling.
  464. @table @option
  465. @item w
  466. Set window size, in milliseconds. Allowed range is from @code{10} to
  467. @code{100}. Default value is @code{55} milliseconds.
  468. This sets size of window which will be processed at once.
  469. @item o
  470. Set window overlap, in percentage of window size. Allowed range is from
  471. @code{50} to @code{95}. Default value is @code{75} percent.
  472. Setting this to a very high value increases impulsive noise removal but makes
  473. whole process much slower.
  474. @item a
  475. Set autoregression order, in percentage of window size. Allowed range is from
  476. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  477. controls quality of interpolated samples using neighbour good samples.
  478. @item t
  479. Set threshold value. Allowed range is from @code{1} to @code{100}.
  480. Default value is @code{2}.
  481. This controls the strength of impulsive noise which is going to be removed.
  482. The lower value, the more samples will be detected as impulsive noise.
  483. @item b
  484. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  485. @code{10}. Default value is @code{2}.
  486. If any two samples detected as noise are spaced less than this value then any
  487. sample between those two samples will be also detected as noise.
  488. @item m
  489. Set overlap method.
  490. It accepts the following values:
  491. @table @option
  492. @item a
  493. Select overlap-add method. Even not interpolated samples are slightly
  494. changed with this method.
  495. @item s
  496. Select overlap-save method. Not interpolated samples remain unchanged.
  497. @end table
  498. Default value is @code{a}.
  499. @end table
  500. @section adeclip
  501. Remove clipped samples from input audio.
  502. Samples detected as clipped are replaced by interpolated samples using
  503. autoregressive modelling.
  504. @table @option
  505. @item w
  506. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  507. Default value is @code{55} milliseconds.
  508. This sets size of window which will be processed at once.
  509. @item o
  510. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  511. to @code{95}. Default value is @code{75} percent.
  512. @item a
  513. Set autoregression order, in percentage of window size. Allowed range is from
  514. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  515. quality of interpolated samples using neighbour good samples.
  516. @item t
  517. Set threshold value. Allowed range is from @code{1} to @code{100}.
  518. Default value is @code{10}. Higher values make clip detection less aggressive.
  519. @item n
  520. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  521. Default value is @code{1000}. Higher values make clip detection less aggressive.
  522. @item m
  523. Set overlap method.
  524. It accepts the following values:
  525. @table @option
  526. @item a
  527. Select overlap-add method. Even not interpolated samples are slightly changed
  528. with this method.
  529. @item s
  530. Select overlap-save method. Not interpolated samples remain unchanged.
  531. @end table
  532. Default value is @code{a}.
  533. @end table
  534. @section adelay
  535. Delay one or more audio channels.
  536. Samples in delayed channel are filled with silence.
  537. The filter accepts the following option:
  538. @table @option
  539. @item delays
  540. Set list of delays in milliseconds for each channel separated by '|'.
  541. Unused delays will be silently ignored. If number of given delays is
  542. smaller than number of channels all remaining channels will not be delayed.
  543. If you want to delay exact number of samples, append 'S' to number.
  544. If you want instead to delay in seconds, append 's' to number.
  545. @item all
  546. Use last set delay for all remaining channels. By default is disabled.
  547. This option if enabled changes how option @code{delays} is interpreted.
  548. @end table
  549. @subsection Examples
  550. @itemize
  551. @item
  552. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  553. the second channel (and any other channels that may be present) unchanged.
  554. @example
  555. adelay=1500|0|500
  556. @end example
  557. @item
  558. Delay second channel by 500 samples, the third channel by 700 samples and leave
  559. the first channel (and any other channels that may be present) unchanged.
  560. @example
  561. adelay=0|500S|700S
  562. @end example
  563. @item
  564. Delay all channels by same number of samples:
  565. @example
  566. adelay=delays=64S:all=1
  567. @end example
  568. @end itemize
  569. @section adenorm
  570. Remedy denormals in audio by adding extremely low-level noise.
  571. A description of the accepted parameters follows.
  572. @table @option
  573. @item level
  574. Set level of added noise in dB. Default is @code{-351}.
  575. Allowed range is from -451 to -90.
  576. @item type
  577. Set type of added noise.
  578. @table @option
  579. @item dc
  580. Add DC signal.
  581. @item ac
  582. Add AC signal.
  583. @item square
  584. Add square signal.
  585. @item pulse
  586. Add pulse signal.
  587. @end table
  588. Default is @code{dc}.
  589. @end table
  590. @section aderivative, aintegral
  591. Compute derivative/integral of audio stream.
  592. Applying both filters one after another produces original audio.
  593. @section aecho
  594. Apply echoing to the input audio.
  595. Echoes are reflected sound and can occur naturally amongst mountains
  596. (and sometimes large buildings) when talking or shouting; digital echo
  597. effects emulate this behaviour and are often used to help fill out the
  598. sound of a single instrument or vocal. The time difference between the
  599. original signal and the reflection is the @code{delay}, and the
  600. loudness of the reflected signal is the @code{decay}.
  601. Multiple echoes can have different delays and decays.
  602. A description of the accepted parameters follows.
  603. @table @option
  604. @item in_gain
  605. Set input gain of reflected signal. Default is @code{0.6}.
  606. @item out_gain
  607. Set output gain of reflected signal. Default is @code{0.3}.
  608. @item delays
  609. Set list of time intervals in milliseconds between original signal and reflections
  610. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  611. Default is @code{1000}.
  612. @item decays
  613. Set list of loudness of reflected signals separated by '|'.
  614. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  615. Default is @code{0.5}.
  616. @end table
  617. @subsection Examples
  618. @itemize
  619. @item
  620. Make it sound as if there are twice as many instruments as are actually playing:
  621. @example
  622. aecho=0.8:0.88:60:0.4
  623. @end example
  624. @item
  625. If delay is very short, then it sounds like a (metallic) robot playing music:
  626. @example
  627. aecho=0.8:0.88:6:0.4
  628. @end example
  629. @item
  630. A longer delay will sound like an open air concert in the mountains:
  631. @example
  632. aecho=0.8:0.9:1000:0.3
  633. @end example
  634. @item
  635. Same as above but with one more mountain:
  636. @example
  637. aecho=0.8:0.9:1000|1800:0.3|0.25
  638. @end example
  639. @end itemize
  640. @section aemphasis
  641. Audio emphasis filter creates or restores material directly taken from LPs or
  642. emphased CDs with different filter curves. E.g. to store music on vinyl the
  643. signal has to be altered by a filter first to even out the disadvantages of
  644. this recording medium.
  645. Once the material is played back the inverse filter has to be applied to
  646. restore the distortion of the frequency response.
  647. The filter accepts the following options:
  648. @table @option
  649. @item level_in
  650. Set input gain.
  651. @item level_out
  652. Set output gain.
  653. @item mode
  654. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  655. use @code{production} mode. Default is @code{reproduction} mode.
  656. @item type
  657. Set filter type. Selects medium. Can be one of the following:
  658. @table @option
  659. @item col
  660. select Columbia.
  661. @item emi
  662. select EMI.
  663. @item bsi
  664. select BSI (78RPM).
  665. @item riaa
  666. select RIAA.
  667. @item cd
  668. select Compact Disc (CD).
  669. @item 50fm
  670. select 50µs (FM).
  671. @item 75fm
  672. select 75µs (FM).
  673. @item 50kf
  674. select 50µs (FM-KF).
  675. @item 75kf
  676. select 75µs (FM-KF).
  677. @end table
  678. @end table
  679. @section aeval
  680. Modify an audio signal according to the specified expressions.
  681. This filter accepts one or more expressions (one for each channel),
  682. which are evaluated and used to modify a corresponding audio signal.
  683. It accepts the following parameters:
  684. @table @option
  685. @item exprs
  686. Set the '|'-separated expressions list for each separate channel. If
  687. the number of input channels is greater than the number of
  688. expressions, the last specified expression is used for the remaining
  689. output channels.
  690. @item channel_layout, c
  691. Set output channel layout. If not specified, the channel layout is
  692. specified by the number of expressions. If set to @samp{same}, it will
  693. use by default the same input channel layout.
  694. @end table
  695. Each expression in @var{exprs} can contain the following constants and functions:
  696. @table @option
  697. @item ch
  698. channel number of the current expression
  699. @item n
  700. number of the evaluated sample, starting from 0
  701. @item s
  702. sample rate
  703. @item t
  704. time of the evaluated sample expressed in seconds
  705. @item nb_in_channels
  706. @item nb_out_channels
  707. input and output number of channels
  708. @item val(CH)
  709. the value of input channel with number @var{CH}
  710. @end table
  711. Note: this filter is slow. For faster processing you should use a
  712. dedicated filter.
  713. @subsection Examples
  714. @itemize
  715. @item
  716. Half volume:
  717. @example
  718. aeval=val(ch)/2:c=same
  719. @end example
  720. @item
  721. Invert phase of the second channel:
  722. @example
  723. aeval=val(0)|-val(1)
  724. @end example
  725. @end itemize
  726. @anchor{afade}
  727. @section afade
  728. Apply fade-in/out effect to input audio.
  729. A description of the accepted parameters follows.
  730. @table @option
  731. @item type, t
  732. Specify the effect type, can be either @code{in} for fade-in, or
  733. @code{out} for a fade-out effect. Default is @code{in}.
  734. @item start_sample, ss
  735. Specify the number of the start sample for starting to apply the fade
  736. effect. Default is 0.
  737. @item nb_samples, ns
  738. Specify the number of samples for which the fade effect has to last. At
  739. the end of the fade-in effect the output audio will have the same
  740. volume as the input audio, at the end of the fade-out transition
  741. the output audio will be silence. Default is 44100.
  742. @item start_time, st
  743. Specify the start time of the fade effect. Default is 0.
  744. The value must be specified as a time duration; see
  745. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  746. for the accepted syntax.
  747. If set this option is used instead of @var{start_sample}.
  748. @item duration, d
  749. Specify the duration of the fade effect. See
  750. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  751. for the accepted syntax.
  752. At the end of the fade-in effect the output audio will have the same
  753. volume as the input audio, at the end of the fade-out transition
  754. the output audio will be silence.
  755. By default the duration is determined by @var{nb_samples}.
  756. If set this option is used instead of @var{nb_samples}.
  757. @item curve
  758. Set curve for fade transition.
  759. It accepts the following values:
  760. @table @option
  761. @item tri
  762. select triangular, linear slope (default)
  763. @item qsin
  764. select quarter of sine wave
  765. @item hsin
  766. select half of sine wave
  767. @item esin
  768. select exponential sine wave
  769. @item log
  770. select logarithmic
  771. @item ipar
  772. select inverted parabola
  773. @item qua
  774. select quadratic
  775. @item cub
  776. select cubic
  777. @item squ
  778. select square root
  779. @item cbr
  780. select cubic root
  781. @item par
  782. select parabola
  783. @item exp
  784. select exponential
  785. @item iqsin
  786. select inverted quarter of sine wave
  787. @item ihsin
  788. select inverted half of sine wave
  789. @item dese
  790. select double-exponential seat
  791. @item desi
  792. select double-exponential sigmoid
  793. @item losi
  794. select logistic sigmoid
  795. @item sinc
  796. select sine cardinal function
  797. @item isinc
  798. select inverted sine cardinal function
  799. @item nofade
  800. no fade applied
  801. @end table
  802. @end table
  803. @subsection Examples
  804. @itemize
  805. @item
  806. Fade in first 15 seconds of audio:
  807. @example
  808. afade=t=in:ss=0:d=15
  809. @end example
  810. @item
  811. Fade out last 25 seconds of a 900 seconds audio:
  812. @example
  813. afade=t=out:st=875:d=25
  814. @end example
  815. @end itemize
  816. @section afftdn
  817. Denoise audio samples with FFT.
  818. A description of the accepted parameters follows.
  819. @table @option
  820. @item nr
  821. Set the noise reduction in dB, allowed range is 0.01 to 97.
  822. Default value is 12 dB.
  823. @item nf
  824. Set the noise floor in dB, allowed range is -80 to -20.
  825. Default value is -50 dB.
  826. @item nt
  827. Set the noise type.
  828. It accepts the following values:
  829. @table @option
  830. @item w
  831. Select white noise.
  832. @item v
  833. Select vinyl noise.
  834. @item s
  835. Select shellac noise.
  836. @item c
  837. Select custom noise, defined in @code{bn} option.
  838. Default value is white noise.
  839. @end table
  840. @item bn
  841. Set custom band noise for every one of 15 bands.
  842. Bands are separated by ' ' or '|'.
  843. @item rf
  844. Set the residual floor in dB, allowed range is -80 to -20.
  845. Default value is -38 dB.
  846. @item tn
  847. Enable noise tracking. By default is disabled.
  848. With this enabled, noise floor is automatically adjusted.
  849. @item tr
  850. Enable residual tracking. By default is disabled.
  851. @item om
  852. Set the output mode.
  853. It accepts the following values:
  854. @table @option
  855. @item i
  856. Pass input unchanged.
  857. @item o
  858. Pass noise filtered out.
  859. @item n
  860. Pass only noise.
  861. Default value is @var{o}.
  862. @end table
  863. @end table
  864. @subsection Commands
  865. This filter supports the following commands:
  866. @table @option
  867. @item sample_noise, sn
  868. Start or stop measuring noise profile.
  869. Syntax for the command is : "start" or "stop" string.
  870. After measuring noise profile is stopped it will be
  871. automatically applied in filtering.
  872. @item noise_reduction, nr
  873. Change noise reduction. Argument is single float number.
  874. Syntax for the command is : "@var{noise_reduction}"
  875. @item noise_floor, nf
  876. Change noise floor. Argument is single float number.
  877. Syntax for the command is : "@var{noise_floor}"
  878. @item output_mode, om
  879. Change output mode operation.
  880. Syntax for the command is : "i", "o" or "n" string.
  881. @end table
  882. @section afftfilt
  883. Apply arbitrary expressions to samples in frequency domain.
  884. @table @option
  885. @item real
  886. Set frequency domain real expression for each separate channel separated
  887. by '|'. Default is "re".
  888. If the number of input channels is greater than the number of
  889. expressions, the last specified expression is used for the remaining
  890. output channels.
  891. @item imag
  892. Set frequency domain imaginary expression for each separate channel
  893. separated by '|'. Default is "im".
  894. Each expression in @var{real} and @var{imag} can contain the following
  895. constants and functions:
  896. @table @option
  897. @item sr
  898. sample rate
  899. @item b
  900. current frequency bin number
  901. @item nb
  902. number of available bins
  903. @item ch
  904. channel number of the current expression
  905. @item chs
  906. number of channels
  907. @item pts
  908. current frame pts
  909. @item re
  910. current real part of frequency bin of current channel
  911. @item im
  912. current imaginary part of frequency bin of current channel
  913. @item real(b, ch)
  914. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  915. @item imag(b, ch)
  916. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  917. @end table
  918. @item win_size
  919. Set window size. Allowed range is from 16 to 131072.
  920. Default is @code{4096}
  921. @item win_func
  922. Set window function. Default is @code{hann}.
  923. @item overlap
  924. Set window overlap. If set to 1, the recommended overlap for selected
  925. window function will be picked. Default is @code{0.75}.
  926. @end table
  927. @subsection Examples
  928. @itemize
  929. @item
  930. Leave almost only low frequencies in audio:
  931. @example
  932. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  933. @end example
  934. @item
  935. Apply robotize effect:
  936. @example
  937. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  938. @end example
  939. @item
  940. Apply whisper effect:
  941. @example
  942. 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"
  943. @end example
  944. @end itemize
  945. @anchor{afir}
  946. @section afir
  947. Apply an arbitrary Finite Impulse Response filter.
  948. This filter is designed for applying long FIR filters,
  949. up to 60 seconds long.
  950. It can be used as component for digital crossover filters,
  951. room equalization, cross talk cancellation, wavefield synthesis,
  952. auralization, ambiophonics, ambisonics and spatialization.
  953. This filter uses the streams higher than first one as FIR coefficients.
  954. If the non-first stream holds a single channel, it will be used
  955. for all input channels in the first stream, otherwise
  956. the number of channels in the non-first stream must be same as
  957. the number of channels in the first stream.
  958. It accepts the following parameters:
  959. @table @option
  960. @item dry
  961. Set dry gain. This sets input gain.
  962. @item wet
  963. Set wet gain. This sets final output gain.
  964. @item length
  965. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  966. @item gtype
  967. Enable applying gain measured from power of IR.
  968. Set which approach to use for auto gain measurement.
  969. @table @option
  970. @item none
  971. Do not apply any gain.
  972. @item peak
  973. select peak gain, very conservative approach. This is default value.
  974. @item dc
  975. select DC gain, limited application.
  976. @item gn
  977. select gain to noise approach, this is most popular one.
  978. @end table
  979. @item irgain
  980. Set gain to be applied to IR coefficients before filtering.
  981. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  982. @item irfmt
  983. Set format of IR stream. Can be @code{mono} or @code{input}.
  984. Default is @code{input}.
  985. @item maxir
  986. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  987. Allowed range is 0.1 to 60 seconds.
  988. @item response
  989. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  990. By default it is disabled.
  991. @item channel
  992. Set for which IR channel to display frequency response. By default is first channel
  993. displayed. This option is used only when @var{response} is enabled.
  994. @item size
  995. Set video stream size. This option is used only when @var{response} is enabled.
  996. @item rate
  997. Set video stream frame rate. This option is used only when @var{response} is enabled.
  998. @item minp
  999. Set minimal partition size used for convolution. Default is @var{8192}.
  1000. Allowed range is from @var{1} to @var{32768}.
  1001. Lower values decreases latency at cost of higher CPU usage.
  1002. @item maxp
  1003. Set maximal partition size used for convolution. Default is @var{8192}.
  1004. Allowed range is from @var{8} to @var{32768}.
  1005. Lower values may increase CPU usage.
  1006. @item nbirs
  1007. Set number of input impulse responses streams which will be switchable at runtime.
  1008. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1009. @item ir
  1010. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1011. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1012. This option can be changed at runtime via @ref{commands}.
  1013. @end table
  1014. @subsection Examples
  1015. @itemize
  1016. @item
  1017. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1018. @example
  1019. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1020. @end example
  1021. @end itemize
  1022. @anchor{aformat}
  1023. @section aformat
  1024. Set output format constraints for the input audio. The framework will
  1025. negotiate the most appropriate format to minimize conversions.
  1026. It accepts the following parameters:
  1027. @table @option
  1028. @item sample_fmts, f
  1029. A '|'-separated list of requested sample formats.
  1030. @item sample_rates, r
  1031. A '|'-separated list of requested sample rates.
  1032. @item channel_layouts, cl
  1033. A '|'-separated list of requested channel layouts.
  1034. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1035. for the required syntax.
  1036. @end table
  1037. If a parameter is omitted, all values are allowed.
  1038. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1039. @example
  1040. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1041. @end example
  1042. @section afreqshift
  1043. Apply frequency shift to input audio samples.
  1044. The filter accepts the following options:
  1045. @table @option
  1046. @item shift
  1047. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1048. Default value is 0.0.
  1049. @end table
  1050. @subsection Commands
  1051. This filter supports the above option as @ref{commands}.
  1052. @section agate
  1053. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1054. processing reduces disturbing noise between useful signals.
  1055. Gating is done by detecting the volume below a chosen level @var{threshold}
  1056. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1057. floor is set via @var{range}. Because an exact manipulation of the signal
  1058. would cause distortion of the waveform the reduction can be levelled over
  1059. time. This is done by setting @var{attack} and @var{release}.
  1060. @var{attack} determines how long the signal has to fall below the threshold
  1061. before any reduction will occur and @var{release} sets the time the signal
  1062. has to rise above the threshold to reduce the reduction again.
  1063. Shorter signals than the chosen attack time will be left untouched.
  1064. @table @option
  1065. @item level_in
  1066. Set input level before filtering.
  1067. Default is 1. Allowed range is from 0.015625 to 64.
  1068. @item mode
  1069. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1070. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1071. will be amplified, expanding dynamic range in upward direction.
  1072. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1073. @item range
  1074. Set the level of gain reduction when the signal is below the threshold.
  1075. Default is 0.06125. Allowed range is from 0 to 1.
  1076. Setting this to 0 disables reduction and then filter behaves like expander.
  1077. @item threshold
  1078. If a signal rises above this level the gain reduction is released.
  1079. Default is 0.125. Allowed range is from 0 to 1.
  1080. @item ratio
  1081. Set a ratio by which the signal is reduced.
  1082. Default is 2. Allowed range is from 1 to 9000.
  1083. @item attack
  1084. Amount of milliseconds the signal has to rise above the threshold before gain
  1085. reduction stops.
  1086. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1087. @item release
  1088. Amount of milliseconds the signal has to fall below the threshold before the
  1089. reduction is increased again. Default is 250 milliseconds.
  1090. Allowed range is from 0.01 to 9000.
  1091. @item makeup
  1092. Set amount of amplification of signal after processing.
  1093. Default is 1. Allowed range is from 1 to 64.
  1094. @item knee
  1095. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1096. Default is 2.828427125. Allowed range is from 1 to 8.
  1097. @item detection
  1098. Choose if exact signal should be taken for detection or an RMS like one.
  1099. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1100. @item link
  1101. Choose if the average level between all channels or the louder channel affects
  1102. the reduction.
  1103. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1104. @end table
  1105. @section aiir
  1106. Apply an arbitrary Infinite Impulse Response filter.
  1107. It accepts the following parameters:
  1108. @table @option
  1109. @item zeros, z
  1110. Set B/numerator/zeros/reflection coefficients.
  1111. @item poles, p
  1112. Set A/denominator/poles/ladder coefficients.
  1113. @item gains, k
  1114. Set channels gains.
  1115. @item dry_gain
  1116. Set input gain.
  1117. @item wet_gain
  1118. Set output gain.
  1119. @item format, f
  1120. Set coefficients format.
  1121. @table @samp
  1122. @item ll
  1123. lattice-ladder function
  1124. @item sf
  1125. analog transfer function
  1126. @item tf
  1127. digital transfer function
  1128. @item zp
  1129. Z-plane zeros/poles, cartesian (default)
  1130. @item pr
  1131. Z-plane zeros/poles, polar radians
  1132. @item pd
  1133. Z-plane zeros/poles, polar degrees
  1134. @item sp
  1135. S-plane zeros/poles
  1136. @end table
  1137. @item process, r
  1138. Set type of processing.
  1139. @table @samp
  1140. @item d
  1141. direct processing
  1142. @item s
  1143. serial processing
  1144. @item p
  1145. parallel processing
  1146. @end table
  1147. @item precision, e
  1148. Set filtering precision.
  1149. @table @samp
  1150. @item dbl
  1151. double-precision floating-point (default)
  1152. @item flt
  1153. single-precision floating-point
  1154. @item i32
  1155. 32-bit integers
  1156. @item i16
  1157. 16-bit integers
  1158. @end table
  1159. @item normalize, n
  1160. Normalize filter coefficients, by default is enabled.
  1161. Enabling it will normalize magnitude response at DC to 0dB.
  1162. @item mix
  1163. How much to use filtered signal in output. Default is 1.
  1164. Range is between 0 and 1.
  1165. @item response
  1166. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1167. By default it is disabled.
  1168. @item channel
  1169. Set for which IR channel to display frequency response. By default is first channel
  1170. displayed. This option is used only when @var{response} is enabled.
  1171. @item size
  1172. Set video stream size. This option is used only when @var{response} is enabled.
  1173. @end table
  1174. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1175. order.
  1176. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1177. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1178. imaginary unit.
  1179. Different coefficients and gains can be provided for every channel, in such case
  1180. use '|' to separate coefficients or gains. Last provided coefficients will be
  1181. used for all remaining channels.
  1182. @subsection Examples
  1183. @itemize
  1184. @item
  1185. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1186. @example
  1187. 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
  1188. @end example
  1189. @item
  1190. Same as above but in @code{zp} format:
  1191. @example
  1192. 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
  1193. @end example
  1194. @item
  1195. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1196. @example
  1197. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1198. @end example
  1199. @end itemize
  1200. @section alimiter
  1201. The limiter prevents an input signal from rising over a desired threshold.
  1202. This limiter uses lookahead technology to prevent your signal from distorting.
  1203. It means that there is a small delay after the signal is processed. Keep in mind
  1204. that the delay it produces is the attack time you set.
  1205. The filter accepts the following options:
  1206. @table @option
  1207. @item level_in
  1208. Set input gain. Default is 1.
  1209. @item level_out
  1210. Set output gain. Default is 1.
  1211. @item limit
  1212. Don't let signals above this level pass the limiter. Default is 1.
  1213. @item attack
  1214. The limiter will reach its attenuation level in this amount of time in
  1215. milliseconds. Default is 5 milliseconds.
  1216. @item release
  1217. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1218. Default is 50 milliseconds.
  1219. @item asc
  1220. When gain reduction is always needed ASC takes care of releasing to an
  1221. average reduction level rather than reaching a reduction of 0 in the release
  1222. time.
  1223. @item asc_level
  1224. Select how much the release time is affected by ASC, 0 means nearly no changes
  1225. in release time while 1 produces higher release times.
  1226. @item level
  1227. Auto level output signal. Default is enabled.
  1228. This normalizes audio back to 0dB if enabled.
  1229. @end table
  1230. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1231. with @ref{aresample} before applying this filter.
  1232. @section allpass
  1233. Apply a two-pole all-pass filter with central frequency (in Hz)
  1234. @var{frequency}, and filter-width @var{width}.
  1235. An all-pass filter changes the audio's frequency to phase relationship
  1236. without changing its frequency to amplitude relationship.
  1237. The filter accepts the following options:
  1238. @table @option
  1239. @item frequency, f
  1240. Set frequency in Hz.
  1241. @item width_type, t
  1242. Set method to specify band-width of filter.
  1243. @table @option
  1244. @item h
  1245. Hz
  1246. @item q
  1247. Q-Factor
  1248. @item o
  1249. octave
  1250. @item s
  1251. slope
  1252. @item k
  1253. kHz
  1254. @end table
  1255. @item width, w
  1256. Specify the band-width of a filter in width_type units.
  1257. @item mix, m
  1258. How much to use filtered signal in output. Default is 1.
  1259. Range is between 0 and 1.
  1260. @item channels, c
  1261. Specify which channels to filter, by default all available are filtered.
  1262. @item normalize, n
  1263. Normalize biquad coefficients, by default is disabled.
  1264. Enabling it will normalize magnitude response at DC to 0dB.
  1265. @item order, o
  1266. Set the filter order, can be 1 or 2. Default is 2.
  1267. @item transform, a
  1268. Set transform type of IIR filter.
  1269. @table @option
  1270. @item di
  1271. @item dii
  1272. @item tdii
  1273. @item latt
  1274. @end table
  1275. @end table
  1276. @subsection Commands
  1277. This filter supports the following commands:
  1278. @table @option
  1279. @item frequency, f
  1280. Change allpass frequency.
  1281. Syntax for the command is : "@var{frequency}"
  1282. @item width_type, t
  1283. Change allpass width_type.
  1284. Syntax for the command is : "@var{width_type}"
  1285. @item width, w
  1286. Change allpass width.
  1287. Syntax for the command is : "@var{width}"
  1288. @item mix, m
  1289. Change allpass mix.
  1290. Syntax for the command is : "@var{mix}"
  1291. @end table
  1292. @section aloop
  1293. Loop audio samples.
  1294. The filter accepts the following options:
  1295. @table @option
  1296. @item loop
  1297. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1298. Default is 0.
  1299. @item size
  1300. Set maximal number of samples. Default is 0.
  1301. @item start
  1302. Set first sample of loop. Default is 0.
  1303. @end table
  1304. @anchor{amerge}
  1305. @section amerge
  1306. Merge two or more audio streams into a single multi-channel stream.
  1307. The filter accepts the following options:
  1308. @table @option
  1309. @item inputs
  1310. Set the number of inputs. Default is 2.
  1311. @end table
  1312. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1313. the channel layout of the output will be set accordingly and the channels
  1314. will be reordered as necessary. If the channel layouts of the inputs are not
  1315. disjoint, the output will have all the channels of the first input then all
  1316. the channels of the second input, in that order, and the channel layout of
  1317. the output will be the default value corresponding to the total number of
  1318. channels.
  1319. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1320. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1321. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1322. first input, b1 is the first channel of the second input).
  1323. On the other hand, if both input are in stereo, the output channels will be
  1324. in the default order: a1, a2, b1, b2, and the channel layout will be
  1325. arbitrarily set to 4.0, which may or may not be the expected value.
  1326. All inputs must have the same sample rate, and format.
  1327. If inputs do not have the same duration, the output will stop with the
  1328. shortest.
  1329. @subsection Examples
  1330. @itemize
  1331. @item
  1332. Merge two mono files into a stereo stream:
  1333. @example
  1334. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1335. @end example
  1336. @item
  1337. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1338. @example
  1339. 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
  1340. @end example
  1341. @end itemize
  1342. @section amix
  1343. Mixes multiple audio inputs into a single output.
  1344. Note that this filter only supports float samples (the @var{amerge}
  1345. and @var{pan} audio filters support many formats). If the @var{amix}
  1346. input has integer samples then @ref{aresample} will be automatically
  1347. inserted to perform the conversion to float samples.
  1348. For example
  1349. @example
  1350. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1351. @end example
  1352. will mix 3 input audio streams to a single output with the same duration as the
  1353. first input and a dropout transition time of 3 seconds.
  1354. It accepts the following parameters:
  1355. @table @option
  1356. @item inputs
  1357. The number of inputs. If unspecified, it defaults to 2.
  1358. @item duration
  1359. How to determine the end-of-stream.
  1360. @table @option
  1361. @item longest
  1362. The duration of the longest input. (default)
  1363. @item shortest
  1364. The duration of the shortest input.
  1365. @item first
  1366. The duration of the first input.
  1367. @end table
  1368. @item dropout_transition
  1369. The transition time, in seconds, for volume renormalization when an input
  1370. stream ends. The default value is 2 seconds.
  1371. @item weights
  1372. Specify weight of each input audio stream as sequence.
  1373. Each weight is separated by space. By default all inputs have same weight.
  1374. @end table
  1375. @subsection Commands
  1376. This filter supports the following commands:
  1377. @table @option
  1378. @item weights
  1379. Syntax is same as option with same name.
  1380. @end table
  1381. @section amultiply
  1382. Multiply first audio stream with second audio stream and store result
  1383. in output audio stream. Multiplication is done by multiplying each
  1384. sample from first stream with sample at same position from second stream.
  1385. With this element-wise multiplication one can create amplitude fades and
  1386. amplitude modulations.
  1387. @section anequalizer
  1388. High-order parametric multiband equalizer for each channel.
  1389. It accepts the following parameters:
  1390. @table @option
  1391. @item params
  1392. This option string is in format:
  1393. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1394. Each equalizer band is separated by '|'.
  1395. @table @option
  1396. @item chn
  1397. Set channel number to which equalization will be applied.
  1398. If input doesn't have that channel the entry is ignored.
  1399. @item f
  1400. Set central frequency for band.
  1401. If input doesn't have that frequency the entry is ignored.
  1402. @item w
  1403. Set band width in hertz.
  1404. @item g
  1405. Set band gain in dB.
  1406. @item t
  1407. Set filter type for band, optional, can be:
  1408. @table @samp
  1409. @item 0
  1410. Butterworth, this is default.
  1411. @item 1
  1412. Chebyshev type 1.
  1413. @item 2
  1414. Chebyshev type 2.
  1415. @end table
  1416. @end table
  1417. @item curves
  1418. With this option activated frequency response of anequalizer is displayed
  1419. in video stream.
  1420. @item size
  1421. Set video stream size. Only useful if curves option is activated.
  1422. @item mgain
  1423. Set max gain that will be displayed. Only useful if curves option is activated.
  1424. Setting this to a reasonable value makes it possible to display gain which is derived from
  1425. neighbour bands which are too close to each other and thus produce higher gain
  1426. when both are activated.
  1427. @item fscale
  1428. Set frequency scale used to draw frequency response in video output.
  1429. Can be linear or logarithmic. Default is logarithmic.
  1430. @item colors
  1431. Set color for each channel curve which is going to be displayed in video stream.
  1432. This is list of color names separated by space or by '|'.
  1433. Unrecognised or missing colors will be replaced by white color.
  1434. @end table
  1435. @subsection Examples
  1436. @itemize
  1437. @item
  1438. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1439. for first 2 channels using Chebyshev type 1 filter:
  1440. @example
  1441. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1442. @end example
  1443. @end itemize
  1444. @subsection Commands
  1445. This filter supports the following commands:
  1446. @table @option
  1447. @item change
  1448. Alter existing filter parameters.
  1449. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1450. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1451. error is returned.
  1452. @var{freq} set new frequency parameter.
  1453. @var{width} set new width parameter in herz.
  1454. @var{gain} set new gain parameter in dB.
  1455. Full filter invocation with asendcmd may look like this:
  1456. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1457. @end table
  1458. @section anlmdn
  1459. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1460. Each sample is adjusted by looking for other samples with similar contexts. This
  1461. context similarity is defined by comparing their surrounding patches of size
  1462. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1463. The filter accepts the following options:
  1464. @table @option
  1465. @item s
  1466. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1467. @item p
  1468. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1469. Default value is 2 milliseconds.
  1470. @item r
  1471. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1472. Default value is 6 milliseconds.
  1473. @item o
  1474. Set the output mode.
  1475. It accepts the following values:
  1476. @table @option
  1477. @item i
  1478. Pass input unchanged.
  1479. @item o
  1480. Pass noise filtered out.
  1481. @item n
  1482. Pass only noise.
  1483. Default value is @var{o}.
  1484. @end table
  1485. @item m
  1486. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1487. @end table
  1488. @subsection Commands
  1489. This filter supports the all above options as @ref{commands}.
  1490. @section anlms
  1491. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1492. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1493. relate to producing the least mean square of the error signal (difference between the desired,
  1494. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1495. A description of the accepted options follows.
  1496. @table @option
  1497. @item order
  1498. Set filter order.
  1499. @item mu
  1500. Set filter mu.
  1501. @item eps
  1502. Set the filter eps.
  1503. @item leakage
  1504. Set the filter leakage.
  1505. @item out_mode
  1506. It accepts the following values:
  1507. @table @option
  1508. @item i
  1509. Pass the 1st input.
  1510. @item d
  1511. Pass the 2nd input.
  1512. @item o
  1513. Pass filtered samples.
  1514. @item n
  1515. Pass difference between desired and filtered samples.
  1516. Default value is @var{o}.
  1517. @end table
  1518. @end table
  1519. @subsection Examples
  1520. @itemize
  1521. @item
  1522. One of many usages of this filter is noise reduction, input audio is filtered
  1523. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1524. @example
  1525. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1526. @end example
  1527. @end itemize
  1528. @subsection Commands
  1529. This filter supports the same commands as options, excluding option @code{order}.
  1530. @section anull
  1531. Pass the audio source unchanged to the output.
  1532. @section apad
  1533. Pad the end of an audio stream with silence.
  1534. This can be used together with @command{ffmpeg} @option{-shortest} to
  1535. extend audio streams to the same length as the video stream.
  1536. A description of the accepted options follows.
  1537. @table @option
  1538. @item packet_size
  1539. Set silence packet size. Default value is 4096.
  1540. @item pad_len
  1541. Set the number of samples of silence to add to the end. After the
  1542. value is reached, the stream is terminated. This option is mutually
  1543. exclusive with @option{whole_len}.
  1544. @item whole_len
  1545. Set the minimum total number of samples in the output audio stream. If
  1546. the value is longer than the input audio length, silence is added to
  1547. the end, until the value is reached. This option is mutually exclusive
  1548. with @option{pad_len}.
  1549. @item pad_dur
  1550. Specify the duration of samples of silence to add. See
  1551. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1552. for the accepted syntax. Used only if set to non-zero value.
  1553. @item whole_dur
  1554. Specify the minimum total duration in the output audio stream. See
  1555. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1556. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1557. the input audio length, silence is added to the end, until the value is reached.
  1558. This option is mutually exclusive with @option{pad_dur}
  1559. @end table
  1560. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1561. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1562. the input stream indefinitely.
  1563. @subsection Examples
  1564. @itemize
  1565. @item
  1566. Add 1024 samples of silence to the end of the input:
  1567. @example
  1568. apad=pad_len=1024
  1569. @end example
  1570. @item
  1571. Make sure the audio output will contain at least 10000 samples, pad
  1572. the input with silence if required:
  1573. @example
  1574. apad=whole_len=10000
  1575. @end example
  1576. @item
  1577. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1578. video stream will always result the shortest and will be converted
  1579. until the end in the output file when using the @option{shortest}
  1580. option:
  1581. @example
  1582. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1583. @end example
  1584. @end itemize
  1585. @section aphaser
  1586. Add a phasing effect to the input audio.
  1587. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1588. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1589. A description of the accepted parameters follows.
  1590. @table @option
  1591. @item in_gain
  1592. Set input gain. Default is 0.4.
  1593. @item out_gain
  1594. Set output gain. Default is 0.74
  1595. @item delay
  1596. Set delay in milliseconds. Default is 3.0.
  1597. @item decay
  1598. Set decay. Default is 0.4.
  1599. @item speed
  1600. Set modulation speed in Hz. Default is 0.5.
  1601. @item type
  1602. Set modulation type. Default is triangular.
  1603. It accepts the following values:
  1604. @table @samp
  1605. @item triangular, t
  1606. @item sinusoidal, s
  1607. @end table
  1608. @end table
  1609. @section aphaseshift
  1610. Apply phase shift to input audio samples.
  1611. The filter accepts the following options:
  1612. @table @option
  1613. @item shift
  1614. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1615. Default value is 0.0.
  1616. @end table
  1617. @subsection Commands
  1618. This filter supports the above option as @ref{commands}.
  1619. @section apulsator
  1620. Audio pulsator is something between an autopanner and a tremolo.
  1621. But it can produce funny stereo effects as well. Pulsator changes the volume
  1622. of the left and right channel based on a LFO (low frequency oscillator) with
  1623. different waveforms and shifted phases.
  1624. This filter have the ability to define an offset between left and right
  1625. channel. An offset of 0 means that both LFO shapes match each other.
  1626. The left and right channel are altered equally - a conventional tremolo.
  1627. An offset of 50% means that the shape of the right channel is exactly shifted
  1628. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1629. an autopanner. At 1 both curves match again. Every setting in between moves the
  1630. phase shift gapless between all stages and produces some "bypassing" sounds with
  1631. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1632. the 0.5) the faster the signal passes from the left to the right speaker.
  1633. The filter accepts the following options:
  1634. @table @option
  1635. @item level_in
  1636. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1637. @item level_out
  1638. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1639. @item mode
  1640. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1641. sawup or sawdown. Default is sine.
  1642. @item amount
  1643. Set modulation. Define how much of original signal is affected by the LFO.
  1644. @item offset_l
  1645. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1646. @item offset_r
  1647. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1648. @item width
  1649. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1650. @item timing
  1651. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1652. @item bpm
  1653. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1654. is set to bpm.
  1655. @item ms
  1656. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1657. is set to ms.
  1658. @item hz
  1659. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1660. if timing is set to hz.
  1661. @end table
  1662. @anchor{aresample}
  1663. @section aresample
  1664. Resample the input audio to the specified parameters, using the
  1665. libswresample library. If none are specified then the filter will
  1666. automatically convert between its input and output.
  1667. This filter is also able to stretch/squeeze the audio data to make it match
  1668. the timestamps or to inject silence / cut out audio to make it match the
  1669. timestamps, do a combination of both or do neither.
  1670. The filter accepts the syntax
  1671. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1672. expresses a sample rate and @var{resampler_options} is a list of
  1673. @var{key}=@var{value} pairs, separated by ":". See the
  1674. @ref{Resampler Options,,"Resampler Options" section in the
  1675. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1676. for the complete list of supported options.
  1677. @subsection Examples
  1678. @itemize
  1679. @item
  1680. Resample the input audio to 44100Hz:
  1681. @example
  1682. aresample=44100
  1683. @end example
  1684. @item
  1685. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1686. samples per second compensation:
  1687. @example
  1688. aresample=async=1000
  1689. @end example
  1690. @end itemize
  1691. @section areverse
  1692. Reverse an audio clip.
  1693. Warning: This filter requires memory to buffer the entire clip, so trimming
  1694. is suggested.
  1695. @subsection Examples
  1696. @itemize
  1697. @item
  1698. Take the first 5 seconds of a clip, and reverse it.
  1699. @example
  1700. atrim=end=5,areverse
  1701. @end example
  1702. @end itemize
  1703. @section arnndn
  1704. Reduce noise from speech using Recurrent Neural Networks.
  1705. This filter accepts the following options:
  1706. @table @option
  1707. @item model, m
  1708. Set train model file to load. This option is always required.
  1709. @end table
  1710. @section asetnsamples
  1711. Set the number of samples per each output audio frame.
  1712. The last output packet may contain a different number of samples, as
  1713. the filter will flush all the remaining samples when the input audio
  1714. signals its end.
  1715. The filter accepts the following options:
  1716. @table @option
  1717. @item nb_out_samples, n
  1718. Set the number of frames per each output audio frame. The number is
  1719. intended as the number of samples @emph{per each channel}.
  1720. Default value is 1024.
  1721. @item pad, p
  1722. If set to 1, the filter will pad the last audio frame with zeroes, so
  1723. that the last frame will contain the same number of samples as the
  1724. previous ones. Default value is 1.
  1725. @end table
  1726. For example, to set the number of per-frame samples to 1234 and
  1727. disable padding for the last frame, use:
  1728. @example
  1729. asetnsamples=n=1234:p=0
  1730. @end example
  1731. @section asetrate
  1732. Set the sample rate without altering the PCM data.
  1733. This will result in a change of speed and pitch.
  1734. The filter accepts the following options:
  1735. @table @option
  1736. @item sample_rate, r
  1737. Set the output sample rate. Default is 44100 Hz.
  1738. @end table
  1739. @section ashowinfo
  1740. Show a line containing various information for each input audio frame.
  1741. The input audio is not modified.
  1742. The shown line contains a sequence of key/value pairs of the form
  1743. @var{key}:@var{value}.
  1744. The following values are shown in the output:
  1745. @table @option
  1746. @item n
  1747. The (sequential) number of the input frame, starting from 0.
  1748. @item pts
  1749. The presentation timestamp of the input frame, in time base units; the time base
  1750. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1751. @item pts_time
  1752. The presentation timestamp of the input frame in seconds.
  1753. @item pos
  1754. position of the frame in the input stream, -1 if this information in
  1755. unavailable and/or meaningless (for example in case of synthetic audio)
  1756. @item fmt
  1757. The sample format.
  1758. @item chlayout
  1759. The channel layout.
  1760. @item rate
  1761. The sample rate for the audio frame.
  1762. @item nb_samples
  1763. The number of samples (per channel) in the frame.
  1764. @item checksum
  1765. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1766. audio, the data is treated as if all the planes were concatenated.
  1767. @item plane_checksums
  1768. A list of Adler-32 checksums for each data plane.
  1769. @end table
  1770. @section asoftclip
  1771. Apply audio soft clipping.
  1772. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1773. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1774. This filter accepts the following options:
  1775. @table @option
  1776. @item type
  1777. Set type of soft-clipping.
  1778. It accepts the following values:
  1779. @table @option
  1780. @item hard
  1781. @item tanh
  1782. @item atan
  1783. @item cubic
  1784. @item exp
  1785. @item alg
  1786. @item quintic
  1787. @item sin
  1788. @item erf
  1789. @end table
  1790. @item param
  1791. Set additional parameter which controls sigmoid function.
  1792. @item oversample
  1793. Set oversampling factor.
  1794. @end table
  1795. @subsection Commands
  1796. This filter supports the all above options as @ref{commands}.
  1797. @section asr
  1798. Automatic Speech Recognition
  1799. This filter uses PocketSphinx for speech recognition. To enable
  1800. compilation of this filter, you need to configure FFmpeg with
  1801. @code{--enable-pocketsphinx}.
  1802. It accepts the following options:
  1803. @table @option
  1804. @item rate
  1805. Set sampling rate of input audio. Defaults is @code{16000}.
  1806. This need to match speech models, otherwise one will get poor results.
  1807. @item hmm
  1808. Set dictionary containing acoustic model files.
  1809. @item dict
  1810. Set pronunciation dictionary.
  1811. @item lm
  1812. Set language model file.
  1813. @item lmctl
  1814. Set language model set.
  1815. @item lmname
  1816. Set which language model to use.
  1817. @item logfn
  1818. Set output for log messages.
  1819. @end table
  1820. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1821. @anchor{astats}
  1822. @section astats
  1823. Display time domain statistical information about the audio channels.
  1824. Statistics are calculated and displayed for each audio channel and,
  1825. where applicable, an overall figure is also given.
  1826. It accepts the following option:
  1827. @table @option
  1828. @item length
  1829. Short window length in seconds, used for peak and trough RMS measurement.
  1830. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1831. @item metadata
  1832. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1833. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1834. disabled.
  1835. Available keys for each channel are:
  1836. DC_offset
  1837. Min_level
  1838. Max_level
  1839. Min_difference
  1840. Max_difference
  1841. Mean_difference
  1842. RMS_difference
  1843. Peak_level
  1844. RMS_peak
  1845. RMS_trough
  1846. Crest_factor
  1847. Flat_factor
  1848. Peak_count
  1849. Noise_floor
  1850. Noise_floor_count
  1851. Bit_depth
  1852. Dynamic_range
  1853. Zero_crossings
  1854. Zero_crossings_rate
  1855. Number_of_NaNs
  1856. Number_of_Infs
  1857. Number_of_denormals
  1858. and for Overall:
  1859. DC_offset
  1860. Min_level
  1861. Max_level
  1862. Min_difference
  1863. Max_difference
  1864. Mean_difference
  1865. RMS_difference
  1866. Peak_level
  1867. RMS_level
  1868. RMS_peak
  1869. RMS_trough
  1870. Flat_factor
  1871. Peak_count
  1872. Noise_floor
  1873. Noise_floor_count
  1874. Bit_depth
  1875. Number_of_samples
  1876. Number_of_NaNs
  1877. Number_of_Infs
  1878. Number_of_denormals
  1879. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1880. this @code{lavfi.astats.Overall.Peak_count}.
  1881. For description what each key means read below.
  1882. @item reset
  1883. Set number of frame after which stats are going to be recalculated.
  1884. Default is disabled.
  1885. @item measure_perchannel
  1886. Select the entries which need to be measured per channel. The metadata keys can
  1887. be used as flags, default is @option{all} which measures everything.
  1888. @option{none} disables all per channel measurement.
  1889. @item measure_overall
  1890. Select the entries which need to be measured overall. The metadata keys can
  1891. be used as flags, default is @option{all} which measures everything.
  1892. @option{none} disables all overall measurement.
  1893. @end table
  1894. A description of each shown parameter follows:
  1895. @table @option
  1896. @item DC offset
  1897. Mean amplitude displacement from zero.
  1898. @item Min level
  1899. Minimal sample level.
  1900. @item Max level
  1901. Maximal sample level.
  1902. @item Min difference
  1903. Minimal difference between two consecutive samples.
  1904. @item Max difference
  1905. Maximal difference between two consecutive samples.
  1906. @item Mean difference
  1907. Mean difference between two consecutive samples.
  1908. The average of each difference between two consecutive samples.
  1909. @item RMS difference
  1910. Root Mean Square difference between two consecutive samples.
  1911. @item Peak level dB
  1912. @item RMS level dB
  1913. Standard peak and RMS level measured in dBFS.
  1914. @item RMS peak dB
  1915. @item RMS trough dB
  1916. Peak and trough values for RMS level measured over a short window.
  1917. @item Crest factor
  1918. Standard ratio of peak to RMS level (note: not in dB).
  1919. @item Flat factor
  1920. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1921. (i.e. either @var{Min level} or @var{Max level}).
  1922. @item Peak count
  1923. Number of occasions (not the number of samples) that the signal attained either
  1924. @var{Min level} or @var{Max level}.
  1925. @item Noise floor dB
  1926. Minimum local peak measured in dBFS over a short window.
  1927. @item Noise floor count
  1928. Number of occasions (not the number of samples) that the signal attained
  1929. @var{Noise floor}.
  1930. @item Bit depth
  1931. Overall bit depth of audio. Number of bits used for each sample.
  1932. @item Dynamic range
  1933. Measured dynamic range of audio in dB.
  1934. @item Zero crossings
  1935. Number of points where the waveform crosses the zero level axis.
  1936. @item Zero crossings rate
  1937. Rate of Zero crossings and number of audio samples.
  1938. @end table
  1939. @section asubboost
  1940. Boost subwoofer frequencies.
  1941. The filter accepts the following options:
  1942. @table @option
  1943. @item dry
  1944. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  1945. Default value is 0.5.
  1946. @item wet
  1947. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  1948. Default value is 0.8.
  1949. @item decay
  1950. Set delay line decay gain value. Allowed range is from 0 to 1.
  1951. Default value is 0.7.
  1952. @item feedback
  1953. Set delay line feedback gain value. Allowed range is from 0 to 1.
  1954. Default value is 0.5.
  1955. @item cutoff
  1956. Set cutoff frequency in herz. Allowed range is 50 to 900.
  1957. Default value is 100.
  1958. @item slope
  1959. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  1960. Default value is 0.5.
  1961. @item delay
  1962. Set delay. Allowed range is from 1 to 100.
  1963. Default value is 20.
  1964. @end table
  1965. @subsection Commands
  1966. This filter supports the all above options as @ref{commands}.
  1967. @section atempo
  1968. Adjust audio tempo.
  1969. The filter accepts exactly one parameter, the audio tempo. If not
  1970. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1971. be in the [0.5, 100.0] range.
  1972. Note that tempo greater than 2 will skip some samples rather than
  1973. blend them in. If for any reason this is a concern it is always
  1974. possible to daisy-chain several instances of atempo to achieve the
  1975. desired product tempo.
  1976. @subsection Examples
  1977. @itemize
  1978. @item
  1979. Slow down audio to 80% tempo:
  1980. @example
  1981. atempo=0.8
  1982. @end example
  1983. @item
  1984. To speed up audio to 300% tempo:
  1985. @example
  1986. atempo=3
  1987. @end example
  1988. @item
  1989. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1990. @example
  1991. atempo=sqrt(3),atempo=sqrt(3)
  1992. @end example
  1993. @end itemize
  1994. @subsection Commands
  1995. This filter supports the following commands:
  1996. @table @option
  1997. @item tempo
  1998. Change filter tempo scale factor.
  1999. Syntax for the command is : "@var{tempo}"
  2000. @end table
  2001. @section atrim
  2002. Trim the input so that the output contains one continuous subpart of the input.
  2003. It accepts the following parameters:
  2004. @table @option
  2005. @item start
  2006. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2007. sample with the timestamp @var{start} will be the first sample in the output.
  2008. @item end
  2009. Specify time of the first audio sample that will be dropped, i.e. the
  2010. audio sample immediately preceding the one with the timestamp @var{end} will be
  2011. the last sample in the output.
  2012. @item start_pts
  2013. Same as @var{start}, except this option sets the start timestamp in samples
  2014. instead of seconds.
  2015. @item end_pts
  2016. Same as @var{end}, except this option sets the end timestamp in samples instead
  2017. of seconds.
  2018. @item duration
  2019. The maximum duration of the output in seconds.
  2020. @item start_sample
  2021. The number of the first sample that should be output.
  2022. @item end_sample
  2023. The number of the first sample that should be dropped.
  2024. @end table
  2025. @option{start}, @option{end}, and @option{duration} are expressed as time
  2026. duration specifications; see
  2027. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2028. Note that the first two sets of the start/end options and the @option{duration}
  2029. option look at the frame timestamp, while the _sample options simply count the
  2030. samples that pass through the filter. So start/end_pts and start/end_sample will
  2031. give different results when the timestamps are wrong, inexact or do not start at
  2032. zero. Also note that this filter does not modify the timestamps. If you wish
  2033. to have the output timestamps start at zero, insert the asetpts filter after the
  2034. atrim filter.
  2035. If multiple start or end options are set, this filter tries to be greedy and
  2036. keep all samples that match at least one of the specified constraints. To keep
  2037. only the part that matches all the constraints at once, chain multiple atrim
  2038. filters.
  2039. The defaults are such that all the input is kept. So it is possible to set e.g.
  2040. just the end values to keep everything before the specified time.
  2041. Examples:
  2042. @itemize
  2043. @item
  2044. Drop everything except the second minute of input:
  2045. @example
  2046. ffmpeg -i INPUT -af atrim=60:120
  2047. @end example
  2048. @item
  2049. Keep only the first 1000 samples:
  2050. @example
  2051. ffmpeg -i INPUT -af atrim=end_sample=1000
  2052. @end example
  2053. @end itemize
  2054. @section axcorrelate
  2055. Calculate normalized cross-correlation between two input audio streams.
  2056. Resulted samples are always between -1 and 1 inclusive.
  2057. If result is 1 it means two input samples are highly correlated in that selected segment.
  2058. Result 0 means they are not correlated at all.
  2059. If result is -1 it means two input samples are out of phase, which means they cancel each
  2060. other.
  2061. The filter accepts the following options:
  2062. @table @option
  2063. @item size
  2064. Set size of segment over which cross-correlation is calculated.
  2065. Default is 256. Allowed range is from 2 to 131072.
  2066. @item algo
  2067. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2068. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2069. are always zero and thus need much less calculations to make.
  2070. This is generally not true, but is valid for typical audio streams.
  2071. @end table
  2072. @subsection Examples
  2073. @itemize
  2074. @item
  2075. Calculate correlation between channels in stereo audio stream:
  2076. @example
  2077. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2078. @end example
  2079. @end itemize
  2080. @section bandpass
  2081. Apply a two-pole Butterworth band-pass filter with central
  2082. frequency @var{frequency}, and (3dB-point) band-width width.
  2083. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2084. instead of the default: constant 0dB peak gain.
  2085. The filter roll off at 6dB per octave (20dB per decade).
  2086. The filter accepts the following options:
  2087. @table @option
  2088. @item frequency, f
  2089. Set the filter's central frequency. Default is @code{3000}.
  2090. @item csg
  2091. Constant skirt gain if set to 1. Defaults to 0.
  2092. @item width_type, t
  2093. Set method to specify band-width of filter.
  2094. @table @option
  2095. @item h
  2096. Hz
  2097. @item q
  2098. Q-Factor
  2099. @item o
  2100. octave
  2101. @item s
  2102. slope
  2103. @item k
  2104. kHz
  2105. @end table
  2106. @item width, w
  2107. Specify the band-width of a filter in width_type units.
  2108. @item mix, m
  2109. How much to use filtered signal in output. Default is 1.
  2110. Range is between 0 and 1.
  2111. @item channels, c
  2112. Specify which channels to filter, by default all available are filtered.
  2113. @item normalize, n
  2114. Normalize biquad coefficients, by default is disabled.
  2115. Enabling it will normalize magnitude response at DC to 0dB.
  2116. @item transform, a
  2117. Set transform type of IIR filter.
  2118. @table @option
  2119. @item di
  2120. @item dii
  2121. @item tdii
  2122. @item latt
  2123. @end table
  2124. @end table
  2125. @subsection Commands
  2126. This filter supports the following commands:
  2127. @table @option
  2128. @item frequency, f
  2129. Change bandpass frequency.
  2130. Syntax for the command is : "@var{frequency}"
  2131. @item width_type, t
  2132. Change bandpass width_type.
  2133. Syntax for the command is : "@var{width_type}"
  2134. @item width, w
  2135. Change bandpass width.
  2136. Syntax for the command is : "@var{width}"
  2137. @item mix, m
  2138. Change bandpass mix.
  2139. Syntax for the command is : "@var{mix}"
  2140. @end table
  2141. @section bandreject
  2142. Apply a two-pole Butterworth band-reject filter with central
  2143. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2144. The filter roll off at 6dB per octave (20dB per decade).
  2145. The filter accepts the following options:
  2146. @table @option
  2147. @item frequency, f
  2148. Set the filter's central frequency. Default is @code{3000}.
  2149. @item width_type, t
  2150. Set method to specify band-width of filter.
  2151. @table @option
  2152. @item h
  2153. Hz
  2154. @item q
  2155. Q-Factor
  2156. @item o
  2157. octave
  2158. @item s
  2159. slope
  2160. @item k
  2161. kHz
  2162. @end table
  2163. @item width, w
  2164. Specify the band-width of a filter in width_type units.
  2165. @item mix, m
  2166. How much to use filtered signal in output. Default is 1.
  2167. Range is between 0 and 1.
  2168. @item channels, c
  2169. Specify which channels to filter, by default all available are filtered.
  2170. @item normalize, n
  2171. Normalize biquad coefficients, by default is disabled.
  2172. Enabling it will normalize magnitude response at DC to 0dB.
  2173. @item transform, a
  2174. Set transform type of IIR filter.
  2175. @table @option
  2176. @item di
  2177. @item dii
  2178. @item tdii
  2179. @item latt
  2180. @end table
  2181. @end table
  2182. @subsection Commands
  2183. This filter supports the following commands:
  2184. @table @option
  2185. @item frequency, f
  2186. Change bandreject frequency.
  2187. Syntax for the command is : "@var{frequency}"
  2188. @item width_type, t
  2189. Change bandreject width_type.
  2190. Syntax for the command is : "@var{width_type}"
  2191. @item width, w
  2192. Change bandreject width.
  2193. Syntax for the command is : "@var{width}"
  2194. @item mix, m
  2195. Change bandreject mix.
  2196. Syntax for the command is : "@var{mix}"
  2197. @end table
  2198. @section bass, lowshelf
  2199. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2200. shelving filter with a response similar to that of a standard
  2201. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2202. The filter accepts the following options:
  2203. @table @option
  2204. @item gain, g
  2205. Give the gain at 0 Hz. Its useful range is about -20
  2206. (for a large cut) to +20 (for a large boost).
  2207. Beware of clipping when using a positive gain.
  2208. @item frequency, f
  2209. Set the filter's central frequency and so can be used
  2210. to extend or reduce the frequency range to be boosted or cut.
  2211. The default value is @code{100} Hz.
  2212. @item width_type, t
  2213. Set method to specify band-width of filter.
  2214. @table @option
  2215. @item h
  2216. Hz
  2217. @item q
  2218. Q-Factor
  2219. @item o
  2220. octave
  2221. @item s
  2222. slope
  2223. @item k
  2224. kHz
  2225. @end table
  2226. @item width, w
  2227. Determine how steep is the filter's shelf transition.
  2228. @item mix, m
  2229. How much to use filtered signal in output. Default is 1.
  2230. Range is between 0 and 1.
  2231. @item channels, c
  2232. Specify which channels to filter, by default all available are filtered.
  2233. @item normalize, n
  2234. Normalize biquad coefficients, by default is disabled.
  2235. Enabling it will normalize magnitude response at DC to 0dB.
  2236. @item transform, a
  2237. Set transform type of IIR filter.
  2238. @table @option
  2239. @item di
  2240. @item dii
  2241. @item tdii
  2242. @item latt
  2243. @end table
  2244. @end table
  2245. @subsection Commands
  2246. This filter supports the following commands:
  2247. @table @option
  2248. @item frequency, f
  2249. Change bass frequency.
  2250. Syntax for the command is : "@var{frequency}"
  2251. @item width_type, t
  2252. Change bass width_type.
  2253. Syntax for the command is : "@var{width_type}"
  2254. @item width, w
  2255. Change bass width.
  2256. Syntax for the command is : "@var{width}"
  2257. @item gain, g
  2258. Change bass gain.
  2259. Syntax for the command is : "@var{gain}"
  2260. @item mix, m
  2261. Change bass mix.
  2262. Syntax for the command is : "@var{mix}"
  2263. @end table
  2264. @section biquad
  2265. Apply a biquad IIR filter with the given coefficients.
  2266. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2267. are the numerator and denominator coefficients respectively.
  2268. and @var{channels}, @var{c} specify which channels to filter, by default all
  2269. available are filtered.
  2270. @subsection Commands
  2271. This filter supports the following commands:
  2272. @table @option
  2273. @item a0
  2274. @item a1
  2275. @item a2
  2276. @item b0
  2277. @item b1
  2278. @item b2
  2279. Change biquad parameter.
  2280. Syntax for the command is : "@var{value}"
  2281. @item mix, m
  2282. How much to use filtered signal in output. Default is 1.
  2283. Range is between 0 and 1.
  2284. @item channels, c
  2285. Specify which channels to filter, by default all available are filtered.
  2286. @item normalize, n
  2287. Normalize biquad coefficients, by default is disabled.
  2288. Enabling it will normalize magnitude response at DC to 0dB.
  2289. @item transform, a
  2290. Set transform type of IIR filter.
  2291. @table @option
  2292. @item di
  2293. @item dii
  2294. @item tdii
  2295. @item latt
  2296. @end table
  2297. @end table
  2298. @section bs2b
  2299. Bauer stereo to binaural transformation, which improves headphone listening of
  2300. stereo audio records.
  2301. To enable compilation of this filter you need to configure FFmpeg with
  2302. @code{--enable-libbs2b}.
  2303. It accepts the following parameters:
  2304. @table @option
  2305. @item profile
  2306. Pre-defined crossfeed level.
  2307. @table @option
  2308. @item default
  2309. Default level (fcut=700, feed=50).
  2310. @item cmoy
  2311. Chu Moy circuit (fcut=700, feed=60).
  2312. @item jmeier
  2313. Jan Meier circuit (fcut=650, feed=95).
  2314. @end table
  2315. @item fcut
  2316. Cut frequency (in Hz).
  2317. @item feed
  2318. Feed level (in Hz).
  2319. @end table
  2320. @section channelmap
  2321. Remap input channels to new locations.
  2322. It accepts the following parameters:
  2323. @table @option
  2324. @item map
  2325. Map channels from input to output. The argument is a '|'-separated list of
  2326. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2327. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2328. channel (e.g. FL for front left) or its index in the input channel layout.
  2329. @var{out_channel} is the name of the output channel or its index in the output
  2330. channel layout. If @var{out_channel} is not given then it is implicitly an
  2331. index, starting with zero and increasing by one for each mapping.
  2332. @item channel_layout
  2333. The channel layout of the output stream.
  2334. @end table
  2335. If no mapping is present, the filter will implicitly map input channels to
  2336. output channels, preserving indices.
  2337. @subsection Examples
  2338. @itemize
  2339. @item
  2340. For example, assuming a 5.1+downmix input MOV file,
  2341. @example
  2342. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2343. @end example
  2344. will create an output WAV file tagged as stereo from the downmix channels of
  2345. the input.
  2346. @item
  2347. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2348. @example
  2349. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2350. @end example
  2351. @end itemize
  2352. @section channelsplit
  2353. Split each channel from an input audio stream into a separate output stream.
  2354. It accepts the following parameters:
  2355. @table @option
  2356. @item channel_layout
  2357. The channel layout of the input stream. The default is "stereo".
  2358. @item channels
  2359. A channel layout describing the channels to be extracted as separate output streams
  2360. or "all" to extract each input channel as a separate stream. The default is "all".
  2361. Choosing channels not present in channel layout in the input will result in an error.
  2362. @end table
  2363. @subsection Examples
  2364. @itemize
  2365. @item
  2366. For example, assuming a stereo input MP3 file,
  2367. @example
  2368. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2369. @end example
  2370. will create an output Matroska file with two audio streams, one containing only
  2371. the left channel and the other the right channel.
  2372. @item
  2373. Split a 5.1 WAV file into per-channel files:
  2374. @example
  2375. ffmpeg -i in.wav -filter_complex
  2376. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2377. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2378. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2379. side_right.wav
  2380. @end example
  2381. @item
  2382. Extract only LFE from a 5.1 WAV file:
  2383. @example
  2384. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2385. -map '[LFE]' lfe.wav
  2386. @end example
  2387. @end itemize
  2388. @section chorus
  2389. Add a chorus effect to the audio.
  2390. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2391. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2392. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2393. The modulation depth defines the range the modulated delay is played before or after
  2394. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2395. sound tuned around the original one, like in a chorus where some vocals are slightly
  2396. off key.
  2397. It accepts the following parameters:
  2398. @table @option
  2399. @item in_gain
  2400. Set input gain. Default is 0.4.
  2401. @item out_gain
  2402. Set output gain. Default is 0.4.
  2403. @item delays
  2404. Set delays. A typical delay is around 40ms to 60ms.
  2405. @item decays
  2406. Set decays.
  2407. @item speeds
  2408. Set speeds.
  2409. @item depths
  2410. Set depths.
  2411. @end table
  2412. @subsection Examples
  2413. @itemize
  2414. @item
  2415. A single delay:
  2416. @example
  2417. chorus=0.7:0.9:55:0.4:0.25:2
  2418. @end example
  2419. @item
  2420. Two delays:
  2421. @example
  2422. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2423. @end example
  2424. @item
  2425. Fuller sounding chorus with three delays:
  2426. @example
  2427. 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
  2428. @end example
  2429. @end itemize
  2430. @section compand
  2431. Compress or expand the audio's dynamic range.
  2432. It accepts the following parameters:
  2433. @table @option
  2434. @item attacks
  2435. @item decays
  2436. A list of times in seconds for each channel over which the instantaneous level
  2437. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2438. increase of volume and @var{decays} refers to decrease of volume. For most
  2439. situations, the attack time (response to the audio getting louder) should be
  2440. shorter than the decay time, because the human ear is more sensitive to sudden
  2441. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2442. a typical value for decay is 0.8 seconds.
  2443. If specified number of attacks & decays is lower than number of channels, the last
  2444. set attack/decay will be used for all remaining channels.
  2445. @item points
  2446. A list of points for the transfer function, specified in dB relative to the
  2447. maximum possible signal amplitude. Each key points list must be defined using
  2448. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2449. @code{x0/y0 x1/y1 x2/y2 ....}
  2450. The input values must be in strictly increasing order but the transfer function
  2451. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2452. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2453. function are @code{-70/-70|-60/-20|1/0}.
  2454. @item soft-knee
  2455. Set the curve radius in dB for all joints. It defaults to 0.01.
  2456. @item gain
  2457. Set the additional gain in dB to be applied at all points on the transfer
  2458. function. This allows for easy adjustment of the overall gain.
  2459. It defaults to 0.
  2460. @item volume
  2461. Set an initial volume, in dB, to be assumed for each channel when filtering
  2462. starts. This permits the user to supply a nominal level initially, so that, for
  2463. example, a very large gain is not applied to initial signal levels before the
  2464. companding has begun to operate. A typical value for audio which is initially
  2465. quiet is -90 dB. It defaults to 0.
  2466. @item delay
  2467. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2468. delayed before being fed to the volume adjuster. Specifying a delay
  2469. approximately equal to the attack/decay times allows the filter to effectively
  2470. operate in predictive rather than reactive mode. It defaults to 0.
  2471. @end table
  2472. @subsection Examples
  2473. @itemize
  2474. @item
  2475. Make music with both quiet and loud passages suitable for listening to in a
  2476. noisy environment:
  2477. @example
  2478. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2479. @end example
  2480. Another example for audio with whisper and explosion parts:
  2481. @example
  2482. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2483. @end example
  2484. @item
  2485. A noise gate for when the noise is at a lower level than the signal:
  2486. @example
  2487. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2488. @end example
  2489. @item
  2490. Here is another noise gate, this time for when the noise is at a higher level
  2491. than the signal (making it, in some ways, similar to squelch):
  2492. @example
  2493. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2494. @end example
  2495. @item
  2496. 2:1 compression starting at -6dB:
  2497. @example
  2498. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2499. @end example
  2500. @item
  2501. 2:1 compression starting at -9dB:
  2502. @example
  2503. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2504. @end example
  2505. @item
  2506. 2:1 compression starting at -12dB:
  2507. @example
  2508. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2509. @end example
  2510. @item
  2511. 2:1 compression starting at -18dB:
  2512. @example
  2513. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2514. @end example
  2515. @item
  2516. 3:1 compression starting at -15dB:
  2517. @example
  2518. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2519. @end example
  2520. @item
  2521. Compressor/Gate:
  2522. @example
  2523. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2524. @end example
  2525. @item
  2526. Expander:
  2527. @example
  2528. 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
  2529. @end example
  2530. @item
  2531. Hard limiter at -6dB:
  2532. @example
  2533. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2534. @end example
  2535. @item
  2536. Hard limiter at -12dB:
  2537. @example
  2538. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2539. @end example
  2540. @item
  2541. Hard noise gate at -35 dB:
  2542. @example
  2543. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2544. @end example
  2545. @item
  2546. Soft limiter:
  2547. @example
  2548. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2549. @end example
  2550. @end itemize
  2551. @section compensationdelay
  2552. Compensation Delay Line is a metric based delay to compensate differing
  2553. positions of microphones or speakers.
  2554. For example, you have recorded guitar with two microphones placed in
  2555. different locations. Because the front of sound wave has fixed speed in
  2556. normal conditions, the phasing of microphones can vary and depends on
  2557. their location and interposition. The best sound mix can be achieved when
  2558. these microphones are in phase (synchronized). Note that a distance of
  2559. ~30 cm between microphones makes one microphone capture the signal in
  2560. antiphase to the other microphone. That makes the final mix sound moody.
  2561. This filter helps to solve phasing problems by adding different delays
  2562. to each microphone track and make them synchronized.
  2563. The best result can be reached when you take one track as base and
  2564. synchronize other tracks one by one with it.
  2565. Remember that synchronization/delay tolerance depends on sample rate, too.
  2566. Higher sample rates will give more tolerance.
  2567. The filter accepts the following parameters:
  2568. @table @option
  2569. @item mm
  2570. Set millimeters distance. This is compensation distance for fine tuning.
  2571. Default is 0.
  2572. @item cm
  2573. Set cm distance. This is compensation distance for tightening distance setup.
  2574. Default is 0.
  2575. @item m
  2576. Set meters distance. This is compensation distance for hard distance setup.
  2577. Default is 0.
  2578. @item dry
  2579. Set dry amount. Amount of unprocessed (dry) signal.
  2580. Default is 0.
  2581. @item wet
  2582. Set wet amount. Amount of processed (wet) signal.
  2583. Default is 1.
  2584. @item temp
  2585. Set temperature in degrees Celsius. This is the temperature of the environment.
  2586. Default is 20.
  2587. @end table
  2588. @section crossfeed
  2589. Apply headphone crossfeed filter.
  2590. Crossfeed is the process of blending the left and right channels of stereo
  2591. audio recording.
  2592. It is mainly used to reduce extreme stereo separation of low frequencies.
  2593. The intent is to produce more speaker like sound to the listener.
  2594. The filter accepts the following options:
  2595. @table @option
  2596. @item strength
  2597. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2598. This sets gain of low shelf filter for side part of stereo image.
  2599. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2600. @item range
  2601. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2602. This sets cut off frequency of low shelf filter. Default is cut off near
  2603. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2604. @item slope
  2605. Set curve slope of low shelf filter. Default is 0.5.
  2606. Allowed range is from 0.01 to 1.
  2607. @item level_in
  2608. Set input gain. Default is 0.9.
  2609. @item level_out
  2610. Set output gain. Default is 1.
  2611. @end table
  2612. @subsection Commands
  2613. This filter supports the all above options as @ref{commands}.
  2614. @section crystalizer
  2615. Simple algorithm to expand audio dynamic range.
  2616. The filter accepts the following options:
  2617. @table @option
  2618. @item i
  2619. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2620. (unchanged sound) to 10.0 (maximum effect).
  2621. @item c
  2622. Enable clipping. By default is enabled.
  2623. @end table
  2624. @subsection Commands
  2625. This filter supports the all above options as @ref{commands}.
  2626. @section dcshift
  2627. Apply a DC shift to the audio.
  2628. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2629. in the recording chain) from the audio. The effect of a DC offset is reduced
  2630. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2631. a signal has a DC offset.
  2632. @table @option
  2633. @item shift
  2634. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2635. the audio.
  2636. @item limitergain
  2637. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2638. used to prevent clipping.
  2639. @end table
  2640. @section deesser
  2641. Apply de-essing to the audio samples.
  2642. @table @option
  2643. @item i
  2644. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2645. Default is 0.
  2646. @item m
  2647. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2648. Default is 0.5.
  2649. @item f
  2650. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2651. Default is 0.5.
  2652. @item s
  2653. Set the output mode.
  2654. It accepts the following values:
  2655. @table @option
  2656. @item i
  2657. Pass input unchanged.
  2658. @item o
  2659. Pass ess filtered out.
  2660. @item e
  2661. Pass only ess.
  2662. Default value is @var{o}.
  2663. @end table
  2664. @end table
  2665. @section drmeter
  2666. Measure audio dynamic range.
  2667. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2668. is found in transition material. And anything less that 8 have very poor dynamics
  2669. and is very compressed.
  2670. The filter accepts the following options:
  2671. @table @option
  2672. @item length
  2673. Set window length in seconds used to split audio into segments of equal length.
  2674. Default is 3 seconds.
  2675. @end table
  2676. @section dynaudnorm
  2677. Dynamic Audio Normalizer.
  2678. This filter applies a certain amount of gain to the input audio in order
  2679. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2680. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2681. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2682. This allows for applying extra gain to the "quiet" sections of the audio
  2683. while avoiding distortions or clipping the "loud" sections. In other words:
  2684. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2685. sections, in the sense that the volume of each section is brought to the
  2686. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2687. this goal *without* applying "dynamic range compressing". It will retain 100%
  2688. of the dynamic range *within* each section of the audio file.
  2689. @table @option
  2690. @item framelen, f
  2691. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2692. Default is 500 milliseconds.
  2693. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2694. referred to as frames. This is required, because a peak magnitude has no
  2695. meaning for just a single sample value. Instead, we need to determine the
  2696. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2697. normalizer would simply use the peak magnitude of the complete file, the
  2698. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2699. frame. The length of a frame is specified in milliseconds. By default, the
  2700. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2701. been found to give good results with most files.
  2702. Note that the exact frame length, in number of samples, will be determined
  2703. automatically, based on the sampling rate of the individual input audio file.
  2704. @item gausssize, g
  2705. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2706. number. Default is 31.
  2707. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2708. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2709. is specified in frames, centered around the current frame. For the sake of
  2710. simplicity, this must be an odd number. Consequently, the default value of 31
  2711. takes into account the current frame, as well as the 15 preceding frames and
  2712. the 15 subsequent frames. Using a larger window results in a stronger
  2713. smoothing effect and thus in less gain variation, i.e. slower gain
  2714. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2715. effect and thus in more gain variation, i.e. faster gain adaptation.
  2716. In other words, the more you increase this value, the more the Dynamic Audio
  2717. Normalizer will behave like a "traditional" normalization filter. On the
  2718. contrary, the more you decrease this value, the more the Dynamic Audio
  2719. Normalizer will behave like a dynamic range compressor.
  2720. @item peak, p
  2721. Set the target peak value. This specifies the highest permissible magnitude
  2722. level for the normalized audio input. This filter will try to approach the
  2723. target peak magnitude as closely as possible, but at the same time it also
  2724. makes sure that the normalized signal will never exceed the peak magnitude.
  2725. A frame's maximum local gain factor is imposed directly by the target peak
  2726. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2727. It is not recommended to go above this value.
  2728. @item maxgain, m
  2729. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2730. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2731. factor for each input frame, i.e. the maximum gain factor that does not
  2732. result in clipping or distortion. The maximum gain factor is determined by
  2733. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2734. additionally bounds the frame's maximum gain factor by a predetermined
  2735. (global) maximum gain factor. This is done in order to avoid excessive gain
  2736. factors in "silent" or almost silent frames. By default, the maximum gain
  2737. factor is 10.0, For most inputs the default value should be sufficient and
  2738. it usually is not recommended to increase this value. Though, for input
  2739. with an extremely low overall volume level, it may be necessary to allow even
  2740. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2741. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2742. Instead, a "sigmoid" threshold function will be applied. This way, the
  2743. gain factors will smoothly approach the threshold value, but never exceed that
  2744. value.
  2745. @item targetrms, r
  2746. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2747. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2748. This means that the maximum local gain factor for each frame is defined
  2749. (only) by the frame's highest magnitude sample. This way, the samples can
  2750. be amplified as much as possible without exceeding the maximum signal
  2751. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2752. Normalizer can also take into account the frame's root mean square,
  2753. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2754. determine the power of a time-varying signal. It is therefore considered
  2755. that the RMS is a better approximation of the "perceived loudness" than
  2756. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2757. frames to a constant RMS value, a uniform "perceived loudness" can be
  2758. established. If a target RMS value has been specified, a frame's local gain
  2759. factor is defined as the factor that would result in exactly that RMS value.
  2760. Note, however, that the maximum local gain factor is still restricted by the
  2761. frame's highest magnitude sample, in order to prevent clipping.
  2762. @item coupling, n
  2763. Enable channels coupling. By default is enabled.
  2764. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2765. amount. This means the same gain factor will be applied to all channels, i.e.
  2766. the maximum possible gain factor is determined by the "loudest" channel.
  2767. However, in some recordings, it may happen that the volume of the different
  2768. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2769. In this case, this option can be used to disable the channel coupling. This way,
  2770. the gain factor will be determined independently for each channel, depending
  2771. only on the individual channel's highest magnitude sample. This allows for
  2772. harmonizing the volume of the different channels.
  2773. @item correctdc, c
  2774. Enable DC bias correction. By default is disabled.
  2775. An audio signal (in the time domain) is a sequence of sample values.
  2776. In the Dynamic Audio Normalizer these sample values are represented in the
  2777. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2778. audio signal, or "waveform", should be centered around the zero point.
  2779. That means if we calculate the mean value of all samples in a file, or in a
  2780. single frame, then the result should be 0.0 or at least very close to that
  2781. value. If, however, there is a significant deviation of the mean value from
  2782. 0.0, in either positive or negative direction, this is referred to as a
  2783. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2784. Audio Normalizer provides optional DC bias correction.
  2785. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2786. the mean value, or "DC correction" offset, of each input frame and subtract
  2787. that value from all of the frame's sample values which ensures those samples
  2788. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2789. boundaries, the DC correction offset values will be interpolated smoothly
  2790. between neighbouring frames.
  2791. @item altboundary, b
  2792. Enable alternative boundary mode. By default is disabled.
  2793. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2794. around each frame. This includes the preceding frames as well as the
  2795. subsequent frames. However, for the "boundary" frames, located at the very
  2796. beginning and at the very end of the audio file, not all neighbouring
  2797. frames are available. In particular, for the first few frames in the audio
  2798. file, the preceding frames are not known. And, similarly, for the last few
  2799. frames in the audio file, the subsequent frames are not known. Thus, the
  2800. question arises which gain factors should be assumed for the missing frames
  2801. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2802. to deal with this situation. The default boundary mode assumes a gain factor
  2803. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2804. "fade out" at the beginning and at the end of the input, respectively.
  2805. @item compress, s
  2806. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2807. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2808. compression. This means that signal peaks will not be pruned and thus the
  2809. full dynamic range will be retained within each local neighbourhood. However,
  2810. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2811. normalization algorithm with a more "traditional" compression.
  2812. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2813. (thresholding) function. If (and only if) the compression feature is enabled,
  2814. all input frames will be processed by a soft knee thresholding function prior
  2815. to the actual normalization process. Put simply, the thresholding function is
  2816. going to prune all samples whose magnitude exceeds a certain threshold value.
  2817. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2818. value. Instead, the threshold value will be adjusted for each individual
  2819. frame.
  2820. In general, smaller parameters result in stronger compression, and vice versa.
  2821. Values below 3.0 are not recommended, because audible distortion may appear.
  2822. @item threshold, t
  2823. Set the target threshold value. This specifies the lowest permissible
  2824. magnitude level for the audio input which will be normalized.
  2825. If input frame volume is above this value frame will be normalized.
  2826. Otherwise frame may not be normalized at all. The default value is set
  2827. to 0, which means all input frames will be normalized.
  2828. This option is mostly useful if digital noise is not wanted to be amplified.
  2829. @end table
  2830. @subsection Commands
  2831. This filter supports the all above options as @ref{commands}.
  2832. @section earwax
  2833. Make audio easier to listen to on headphones.
  2834. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2835. so that when listened to on headphones the stereo image is moved from
  2836. inside your head (standard for headphones) to outside and in front of
  2837. the listener (standard for speakers).
  2838. Ported from SoX.
  2839. @section equalizer
  2840. Apply a two-pole peaking equalisation (EQ) filter. With this
  2841. filter, the signal-level at and around a selected frequency can
  2842. be increased or decreased, whilst (unlike bandpass and bandreject
  2843. filters) that at all other frequencies is unchanged.
  2844. In order to produce complex equalisation curves, this filter can
  2845. be given several times, each with a different central frequency.
  2846. The filter accepts the following options:
  2847. @table @option
  2848. @item frequency, f
  2849. Set the filter's central frequency in Hz.
  2850. @item width_type, t
  2851. Set method to specify band-width of filter.
  2852. @table @option
  2853. @item h
  2854. Hz
  2855. @item q
  2856. Q-Factor
  2857. @item o
  2858. octave
  2859. @item s
  2860. slope
  2861. @item k
  2862. kHz
  2863. @end table
  2864. @item width, w
  2865. Specify the band-width of a filter in width_type units.
  2866. @item gain, g
  2867. Set the required gain or attenuation in dB.
  2868. Beware of clipping when using a positive gain.
  2869. @item mix, m
  2870. How much to use filtered signal in output. Default is 1.
  2871. Range is between 0 and 1.
  2872. @item channels, c
  2873. Specify which channels to filter, by default all available are filtered.
  2874. @item normalize, n
  2875. Normalize biquad coefficients, by default is disabled.
  2876. Enabling it will normalize magnitude response at DC to 0dB.
  2877. @item transform, a
  2878. Set transform type of IIR filter.
  2879. @table @option
  2880. @item di
  2881. @item dii
  2882. @item tdii
  2883. @item latt
  2884. @end table
  2885. @end table
  2886. @subsection Examples
  2887. @itemize
  2888. @item
  2889. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2890. @example
  2891. equalizer=f=1000:t=h:width=200:g=-10
  2892. @end example
  2893. @item
  2894. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2895. @example
  2896. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2897. @end example
  2898. @end itemize
  2899. @subsection Commands
  2900. This filter supports the following commands:
  2901. @table @option
  2902. @item frequency, f
  2903. Change equalizer frequency.
  2904. Syntax for the command is : "@var{frequency}"
  2905. @item width_type, t
  2906. Change equalizer width_type.
  2907. Syntax for the command is : "@var{width_type}"
  2908. @item width, w
  2909. Change equalizer width.
  2910. Syntax for the command is : "@var{width}"
  2911. @item gain, g
  2912. Change equalizer gain.
  2913. Syntax for the command is : "@var{gain}"
  2914. @item mix, m
  2915. Change equalizer mix.
  2916. Syntax for the command is : "@var{mix}"
  2917. @end table
  2918. @section extrastereo
  2919. Linearly increases the difference between left and right channels which
  2920. adds some sort of "live" effect to playback.
  2921. The filter accepts the following options:
  2922. @table @option
  2923. @item m
  2924. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2925. (average of both channels), with 1.0 sound will be unchanged, with
  2926. -1.0 left and right channels will be swapped.
  2927. @item c
  2928. Enable clipping. By default is enabled.
  2929. @end table
  2930. @subsection Commands
  2931. This filter supports the all above options as @ref{commands}.
  2932. @section firequalizer
  2933. Apply FIR Equalization using arbitrary frequency response.
  2934. The filter accepts the following option:
  2935. @table @option
  2936. @item gain
  2937. Set gain curve equation (in dB). The expression can contain variables:
  2938. @table @option
  2939. @item f
  2940. the evaluated frequency
  2941. @item sr
  2942. sample rate
  2943. @item ch
  2944. channel number, set to 0 when multichannels evaluation is disabled
  2945. @item chid
  2946. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2947. multichannels evaluation is disabled
  2948. @item chs
  2949. number of channels
  2950. @item chlayout
  2951. channel_layout, see libavutil/channel_layout.h
  2952. @end table
  2953. and functions:
  2954. @table @option
  2955. @item gain_interpolate(f)
  2956. interpolate gain on frequency f based on gain_entry
  2957. @item cubic_interpolate(f)
  2958. same as gain_interpolate, but smoother
  2959. @end table
  2960. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2961. @item gain_entry
  2962. Set gain entry for gain_interpolate function. The expression can
  2963. contain functions:
  2964. @table @option
  2965. @item entry(f, g)
  2966. store gain entry at frequency f with value g
  2967. @end table
  2968. This option is also available as command.
  2969. @item delay
  2970. Set filter delay in seconds. Higher value means more accurate.
  2971. Default is @code{0.01}.
  2972. @item accuracy
  2973. Set filter accuracy in Hz. Lower value means more accurate.
  2974. Default is @code{5}.
  2975. @item wfunc
  2976. Set window function. Acceptable values are:
  2977. @table @option
  2978. @item rectangular
  2979. rectangular window, useful when gain curve is already smooth
  2980. @item hann
  2981. hann window (default)
  2982. @item hamming
  2983. hamming window
  2984. @item blackman
  2985. blackman window
  2986. @item nuttall3
  2987. 3-terms continuous 1st derivative nuttall window
  2988. @item mnuttall3
  2989. minimum 3-terms discontinuous nuttall window
  2990. @item nuttall
  2991. 4-terms continuous 1st derivative nuttall window
  2992. @item bnuttall
  2993. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2994. @item bharris
  2995. blackman-harris window
  2996. @item tukey
  2997. tukey window
  2998. @end table
  2999. @item fixed
  3000. If enabled, use fixed number of audio samples. This improves speed when
  3001. filtering with large delay. Default is disabled.
  3002. @item multi
  3003. Enable multichannels evaluation on gain. Default is disabled.
  3004. @item zero_phase
  3005. Enable zero phase mode by subtracting timestamp to compensate delay.
  3006. Default is disabled.
  3007. @item scale
  3008. Set scale used by gain. Acceptable values are:
  3009. @table @option
  3010. @item linlin
  3011. linear frequency, linear gain
  3012. @item linlog
  3013. linear frequency, logarithmic (in dB) gain (default)
  3014. @item loglin
  3015. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3016. @item loglog
  3017. logarithmic frequency, logarithmic gain
  3018. @end table
  3019. @item dumpfile
  3020. Set file for dumping, suitable for gnuplot.
  3021. @item dumpscale
  3022. Set scale for dumpfile. Acceptable values are same with scale option.
  3023. Default is linlog.
  3024. @item fft2
  3025. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3026. Default is disabled.
  3027. @item min_phase
  3028. Enable minimum phase impulse response. Default is disabled.
  3029. @end table
  3030. @subsection Examples
  3031. @itemize
  3032. @item
  3033. lowpass at 1000 Hz:
  3034. @example
  3035. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3036. @end example
  3037. @item
  3038. lowpass at 1000 Hz with gain_entry:
  3039. @example
  3040. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3041. @end example
  3042. @item
  3043. custom equalization:
  3044. @example
  3045. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3046. @end example
  3047. @item
  3048. higher delay with zero phase to compensate delay:
  3049. @example
  3050. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3051. @end example
  3052. @item
  3053. lowpass on left channel, highpass on right channel:
  3054. @example
  3055. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3056. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3057. @end example
  3058. @end itemize
  3059. @section flanger
  3060. Apply a flanging effect to the audio.
  3061. The filter accepts the following options:
  3062. @table @option
  3063. @item delay
  3064. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3065. @item depth
  3066. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3067. @item regen
  3068. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3069. Default value is 0.
  3070. @item width
  3071. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3072. Default value is 71.
  3073. @item speed
  3074. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3075. @item shape
  3076. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3077. Default value is @var{sinusoidal}.
  3078. @item phase
  3079. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3080. Default value is 25.
  3081. @item interp
  3082. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3083. Default is @var{linear}.
  3084. @end table
  3085. @section haas
  3086. Apply Haas effect to audio.
  3087. Note that this makes most sense to apply on mono signals.
  3088. With this filter applied to mono signals it give some directionality and
  3089. stretches its stereo image.
  3090. The filter accepts the following options:
  3091. @table @option
  3092. @item level_in
  3093. Set input level. By default is @var{1}, or 0dB
  3094. @item level_out
  3095. Set output level. By default is @var{1}, or 0dB.
  3096. @item side_gain
  3097. Set gain applied to side part of signal. By default is @var{1}.
  3098. @item middle_source
  3099. Set kind of middle source. Can be one of the following:
  3100. @table @samp
  3101. @item left
  3102. Pick left channel.
  3103. @item right
  3104. Pick right channel.
  3105. @item mid
  3106. Pick middle part signal of stereo image.
  3107. @item side
  3108. Pick side part signal of stereo image.
  3109. @end table
  3110. @item middle_phase
  3111. Change middle phase. By default is disabled.
  3112. @item left_delay
  3113. Set left channel delay. By default is @var{2.05} milliseconds.
  3114. @item left_balance
  3115. Set left channel balance. By default is @var{-1}.
  3116. @item left_gain
  3117. Set left channel gain. By default is @var{1}.
  3118. @item left_phase
  3119. Change left phase. By default is disabled.
  3120. @item right_delay
  3121. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3122. @item right_balance
  3123. Set right channel balance. By default is @var{1}.
  3124. @item right_gain
  3125. Set right channel gain. By default is @var{1}.
  3126. @item right_phase
  3127. Change right phase. By default is enabled.
  3128. @end table
  3129. @section hdcd
  3130. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3131. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3132. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3133. of HDCD, and detects the Transient Filter flag.
  3134. @example
  3135. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3136. @end example
  3137. When using the filter with wav, note the default encoding for wav is 16-bit,
  3138. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3139. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3140. @example
  3141. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3142. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3143. @end example
  3144. The filter accepts the following options:
  3145. @table @option
  3146. @item disable_autoconvert
  3147. Disable any automatic format conversion or resampling in the filter graph.
  3148. @item process_stereo
  3149. Process the stereo channels together. If target_gain does not match between
  3150. channels, consider it invalid and use the last valid target_gain.
  3151. @item cdt_ms
  3152. Set the code detect timer period in ms.
  3153. @item force_pe
  3154. Always extend peaks above -3dBFS even if PE isn't signaled.
  3155. @item analyze_mode
  3156. Replace audio with a solid tone and adjust the amplitude to signal some
  3157. specific aspect of the decoding process. The output file can be loaded in
  3158. an audio editor alongside the original to aid analysis.
  3159. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3160. Modes are:
  3161. @table @samp
  3162. @item 0, off
  3163. Disabled
  3164. @item 1, lle
  3165. Gain adjustment level at each sample
  3166. @item 2, pe
  3167. Samples where peak extend occurs
  3168. @item 3, cdt
  3169. Samples where the code detect timer is active
  3170. @item 4, tgm
  3171. Samples where the target gain does not match between channels
  3172. @end table
  3173. @end table
  3174. @section headphone
  3175. Apply head-related transfer functions (HRTFs) to create virtual
  3176. loudspeakers around the user for binaural listening via headphones.
  3177. The HRIRs are provided via additional streams, for each channel
  3178. one stereo input stream is needed.
  3179. The filter accepts the following options:
  3180. @table @option
  3181. @item map
  3182. Set mapping of input streams for convolution.
  3183. The argument is a '|'-separated list of channel names in order as they
  3184. are given as additional stream inputs for filter.
  3185. This also specify number of input streams. Number of input streams
  3186. must be not less than number of channels in first stream plus one.
  3187. @item gain
  3188. Set gain applied to audio. Value is in dB. Default is 0.
  3189. @item type
  3190. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3191. processing audio in time domain which is slow.
  3192. @var{freq} is processing audio in frequency domain which is fast.
  3193. Default is @var{freq}.
  3194. @item lfe
  3195. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3196. @item size
  3197. Set size of frame in number of samples which will be processed at once.
  3198. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3199. @item hrir
  3200. Set format of hrir stream.
  3201. Default value is @var{stereo}. Alternative value is @var{multich}.
  3202. If value is set to @var{stereo}, number of additional streams should
  3203. be greater or equal to number of input channels in first input stream.
  3204. Also each additional stream should have stereo number of channels.
  3205. If value is set to @var{multich}, number of additional streams should
  3206. be exactly one. Also number of input channels of additional stream
  3207. should be equal or greater than twice number of channels of first input
  3208. stream.
  3209. @end table
  3210. @subsection Examples
  3211. @itemize
  3212. @item
  3213. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3214. each amovie filter use stereo file with IR coefficients as input.
  3215. The files give coefficients for each position of virtual loudspeaker:
  3216. @example
  3217. ffmpeg -i input.wav
  3218. -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"
  3219. output.wav
  3220. @end example
  3221. @item
  3222. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3223. but now in @var{multich} @var{hrir} format.
  3224. @example
  3225. 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"
  3226. output.wav
  3227. @end example
  3228. @end itemize
  3229. @section highpass
  3230. Apply a high-pass filter with 3dB point frequency.
  3231. The filter can be either single-pole, or double-pole (the default).
  3232. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3233. The filter accepts the following options:
  3234. @table @option
  3235. @item frequency, f
  3236. Set frequency in Hz. Default is 3000.
  3237. @item poles, p
  3238. Set number of poles. Default is 2.
  3239. @item width_type, t
  3240. Set method to specify band-width of filter.
  3241. @table @option
  3242. @item h
  3243. Hz
  3244. @item q
  3245. Q-Factor
  3246. @item o
  3247. octave
  3248. @item s
  3249. slope
  3250. @item k
  3251. kHz
  3252. @end table
  3253. @item width, w
  3254. Specify the band-width of a filter in width_type units.
  3255. Applies only to double-pole filter.
  3256. The default is 0.707q and gives a Butterworth response.
  3257. @item mix, m
  3258. How much to use filtered signal in output. Default is 1.
  3259. Range is between 0 and 1.
  3260. @item channels, c
  3261. Specify which channels to filter, by default all available are filtered.
  3262. @item normalize, n
  3263. Normalize biquad coefficients, by default is disabled.
  3264. Enabling it will normalize magnitude response at DC to 0dB.
  3265. @item transform, a
  3266. Set transform type of IIR filter.
  3267. @table @option
  3268. @item di
  3269. @item dii
  3270. @item tdii
  3271. @item latt
  3272. @end table
  3273. @end table
  3274. @subsection Commands
  3275. This filter supports the following commands:
  3276. @table @option
  3277. @item frequency, f
  3278. Change highpass frequency.
  3279. Syntax for the command is : "@var{frequency}"
  3280. @item width_type, t
  3281. Change highpass width_type.
  3282. Syntax for the command is : "@var{width_type}"
  3283. @item width, w
  3284. Change highpass width.
  3285. Syntax for the command is : "@var{width}"
  3286. @item mix, m
  3287. Change highpass mix.
  3288. Syntax for the command is : "@var{mix}"
  3289. @end table
  3290. @section join
  3291. Join multiple input streams into one multi-channel stream.
  3292. It accepts the following parameters:
  3293. @table @option
  3294. @item inputs
  3295. The number of input streams. It defaults to 2.
  3296. @item channel_layout
  3297. The desired output channel layout. It defaults to stereo.
  3298. @item map
  3299. Map channels from inputs to output. The argument is a '|'-separated list of
  3300. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3301. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3302. can be either the name of the input channel (e.g. FL for front left) or its
  3303. index in the specified input stream. @var{out_channel} is the name of the output
  3304. channel.
  3305. @end table
  3306. The filter will attempt to guess the mappings when they are not specified
  3307. explicitly. It does so by first trying to find an unused matching input channel
  3308. and if that fails it picks the first unused input channel.
  3309. Join 3 inputs (with properly set channel layouts):
  3310. @example
  3311. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3312. @end example
  3313. Build a 5.1 output from 6 single-channel streams:
  3314. @example
  3315. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3316. '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'
  3317. out
  3318. @end example
  3319. @section ladspa
  3320. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3321. To enable compilation of this filter you need to configure FFmpeg with
  3322. @code{--enable-ladspa}.
  3323. @table @option
  3324. @item file, f
  3325. Specifies the name of LADSPA plugin library to load. If the environment
  3326. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3327. each one of the directories specified by the colon separated list in
  3328. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3329. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3330. @file{/usr/lib/ladspa/}.
  3331. @item plugin, p
  3332. Specifies the plugin within the library. Some libraries contain only
  3333. one plugin, but others contain many of them. If this is not set filter
  3334. will list all available plugins within the specified library.
  3335. @item controls, c
  3336. Set the '|' separated list of controls which are zero or more floating point
  3337. values that determine the behavior of the loaded plugin (for example delay,
  3338. threshold or gain).
  3339. Controls need to be defined using the following syntax:
  3340. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3341. @var{valuei} is the value set on the @var{i}-th control.
  3342. Alternatively they can be also defined using the following syntax:
  3343. @var{value0}|@var{value1}|@var{value2}|..., where
  3344. @var{valuei} is the value set on the @var{i}-th control.
  3345. If @option{controls} is set to @code{help}, all available controls and
  3346. their valid ranges are printed.
  3347. @item sample_rate, s
  3348. Specify the sample rate, default to 44100. Only used if plugin have
  3349. zero inputs.
  3350. @item nb_samples, n
  3351. Set the number of samples per channel per each output frame, default
  3352. is 1024. Only used if plugin have zero inputs.
  3353. @item duration, d
  3354. Set the minimum duration of the sourced audio. See
  3355. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3356. for the accepted syntax.
  3357. Note that the resulting duration may be greater than the specified duration,
  3358. as the generated audio is always cut at the end of a complete frame.
  3359. If not specified, or the expressed duration is negative, the audio is
  3360. supposed to be generated forever.
  3361. Only used if plugin have zero inputs.
  3362. @item latency, l
  3363. Enable latency compensation, by default is disabled.
  3364. Only used if plugin have inputs.
  3365. @end table
  3366. @subsection Examples
  3367. @itemize
  3368. @item
  3369. List all available plugins within amp (LADSPA example plugin) library:
  3370. @example
  3371. ladspa=file=amp
  3372. @end example
  3373. @item
  3374. List all available controls and their valid ranges for @code{vcf_notch}
  3375. plugin from @code{VCF} library:
  3376. @example
  3377. ladspa=f=vcf:p=vcf_notch:c=help
  3378. @end example
  3379. @item
  3380. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3381. plugin library:
  3382. @example
  3383. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3384. @end example
  3385. @item
  3386. Add reverberation to the audio using TAP-plugins
  3387. (Tom's Audio Processing plugins):
  3388. @example
  3389. ladspa=file=tap_reverb:tap_reverb
  3390. @end example
  3391. @item
  3392. Generate white noise, with 0.2 amplitude:
  3393. @example
  3394. ladspa=file=cmt:noise_source_white:c=c0=.2
  3395. @end example
  3396. @item
  3397. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3398. @code{C* Audio Plugin Suite} (CAPS) library:
  3399. @example
  3400. ladspa=file=caps:Click:c=c1=20'
  3401. @end example
  3402. @item
  3403. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3404. @example
  3405. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3406. @end example
  3407. @item
  3408. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3409. @code{SWH Plugins} collection:
  3410. @example
  3411. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3412. @end example
  3413. @item
  3414. Attenuate low frequencies using Multiband EQ from Steve Harris
  3415. @code{SWH Plugins} collection:
  3416. @example
  3417. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3418. @end example
  3419. @item
  3420. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3421. (CAPS) library:
  3422. @example
  3423. ladspa=caps:Narrower
  3424. @end example
  3425. @item
  3426. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3427. @example
  3428. ladspa=caps:White:.2
  3429. @end example
  3430. @item
  3431. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3432. @example
  3433. ladspa=caps:Fractal:c=c1=1
  3434. @end example
  3435. @item
  3436. Dynamic volume normalization using @code{VLevel} plugin:
  3437. @example
  3438. ladspa=vlevel-ladspa:vlevel_mono
  3439. @end example
  3440. @end itemize
  3441. @subsection Commands
  3442. This filter supports the following commands:
  3443. @table @option
  3444. @item cN
  3445. Modify the @var{N}-th control value.
  3446. If the specified value is not valid, it is ignored and prior one is kept.
  3447. @end table
  3448. @section loudnorm
  3449. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3450. Support for both single pass (livestreams, files) and double pass (files) modes.
  3451. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3452. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3453. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3454. The filter accepts the following options:
  3455. @table @option
  3456. @item I, i
  3457. Set integrated loudness target.
  3458. Range is -70.0 - -5.0. Default value is -24.0.
  3459. @item LRA, lra
  3460. Set loudness range target.
  3461. Range is 1.0 - 20.0. Default value is 7.0.
  3462. @item TP, tp
  3463. Set maximum true peak.
  3464. Range is -9.0 - +0.0. Default value is -2.0.
  3465. @item measured_I, measured_i
  3466. Measured IL of input file.
  3467. Range is -99.0 - +0.0.
  3468. @item measured_LRA, measured_lra
  3469. Measured LRA of input file.
  3470. Range is 0.0 - 99.0.
  3471. @item measured_TP, measured_tp
  3472. Measured true peak of input file.
  3473. Range is -99.0 - +99.0.
  3474. @item measured_thresh
  3475. Measured threshold of input file.
  3476. Range is -99.0 - +0.0.
  3477. @item offset
  3478. Set offset gain. Gain is applied before the true-peak limiter.
  3479. Range is -99.0 - +99.0. Default is +0.0.
  3480. @item linear
  3481. Normalize by linearly scaling the source audio.
  3482. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3483. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3484. be lower than source LRA and the change in integrated loudness shouldn't
  3485. result in a true peak which exceeds the target TP. If any of these
  3486. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3487. Options are @code{true} or @code{false}. Default is @code{true}.
  3488. @item dual_mono
  3489. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3490. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3491. If set to @code{true}, this option will compensate for this effect.
  3492. Multi-channel input files are not affected by this option.
  3493. Options are true or false. Default is false.
  3494. @item print_format
  3495. Set print format for stats. Options are summary, json, or none.
  3496. Default value is none.
  3497. @end table
  3498. @section lowpass
  3499. Apply a low-pass filter with 3dB point frequency.
  3500. The filter can be either single-pole or double-pole (the default).
  3501. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3502. The filter accepts the following options:
  3503. @table @option
  3504. @item frequency, f
  3505. Set frequency in Hz. Default is 500.
  3506. @item poles, p
  3507. Set number of poles. Default is 2.
  3508. @item width_type, t
  3509. Set method to specify band-width of filter.
  3510. @table @option
  3511. @item h
  3512. Hz
  3513. @item q
  3514. Q-Factor
  3515. @item o
  3516. octave
  3517. @item s
  3518. slope
  3519. @item k
  3520. kHz
  3521. @end table
  3522. @item width, w
  3523. Specify the band-width of a filter in width_type units.
  3524. Applies only to double-pole filter.
  3525. The default is 0.707q and gives a Butterworth response.
  3526. @item mix, m
  3527. How much to use filtered signal in output. Default is 1.
  3528. Range is between 0 and 1.
  3529. @item channels, c
  3530. Specify which channels to filter, by default all available are filtered.
  3531. @item normalize, n
  3532. Normalize biquad coefficients, by default is disabled.
  3533. Enabling it will normalize magnitude response at DC to 0dB.
  3534. @item transform, a
  3535. Set transform type of IIR filter.
  3536. @table @option
  3537. @item di
  3538. @item dii
  3539. @item tdii
  3540. @item latt
  3541. @end table
  3542. @end table
  3543. @subsection Examples
  3544. @itemize
  3545. @item
  3546. Lowpass only LFE channel, it LFE is not present it does nothing:
  3547. @example
  3548. lowpass=c=LFE
  3549. @end example
  3550. @end itemize
  3551. @subsection Commands
  3552. This filter supports the following commands:
  3553. @table @option
  3554. @item frequency, f
  3555. Change lowpass frequency.
  3556. Syntax for the command is : "@var{frequency}"
  3557. @item width_type, t
  3558. Change lowpass width_type.
  3559. Syntax for the command is : "@var{width_type}"
  3560. @item width, w
  3561. Change lowpass width.
  3562. Syntax for the command is : "@var{width}"
  3563. @item mix, m
  3564. Change lowpass mix.
  3565. Syntax for the command is : "@var{mix}"
  3566. @end table
  3567. @section lv2
  3568. Load a LV2 (LADSPA Version 2) plugin.
  3569. To enable compilation of this filter you need to configure FFmpeg with
  3570. @code{--enable-lv2}.
  3571. @table @option
  3572. @item plugin, p
  3573. Specifies the plugin URI. You may need to escape ':'.
  3574. @item controls, c
  3575. Set the '|' separated list of controls which are zero or more floating point
  3576. values that determine the behavior of the loaded plugin (for example delay,
  3577. threshold or gain).
  3578. If @option{controls} is set to @code{help}, all available controls and
  3579. their valid ranges are printed.
  3580. @item sample_rate, s
  3581. Specify the sample rate, default to 44100. Only used if plugin have
  3582. zero inputs.
  3583. @item nb_samples, n
  3584. Set the number of samples per channel per each output frame, default
  3585. is 1024. Only used if plugin have zero inputs.
  3586. @item duration, d
  3587. Set the minimum duration of the sourced audio. See
  3588. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3589. for the accepted syntax.
  3590. Note that the resulting duration may be greater than the specified duration,
  3591. as the generated audio is always cut at the end of a complete frame.
  3592. If not specified, or the expressed duration is negative, the audio is
  3593. supposed to be generated forever.
  3594. Only used if plugin have zero inputs.
  3595. @end table
  3596. @subsection Examples
  3597. @itemize
  3598. @item
  3599. Apply bass enhancer plugin from Calf:
  3600. @example
  3601. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3602. @end example
  3603. @item
  3604. Apply vinyl plugin from Calf:
  3605. @example
  3606. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3607. @end example
  3608. @item
  3609. Apply bit crusher plugin from ArtyFX:
  3610. @example
  3611. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3612. @end example
  3613. @end itemize
  3614. @section mcompand
  3615. Multiband Compress or expand the audio's dynamic range.
  3616. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3617. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3618. response when absent compander action.
  3619. It accepts the following parameters:
  3620. @table @option
  3621. @item args
  3622. This option syntax is:
  3623. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3624. For explanation of each item refer to compand filter documentation.
  3625. @end table
  3626. @anchor{pan}
  3627. @section pan
  3628. Mix channels with specific gain levels. The filter accepts the output
  3629. channel layout followed by a set of channels definitions.
  3630. This filter is also designed to efficiently remap the channels of an audio
  3631. stream.
  3632. The filter accepts parameters of the form:
  3633. "@var{l}|@var{outdef}|@var{outdef}|..."
  3634. @table @option
  3635. @item l
  3636. output channel layout or number of channels
  3637. @item outdef
  3638. output channel specification, of the form:
  3639. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3640. @item out_name
  3641. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3642. number (c0, c1, etc.)
  3643. @item gain
  3644. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3645. @item in_name
  3646. input channel to use, see out_name for details; it is not possible to mix
  3647. named and numbered input channels
  3648. @end table
  3649. If the `=' in a channel specification is replaced by `<', then the gains for
  3650. that specification will be renormalized so that the total is 1, thus
  3651. avoiding clipping noise.
  3652. @subsection Mixing examples
  3653. For example, if you want to down-mix from stereo to mono, but with a bigger
  3654. factor for the left channel:
  3655. @example
  3656. pan=1c|c0=0.9*c0+0.1*c1
  3657. @end example
  3658. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3659. 7-channels surround:
  3660. @example
  3661. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3662. @end example
  3663. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3664. that should be preferred (see "-ac" option) unless you have very specific
  3665. needs.
  3666. @subsection Remapping examples
  3667. The channel remapping will be effective if, and only if:
  3668. @itemize
  3669. @item gain coefficients are zeroes or ones,
  3670. @item only one input per channel output,
  3671. @end itemize
  3672. If all these conditions are satisfied, the filter will notify the user ("Pure
  3673. channel mapping detected"), and use an optimized and lossless method to do the
  3674. remapping.
  3675. For example, if you have a 5.1 source and want a stereo audio stream by
  3676. dropping the extra channels:
  3677. @example
  3678. pan="stereo| c0=FL | c1=FR"
  3679. @end example
  3680. Given the same source, you can also switch front left and front right channels
  3681. and keep the input channel layout:
  3682. @example
  3683. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3684. @end example
  3685. If the input is a stereo audio stream, you can mute the front left channel (and
  3686. still keep the stereo channel layout) with:
  3687. @example
  3688. pan="stereo|c1=c1"
  3689. @end example
  3690. Still with a stereo audio stream input, you can copy the right channel in both
  3691. front left and right:
  3692. @example
  3693. pan="stereo| c0=FR | c1=FR"
  3694. @end example
  3695. @section replaygain
  3696. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3697. outputs it unchanged.
  3698. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3699. @section resample
  3700. Convert the audio sample format, sample rate and channel layout. It is
  3701. not meant to be used directly.
  3702. @section rubberband
  3703. Apply time-stretching and pitch-shifting with librubberband.
  3704. To enable compilation of this filter, you need to configure FFmpeg with
  3705. @code{--enable-librubberband}.
  3706. The filter accepts the following options:
  3707. @table @option
  3708. @item tempo
  3709. Set tempo scale factor.
  3710. @item pitch
  3711. Set pitch scale factor.
  3712. @item transients
  3713. Set transients detector.
  3714. Possible values are:
  3715. @table @var
  3716. @item crisp
  3717. @item mixed
  3718. @item smooth
  3719. @end table
  3720. @item detector
  3721. Set detector.
  3722. Possible values are:
  3723. @table @var
  3724. @item compound
  3725. @item percussive
  3726. @item soft
  3727. @end table
  3728. @item phase
  3729. Set phase.
  3730. Possible values are:
  3731. @table @var
  3732. @item laminar
  3733. @item independent
  3734. @end table
  3735. @item window
  3736. Set processing window size.
  3737. Possible values are:
  3738. @table @var
  3739. @item standard
  3740. @item short
  3741. @item long
  3742. @end table
  3743. @item smoothing
  3744. Set smoothing.
  3745. Possible values are:
  3746. @table @var
  3747. @item off
  3748. @item on
  3749. @end table
  3750. @item formant
  3751. Enable formant preservation when shift pitching.
  3752. Possible values are:
  3753. @table @var
  3754. @item shifted
  3755. @item preserved
  3756. @end table
  3757. @item pitchq
  3758. Set pitch quality.
  3759. Possible values are:
  3760. @table @var
  3761. @item quality
  3762. @item speed
  3763. @item consistency
  3764. @end table
  3765. @item channels
  3766. Set channels.
  3767. Possible values are:
  3768. @table @var
  3769. @item apart
  3770. @item together
  3771. @end table
  3772. @end table
  3773. @subsection Commands
  3774. This filter supports the following commands:
  3775. @table @option
  3776. @item tempo
  3777. Change filter tempo scale factor.
  3778. Syntax for the command is : "@var{tempo}"
  3779. @item pitch
  3780. Change filter pitch scale factor.
  3781. Syntax for the command is : "@var{pitch}"
  3782. @end table
  3783. @section sidechaincompress
  3784. This filter acts like normal compressor but has the ability to compress
  3785. detected signal using second input signal.
  3786. It needs two input streams and returns one output stream.
  3787. First input stream will be processed depending on second stream signal.
  3788. The filtered signal then can be filtered with other filters in later stages of
  3789. processing. See @ref{pan} and @ref{amerge} filter.
  3790. The filter accepts the following options:
  3791. @table @option
  3792. @item level_in
  3793. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3794. @item mode
  3795. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3796. Default is @code{downward}.
  3797. @item threshold
  3798. If a signal of second stream raises above this level it will affect the gain
  3799. reduction of first stream.
  3800. By default is 0.125. Range is between 0.00097563 and 1.
  3801. @item ratio
  3802. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3803. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3804. Default is 2. Range is between 1 and 20.
  3805. @item attack
  3806. Amount of milliseconds the signal has to rise above the threshold before gain
  3807. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3808. @item release
  3809. Amount of milliseconds the signal has to fall below the threshold before
  3810. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3811. @item makeup
  3812. Set the amount by how much signal will be amplified after processing.
  3813. Default is 1. Range is from 1 to 64.
  3814. @item knee
  3815. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3816. Default is 2.82843. Range is between 1 and 8.
  3817. @item link
  3818. Choose if the @code{average} level between all channels of side-chain stream
  3819. or the louder(@code{maximum}) channel of side-chain stream affects the
  3820. reduction. Default is @code{average}.
  3821. @item detection
  3822. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3823. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3824. @item level_sc
  3825. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3826. @item mix
  3827. How much to use compressed signal in output. Default is 1.
  3828. Range is between 0 and 1.
  3829. @end table
  3830. @subsection Commands
  3831. This filter supports the all above options as @ref{commands}.
  3832. @subsection Examples
  3833. @itemize
  3834. @item
  3835. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3836. depending on the signal of 2nd input and later compressed signal to be
  3837. merged with 2nd input:
  3838. @example
  3839. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3840. @end example
  3841. @end itemize
  3842. @section sidechaingate
  3843. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3844. filter the detected signal before sending it to the gain reduction stage.
  3845. Normally a gate uses the full range signal to detect a level above the
  3846. threshold.
  3847. For example: If you cut all lower frequencies from your sidechain signal
  3848. the gate will decrease the volume of your track only if not enough highs
  3849. appear. With this technique you are able to reduce the resonation of a
  3850. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3851. guitar.
  3852. It needs two input streams and returns one output stream.
  3853. First input stream will be processed depending on second stream signal.
  3854. The filter accepts the following options:
  3855. @table @option
  3856. @item level_in
  3857. Set input level before filtering.
  3858. Default is 1. Allowed range is from 0.015625 to 64.
  3859. @item mode
  3860. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3861. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3862. will be amplified, expanding dynamic range in upward direction.
  3863. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3864. @item range
  3865. Set the level of gain reduction when the signal is below the threshold.
  3866. Default is 0.06125. Allowed range is from 0 to 1.
  3867. Setting this to 0 disables reduction and then filter behaves like expander.
  3868. @item threshold
  3869. If a signal rises above this level the gain reduction is released.
  3870. Default is 0.125. Allowed range is from 0 to 1.
  3871. @item ratio
  3872. Set a ratio about which the signal is reduced.
  3873. Default is 2. Allowed range is from 1 to 9000.
  3874. @item attack
  3875. Amount of milliseconds the signal has to rise above the threshold before gain
  3876. reduction stops.
  3877. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3878. @item release
  3879. Amount of milliseconds the signal has to fall below the threshold before the
  3880. reduction is increased again. Default is 250 milliseconds.
  3881. Allowed range is from 0.01 to 9000.
  3882. @item makeup
  3883. Set amount of amplification of signal after processing.
  3884. Default is 1. Allowed range is from 1 to 64.
  3885. @item knee
  3886. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3887. Default is 2.828427125. Allowed range is from 1 to 8.
  3888. @item detection
  3889. Choose if exact signal should be taken for detection or an RMS like one.
  3890. Default is rms. Can be peak or rms.
  3891. @item link
  3892. Choose if the average level between all channels or the louder channel affects
  3893. the reduction.
  3894. Default is average. Can be average or maximum.
  3895. @item level_sc
  3896. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3897. @end table
  3898. @section silencedetect
  3899. Detect silence in an audio stream.
  3900. This filter logs a message when it detects that the input audio volume is less
  3901. or equal to a noise tolerance value for a duration greater or equal to the
  3902. minimum detected noise duration.
  3903. The printed times and duration are expressed in seconds. The
  3904. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3905. is set on the first frame whose timestamp equals or exceeds the detection
  3906. duration and it contains the timestamp of the first frame of the silence.
  3907. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3908. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3909. keys are set on the first frame after the silence. If @option{mono} is
  3910. enabled, and each channel is evaluated separately, the @code{.X}
  3911. suffixed keys are used, and @code{X} corresponds to the channel number.
  3912. The filter accepts the following options:
  3913. @table @option
  3914. @item noise, n
  3915. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3916. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3917. @item duration, d
  3918. Set silence duration until notification (default is 2 seconds). See
  3919. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3920. for the accepted syntax.
  3921. @item mono, m
  3922. Process each channel separately, instead of combined. By default is disabled.
  3923. @end table
  3924. @subsection Examples
  3925. @itemize
  3926. @item
  3927. Detect 5 seconds of silence with -50dB noise tolerance:
  3928. @example
  3929. silencedetect=n=-50dB:d=5
  3930. @end example
  3931. @item
  3932. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3933. tolerance in @file{silence.mp3}:
  3934. @example
  3935. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3936. @end example
  3937. @end itemize
  3938. @section silenceremove
  3939. Remove silence from the beginning, middle or end of the audio.
  3940. The filter accepts the following options:
  3941. @table @option
  3942. @item start_periods
  3943. This value is used to indicate if audio should be trimmed at beginning of
  3944. the audio. A value of zero indicates no silence should be trimmed from the
  3945. beginning. When specifying a non-zero value, it trims audio up until it
  3946. finds non-silence. Normally, when trimming silence from beginning of audio
  3947. the @var{start_periods} will be @code{1} but it can be increased to higher
  3948. values to trim all audio up to specific count of non-silence periods.
  3949. Default value is @code{0}.
  3950. @item start_duration
  3951. Specify the amount of time that non-silence must be detected before it stops
  3952. trimming audio. By increasing the duration, bursts of noises can be treated
  3953. as silence and trimmed off. Default value is @code{0}.
  3954. @item start_threshold
  3955. This indicates what sample value should be treated as silence. For digital
  3956. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3957. you may wish to increase the value to account for background noise.
  3958. Can be specified in dB (in case "dB" is appended to the specified value)
  3959. or amplitude ratio. Default value is @code{0}.
  3960. @item start_silence
  3961. Specify max duration of silence at beginning that will be kept after
  3962. trimming. Default is 0, which is equal to trimming all samples detected
  3963. as silence.
  3964. @item start_mode
  3965. Specify mode of detection of silence end in start of multi-channel audio.
  3966. Can be @var{any} or @var{all}. Default is @var{any}.
  3967. With @var{any}, any sample that is detected as non-silence will cause
  3968. stopped trimming of silence.
  3969. With @var{all}, only if all channels are detected as non-silence will cause
  3970. stopped trimming of silence.
  3971. @item stop_periods
  3972. Set the count for trimming silence from the end of audio.
  3973. To remove silence from the middle of a file, specify a @var{stop_periods}
  3974. that is negative. This value is then treated as a positive value and is
  3975. used to indicate the effect should restart processing as specified by
  3976. @var{start_periods}, making it suitable for removing periods of silence
  3977. in the middle of the audio.
  3978. Default value is @code{0}.
  3979. @item stop_duration
  3980. Specify a duration of silence that must exist before audio is not copied any
  3981. more. By specifying a higher duration, silence that is wanted can be left in
  3982. the audio.
  3983. Default value is @code{0}.
  3984. @item stop_threshold
  3985. This is the same as @option{start_threshold} but for trimming silence from
  3986. the end of audio.
  3987. Can be specified in dB (in case "dB" is appended to the specified value)
  3988. or amplitude ratio. Default value is @code{0}.
  3989. @item stop_silence
  3990. Specify max duration of silence at end that will be kept after
  3991. trimming. Default is 0, which is equal to trimming all samples detected
  3992. as silence.
  3993. @item stop_mode
  3994. Specify mode of detection of silence start in end of multi-channel audio.
  3995. Can be @var{any} or @var{all}. Default is @var{any}.
  3996. With @var{any}, any sample that is detected as non-silence will cause
  3997. stopped trimming of silence.
  3998. With @var{all}, only if all channels are detected as non-silence will cause
  3999. stopped trimming of silence.
  4000. @item detection
  4001. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4002. and works better with digital silence which is exactly 0.
  4003. Default value is @code{rms}.
  4004. @item window
  4005. Set duration in number of seconds used to calculate size of window in number
  4006. of samples for detecting silence.
  4007. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4008. @end table
  4009. @subsection Examples
  4010. @itemize
  4011. @item
  4012. The following example shows how this filter can be used to start a recording
  4013. that does not contain the delay at the start which usually occurs between
  4014. pressing the record button and the start of the performance:
  4015. @example
  4016. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4017. @end example
  4018. @item
  4019. Trim all silence encountered from beginning to end where there is more than 1
  4020. second of silence in audio:
  4021. @example
  4022. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4023. @end example
  4024. @item
  4025. Trim all digital silence samples, using peak detection, from beginning to end
  4026. where there is more than 0 samples of digital silence in audio and digital
  4027. silence is detected in all channels at same positions in stream:
  4028. @example
  4029. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4030. @end example
  4031. @end itemize
  4032. @section sofalizer
  4033. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4034. loudspeakers around the user for binaural listening via headphones (audio
  4035. formats up to 9 channels supported).
  4036. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4037. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4038. Austrian Academy of Sciences.
  4039. To enable compilation of this filter you need to configure FFmpeg with
  4040. @code{--enable-libmysofa}.
  4041. The filter accepts the following options:
  4042. @table @option
  4043. @item sofa
  4044. Set the SOFA file used for rendering.
  4045. @item gain
  4046. Set gain applied to audio. Value is in dB. Default is 0.
  4047. @item rotation
  4048. Set rotation of virtual loudspeakers in deg. Default is 0.
  4049. @item elevation
  4050. Set elevation of virtual speakers in deg. Default is 0.
  4051. @item radius
  4052. Set distance in meters between loudspeakers and the listener with near-field
  4053. HRTFs. Default is 1.
  4054. @item type
  4055. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4056. processing audio in time domain which is slow.
  4057. @var{freq} is processing audio in frequency domain which is fast.
  4058. Default is @var{freq}.
  4059. @item speakers
  4060. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4061. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4062. Each virtual loudspeaker is described with short channel name following with
  4063. azimuth and elevation in degrees.
  4064. Each virtual loudspeaker description is separated by '|'.
  4065. For example to override front left and front right channel positions use:
  4066. 'speakers=FL 45 15|FR 345 15'.
  4067. Descriptions with unrecognised channel names are ignored.
  4068. @item lfegain
  4069. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4070. @item framesize
  4071. Set custom frame size in number of samples. Default is 1024.
  4072. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4073. is set to @var{freq}.
  4074. @item normalize
  4075. Should all IRs be normalized upon importing SOFA file.
  4076. By default is enabled.
  4077. @item interpolate
  4078. Should nearest IRs be interpolated with neighbor IRs if exact position
  4079. does not match. By default is disabled.
  4080. @item minphase
  4081. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4082. @item anglestep
  4083. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4084. @item radstep
  4085. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4086. @end table
  4087. @subsection Examples
  4088. @itemize
  4089. @item
  4090. Using ClubFritz6 sofa file:
  4091. @example
  4092. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4093. @end example
  4094. @item
  4095. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4096. @example
  4097. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4098. @end example
  4099. @item
  4100. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4101. and also with custom gain:
  4102. @example
  4103. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4104. @end example
  4105. @end itemize
  4106. @section speechnorm
  4107. Speech Normalizer.
  4108. This filter expands or compresses each half-cycle of audio samples
  4109. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4110. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4111. The filter accepts the following options:
  4112. @table @option
  4113. @item peak, p
  4114. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4115. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4116. @item expansion, e
  4117. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4118. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4119. would be such that local peak value reaches target peak value but never to surpass it and that
  4120. ratio between new and previous peak value does not surpass this option value.
  4121. @item compression, c
  4122. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4123. This option controls maximum local half-cycle of samples compression. This option is used
  4124. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4125. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4126. that peak's half-cycle will be compressed by current compression factor.
  4127. @item threshold, t
  4128. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4129. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4130. Any half-cycle samples with their local peak value below or same as this option value will be
  4131. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4132. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4133. @item raise, r
  4134. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4135. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4136. each new half-cycle until it reaches @option{expansion} value.
  4137. Setting this options too high may lead to distortions.
  4138. @item fall, f
  4139. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4140. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4141. each new half-cycle until it reaches @option{compression} value.
  4142. @item channels, h
  4143. Specify which channels to filter, by default all available channels are filtered.
  4144. @item invert, i
  4145. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4146. option. When enabled any half-cycle of samples with their local peak value below or same as
  4147. @option{threshold} option will be expanded otherwise it will be compressed.
  4148. @item link, l
  4149. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4150. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4151. is enabled the minimum of all possible gains for each filtered channel is used.
  4152. @end table
  4153. @subsection Commands
  4154. This filter supports the all above options as @ref{commands}.
  4155. @section stereotools
  4156. This filter has some handy utilities to manage stereo signals, for converting
  4157. M/S stereo recordings to L/R signal while having control over the parameters
  4158. or spreading the stereo image of master track.
  4159. The filter accepts the following options:
  4160. @table @option
  4161. @item level_in
  4162. Set input level before filtering for both channels. Defaults is 1.
  4163. Allowed range is from 0.015625 to 64.
  4164. @item level_out
  4165. Set output level after filtering for both channels. Defaults is 1.
  4166. Allowed range is from 0.015625 to 64.
  4167. @item balance_in
  4168. Set input balance between both channels. Default is 0.
  4169. Allowed range is from -1 to 1.
  4170. @item balance_out
  4171. Set output balance between both channels. Default is 0.
  4172. Allowed range is from -1 to 1.
  4173. @item softclip
  4174. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4175. clipping. Disabled by default.
  4176. @item mutel
  4177. Mute the left channel. Disabled by default.
  4178. @item muter
  4179. Mute the right channel. Disabled by default.
  4180. @item phasel
  4181. Change the phase of the left channel. Disabled by default.
  4182. @item phaser
  4183. Change the phase of the right channel. Disabled by default.
  4184. @item mode
  4185. Set stereo mode. Available values are:
  4186. @table @samp
  4187. @item lr>lr
  4188. Left/Right to Left/Right, this is default.
  4189. @item lr>ms
  4190. Left/Right to Mid/Side.
  4191. @item ms>lr
  4192. Mid/Side to Left/Right.
  4193. @item lr>ll
  4194. Left/Right to Left/Left.
  4195. @item lr>rr
  4196. Left/Right to Right/Right.
  4197. @item lr>l+r
  4198. Left/Right to Left + Right.
  4199. @item lr>rl
  4200. Left/Right to Right/Left.
  4201. @item ms>ll
  4202. Mid/Side to Left/Left.
  4203. @item ms>rr
  4204. Mid/Side to Right/Right.
  4205. @end table
  4206. @item slev
  4207. Set level of side signal. Default is 1.
  4208. Allowed range is from 0.015625 to 64.
  4209. @item sbal
  4210. Set balance of side signal. Default is 0.
  4211. Allowed range is from -1 to 1.
  4212. @item mlev
  4213. Set level of the middle signal. Default is 1.
  4214. Allowed range is from 0.015625 to 64.
  4215. @item mpan
  4216. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4217. @item base
  4218. Set stereo base between mono and inversed channels. Default is 0.
  4219. Allowed range is from -1 to 1.
  4220. @item delay
  4221. Set delay in milliseconds how much to delay left from right channel and
  4222. vice versa. Default is 0. Allowed range is from -20 to 20.
  4223. @item sclevel
  4224. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4225. @item phase
  4226. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4227. @item bmode_in, bmode_out
  4228. Set balance mode for balance_in/balance_out option.
  4229. Can be one of the following:
  4230. @table @samp
  4231. @item balance
  4232. Classic balance mode. Attenuate one channel at time.
  4233. Gain is raised up to 1.
  4234. @item amplitude
  4235. Similar as classic mode above but gain is raised up to 2.
  4236. @item power
  4237. Equal power distribution, from -6dB to +6dB range.
  4238. @end table
  4239. @end table
  4240. @subsection Examples
  4241. @itemize
  4242. @item
  4243. Apply karaoke like effect:
  4244. @example
  4245. stereotools=mlev=0.015625
  4246. @end example
  4247. @item
  4248. Convert M/S signal to L/R:
  4249. @example
  4250. "stereotools=mode=ms>lr"
  4251. @end example
  4252. @end itemize
  4253. @section stereowiden
  4254. This filter enhance the stereo effect by suppressing signal common to both
  4255. channels and by delaying the signal of left into right and vice versa,
  4256. thereby widening the stereo effect.
  4257. The filter accepts the following options:
  4258. @table @option
  4259. @item delay
  4260. Time in milliseconds of the delay of left signal into right and vice versa.
  4261. Default is 20 milliseconds.
  4262. @item feedback
  4263. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4264. effect of left signal in right output and vice versa which gives widening
  4265. effect. Default is 0.3.
  4266. @item crossfeed
  4267. Cross feed of left into right with inverted phase. This helps in suppressing
  4268. the mono. If the value is 1 it will cancel all the signal common to both
  4269. channels. Default is 0.3.
  4270. @item drymix
  4271. Set level of input signal of original channel. Default is 0.8.
  4272. @end table
  4273. @subsection Commands
  4274. This filter supports the all above options except @code{delay} as @ref{commands}.
  4275. @section superequalizer
  4276. Apply 18 band equalizer.
  4277. The filter accepts the following options:
  4278. @table @option
  4279. @item 1b
  4280. Set 65Hz band gain.
  4281. @item 2b
  4282. Set 92Hz band gain.
  4283. @item 3b
  4284. Set 131Hz band gain.
  4285. @item 4b
  4286. Set 185Hz band gain.
  4287. @item 5b
  4288. Set 262Hz band gain.
  4289. @item 6b
  4290. Set 370Hz band gain.
  4291. @item 7b
  4292. Set 523Hz band gain.
  4293. @item 8b
  4294. Set 740Hz band gain.
  4295. @item 9b
  4296. Set 1047Hz band gain.
  4297. @item 10b
  4298. Set 1480Hz band gain.
  4299. @item 11b
  4300. Set 2093Hz band gain.
  4301. @item 12b
  4302. Set 2960Hz band gain.
  4303. @item 13b
  4304. Set 4186Hz band gain.
  4305. @item 14b
  4306. Set 5920Hz band gain.
  4307. @item 15b
  4308. Set 8372Hz band gain.
  4309. @item 16b
  4310. Set 11840Hz band gain.
  4311. @item 17b
  4312. Set 16744Hz band gain.
  4313. @item 18b
  4314. Set 20000Hz band gain.
  4315. @end table
  4316. @section surround
  4317. Apply audio surround upmix filter.
  4318. This filter allows to produce multichannel output from audio stream.
  4319. The filter accepts the following options:
  4320. @table @option
  4321. @item chl_out
  4322. Set output channel layout. By default, this is @var{5.1}.
  4323. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4324. for the required syntax.
  4325. @item chl_in
  4326. Set input channel layout. By default, this is @var{stereo}.
  4327. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4328. for the required syntax.
  4329. @item level_in
  4330. Set input volume level. By default, this is @var{1}.
  4331. @item level_out
  4332. Set output volume level. By default, this is @var{1}.
  4333. @item lfe
  4334. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4335. @item lfe_low
  4336. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4337. @item lfe_high
  4338. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4339. @item lfe_mode
  4340. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4341. In @var{add} mode, LFE channel is created from input audio and added to output.
  4342. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4343. also all non-LFE output channels are subtracted with output LFE channel.
  4344. @item angle
  4345. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4346. Default is @var{90}.
  4347. @item fc_in
  4348. Set front center input volume. By default, this is @var{1}.
  4349. @item fc_out
  4350. Set front center output volume. By default, this is @var{1}.
  4351. @item fl_in
  4352. Set front left input volume. By default, this is @var{1}.
  4353. @item fl_out
  4354. Set front left output volume. By default, this is @var{1}.
  4355. @item fr_in
  4356. Set front right input volume. By default, this is @var{1}.
  4357. @item fr_out
  4358. Set front right output volume. By default, this is @var{1}.
  4359. @item sl_in
  4360. Set side left input volume. By default, this is @var{1}.
  4361. @item sl_out
  4362. Set side left output volume. By default, this is @var{1}.
  4363. @item sr_in
  4364. Set side right input volume. By default, this is @var{1}.
  4365. @item sr_out
  4366. Set side right output volume. By default, this is @var{1}.
  4367. @item bl_in
  4368. Set back left input volume. By default, this is @var{1}.
  4369. @item bl_out
  4370. Set back left output volume. By default, this is @var{1}.
  4371. @item br_in
  4372. Set back right input volume. By default, this is @var{1}.
  4373. @item br_out
  4374. Set back right output volume. By default, this is @var{1}.
  4375. @item bc_in
  4376. Set back center input volume. By default, this is @var{1}.
  4377. @item bc_out
  4378. Set back center output volume. By default, this is @var{1}.
  4379. @item lfe_in
  4380. Set LFE input volume. By default, this is @var{1}.
  4381. @item lfe_out
  4382. Set LFE output volume. By default, this is @var{1}.
  4383. @item allx
  4384. Set spread usage of stereo image across X axis for all channels.
  4385. @item ally
  4386. Set spread usage of stereo image across Y axis for all channels.
  4387. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4388. Set spread usage of stereo image across X axis for each channel.
  4389. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4390. Set spread usage of stereo image across Y axis for each channel.
  4391. @item win_size
  4392. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4393. @item win_func
  4394. Set window function.
  4395. It accepts the following values:
  4396. @table @samp
  4397. @item rect
  4398. @item bartlett
  4399. @item hann, hanning
  4400. @item hamming
  4401. @item blackman
  4402. @item welch
  4403. @item flattop
  4404. @item bharris
  4405. @item bnuttall
  4406. @item bhann
  4407. @item sine
  4408. @item nuttall
  4409. @item lanczos
  4410. @item gauss
  4411. @item tukey
  4412. @item dolph
  4413. @item cauchy
  4414. @item parzen
  4415. @item poisson
  4416. @item bohman
  4417. @end table
  4418. Default is @code{hann}.
  4419. @item overlap
  4420. Set window overlap. If set to 1, the recommended overlap for selected
  4421. window function will be picked. Default is @code{0.5}.
  4422. @end table
  4423. @section treble, highshelf
  4424. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4425. shelving filter with a response similar to that of a standard
  4426. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4427. The filter accepts the following options:
  4428. @table @option
  4429. @item gain, g
  4430. Give the gain at whichever is the lower of ~22 kHz and the
  4431. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4432. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4433. @item frequency, f
  4434. Set the filter's central frequency and so can be used
  4435. to extend or reduce the frequency range to be boosted or cut.
  4436. The default value is @code{3000} Hz.
  4437. @item width_type, t
  4438. Set method to specify band-width of filter.
  4439. @table @option
  4440. @item h
  4441. Hz
  4442. @item q
  4443. Q-Factor
  4444. @item o
  4445. octave
  4446. @item s
  4447. slope
  4448. @item k
  4449. kHz
  4450. @end table
  4451. @item width, w
  4452. Determine how steep is the filter's shelf transition.
  4453. @item mix, m
  4454. How much to use filtered signal in output. Default is 1.
  4455. Range is between 0 and 1.
  4456. @item channels, c
  4457. Specify which channels to filter, by default all available are filtered.
  4458. @item normalize, n
  4459. Normalize biquad coefficients, by default is disabled.
  4460. Enabling it will normalize magnitude response at DC to 0dB.
  4461. @item transform, a
  4462. Set transform type of IIR filter.
  4463. @table @option
  4464. @item di
  4465. @item dii
  4466. @item tdii
  4467. @item latt
  4468. @end table
  4469. @end table
  4470. @subsection Commands
  4471. This filter supports the following commands:
  4472. @table @option
  4473. @item frequency, f
  4474. Change treble frequency.
  4475. Syntax for the command is : "@var{frequency}"
  4476. @item width_type, t
  4477. Change treble width_type.
  4478. Syntax for the command is : "@var{width_type}"
  4479. @item width, w
  4480. Change treble width.
  4481. Syntax for the command is : "@var{width}"
  4482. @item gain, g
  4483. Change treble gain.
  4484. Syntax for the command is : "@var{gain}"
  4485. @item mix, m
  4486. Change treble mix.
  4487. Syntax for the command is : "@var{mix}"
  4488. @end table
  4489. @section tremolo
  4490. Sinusoidal amplitude modulation.
  4491. The filter accepts the following options:
  4492. @table @option
  4493. @item f
  4494. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4495. (20 Hz or lower) will result in a tremolo effect.
  4496. This filter may also be used as a ring modulator by specifying
  4497. a modulation frequency higher than 20 Hz.
  4498. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4499. @item d
  4500. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4501. Default value is 0.5.
  4502. @end table
  4503. @section vibrato
  4504. Sinusoidal phase modulation.
  4505. The filter accepts the following options:
  4506. @table @option
  4507. @item f
  4508. Modulation frequency in Hertz.
  4509. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4510. @item d
  4511. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4512. Default value is 0.5.
  4513. @end table
  4514. @section volume
  4515. Adjust the input audio volume.
  4516. It accepts the following parameters:
  4517. @table @option
  4518. @item volume
  4519. Set audio volume expression.
  4520. Output values are clipped to the maximum value.
  4521. The output audio volume is given by the relation:
  4522. @example
  4523. @var{output_volume} = @var{volume} * @var{input_volume}
  4524. @end example
  4525. The default value for @var{volume} is "1.0".
  4526. @item precision
  4527. This parameter represents the mathematical precision.
  4528. It determines which input sample formats will be allowed, which affects the
  4529. precision of the volume scaling.
  4530. @table @option
  4531. @item fixed
  4532. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4533. @item float
  4534. 32-bit floating-point; this limits input sample format to FLT. (default)
  4535. @item double
  4536. 64-bit floating-point; this limits input sample format to DBL.
  4537. @end table
  4538. @item replaygain
  4539. Choose the behaviour on encountering ReplayGain side data in input frames.
  4540. @table @option
  4541. @item drop
  4542. Remove ReplayGain side data, ignoring its contents (the default).
  4543. @item ignore
  4544. Ignore ReplayGain side data, but leave it in the frame.
  4545. @item track
  4546. Prefer the track gain, if present.
  4547. @item album
  4548. Prefer the album gain, if present.
  4549. @end table
  4550. @item replaygain_preamp
  4551. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4552. Default value for @var{replaygain_preamp} is 0.0.
  4553. @item replaygain_noclip
  4554. Prevent clipping by limiting the gain applied.
  4555. Default value for @var{replaygain_noclip} is 1.
  4556. @item eval
  4557. Set when the volume expression is evaluated.
  4558. It accepts the following values:
  4559. @table @samp
  4560. @item once
  4561. only evaluate expression once during the filter initialization, or
  4562. when the @samp{volume} command is sent
  4563. @item frame
  4564. evaluate expression for each incoming frame
  4565. @end table
  4566. Default value is @samp{once}.
  4567. @end table
  4568. The volume expression can contain the following parameters.
  4569. @table @option
  4570. @item n
  4571. frame number (starting at zero)
  4572. @item nb_channels
  4573. number of channels
  4574. @item nb_consumed_samples
  4575. number of samples consumed by the filter
  4576. @item nb_samples
  4577. number of samples in the current frame
  4578. @item pos
  4579. original frame position in the file
  4580. @item pts
  4581. frame PTS
  4582. @item sample_rate
  4583. sample rate
  4584. @item startpts
  4585. PTS at start of stream
  4586. @item startt
  4587. time at start of stream
  4588. @item t
  4589. frame time
  4590. @item tb
  4591. timestamp timebase
  4592. @item volume
  4593. last set volume value
  4594. @end table
  4595. Note that when @option{eval} is set to @samp{once} only the
  4596. @var{sample_rate} and @var{tb} variables are available, all other
  4597. variables will evaluate to NAN.
  4598. @subsection Commands
  4599. This filter supports the following commands:
  4600. @table @option
  4601. @item volume
  4602. Modify the volume expression.
  4603. The command accepts the same syntax of the corresponding option.
  4604. If the specified expression is not valid, it is kept at its current
  4605. value.
  4606. @end table
  4607. @subsection Examples
  4608. @itemize
  4609. @item
  4610. Halve the input audio volume:
  4611. @example
  4612. volume=volume=0.5
  4613. volume=volume=1/2
  4614. volume=volume=-6.0206dB
  4615. @end example
  4616. In all the above example the named key for @option{volume} can be
  4617. omitted, for example like in:
  4618. @example
  4619. volume=0.5
  4620. @end example
  4621. @item
  4622. Increase input audio power by 6 decibels using fixed-point precision:
  4623. @example
  4624. volume=volume=6dB:precision=fixed
  4625. @end example
  4626. @item
  4627. Fade volume after time 10 with an annihilation period of 5 seconds:
  4628. @example
  4629. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4630. @end example
  4631. @end itemize
  4632. @section volumedetect
  4633. Detect the volume of the input video.
  4634. The filter has no parameters. The input is not modified. Statistics about
  4635. the volume will be printed in the log when the input stream end is reached.
  4636. In particular it will show the mean volume (root mean square), maximum
  4637. volume (on a per-sample basis), and the beginning of a histogram of the
  4638. registered volume values (from the maximum value to a cumulated 1/1000 of
  4639. the samples).
  4640. All volumes are in decibels relative to the maximum PCM value.
  4641. @subsection Examples
  4642. Here is an excerpt of the output:
  4643. @example
  4644. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4645. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4646. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4647. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4648. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4649. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4650. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4651. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4652. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4653. @end example
  4654. It means that:
  4655. @itemize
  4656. @item
  4657. The mean square energy is approximately -27 dB, or 10^-2.7.
  4658. @item
  4659. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4660. @item
  4661. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4662. @end itemize
  4663. In other words, raising the volume by +4 dB does not cause any clipping,
  4664. raising it by +5 dB causes clipping for 6 samples, etc.
  4665. @c man end AUDIO FILTERS
  4666. @chapter Audio Sources
  4667. @c man begin AUDIO SOURCES
  4668. Below is a description of the currently available audio sources.
  4669. @section abuffer
  4670. Buffer audio frames, and make them available to the filter chain.
  4671. This source is mainly intended for a programmatic use, in particular
  4672. through the interface defined in @file{libavfilter/buffersrc.h}.
  4673. It accepts the following parameters:
  4674. @table @option
  4675. @item time_base
  4676. The timebase which will be used for timestamps of submitted frames. It must be
  4677. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4678. @item sample_rate
  4679. The sample rate of the incoming audio buffers.
  4680. @item sample_fmt
  4681. The sample format of the incoming audio buffers.
  4682. Either a sample format name or its corresponding integer representation from
  4683. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4684. @item channel_layout
  4685. The channel layout of the incoming audio buffers.
  4686. Either a channel layout name from channel_layout_map in
  4687. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4688. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4689. @item channels
  4690. The number of channels of the incoming audio buffers.
  4691. If both @var{channels} and @var{channel_layout} are specified, then they
  4692. must be consistent.
  4693. @end table
  4694. @subsection Examples
  4695. @example
  4696. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4697. @end example
  4698. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4699. Since the sample format with name "s16p" corresponds to the number
  4700. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4701. equivalent to:
  4702. @example
  4703. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4704. @end example
  4705. @section aevalsrc
  4706. Generate an audio signal specified by an expression.
  4707. This source accepts in input one or more expressions (one for each
  4708. channel), which are evaluated and used to generate a corresponding
  4709. audio signal.
  4710. This source accepts the following options:
  4711. @table @option
  4712. @item exprs
  4713. Set the '|'-separated expressions list for each separate channel. In case the
  4714. @option{channel_layout} option is not specified, the selected channel layout
  4715. depends on the number of provided expressions. Otherwise the last
  4716. specified expression is applied to the remaining output channels.
  4717. @item channel_layout, c
  4718. Set the channel layout. The number of channels in the specified layout
  4719. must be equal to the number of specified expressions.
  4720. @item duration, d
  4721. Set the minimum duration of the sourced audio. See
  4722. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4723. for the accepted syntax.
  4724. Note that the resulting duration may be greater than the specified
  4725. duration, as the generated audio is always cut at the end of a
  4726. complete frame.
  4727. If not specified, or the expressed duration is negative, the audio is
  4728. supposed to be generated forever.
  4729. @item nb_samples, n
  4730. Set the number of samples per channel per each output frame,
  4731. default to 1024.
  4732. @item sample_rate, s
  4733. Specify the sample rate, default to 44100.
  4734. @end table
  4735. Each expression in @var{exprs} can contain the following constants:
  4736. @table @option
  4737. @item n
  4738. number of the evaluated sample, starting from 0
  4739. @item t
  4740. time of the evaluated sample expressed in seconds, starting from 0
  4741. @item s
  4742. sample rate
  4743. @end table
  4744. @subsection Examples
  4745. @itemize
  4746. @item
  4747. Generate silence:
  4748. @example
  4749. aevalsrc=0
  4750. @end example
  4751. @item
  4752. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4753. 8000 Hz:
  4754. @example
  4755. aevalsrc="sin(440*2*PI*t):s=8000"
  4756. @end example
  4757. @item
  4758. Generate a two channels signal, specify the channel layout (Front
  4759. Center + Back Center) explicitly:
  4760. @example
  4761. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4762. @end example
  4763. @item
  4764. Generate white noise:
  4765. @example
  4766. aevalsrc="-2+random(0)"
  4767. @end example
  4768. @item
  4769. Generate an amplitude modulated signal:
  4770. @example
  4771. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4772. @end example
  4773. @item
  4774. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4775. @example
  4776. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4777. @end example
  4778. @end itemize
  4779. @section afirsrc
  4780. Generate a FIR coefficients using frequency sampling method.
  4781. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4782. The filter accepts the following options:
  4783. @table @option
  4784. @item taps, t
  4785. Set number of filter coefficents in output audio stream.
  4786. Default value is 1025.
  4787. @item frequency, f
  4788. Set frequency points from where magnitude and phase are set.
  4789. This must be in non decreasing order, and first element must be 0, while last element
  4790. must be 1. Elements are separated by white spaces.
  4791. @item magnitude, m
  4792. Set magnitude value for every frequency point set by @option{frequency}.
  4793. Number of values must be same as number of frequency points.
  4794. Values are separated by white spaces.
  4795. @item phase, p
  4796. Set phase value for every frequency point set by @option{frequency}.
  4797. Number of values must be same as number of frequency points.
  4798. Values are separated by white spaces.
  4799. @item sample_rate, r
  4800. Set sample rate, default is 44100.
  4801. @item nb_samples, n
  4802. Set number of samples per each frame. Default is 1024.
  4803. @item win_func, w
  4804. Set window function. Default is blackman.
  4805. @end table
  4806. @section anullsrc
  4807. The null audio source, return unprocessed audio frames. It is mainly useful
  4808. as a template and to be employed in analysis / debugging tools, or as
  4809. the source for filters which ignore the input data (for example the sox
  4810. synth filter).
  4811. This source accepts the following options:
  4812. @table @option
  4813. @item channel_layout, cl
  4814. Specifies the channel layout, and can be either an integer or a string
  4815. representing a channel layout. The default value of @var{channel_layout}
  4816. is "stereo".
  4817. Check the channel_layout_map definition in
  4818. @file{libavutil/channel_layout.c} for the mapping between strings and
  4819. channel layout values.
  4820. @item sample_rate, r
  4821. Specifies the sample rate, and defaults to 44100.
  4822. @item nb_samples, n
  4823. Set the number of samples per requested frames.
  4824. @item duration, d
  4825. Set the duration of the sourced audio. See
  4826. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4827. for the accepted syntax.
  4828. If not specified, or the expressed duration is negative, the audio is
  4829. supposed to be generated forever.
  4830. @end table
  4831. @subsection Examples
  4832. @itemize
  4833. @item
  4834. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4835. @example
  4836. anullsrc=r=48000:cl=4
  4837. @end example
  4838. @item
  4839. Do the same operation with a more obvious syntax:
  4840. @example
  4841. anullsrc=r=48000:cl=mono
  4842. @end example
  4843. @end itemize
  4844. All the parameters need to be explicitly defined.
  4845. @section flite
  4846. Synthesize a voice utterance using the libflite library.
  4847. To enable compilation of this filter you need to configure FFmpeg with
  4848. @code{--enable-libflite}.
  4849. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4850. The filter accepts the following options:
  4851. @table @option
  4852. @item list_voices
  4853. If set to 1, list the names of the available voices and exit
  4854. immediately. Default value is 0.
  4855. @item nb_samples, n
  4856. Set the maximum number of samples per frame. Default value is 512.
  4857. @item textfile
  4858. Set the filename containing the text to speak.
  4859. @item text
  4860. Set the text to speak.
  4861. @item voice, v
  4862. Set the voice to use for the speech synthesis. Default value is
  4863. @code{kal}. See also the @var{list_voices} option.
  4864. @end table
  4865. @subsection Examples
  4866. @itemize
  4867. @item
  4868. Read from file @file{speech.txt}, and synthesize the text using the
  4869. standard flite voice:
  4870. @example
  4871. flite=textfile=speech.txt
  4872. @end example
  4873. @item
  4874. Read the specified text selecting the @code{slt} voice:
  4875. @example
  4876. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4877. @end example
  4878. @item
  4879. Input text to ffmpeg:
  4880. @example
  4881. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4882. @end example
  4883. @item
  4884. Make @file{ffplay} speak the specified text, using @code{flite} and
  4885. the @code{lavfi} device:
  4886. @example
  4887. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4888. @end example
  4889. @end itemize
  4890. For more information about libflite, check:
  4891. @url{http://www.festvox.org/flite/}
  4892. @section anoisesrc
  4893. Generate a noise audio signal.
  4894. The filter accepts the following options:
  4895. @table @option
  4896. @item sample_rate, r
  4897. Specify the sample rate. Default value is 48000 Hz.
  4898. @item amplitude, a
  4899. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4900. is 1.0.
  4901. @item duration, d
  4902. Specify the duration of the generated audio stream. Not specifying this option
  4903. results in noise with an infinite length.
  4904. @item color, colour, c
  4905. Specify the color of noise. Available noise colors are white, pink, brown,
  4906. blue, violet and velvet. Default color is white.
  4907. @item seed, s
  4908. Specify a value used to seed the PRNG.
  4909. @item nb_samples, n
  4910. Set the number of samples per each output frame, default is 1024.
  4911. @end table
  4912. @subsection Examples
  4913. @itemize
  4914. @item
  4915. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4916. @example
  4917. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4918. @end example
  4919. @end itemize
  4920. @section hilbert
  4921. Generate odd-tap Hilbert transform FIR coefficients.
  4922. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4923. the signal by 90 degrees.
  4924. This is used in many matrix coding schemes and for analytic signal generation.
  4925. The process is often written as a multiplication by i (or j), the imaginary unit.
  4926. The filter accepts the following options:
  4927. @table @option
  4928. @item sample_rate, s
  4929. Set sample rate, default is 44100.
  4930. @item taps, t
  4931. Set length of FIR filter, default is 22051.
  4932. @item nb_samples, n
  4933. Set number of samples per each frame.
  4934. @item win_func, w
  4935. Set window function to be used when generating FIR coefficients.
  4936. @end table
  4937. @section sinc
  4938. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4939. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4940. The filter accepts the following options:
  4941. @table @option
  4942. @item sample_rate, r
  4943. Set sample rate, default is 44100.
  4944. @item nb_samples, n
  4945. Set number of samples per each frame. Default is 1024.
  4946. @item hp
  4947. Set high-pass frequency. Default is 0.
  4948. @item lp
  4949. Set low-pass frequency. Default is 0.
  4950. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4951. is higher than 0 then filter will create band-pass filter coefficients,
  4952. otherwise band-reject filter coefficients.
  4953. @item phase
  4954. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4955. @item beta
  4956. Set Kaiser window beta.
  4957. @item att
  4958. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4959. @item round
  4960. Enable rounding, by default is disabled.
  4961. @item hptaps
  4962. Set number of taps for high-pass filter.
  4963. @item lptaps
  4964. Set number of taps for low-pass filter.
  4965. @end table
  4966. @section sine
  4967. Generate an audio signal made of a sine wave with amplitude 1/8.
  4968. The audio signal is bit-exact.
  4969. The filter accepts the following options:
  4970. @table @option
  4971. @item frequency, f
  4972. Set the carrier frequency. Default is 440 Hz.
  4973. @item beep_factor, b
  4974. Enable a periodic beep every second with frequency @var{beep_factor} times
  4975. the carrier frequency. Default is 0, meaning the beep is disabled.
  4976. @item sample_rate, r
  4977. Specify the sample rate, default is 44100.
  4978. @item duration, d
  4979. Specify the duration of the generated audio stream.
  4980. @item samples_per_frame
  4981. Set the number of samples per output frame.
  4982. The expression can contain the following constants:
  4983. @table @option
  4984. @item n
  4985. The (sequential) number of the output audio frame, starting from 0.
  4986. @item pts
  4987. The PTS (Presentation TimeStamp) of the output audio frame,
  4988. expressed in @var{TB} units.
  4989. @item t
  4990. The PTS of the output audio frame, expressed in seconds.
  4991. @item TB
  4992. The timebase of the output audio frames.
  4993. @end table
  4994. Default is @code{1024}.
  4995. @end table
  4996. @subsection Examples
  4997. @itemize
  4998. @item
  4999. Generate a simple 440 Hz sine wave:
  5000. @example
  5001. sine
  5002. @end example
  5003. @item
  5004. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5005. @example
  5006. sine=220:4:d=5
  5007. sine=f=220:b=4:d=5
  5008. sine=frequency=220:beep_factor=4:duration=5
  5009. @end example
  5010. @item
  5011. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5012. pattern:
  5013. @example
  5014. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5015. @end example
  5016. @end itemize
  5017. @c man end AUDIO SOURCES
  5018. @chapter Audio Sinks
  5019. @c man begin AUDIO SINKS
  5020. Below is a description of the currently available audio sinks.
  5021. @section abuffersink
  5022. Buffer audio frames, and make them available to the end of filter chain.
  5023. This sink is mainly intended for programmatic use, in particular
  5024. through the interface defined in @file{libavfilter/buffersink.h}
  5025. or the options system.
  5026. It accepts a pointer to an AVABufferSinkContext structure, which
  5027. defines the incoming buffers' formats, to be passed as the opaque
  5028. parameter to @code{avfilter_init_filter} for initialization.
  5029. @section anullsink
  5030. Null audio sink; do absolutely nothing with the input audio. It is
  5031. mainly useful as a template and for use in analysis / debugging
  5032. tools.
  5033. @c man end AUDIO SINKS
  5034. @chapter Video Filters
  5035. @c man begin VIDEO FILTERS
  5036. When you configure your FFmpeg build, you can disable any of the
  5037. existing filters using @code{--disable-filters}.
  5038. The configure output will show the video filters included in your
  5039. build.
  5040. Below is a description of the currently available video filters.
  5041. @section addroi
  5042. Mark a region of interest in a video frame.
  5043. The frame data is passed through unchanged, but metadata is attached
  5044. to the frame indicating regions of interest which can affect the
  5045. behaviour of later encoding. Multiple regions can be marked by
  5046. applying the filter multiple times.
  5047. @table @option
  5048. @item x
  5049. Region distance in pixels from the left edge of the frame.
  5050. @item y
  5051. Region distance in pixels from the top edge of the frame.
  5052. @item w
  5053. Region width in pixels.
  5054. @item h
  5055. Region height in pixels.
  5056. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5057. and may contain the following variables:
  5058. @table @option
  5059. @item iw
  5060. Width of the input frame.
  5061. @item ih
  5062. Height of the input frame.
  5063. @end table
  5064. @item qoffset
  5065. Quantisation offset to apply within the region.
  5066. This must be a real value in the range -1 to +1. A value of zero
  5067. indicates no quality change. A negative value asks for better quality
  5068. (less quantisation), while a positive value asks for worse quality
  5069. (greater quantisation).
  5070. The range is calibrated so that the extreme values indicate the
  5071. largest possible offset - if the rest of the frame is encoded with the
  5072. worst possible quality, an offset of -1 indicates that this region
  5073. should be encoded with the best possible quality anyway. Intermediate
  5074. values are then interpolated in some codec-dependent way.
  5075. For example, in 10-bit H.264 the quantisation parameter varies between
  5076. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5077. this region should be encoded with a QP around one-tenth of the full
  5078. range better than the rest of the frame. So, if most of the frame
  5079. were to be encoded with a QP of around 30, this region would get a QP
  5080. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5081. An extreme value of -1 would indicate that this region should be
  5082. encoded with the best possible quality regardless of the treatment of
  5083. the rest of the frame - that is, should be encoded at a QP of -12.
  5084. @item clear
  5085. If set to true, remove any existing regions of interest marked on the
  5086. frame before adding the new one.
  5087. @end table
  5088. @subsection Examples
  5089. @itemize
  5090. @item
  5091. Mark the centre quarter of the frame as interesting.
  5092. @example
  5093. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5094. @end example
  5095. @item
  5096. Mark the 100-pixel-wide region on the left edge of the frame as very
  5097. uninteresting (to be encoded at much lower quality than the rest of
  5098. the frame).
  5099. @example
  5100. addroi=0:0:100:ih:+1/5
  5101. @end example
  5102. @end itemize
  5103. @section alphaextract
  5104. Extract the alpha component from the input as a grayscale video. This
  5105. is especially useful with the @var{alphamerge} filter.
  5106. @section alphamerge
  5107. Add or replace the alpha component of the primary input with the
  5108. grayscale value of a second input. This is intended for use with
  5109. @var{alphaextract} to allow the transmission or storage of frame
  5110. sequences that have alpha in a format that doesn't support an alpha
  5111. channel.
  5112. For example, to reconstruct full frames from a normal YUV-encoded video
  5113. and a separate video created with @var{alphaextract}, you might use:
  5114. @example
  5115. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5116. @end example
  5117. @section amplify
  5118. Amplify differences between current pixel and pixels of adjacent frames in
  5119. same pixel location.
  5120. This filter accepts the following options:
  5121. @table @option
  5122. @item radius
  5123. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5124. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5125. @item factor
  5126. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5127. @item threshold
  5128. Set threshold for difference amplification. Any difference greater or equal to
  5129. this value will not alter source pixel. Default is 10.
  5130. Allowed range is from 0 to 65535.
  5131. @item tolerance
  5132. Set tolerance for difference amplification. Any difference lower to
  5133. this value will not alter source pixel. Default is 0.
  5134. Allowed range is from 0 to 65535.
  5135. @item low
  5136. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5137. This option controls maximum possible value that will decrease source pixel value.
  5138. @item high
  5139. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5140. This option controls maximum possible value that will increase source pixel value.
  5141. @item planes
  5142. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5143. @end table
  5144. @subsection Commands
  5145. This filter supports the following @ref{commands} that corresponds to option of same name:
  5146. @table @option
  5147. @item factor
  5148. @item threshold
  5149. @item tolerance
  5150. @item low
  5151. @item high
  5152. @item planes
  5153. @end table
  5154. @section ass
  5155. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5156. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5157. Substation Alpha) subtitles files.
  5158. This filter accepts the following option in addition to the common options from
  5159. the @ref{subtitles} filter:
  5160. @table @option
  5161. @item shaping
  5162. Set the shaping engine
  5163. Available values are:
  5164. @table @samp
  5165. @item auto
  5166. The default libass shaping engine, which is the best available.
  5167. @item simple
  5168. Fast, font-agnostic shaper that can do only substitutions
  5169. @item complex
  5170. Slower shaper using OpenType for substitutions and positioning
  5171. @end table
  5172. The default is @code{auto}.
  5173. @end table
  5174. @section atadenoise
  5175. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5176. The filter accepts the following options:
  5177. @table @option
  5178. @item 0a
  5179. Set threshold A for 1st plane. Default is 0.02.
  5180. Valid range is 0 to 0.3.
  5181. @item 0b
  5182. Set threshold B for 1st plane. Default is 0.04.
  5183. Valid range is 0 to 5.
  5184. @item 1a
  5185. Set threshold A for 2nd plane. Default is 0.02.
  5186. Valid range is 0 to 0.3.
  5187. @item 1b
  5188. Set threshold B for 2nd plane. Default is 0.04.
  5189. Valid range is 0 to 5.
  5190. @item 2a
  5191. Set threshold A for 3rd plane. Default is 0.02.
  5192. Valid range is 0 to 0.3.
  5193. @item 2b
  5194. Set threshold B for 3rd plane. Default is 0.04.
  5195. Valid range is 0 to 5.
  5196. Threshold A is designed to react on abrupt changes in the input signal and
  5197. threshold B is designed to react on continuous changes in the input signal.
  5198. @item s
  5199. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5200. number in range [5, 129].
  5201. @item p
  5202. Set what planes of frame filter will use for averaging. Default is all.
  5203. @item a
  5204. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5205. Alternatively can be set to @code{s} serial.
  5206. Parallel can be faster then serial, while other way around is never true.
  5207. Parallel will abort early on first change being greater then thresholds, while serial
  5208. will continue processing other side of frames if they are equal or bellow thresholds.
  5209. @end table
  5210. @subsection Commands
  5211. This filter supports same @ref{commands} as options except option @code{s}.
  5212. The command accepts the same syntax of the corresponding option.
  5213. @section avgblur
  5214. Apply average blur filter.
  5215. The filter accepts the following options:
  5216. @table @option
  5217. @item sizeX
  5218. Set horizontal radius size.
  5219. @item planes
  5220. Set which planes to filter. By default all planes are filtered.
  5221. @item sizeY
  5222. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5223. Default is @code{0}.
  5224. @end table
  5225. @subsection Commands
  5226. This filter supports same commands as options.
  5227. The command accepts the same syntax of the corresponding option.
  5228. If the specified expression is not valid, it is kept at its current
  5229. value.
  5230. @section bbox
  5231. Compute the bounding box for the non-black pixels in the input frame
  5232. luminance plane.
  5233. This filter computes the bounding box containing all the pixels with a
  5234. luminance value greater than the minimum allowed value.
  5235. The parameters describing the bounding box are printed on the filter
  5236. log.
  5237. The filter accepts the following option:
  5238. @table @option
  5239. @item min_val
  5240. Set the minimal luminance value. Default is @code{16}.
  5241. @end table
  5242. @section bilateral
  5243. Apply bilateral filter, spatial smoothing while preserving edges.
  5244. The filter accepts the following options:
  5245. @table @option
  5246. @item sigmaS
  5247. Set sigma of gaussian function to calculate spatial weight.
  5248. Allowed range is 0 to 512. Default is 0.1.
  5249. @item sigmaR
  5250. Set sigma of gaussian function to calculate range weight.
  5251. Allowed range is 0 to 1. Default is 0.1.
  5252. @item planes
  5253. Set planes to filter. Default is first only.
  5254. @end table
  5255. @section bitplanenoise
  5256. Show and measure bit plane noise.
  5257. The filter accepts the following options:
  5258. @table @option
  5259. @item bitplane
  5260. Set which plane to analyze. Default is @code{1}.
  5261. @item filter
  5262. Filter out noisy pixels from @code{bitplane} set above.
  5263. Default is disabled.
  5264. @end table
  5265. @section blackdetect
  5266. Detect video intervals that are (almost) completely black. Can be
  5267. useful to detect chapter transitions, commercials, or invalid
  5268. recordings.
  5269. The filter outputs its detection analysis to both the log as well as
  5270. frame metadata. If a black segment of at least the specified minimum
  5271. duration is found, a line with the start and end timestamps as well
  5272. as duration is printed to the log with level @code{info}. In addition,
  5273. a log line with level @code{debug} is printed per frame showing the
  5274. black amount detected for that frame.
  5275. The filter also attaches metadata to the first frame of a black
  5276. segment with key @code{lavfi.black_start} and to the first frame
  5277. after the black segment ends with key @code{lavfi.black_end}. The
  5278. value is the frame's timestamp. This metadata is added regardless
  5279. of the minimum duration specified.
  5280. The filter accepts the following options:
  5281. @table @option
  5282. @item black_min_duration, d
  5283. Set the minimum detected black duration expressed in seconds. It must
  5284. be a non-negative floating point number.
  5285. Default value is 2.0.
  5286. @item picture_black_ratio_th, pic_th
  5287. Set the threshold for considering a picture "black".
  5288. Express the minimum value for the ratio:
  5289. @example
  5290. @var{nb_black_pixels} / @var{nb_pixels}
  5291. @end example
  5292. for which a picture is considered black.
  5293. Default value is 0.98.
  5294. @item pixel_black_th, pix_th
  5295. Set the threshold for considering a pixel "black".
  5296. The threshold expresses the maximum pixel luminance value for which a
  5297. pixel is considered "black". The provided value is scaled according to
  5298. the following equation:
  5299. @example
  5300. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5301. @end example
  5302. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5303. the input video format, the range is [0-255] for YUV full-range
  5304. formats and [16-235] for YUV non full-range formats.
  5305. Default value is 0.10.
  5306. @end table
  5307. The following example sets the maximum pixel threshold to the minimum
  5308. value, and detects only black intervals of 2 or more seconds:
  5309. @example
  5310. blackdetect=d=2:pix_th=0.00
  5311. @end example
  5312. @section blackframe
  5313. Detect frames that are (almost) completely black. Can be useful to
  5314. detect chapter transitions or commercials. Output lines consist of
  5315. the frame number of the detected frame, the percentage of blackness,
  5316. the position in the file if known or -1 and the timestamp in seconds.
  5317. In order to display the output lines, you need to set the loglevel at
  5318. least to the AV_LOG_INFO value.
  5319. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5320. The value represents the percentage of pixels in the picture that
  5321. are below the threshold value.
  5322. It accepts the following parameters:
  5323. @table @option
  5324. @item amount
  5325. The percentage of the pixels that have to be below the threshold; it defaults to
  5326. @code{98}.
  5327. @item threshold, thresh
  5328. The threshold below which a pixel value is considered black; it defaults to
  5329. @code{32}.
  5330. @end table
  5331. @anchor{blend}
  5332. @section blend
  5333. Blend two video frames into each other.
  5334. The @code{blend} filter takes two input streams and outputs one
  5335. stream, the first input is the "top" layer and second input is
  5336. "bottom" layer. By default, the output terminates when the longest input terminates.
  5337. The @code{tblend} (time blend) filter takes two consecutive frames
  5338. from one single stream, and outputs the result obtained by blending
  5339. the new frame on top of the old frame.
  5340. A description of the accepted options follows.
  5341. @table @option
  5342. @item c0_mode
  5343. @item c1_mode
  5344. @item c2_mode
  5345. @item c3_mode
  5346. @item all_mode
  5347. Set blend mode for specific pixel component or all pixel components in case
  5348. of @var{all_mode}. Default value is @code{normal}.
  5349. Available values for component modes are:
  5350. @table @samp
  5351. @item addition
  5352. @item grainmerge
  5353. @item and
  5354. @item average
  5355. @item burn
  5356. @item darken
  5357. @item difference
  5358. @item grainextract
  5359. @item divide
  5360. @item dodge
  5361. @item freeze
  5362. @item exclusion
  5363. @item extremity
  5364. @item glow
  5365. @item hardlight
  5366. @item hardmix
  5367. @item heat
  5368. @item lighten
  5369. @item linearlight
  5370. @item multiply
  5371. @item multiply128
  5372. @item negation
  5373. @item normal
  5374. @item or
  5375. @item overlay
  5376. @item phoenix
  5377. @item pinlight
  5378. @item reflect
  5379. @item screen
  5380. @item softlight
  5381. @item subtract
  5382. @item vividlight
  5383. @item xor
  5384. @end table
  5385. @item c0_opacity
  5386. @item c1_opacity
  5387. @item c2_opacity
  5388. @item c3_opacity
  5389. @item all_opacity
  5390. Set blend opacity for specific pixel component or all pixel components in case
  5391. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5392. @item c0_expr
  5393. @item c1_expr
  5394. @item c2_expr
  5395. @item c3_expr
  5396. @item all_expr
  5397. Set blend expression for specific pixel component or all pixel components in case
  5398. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5399. The expressions can use the following variables:
  5400. @table @option
  5401. @item N
  5402. The sequential number of the filtered frame, starting from @code{0}.
  5403. @item X
  5404. @item Y
  5405. the coordinates of the current sample
  5406. @item W
  5407. @item H
  5408. the width and height of currently filtered plane
  5409. @item SW
  5410. @item SH
  5411. Width and height scale for the plane being filtered. It is the
  5412. ratio between the dimensions of the current plane to the luma plane,
  5413. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5414. the luma plane and @code{0.5,0.5} for the chroma planes.
  5415. @item T
  5416. Time of the current frame, expressed in seconds.
  5417. @item TOP, A
  5418. Value of pixel component at current location for first video frame (top layer).
  5419. @item BOTTOM, B
  5420. Value of pixel component at current location for second video frame (bottom layer).
  5421. @end table
  5422. @end table
  5423. The @code{blend} filter also supports the @ref{framesync} options.
  5424. @subsection Examples
  5425. @itemize
  5426. @item
  5427. Apply transition from bottom layer to top layer in first 10 seconds:
  5428. @example
  5429. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5430. @end example
  5431. @item
  5432. Apply linear horizontal transition from top layer to bottom layer:
  5433. @example
  5434. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5435. @end example
  5436. @item
  5437. Apply 1x1 checkerboard effect:
  5438. @example
  5439. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5440. @end example
  5441. @item
  5442. Apply uncover left effect:
  5443. @example
  5444. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5445. @end example
  5446. @item
  5447. Apply uncover down effect:
  5448. @example
  5449. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5450. @end example
  5451. @item
  5452. Apply uncover up-left effect:
  5453. @example
  5454. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5455. @end example
  5456. @item
  5457. Split diagonally video and shows top and bottom layer on each side:
  5458. @example
  5459. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5460. @end example
  5461. @item
  5462. Display differences between the current and the previous frame:
  5463. @example
  5464. tblend=all_mode=grainextract
  5465. @end example
  5466. @end itemize
  5467. @section bm3d
  5468. Denoise frames using Block-Matching 3D algorithm.
  5469. The filter accepts the following options.
  5470. @table @option
  5471. @item sigma
  5472. Set denoising strength. Default value is 1.
  5473. Allowed range is from 0 to 999.9.
  5474. The denoising algorithm is very sensitive to sigma, so adjust it
  5475. according to the source.
  5476. @item block
  5477. Set local patch size. This sets dimensions in 2D.
  5478. @item bstep
  5479. Set sliding step for processing blocks. Default value is 4.
  5480. Allowed range is from 1 to 64.
  5481. Smaller values allows processing more reference blocks and is slower.
  5482. @item group
  5483. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5484. When set to 1, no block matching is done. Larger values allows more blocks
  5485. in single group.
  5486. Allowed range is from 1 to 256.
  5487. @item range
  5488. Set radius for search block matching. Default is 9.
  5489. Allowed range is from 1 to INT32_MAX.
  5490. @item mstep
  5491. Set step between two search locations for block matching. Default is 1.
  5492. Allowed range is from 1 to 64. Smaller is slower.
  5493. @item thmse
  5494. Set threshold of mean square error for block matching. Valid range is 0 to
  5495. INT32_MAX.
  5496. @item hdthr
  5497. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5498. Larger values results in stronger hard-thresholding filtering in frequency
  5499. domain.
  5500. @item estim
  5501. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5502. Default is @code{basic}.
  5503. @item ref
  5504. If enabled, filter will use 2nd stream for block matching.
  5505. Default is disabled for @code{basic} value of @var{estim} option,
  5506. and always enabled if value of @var{estim} is @code{final}.
  5507. @item planes
  5508. Set planes to filter. Default is all available except alpha.
  5509. @end table
  5510. @subsection Examples
  5511. @itemize
  5512. @item
  5513. Basic filtering with bm3d:
  5514. @example
  5515. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5516. @end example
  5517. @item
  5518. Same as above, but filtering only luma:
  5519. @example
  5520. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5521. @end example
  5522. @item
  5523. Same as above, but with both estimation modes:
  5524. @example
  5525. 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
  5526. @end example
  5527. @item
  5528. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5529. @example
  5530. 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
  5531. @end example
  5532. @end itemize
  5533. @section boxblur
  5534. Apply a boxblur algorithm to the input video.
  5535. It accepts the following parameters:
  5536. @table @option
  5537. @item luma_radius, lr
  5538. @item luma_power, lp
  5539. @item chroma_radius, cr
  5540. @item chroma_power, cp
  5541. @item alpha_radius, ar
  5542. @item alpha_power, ap
  5543. @end table
  5544. A description of the accepted options follows.
  5545. @table @option
  5546. @item luma_radius, lr
  5547. @item chroma_radius, cr
  5548. @item alpha_radius, ar
  5549. Set an expression for the box radius in pixels used for blurring the
  5550. corresponding input plane.
  5551. The radius value must be a non-negative number, and must not be
  5552. greater than the value of the expression @code{min(w,h)/2} for the
  5553. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5554. planes.
  5555. Default value for @option{luma_radius} is "2". If not specified,
  5556. @option{chroma_radius} and @option{alpha_radius} default to the
  5557. corresponding value set for @option{luma_radius}.
  5558. The expressions can contain the following constants:
  5559. @table @option
  5560. @item w
  5561. @item h
  5562. The input width and height in pixels.
  5563. @item cw
  5564. @item ch
  5565. The input chroma image width and height in pixels.
  5566. @item hsub
  5567. @item vsub
  5568. The horizontal and vertical chroma subsample values. For example, for the
  5569. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5570. @end table
  5571. @item luma_power, lp
  5572. @item chroma_power, cp
  5573. @item alpha_power, ap
  5574. Specify how many times the boxblur filter is applied to the
  5575. corresponding plane.
  5576. Default value for @option{luma_power} is 2. If not specified,
  5577. @option{chroma_power} and @option{alpha_power} default to the
  5578. corresponding value set for @option{luma_power}.
  5579. A value of 0 will disable the effect.
  5580. @end table
  5581. @subsection Examples
  5582. @itemize
  5583. @item
  5584. Apply a boxblur filter with the luma, chroma, and alpha radii
  5585. set to 2:
  5586. @example
  5587. boxblur=luma_radius=2:luma_power=1
  5588. boxblur=2:1
  5589. @end example
  5590. @item
  5591. Set the luma radius to 2, and alpha and chroma radius to 0:
  5592. @example
  5593. boxblur=2:1:cr=0:ar=0
  5594. @end example
  5595. @item
  5596. Set the luma and chroma radii to a fraction of the video dimension:
  5597. @example
  5598. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5599. @end example
  5600. @end itemize
  5601. @section bwdif
  5602. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5603. Deinterlacing Filter").
  5604. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5605. interpolation algorithms.
  5606. It accepts the following parameters:
  5607. @table @option
  5608. @item mode
  5609. The interlacing mode to adopt. It accepts one of the following values:
  5610. @table @option
  5611. @item 0, send_frame
  5612. Output one frame for each frame.
  5613. @item 1, send_field
  5614. Output one frame for each field.
  5615. @end table
  5616. The default value is @code{send_field}.
  5617. @item parity
  5618. The picture field parity assumed for the input interlaced video. It accepts one
  5619. of the following values:
  5620. @table @option
  5621. @item 0, tff
  5622. Assume the top field is first.
  5623. @item 1, bff
  5624. Assume the bottom field is first.
  5625. @item -1, auto
  5626. Enable automatic detection of field parity.
  5627. @end table
  5628. The default value is @code{auto}.
  5629. If the interlacing is unknown or the decoder does not export this information,
  5630. top field first will be assumed.
  5631. @item deint
  5632. Specify which frames to deinterlace. Accepts one of the following
  5633. values:
  5634. @table @option
  5635. @item 0, all
  5636. Deinterlace all frames.
  5637. @item 1, interlaced
  5638. Only deinterlace frames marked as interlaced.
  5639. @end table
  5640. The default value is @code{all}.
  5641. @end table
  5642. @section cas
  5643. Apply Contrast Adaptive Sharpen filter to video stream.
  5644. The filter accepts the following options:
  5645. @table @option
  5646. @item strength
  5647. Set the sharpening strength. Default value is 0.
  5648. @item planes
  5649. Set planes to filter. Default value is to filter all
  5650. planes except alpha plane.
  5651. @end table
  5652. @section chromahold
  5653. Remove all color information for all colors except for certain one.
  5654. The filter accepts the following options:
  5655. @table @option
  5656. @item color
  5657. The color which will not be replaced with neutral chroma.
  5658. @item similarity
  5659. Similarity percentage with the above color.
  5660. 0.01 matches only the exact key color, while 1.0 matches everything.
  5661. @item blend
  5662. Blend percentage.
  5663. 0.0 makes pixels either fully gray, or not gray at all.
  5664. Higher values result in more preserved color.
  5665. @item yuv
  5666. Signals that the color passed is already in YUV instead of RGB.
  5667. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5668. This can be used to pass exact YUV values as hexadecimal numbers.
  5669. @end table
  5670. @subsection Commands
  5671. This filter supports same @ref{commands} as options.
  5672. The command accepts the same syntax of the corresponding option.
  5673. If the specified expression is not valid, it is kept at its current
  5674. value.
  5675. @section chromakey
  5676. YUV colorspace color/chroma keying.
  5677. The filter accepts the following options:
  5678. @table @option
  5679. @item color
  5680. The color which will be replaced with transparency.
  5681. @item similarity
  5682. Similarity percentage with the key color.
  5683. 0.01 matches only the exact key color, while 1.0 matches everything.
  5684. @item blend
  5685. Blend percentage.
  5686. 0.0 makes pixels either fully transparent, or not transparent at all.
  5687. Higher values result in semi-transparent pixels, with a higher transparency
  5688. the more similar the pixels color is to the key color.
  5689. @item yuv
  5690. Signals that the color passed is already in YUV instead of RGB.
  5691. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5692. This can be used to pass exact YUV values as hexadecimal numbers.
  5693. @end table
  5694. @subsection Commands
  5695. This filter supports same @ref{commands} as options.
  5696. The command accepts the same syntax of the corresponding option.
  5697. If the specified expression is not valid, it is kept at its current
  5698. value.
  5699. @subsection Examples
  5700. @itemize
  5701. @item
  5702. Make every green pixel in the input image transparent:
  5703. @example
  5704. ffmpeg -i input.png -vf chromakey=green out.png
  5705. @end example
  5706. @item
  5707. Overlay a greenscreen-video on top of a static black background.
  5708. @example
  5709. 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
  5710. @end example
  5711. @end itemize
  5712. @section chromanr
  5713. Reduce chrominance noise.
  5714. The filter accepts the following options:
  5715. @table @option
  5716. @item thres
  5717. Set threshold for averaging chrominance values.
  5718. Sum of absolute difference of U and V pixel components or current
  5719. pixel and neighbour pixels lower than this threshold will be used in
  5720. averaging. Luma component is left unchanged and is copied to output.
  5721. Default value is 30. Allowed range is from 1 to 200.
  5722. @item sizew
  5723. Set horizontal radius of rectangle used for averaging.
  5724. Allowed range is from 1 to 100. Default value is 5.
  5725. @item sizeh
  5726. Set vertical radius of rectangle used for averaging.
  5727. Allowed range is from 1 to 100. Default value is 5.
  5728. @item stepw
  5729. Set horizontal step when averaging. Default value is 1.
  5730. Allowed range is from 1 to 50.
  5731. Mostly useful to speed-up filtering.
  5732. @item steph
  5733. Set vertical step when averaging. Default value is 1.
  5734. Allowed range is from 1 to 50.
  5735. Mostly useful to speed-up filtering.
  5736. @end table
  5737. @subsection Commands
  5738. This filter supports same @ref{commands} as options.
  5739. The command accepts the same syntax of the corresponding option.
  5740. @section chromashift
  5741. Shift chroma pixels horizontally and/or vertically.
  5742. The filter accepts the following options:
  5743. @table @option
  5744. @item cbh
  5745. Set amount to shift chroma-blue horizontally.
  5746. @item cbv
  5747. Set amount to shift chroma-blue vertically.
  5748. @item crh
  5749. Set amount to shift chroma-red horizontally.
  5750. @item crv
  5751. Set amount to shift chroma-red vertically.
  5752. @item edge
  5753. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5754. @end table
  5755. @subsection Commands
  5756. This filter supports the all above options as @ref{commands}.
  5757. @section ciescope
  5758. Display CIE color diagram with pixels overlaid onto it.
  5759. The filter accepts the following options:
  5760. @table @option
  5761. @item system
  5762. Set color system.
  5763. @table @samp
  5764. @item ntsc, 470m
  5765. @item ebu, 470bg
  5766. @item smpte
  5767. @item 240m
  5768. @item apple
  5769. @item widergb
  5770. @item cie1931
  5771. @item rec709, hdtv
  5772. @item uhdtv, rec2020
  5773. @item dcip3
  5774. @end table
  5775. @item cie
  5776. Set CIE system.
  5777. @table @samp
  5778. @item xyy
  5779. @item ucs
  5780. @item luv
  5781. @end table
  5782. @item gamuts
  5783. Set what gamuts to draw.
  5784. See @code{system} option for available values.
  5785. @item size, s
  5786. Set ciescope size, by default set to 512.
  5787. @item intensity, i
  5788. Set intensity used to map input pixel values to CIE diagram.
  5789. @item contrast
  5790. Set contrast used to draw tongue colors that are out of active color system gamut.
  5791. @item corrgamma
  5792. Correct gamma displayed on scope, by default enabled.
  5793. @item showwhite
  5794. Show white point on CIE diagram, by default disabled.
  5795. @item gamma
  5796. Set input gamma. Used only with XYZ input color space.
  5797. @end table
  5798. @section codecview
  5799. Visualize information exported by some codecs.
  5800. Some codecs can export information through frames using side-data or other
  5801. means. For example, some MPEG based codecs export motion vectors through the
  5802. @var{export_mvs} flag in the codec @option{flags2} option.
  5803. The filter accepts the following option:
  5804. @table @option
  5805. @item mv
  5806. Set motion vectors to visualize.
  5807. Available flags for @var{mv} are:
  5808. @table @samp
  5809. @item pf
  5810. forward predicted MVs of P-frames
  5811. @item bf
  5812. forward predicted MVs of B-frames
  5813. @item bb
  5814. backward predicted MVs of B-frames
  5815. @end table
  5816. @item qp
  5817. Display quantization parameters using the chroma planes.
  5818. @item mv_type, mvt
  5819. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5820. Available flags for @var{mv_type} are:
  5821. @table @samp
  5822. @item fp
  5823. forward predicted MVs
  5824. @item bp
  5825. backward predicted MVs
  5826. @end table
  5827. @item frame_type, ft
  5828. Set frame type to visualize motion vectors of.
  5829. Available flags for @var{frame_type} are:
  5830. @table @samp
  5831. @item if
  5832. intra-coded frames (I-frames)
  5833. @item pf
  5834. predicted frames (P-frames)
  5835. @item bf
  5836. bi-directionally predicted frames (B-frames)
  5837. @end table
  5838. @end table
  5839. @subsection Examples
  5840. @itemize
  5841. @item
  5842. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5843. @example
  5844. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5845. @end example
  5846. @item
  5847. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5848. @example
  5849. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5850. @end example
  5851. @end itemize
  5852. @section colorbalance
  5853. Modify intensity of primary colors (red, green and blue) of input frames.
  5854. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5855. regions for the red-cyan, green-magenta or blue-yellow balance.
  5856. A positive adjustment value shifts the balance towards the primary color, a negative
  5857. value towards the complementary color.
  5858. The filter accepts the following options:
  5859. @table @option
  5860. @item rs
  5861. @item gs
  5862. @item bs
  5863. Adjust red, green and blue shadows (darkest pixels).
  5864. @item rm
  5865. @item gm
  5866. @item bm
  5867. Adjust red, green and blue midtones (medium pixels).
  5868. @item rh
  5869. @item gh
  5870. @item bh
  5871. Adjust red, green and blue highlights (brightest pixels).
  5872. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5873. @item pl
  5874. Preserve lightness when changing color balance. Default is disabled.
  5875. @end table
  5876. @subsection Examples
  5877. @itemize
  5878. @item
  5879. Add red color cast to shadows:
  5880. @example
  5881. colorbalance=rs=.3
  5882. @end example
  5883. @end itemize
  5884. @subsection Commands
  5885. This filter supports the all above options as @ref{commands}.
  5886. @section colorchannelmixer
  5887. Adjust video input frames by re-mixing color channels.
  5888. This filter modifies a color channel by adding the values associated to
  5889. the other channels of the same pixels. For example if the value to
  5890. modify is red, the output value will be:
  5891. @example
  5892. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5893. @end example
  5894. The filter accepts the following options:
  5895. @table @option
  5896. @item rr
  5897. @item rg
  5898. @item rb
  5899. @item ra
  5900. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5901. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5902. @item gr
  5903. @item gg
  5904. @item gb
  5905. @item ga
  5906. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5907. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5908. @item br
  5909. @item bg
  5910. @item bb
  5911. @item ba
  5912. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5913. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5914. @item ar
  5915. @item ag
  5916. @item ab
  5917. @item aa
  5918. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5919. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5920. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5921. @end table
  5922. @subsection Examples
  5923. @itemize
  5924. @item
  5925. Convert source to grayscale:
  5926. @example
  5927. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5928. @end example
  5929. @item
  5930. Simulate sepia tones:
  5931. @example
  5932. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5933. @end example
  5934. @end itemize
  5935. @subsection Commands
  5936. This filter supports the all above options as @ref{commands}.
  5937. @section colorkey
  5938. RGB colorspace color keying.
  5939. The filter accepts the following options:
  5940. @table @option
  5941. @item color
  5942. The color which will be replaced with transparency.
  5943. @item similarity
  5944. Similarity percentage with the key color.
  5945. 0.01 matches only the exact key color, while 1.0 matches everything.
  5946. @item blend
  5947. Blend percentage.
  5948. 0.0 makes pixels either fully transparent, or not transparent at all.
  5949. Higher values result in semi-transparent pixels, with a higher transparency
  5950. the more similar the pixels color is to the key color.
  5951. @end table
  5952. @subsection Examples
  5953. @itemize
  5954. @item
  5955. Make every green pixel in the input image transparent:
  5956. @example
  5957. ffmpeg -i input.png -vf colorkey=green out.png
  5958. @end example
  5959. @item
  5960. Overlay a greenscreen-video on top of a static background image.
  5961. @example
  5962. 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
  5963. @end example
  5964. @end itemize
  5965. @subsection Commands
  5966. This filter supports same @ref{commands} as options.
  5967. The command accepts the same syntax of the corresponding option.
  5968. If the specified expression is not valid, it is kept at its current
  5969. value.
  5970. @section colorhold
  5971. Remove all color information for all RGB colors except for certain one.
  5972. The filter accepts the following options:
  5973. @table @option
  5974. @item color
  5975. The color which will not be replaced with neutral gray.
  5976. @item similarity
  5977. Similarity percentage with the above color.
  5978. 0.01 matches only the exact key color, while 1.0 matches everything.
  5979. @item blend
  5980. Blend percentage. 0.0 makes pixels fully gray.
  5981. Higher values result in more preserved color.
  5982. @end table
  5983. @subsection Commands
  5984. This filter supports same @ref{commands} as options.
  5985. The command accepts the same syntax of the corresponding option.
  5986. If the specified expression is not valid, it is kept at its current
  5987. value.
  5988. @section colorlevels
  5989. Adjust video input frames using levels.
  5990. The filter accepts the following options:
  5991. @table @option
  5992. @item rimin
  5993. @item gimin
  5994. @item bimin
  5995. @item aimin
  5996. Adjust red, green, blue and alpha input black point.
  5997. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5998. @item rimax
  5999. @item gimax
  6000. @item bimax
  6001. @item aimax
  6002. Adjust red, green, blue and alpha input white point.
  6003. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6004. Input levels are used to lighten highlights (bright tones), darken shadows
  6005. (dark tones), change the balance of bright and dark tones.
  6006. @item romin
  6007. @item gomin
  6008. @item bomin
  6009. @item aomin
  6010. Adjust red, green, blue and alpha output black point.
  6011. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6012. @item romax
  6013. @item gomax
  6014. @item bomax
  6015. @item aomax
  6016. Adjust red, green, blue and alpha output white point.
  6017. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6018. Output levels allows manual selection of a constrained output level range.
  6019. @end table
  6020. @subsection Examples
  6021. @itemize
  6022. @item
  6023. Make video output darker:
  6024. @example
  6025. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6026. @end example
  6027. @item
  6028. Increase contrast:
  6029. @example
  6030. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6031. @end example
  6032. @item
  6033. Make video output lighter:
  6034. @example
  6035. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6036. @end example
  6037. @item
  6038. Increase brightness:
  6039. @example
  6040. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6041. @end example
  6042. @end itemize
  6043. @subsection Commands
  6044. This filter supports the all above options as @ref{commands}.
  6045. @section colormatrix
  6046. Convert color matrix.
  6047. The filter accepts the following options:
  6048. @table @option
  6049. @item src
  6050. @item dst
  6051. Specify the source and destination color matrix. Both values must be
  6052. specified.
  6053. The accepted values are:
  6054. @table @samp
  6055. @item bt709
  6056. BT.709
  6057. @item fcc
  6058. FCC
  6059. @item bt601
  6060. BT.601
  6061. @item bt470
  6062. BT.470
  6063. @item bt470bg
  6064. BT.470BG
  6065. @item smpte170m
  6066. SMPTE-170M
  6067. @item smpte240m
  6068. SMPTE-240M
  6069. @item bt2020
  6070. BT.2020
  6071. @end table
  6072. @end table
  6073. For example to convert from BT.601 to SMPTE-240M, use the command:
  6074. @example
  6075. colormatrix=bt601:smpte240m
  6076. @end example
  6077. @section colorspace
  6078. Convert colorspace, transfer characteristics or color primaries.
  6079. Input video needs to have an even size.
  6080. The filter accepts the following options:
  6081. @table @option
  6082. @anchor{all}
  6083. @item all
  6084. Specify all color properties at once.
  6085. The accepted values are:
  6086. @table @samp
  6087. @item bt470m
  6088. BT.470M
  6089. @item bt470bg
  6090. BT.470BG
  6091. @item bt601-6-525
  6092. BT.601-6 525
  6093. @item bt601-6-625
  6094. BT.601-6 625
  6095. @item bt709
  6096. BT.709
  6097. @item smpte170m
  6098. SMPTE-170M
  6099. @item smpte240m
  6100. SMPTE-240M
  6101. @item bt2020
  6102. BT.2020
  6103. @end table
  6104. @anchor{space}
  6105. @item space
  6106. Specify output colorspace.
  6107. The accepted values are:
  6108. @table @samp
  6109. @item bt709
  6110. BT.709
  6111. @item fcc
  6112. FCC
  6113. @item bt470bg
  6114. BT.470BG or BT.601-6 625
  6115. @item smpte170m
  6116. SMPTE-170M or BT.601-6 525
  6117. @item smpte240m
  6118. SMPTE-240M
  6119. @item ycgco
  6120. YCgCo
  6121. @item bt2020ncl
  6122. BT.2020 with non-constant luminance
  6123. @end table
  6124. @anchor{trc}
  6125. @item trc
  6126. Specify output transfer characteristics.
  6127. The accepted values are:
  6128. @table @samp
  6129. @item bt709
  6130. BT.709
  6131. @item bt470m
  6132. BT.470M
  6133. @item bt470bg
  6134. BT.470BG
  6135. @item gamma22
  6136. Constant gamma of 2.2
  6137. @item gamma28
  6138. Constant gamma of 2.8
  6139. @item smpte170m
  6140. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6141. @item smpte240m
  6142. SMPTE-240M
  6143. @item srgb
  6144. SRGB
  6145. @item iec61966-2-1
  6146. iec61966-2-1
  6147. @item iec61966-2-4
  6148. iec61966-2-4
  6149. @item xvycc
  6150. xvycc
  6151. @item bt2020-10
  6152. BT.2020 for 10-bits content
  6153. @item bt2020-12
  6154. BT.2020 for 12-bits content
  6155. @end table
  6156. @anchor{primaries}
  6157. @item primaries
  6158. Specify output color primaries.
  6159. The accepted values are:
  6160. @table @samp
  6161. @item bt709
  6162. BT.709
  6163. @item bt470m
  6164. BT.470M
  6165. @item bt470bg
  6166. BT.470BG or BT.601-6 625
  6167. @item smpte170m
  6168. SMPTE-170M or BT.601-6 525
  6169. @item smpte240m
  6170. SMPTE-240M
  6171. @item film
  6172. film
  6173. @item smpte431
  6174. SMPTE-431
  6175. @item smpte432
  6176. SMPTE-432
  6177. @item bt2020
  6178. BT.2020
  6179. @item jedec-p22
  6180. JEDEC P22 phosphors
  6181. @end table
  6182. @anchor{range}
  6183. @item range
  6184. Specify output color range.
  6185. The accepted values are:
  6186. @table @samp
  6187. @item tv
  6188. TV (restricted) range
  6189. @item mpeg
  6190. MPEG (restricted) range
  6191. @item pc
  6192. PC (full) range
  6193. @item jpeg
  6194. JPEG (full) range
  6195. @end table
  6196. @item format
  6197. Specify output color format.
  6198. The accepted values are:
  6199. @table @samp
  6200. @item yuv420p
  6201. YUV 4:2:0 planar 8-bits
  6202. @item yuv420p10
  6203. YUV 4:2:0 planar 10-bits
  6204. @item yuv420p12
  6205. YUV 4:2:0 planar 12-bits
  6206. @item yuv422p
  6207. YUV 4:2:2 planar 8-bits
  6208. @item yuv422p10
  6209. YUV 4:2:2 planar 10-bits
  6210. @item yuv422p12
  6211. YUV 4:2:2 planar 12-bits
  6212. @item yuv444p
  6213. YUV 4:4:4 planar 8-bits
  6214. @item yuv444p10
  6215. YUV 4:4:4 planar 10-bits
  6216. @item yuv444p12
  6217. YUV 4:4:4 planar 12-bits
  6218. @end table
  6219. @item fast
  6220. Do a fast conversion, which skips gamma/primary correction. This will take
  6221. significantly less CPU, but will be mathematically incorrect. To get output
  6222. compatible with that produced by the colormatrix filter, use fast=1.
  6223. @item dither
  6224. Specify dithering mode.
  6225. The accepted values are:
  6226. @table @samp
  6227. @item none
  6228. No dithering
  6229. @item fsb
  6230. Floyd-Steinberg dithering
  6231. @end table
  6232. @item wpadapt
  6233. Whitepoint adaptation mode.
  6234. The accepted values are:
  6235. @table @samp
  6236. @item bradford
  6237. Bradford whitepoint adaptation
  6238. @item vonkries
  6239. von Kries whitepoint adaptation
  6240. @item identity
  6241. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6242. @end table
  6243. @item iall
  6244. Override all input properties at once. Same accepted values as @ref{all}.
  6245. @item ispace
  6246. Override input colorspace. Same accepted values as @ref{space}.
  6247. @item iprimaries
  6248. Override input color primaries. Same accepted values as @ref{primaries}.
  6249. @item itrc
  6250. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6251. @item irange
  6252. Override input color range. Same accepted values as @ref{range}.
  6253. @end table
  6254. The filter converts the transfer characteristics, color space and color
  6255. primaries to the specified user values. The output value, if not specified,
  6256. is set to a default value based on the "all" property. If that property is
  6257. also not specified, the filter will log an error. The output color range and
  6258. format default to the same value as the input color range and format. The
  6259. input transfer characteristics, color space, color primaries and color range
  6260. should be set on the input data. If any of these are missing, the filter will
  6261. log an error and no conversion will take place.
  6262. For example to convert the input to SMPTE-240M, use the command:
  6263. @example
  6264. colorspace=smpte240m
  6265. @end example
  6266. @section convolution
  6267. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6268. The filter accepts the following options:
  6269. @table @option
  6270. @item 0m
  6271. @item 1m
  6272. @item 2m
  6273. @item 3m
  6274. Set matrix for each plane.
  6275. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6276. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6277. @item 0rdiv
  6278. @item 1rdiv
  6279. @item 2rdiv
  6280. @item 3rdiv
  6281. Set multiplier for calculated value for each plane.
  6282. If unset or 0, it will be sum of all matrix elements.
  6283. @item 0bias
  6284. @item 1bias
  6285. @item 2bias
  6286. @item 3bias
  6287. Set bias for each plane. This value is added to the result of the multiplication.
  6288. Useful for making the overall image brighter or darker. Default is 0.0.
  6289. @item 0mode
  6290. @item 1mode
  6291. @item 2mode
  6292. @item 3mode
  6293. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6294. Default is @var{square}.
  6295. @end table
  6296. @subsection Examples
  6297. @itemize
  6298. @item
  6299. Apply sharpen:
  6300. @example
  6301. 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"
  6302. @end example
  6303. @item
  6304. Apply blur:
  6305. @example
  6306. 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"
  6307. @end example
  6308. @item
  6309. Apply edge enhance:
  6310. @example
  6311. 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"
  6312. @end example
  6313. @item
  6314. Apply edge detect:
  6315. @example
  6316. 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"
  6317. @end example
  6318. @item
  6319. Apply laplacian edge detector which includes diagonals:
  6320. @example
  6321. 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"
  6322. @end example
  6323. @item
  6324. Apply emboss:
  6325. @example
  6326. 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"
  6327. @end example
  6328. @end itemize
  6329. @section convolve
  6330. Apply 2D convolution of video stream in frequency domain using second stream
  6331. as impulse.
  6332. The filter accepts the following options:
  6333. @table @option
  6334. @item planes
  6335. Set which planes to process.
  6336. @item impulse
  6337. Set which impulse video frames will be processed, can be @var{first}
  6338. or @var{all}. Default is @var{all}.
  6339. @end table
  6340. The @code{convolve} filter also supports the @ref{framesync} options.
  6341. @section copy
  6342. Copy the input video source unchanged to the output. This is mainly useful for
  6343. testing purposes.
  6344. @anchor{coreimage}
  6345. @section coreimage
  6346. Video filtering on GPU using Apple's CoreImage API on OSX.
  6347. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6348. processed by video hardware. However, software-based OpenGL implementations
  6349. exist which means there is no guarantee for hardware processing. It depends on
  6350. the respective OSX.
  6351. There are many filters and image generators provided by Apple that come with a
  6352. large variety of options. The filter has to be referenced by its name along
  6353. with its options.
  6354. The coreimage filter accepts the following options:
  6355. @table @option
  6356. @item list_filters
  6357. List all available filters and generators along with all their respective
  6358. options as well as possible minimum and maximum values along with the default
  6359. values.
  6360. @example
  6361. list_filters=true
  6362. @end example
  6363. @item filter
  6364. Specify all filters by their respective name and options.
  6365. Use @var{list_filters} to determine all valid filter names and options.
  6366. Numerical options are specified by a float value and are automatically clamped
  6367. to their respective value range. Vector and color options have to be specified
  6368. by a list of space separated float values. Character escaping has to be done.
  6369. A special option name @code{default} is available to use default options for a
  6370. filter.
  6371. It is required to specify either @code{default} or at least one of the filter options.
  6372. All omitted options are used with their default values.
  6373. The syntax of the filter string is as follows:
  6374. @example
  6375. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6376. @end example
  6377. @item output_rect
  6378. Specify a rectangle where the output of the filter chain is copied into the
  6379. input image. It is given by a list of space separated float values:
  6380. @example
  6381. output_rect=x\ y\ width\ height
  6382. @end example
  6383. If not given, the output rectangle equals the dimensions of the input image.
  6384. The output rectangle is automatically cropped at the borders of the input
  6385. image. Negative values are valid for each component.
  6386. @example
  6387. output_rect=25\ 25\ 100\ 100
  6388. @end example
  6389. @end table
  6390. Several filters can be chained for successive processing without GPU-HOST
  6391. transfers allowing for fast processing of complex filter chains.
  6392. Currently, only filters with zero (generators) or exactly one (filters) input
  6393. image and one output image are supported. Also, transition filters are not yet
  6394. usable as intended.
  6395. Some filters generate output images with additional padding depending on the
  6396. respective filter kernel. The padding is automatically removed to ensure the
  6397. filter output has the same size as the input image.
  6398. For image generators, the size of the output image is determined by the
  6399. previous output image of the filter chain or the input image of the whole
  6400. filterchain, respectively. The generators do not use the pixel information of
  6401. this image to generate their output. However, the generated output is
  6402. blended onto this image, resulting in partial or complete coverage of the
  6403. output image.
  6404. The @ref{coreimagesrc} video source can be used for generating input images
  6405. which are directly fed into the filter chain. By using it, providing input
  6406. images by another video source or an input video is not required.
  6407. @subsection Examples
  6408. @itemize
  6409. @item
  6410. List all filters available:
  6411. @example
  6412. coreimage=list_filters=true
  6413. @end example
  6414. @item
  6415. Use the CIBoxBlur filter with default options to blur an image:
  6416. @example
  6417. coreimage=filter=CIBoxBlur@@default
  6418. @end example
  6419. @item
  6420. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6421. its center at 100x100 and a radius of 50 pixels:
  6422. @example
  6423. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6424. @end example
  6425. @item
  6426. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6427. given as complete and escaped command-line for Apple's standard bash shell:
  6428. @example
  6429. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6430. @end example
  6431. @end itemize
  6432. @section cover_rect
  6433. Cover a rectangular object
  6434. It accepts the following options:
  6435. @table @option
  6436. @item cover
  6437. Filepath of the optional cover image, needs to be in yuv420.
  6438. @item mode
  6439. Set covering mode.
  6440. It accepts the following values:
  6441. @table @samp
  6442. @item cover
  6443. cover it by the supplied image
  6444. @item blur
  6445. cover it by interpolating the surrounding pixels
  6446. @end table
  6447. Default value is @var{blur}.
  6448. @end table
  6449. @subsection Examples
  6450. @itemize
  6451. @item
  6452. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6453. @example
  6454. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6455. @end example
  6456. @end itemize
  6457. @section crop
  6458. Crop the input video to given dimensions.
  6459. It accepts the following parameters:
  6460. @table @option
  6461. @item w, out_w
  6462. The width of the output video. It defaults to @code{iw}.
  6463. This expression is evaluated only once during the filter
  6464. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6465. @item h, out_h
  6466. The height of the output video. It defaults to @code{ih}.
  6467. This expression is evaluated only once during the filter
  6468. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6469. @item x
  6470. The horizontal position, in the input video, of the left edge of the output
  6471. video. It defaults to @code{(in_w-out_w)/2}.
  6472. This expression is evaluated per-frame.
  6473. @item y
  6474. The vertical position, in the input video, of the top edge of the output video.
  6475. It defaults to @code{(in_h-out_h)/2}.
  6476. This expression is evaluated per-frame.
  6477. @item keep_aspect
  6478. If set to 1 will force the output display aspect ratio
  6479. to be the same of the input, by changing the output sample aspect
  6480. ratio. It defaults to 0.
  6481. @item exact
  6482. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6483. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6484. It defaults to 0.
  6485. @end table
  6486. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6487. expressions containing the following constants:
  6488. @table @option
  6489. @item x
  6490. @item y
  6491. The computed values for @var{x} and @var{y}. They are evaluated for
  6492. each new frame.
  6493. @item in_w
  6494. @item in_h
  6495. The input width and height.
  6496. @item iw
  6497. @item ih
  6498. These are the same as @var{in_w} and @var{in_h}.
  6499. @item out_w
  6500. @item out_h
  6501. The output (cropped) width and height.
  6502. @item ow
  6503. @item oh
  6504. These are the same as @var{out_w} and @var{out_h}.
  6505. @item a
  6506. same as @var{iw} / @var{ih}
  6507. @item sar
  6508. input sample aspect ratio
  6509. @item dar
  6510. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6511. @item hsub
  6512. @item vsub
  6513. horizontal and vertical chroma subsample values. For example for the
  6514. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6515. @item n
  6516. The number of the input frame, starting from 0.
  6517. @item pos
  6518. the position in the file of the input frame, NAN if unknown
  6519. @item t
  6520. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6521. @end table
  6522. The expression for @var{out_w} may depend on the value of @var{out_h},
  6523. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6524. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6525. evaluated after @var{out_w} and @var{out_h}.
  6526. The @var{x} and @var{y} parameters specify the expressions for the
  6527. position of the top-left corner of the output (non-cropped) area. They
  6528. are evaluated for each frame. If the evaluated value is not valid, it
  6529. is approximated to the nearest valid value.
  6530. The expression for @var{x} may depend on @var{y}, and the expression
  6531. for @var{y} may depend on @var{x}.
  6532. @subsection Examples
  6533. @itemize
  6534. @item
  6535. Crop area with size 100x100 at position (12,34).
  6536. @example
  6537. crop=100:100:12:34
  6538. @end example
  6539. Using named options, the example above becomes:
  6540. @example
  6541. crop=w=100:h=100:x=12:y=34
  6542. @end example
  6543. @item
  6544. Crop the central input area with size 100x100:
  6545. @example
  6546. crop=100:100
  6547. @end example
  6548. @item
  6549. Crop the central input area with size 2/3 of the input video:
  6550. @example
  6551. crop=2/3*in_w:2/3*in_h
  6552. @end example
  6553. @item
  6554. Crop the input video central square:
  6555. @example
  6556. crop=out_w=in_h
  6557. crop=in_h
  6558. @end example
  6559. @item
  6560. Delimit the rectangle with the top-left corner placed at position
  6561. 100:100 and the right-bottom corner corresponding to the right-bottom
  6562. corner of the input image.
  6563. @example
  6564. crop=in_w-100:in_h-100:100:100
  6565. @end example
  6566. @item
  6567. Crop 10 pixels from the left and right borders, and 20 pixels from
  6568. the top and bottom borders
  6569. @example
  6570. crop=in_w-2*10:in_h-2*20
  6571. @end example
  6572. @item
  6573. Keep only the bottom right quarter of the input image:
  6574. @example
  6575. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6576. @end example
  6577. @item
  6578. Crop height for getting Greek harmony:
  6579. @example
  6580. crop=in_w:1/PHI*in_w
  6581. @end example
  6582. @item
  6583. Apply trembling effect:
  6584. @example
  6585. 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)
  6586. @end example
  6587. @item
  6588. Apply erratic camera effect depending on timestamp:
  6589. @example
  6590. 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)"
  6591. @end example
  6592. @item
  6593. Set x depending on the value of y:
  6594. @example
  6595. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6596. @end example
  6597. @end itemize
  6598. @subsection Commands
  6599. This filter supports the following commands:
  6600. @table @option
  6601. @item w, out_w
  6602. @item h, out_h
  6603. @item x
  6604. @item y
  6605. Set width/height of the output video and the horizontal/vertical position
  6606. in the input video.
  6607. The command accepts the same syntax of the corresponding option.
  6608. If the specified expression is not valid, it is kept at its current
  6609. value.
  6610. @end table
  6611. @section cropdetect
  6612. Auto-detect the crop size.
  6613. It calculates the necessary cropping parameters and prints the
  6614. recommended parameters via the logging system. The detected dimensions
  6615. correspond to the non-black area of the input video.
  6616. It accepts the following parameters:
  6617. @table @option
  6618. @item limit
  6619. Set higher black value threshold, which can be optionally specified
  6620. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6621. value greater to the set value is considered non-black. It defaults to 24.
  6622. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6623. on the bitdepth of the pixel format.
  6624. @item round
  6625. The value which the width/height should be divisible by. It defaults to
  6626. 16. The offset is automatically adjusted to center the video. Use 2 to
  6627. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6628. encoding to most video codecs.
  6629. @item reset_count, reset
  6630. Set the counter that determines after how many frames cropdetect will
  6631. reset the previously detected largest video area and start over to
  6632. detect the current optimal crop area. Default value is 0.
  6633. This can be useful when channel logos distort the video area. 0
  6634. indicates 'never reset', and returns the largest area encountered during
  6635. playback.
  6636. @end table
  6637. @anchor{cue}
  6638. @section cue
  6639. Delay video filtering until a given wallclock timestamp. The filter first
  6640. passes on @option{preroll} amount of frames, then it buffers at most
  6641. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6642. it forwards the buffered frames and also any subsequent frames coming in its
  6643. input.
  6644. The filter can be used synchronize the output of multiple ffmpeg processes for
  6645. realtime output devices like decklink. By putting the delay in the filtering
  6646. chain and pre-buffering frames the process can pass on data to output almost
  6647. immediately after the target wallclock timestamp is reached.
  6648. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6649. some use cases.
  6650. @table @option
  6651. @item cue
  6652. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6653. @item preroll
  6654. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6655. @item buffer
  6656. The maximum duration of content to buffer before waiting for the cue expressed
  6657. in seconds. Default is 0.
  6658. @end table
  6659. @anchor{curves}
  6660. @section curves
  6661. Apply color adjustments using curves.
  6662. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6663. component (red, green and blue) has its values defined by @var{N} key points
  6664. tied from each other using a smooth curve. The x-axis represents the pixel
  6665. values from the input frame, and the y-axis the new pixel values to be set for
  6666. the output frame.
  6667. By default, a component curve is defined by the two points @var{(0;0)} and
  6668. @var{(1;1)}. This creates a straight line where each original pixel value is
  6669. "adjusted" to its own value, which means no change to the image.
  6670. The filter allows you to redefine these two points and add some more. A new
  6671. curve (using a natural cubic spline interpolation) will be define to pass
  6672. smoothly through all these new coordinates. The new defined points needs to be
  6673. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6674. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6675. the vector spaces, the values will be clipped accordingly.
  6676. The filter accepts the following options:
  6677. @table @option
  6678. @item preset
  6679. Select one of the available color presets. This option can be used in addition
  6680. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6681. options takes priority on the preset values.
  6682. Available presets are:
  6683. @table @samp
  6684. @item none
  6685. @item color_negative
  6686. @item cross_process
  6687. @item darker
  6688. @item increase_contrast
  6689. @item lighter
  6690. @item linear_contrast
  6691. @item medium_contrast
  6692. @item negative
  6693. @item strong_contrast
  6694. @item vintage
  6695. @end table
  6696. Default is @code{none}.
  6697. @item master, m
  6698. Set the master key points. These points will define a second pass mapping. It
  6699. is sometimes called a "luminance" or "value" mapping. It can be used with
  6700. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6701. post-processing LUT.
  6702. @item red, r
  6703. Set the key points for the red component.
  6704. @item green, g
  6705. Set the key points for the green component.
  6706. @item blue, b
  6707. Set the key points for the blue component.
  6708. @item all
  6709. Set the key points for all components (not including master).
  6710. Can be used in addition to the other key points component
  6711. options. In this case, the unset component(s) will fallback on this
  6712. @option{all} setting.
  6713. @item psfile
  6714. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6715. @item plot
  6716. Save Gnuplot script of the curves in specified file.
  6717. @end table
  6718. To avoid some filtergraph syntax conflicts, each key points list need to be
  6719. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6720. @subsection Examples
  6721. @itemize
  6722. @item
  6723. Increase slightly the middle level of blue:
  6724. @example
  6725. curves=blue='0/0 0.5/0.58 1/1'
  6726. @end example
  6727. @item
  6728. Vintage effect:
  6729. @example
  6730. 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'
  6731. @end example
  6732. Here we obtain the following coordinates for each components:
  6733. @table @var
  6734. @item red
  6735. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6736. @item green
  6737. @code{(0;0) (0.50;0.48) (1;1)}
  6738. @item blue
  6739. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6740. @end table
  6741. @item
  6742. The previous example can also be achieved with the associated built-in preset:
  6743. @example
  6744. curves=preset=vintage
  6745. @end example
  6746. @item
  6747. Or simply:
  6748. @example
  6749. curves=vintage
  6750. @end example
  6751. @item
  6752. Use a Photoshop preset and redefine the points of the green component:
  6753. @example
  6754. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6755. @end example
  6756. @item
  6757. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6758. and @command{gnuplot}:
  6759. @example
  6760. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6761. gnuplot -p /tmp/curves.plt
  6762. @end example
  6763. @end itemize
  6764. @section datascope
  6765. Video data analysis filter.
  6766. This filter shows hexadecimal pixel values of part of video.
  6767. The filter accepts the following options:
  6768. @table @option
  6769. @item size, s
  6770. Set output video size.
  6771. @item x
  6772. Set x offset from where to pick pixels.
  6773. @item y
  6774. Set y offset from where to pick pixels.
  6775. @item mode
  6776. Set scope mode, can be one of the following:
  6777. @table @samp
  6778. @item mono
  6779. Draw hexadecimal pixel values with white color on black background.
  6780. @item color
  6781. Draw hexadecimal pixel values with input video pixel color on black
  6782. background.
  6783. @item color2
  6784. Draw hexadecimal pixel values on color background picked from input video,
  6785. the text color is picked in such way so its always visible.
  6786. @end table
  6787. @item axis
  6788. Draw rows and columns numbers on left and top of video.
  6789. @item opacity
  6790. Set background opacity.
  6791. @item format
  6792. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6793. @end table
  6794. @section dblur
  6795. Apply Directional blur filter.
  6796. The filter accepts the following options:
  6797. @table @option
  6798. @item angle
  6799. Set angle of directional blur. Default is @code{45}.
  6800. @item radius
  6801. Set radius of directional blur. Default is @code{5}.
  6802. @item planes
  6803. Set which planes to filter. By default all planes are filtered.
  6804. @end table
  6805. @subsection Commands
  6806. This filter supports same @ref{commands} as options.
  6807. The command accepts the same syntax of the corresponding option.
  6808. If the specified expression is not valid, it is kept at its current
  6809. value.
  6810. @section dctdnoiz
  6811. Denoise frames using 2D DCT (frequency domain filtering).
  6812. This filter is not designed for real time.
  6813. The filter accepts the following options:
  6814. @table @option
  6815. @item sigma, s
  6816. Set the noise sigma constant.
  6817. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6818. coefficient (absolute value) below this threshold with be dropped.
  6819. If you need a more advanced filtering, see @option{expr}.
  6820. Default is @code{0}.
  6821. @item overlap
  6822. Set number overlapping pixels for each block. Since the filter can be slow, you
  6823. may want to reduce this value, at the cost of a less effective filter and the
  6824. risk of various artefacts.
  6825. If the overlapping value doesn't permit processing the whole input width or
  6826. height, a warning will be displayed and according borders won't be denoised.
  6827. Default value is @var{blocksize}-1, which is the best possible setting.
  6828. @item expr, e
  6829. Set the coefficient factor expression.
  6830. For each coefficient of a DCT block, this expression will be evaluated as a
  6831. multiplier value for the coefficient.
  6832. If this is option is set, the @option{sigma} option will be ignored.
  6833. The absolute value of the coefficient can be accessed through the @var{c}
  6834. variable.
  6835. @item n
  6836. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6837. @var{blocksize}, which is the width and height of the processed blocks.
  6838. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6839. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6840. on the speed processing. Also, a larger block size does not necessarily means a
  6841. better de-noising.
  6842. @end table
  6843. @subsection Examples
  6844. Apply a denoise with a @option{sigma} of @code{4.5}:
  6845. @example
  6846. dctdnoiz=4.5
  6847. @end example
  6848. The same operation can be achieved using the expression system:
  6849. @example
  6850. dctdnoiz=e='gte(c, 4.5*3)'
  6851. @end example
  6852. Violent denoise using a block size of @code{16x16}:
  6853. @example
  6854. dctdnoiz=15:n=4
  6855. @end example
  6856. @section deband
  6857. Remove banding artifacts from input video.
  6858. It works by replacing banded pixels with average value of referenced pixels.
  6859. The filter accepts the following options:
  6860. @table @option
  6861. @item 1thr
  6862. @item 2thr
  6863. @item 3thr
  6864. @item 4thr
  6865. Set banding detection threshold for each plane. Default is 0.02.
  6866. Valid range is 0.00003 to 0.5.
  6867. If difference between current pixel and reference pixel is less than threshold,
  6868. it will be considered as banded.
  6869. @item range, r
  6870. Banding detection range in pixels. Default is 16. If positive, random number
  6871. in range 0 to set value will be used. If negative, exact absolute value
  6872. will be used.
  6873. The range defines square of four pixels around current pixel.
  6874. @item direction, d
  6875. Set direction in radians from which four pixel will be compared. If positive,
  6876. random direction from 0 to set direction will be picked. If negative, exact of
  6877. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6878. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6879. column.
  6880. @item blur, b
  6881. If enabled, current pixel is compared with average value of all four
  6882. surrounding pixels. The default is enabled. If disabled current pixel is
  6883. compared with all four surrounding pixels. The pixel is considered banded
  6884. if only all four differences with surrounding pixels are less than threshold.
  6885. @item coupling, c
  6886. If enabled, current pixel is changed if and only if all pixel components are banded,
  6887. e.g. banding detection threshold is triggered for all color components.
  6888. The default is disabled.
  6889. @end table
  6890. @section deblock
  6891. Remove blocking artifacts from input video.
  6892. The filter accepts the following options:
  6893. @table @option
  6894. @item filter
  6895. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6896. This controls what kind of deblocking is applied.
  6897. @item block
  6898. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6899. @item alpha
  6900. @item beta
  6901. @item gamma
  6902. @item delta
  6903. Set blocking detection thresholds. Allowed range is 0 to 1.
  6904. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6905. Using higher threshold gives more deblocking strength.
  6906. Setting @var{alpha} controls threshold detection at exact edge of block.
  6907. Remaining options controls threshold detection near the edge. Each one for
  6908. below/above or left/right. Setting any of those to @var{0} disables
  6909. deblocking.
  6910. @item planes
  6911. Set planes to filter. Default is to filter all available planes.
  6912. @end table
  6913. @subsection Examples
  6914. @itemize
  6915. @item
  6916. Deblock using weak filter and block size of 4 pixels.
  6917. @example
  6918. deblock=filter=weak:block=4
  6919. @end example
  6920. @item
  6921. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6922. deblocking more edges.
  6923. @example
  6924. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6925. @end example
  6926. @item
  6927. Similar as above, but filter only first plane.
  6928. @example
  6929. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6930. @end example
  6931. @item
  6932. Similar as above, but filter only second and third plane.
  6933. @example
  6934. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6935. @end example
  6936. @end itemize
  6937. @anchor{decimate}
  6938. @section decimate
  6939. Drop duplicated frames at regular intervals.
  6940. The filter accepts the following options:
  6941. @table @option
  6942. @item cycle
  6943. Set the number of frames from which one will be dropped. Setting this to
  6944. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6945. Default is @code{5}.
  6946. @item dupthresh
  6947. Set the threshold for duplicate detection. If the difference metric for a frame
  6948. is less than or equal to this value, then it is declared as duplicate. Default
  6949. is @code{1.1}
  6950. @item scthresh
  6951. Set scene change threshold. Default is @code{15}.
  6952. @item blockx
  6953. @item blocky
  6954. Set the size of the x and y-axis blocks used during metric calculations.
  6955. Larger blocks give better noise suppression, but also give worse detection of
  6956. small movements. Must be a power of two. Default is @code{32}.
  6957. @item ppsrc
  6958. Mark main input as a pre-processed input and activate clean source input
  6959. stream. This allows the input to be pre-processed with various filters to help
  6960. the metrics calculation while keeping the frame selection lossless. When set to
  6961. @code{1}, the first stream is for the pre-processed input, and the second
  6962. stream is the clean source from where the kept frames are chosen. Default is
  6963. @code{0}.
  6964. @item chroma
  6965. Set whether or not chroma is considered in the metric calculations. Default is
  6966. @code{1}.
  6967. @end table
  6968. @section deconvolve
  6969. Apply 2D deconvolution of video stream in frequency domain using second stream
  6970. as impulse.
  6971. The filter accepts the following options:
  6972. @table @option
  6973. @item planes
  6974. Set which planes to process.
  6975. @item impulse
  6976. Set which impulse video frames will be processed, can be @var{first}
  6977. or @var{all}. Default is @var{all}.
  6978. @item noise
  6979. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6980. and height are not same and not power of 2 or if stream prior to convolving
  6981. had noise.
  6982. @end table
  6983. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6984. @section dedot
  6985. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6986. It accepts the following options:
  6987. @table @option
  6988. @item m
  6989. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6990. @var{rainbows} for cross-color reduction.
  6991. @item lt
  6992. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6993. @item tl
  6994. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6995. @item tc
  6996. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6997. @item ct
  6998. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6999. @end table
  7000. @section deflate
  7001. Apply deflate effect to the video.
  7002. This filter replaces the pixel by the local(3x3) average by taking into account
  7003. only values lower than the pixel.
  7004. It accepts the following options:
  7005. @table @option
  7006. @item threshold0
  7007. @item threshold1
  7008. @item threshold2
  7009. @item threshold3
  7010. Limit the maximum change for each plane, default is 65535.
  7011. If 0, plane will remain unchanged.
  7012. @end table
  7013. @subsection Commands
  7014. This filter supports the all above options as @ref{commands}.
  7015. @section deflicker
  7016. Remove temporal frame luminance variations.
  7017. It accepts the following options:
  7018. @table @option
  7019. @item size, s
  7020. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7021. @item mode, m
  7022. Set averaging mode to smooth temporal luminance variations.
  7023. Available values are:
  7024. @table @samp
  7025. @item am
  7026. Arithmetic mean
  7027. @item gm
  7028. Geometric mean
  7029. @item hm
  7030. Harmonic mean
  7031. @item qm
  7032. Quadratic mean
  7033. @item cm
  7034. Cubic mean
  7035. @item pm
  7036. Power mean
  7037. @item median
  7038. Median
  7039. @end table
  7040. @item bypass
  7041. Do not actually modify frame. Useful when one only wants metadata.
  7042. @end table
  7043. @section dejudder
  7044. Remove judder produced by partially interlaced telecined content.
  7045. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7046. source was partially telecined content then the output of @code{pullup,dejudder}
  7047. will have a variable frame rate. May change the recorded frame rate of the
  7048. container. Aside from that change, this filter will not affect constant frame
  7049. rate video.
  7050. The option available in this filter is:
  7051. @table @option
  7052. @item cycle
  7053. Specify the length of the window over which the judder repeats.
  7054. Accepts any integer greater than 1. Useful values are:
  7055. @table @samp
  7056. @item 4
  7057. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7058. @item 5
  7059. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7060. @item 20
  7061. If a mixture of the two.
  7062. @end table
  7063. The default is @samp{4}.
  7064. @end table
  7065. @section delogo
  7066. Suppress a TV station logo by a simple interpolation of the surrounding
  7067. pixels. Just set a rectangle covering the logo and watch it disappear
  7068. (and sometimes something even uglier appear - your mileage may vary).
  7069. It accepts the following parameters:
  7070. @table @option
  7071. @item x
  7072. @item y
  7073. Specify the top left corner coordinates of the logo. They must be
  7074. specified.
  7075. @item w
  7076. @item h
  7077. Specify the width and height of the logo to clear. They must be
  7078. specified.
  7079. @item band, t
  7080. Specify the thickness of the fuzzy edge of the rectangle (added to
  7081. @var{w} and @var{h}). The default value is 1. This option is
  7082. deprecated, setting higher values should no longer be necessary and
  7083. is not recommended.
  7084. @item show
  7085. When set to 1, a green rectangle is drawn on the screen to simplify
  7086. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7087. The default value is 0.
  7088. The rectangle is drawn on the outermost pixels which will be (partly)
  7089. replaced with interpolated values. The values of the next pixels
  7090. immediately outside this rectangle in each direction will be used to
  7091. compute the interpolated pixel values inside the rectangle.
  7092. @end table
  7093. @subsection Examples
  7094. @itemize
  7095. @item
  7096. Set a rectangle covering the area with top left corner coordinates 0,0
  7097. and size 100x77, and a band of size 10:
  7098. @example
  7099. delogo=x=0:y=0:w=100:h=77:band=10
  7100. @end example
  7101. @end itemize
  7102. @anchor{derain}
  7103. @section derain
  7104. Remove the rain in the input image/video by applying the derain methods based on
  7105. convolutional neural networks. Supported models:
  7106. @itemize
  7107. @item
  7108. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7109. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7110. @end itemize
  7111. Training as well as model generation scripts are provided in
  7112. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7113. Native model files (.model) can be generated from TensorFlow model
  7114. files (.pb) by using tools/python/convert.py
  7115. The filter accepts the following options:
  7116. @table @option
  7117. @item filter_type
  7118. Specify which filter to use. This option accepts the following values:
  7119. @table @samp
  7120. @item derain
  7121. Derain filter. To conduct derain filter, you need to use a derain model.
  7122. @item dehaze
  7123. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7124. @end table
  7125. Default value is @samp{derain}.
  7126. @item dnn_backend
  7127. Specify which DNN backend to use for model loading and execution. This option accepts
  7128. the following values:
  7129. @table @samp
  7130. @item native
  7131. Native implementation of DNN loading and execution.
  7132. @item tensorflow
  7133. TensorFlow backend. To enable this backend you
  7134. need to install the TensorFlow for C library (see
  7135. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7136. @code{--enable-libtensorflow}
  7137. @end table
  7138. Default value is @samp{native}.
  7139. @item model
  7140. Set path to model file specifying network architecture and its parameters.
  7141. Note that different backends use different file formats. TensorFlow and native
  7142. backend can load files for only its format.
  7143. @end table
  7144. It can also be finished with @ref{dnn_processing} filter.
  7145. @section deshake
  7146. Attempt to fix small changes in horizontal and/or vertical shift. This
  7147. filter helps remove camera shake from hand-holding a camera, bumping a
  7148. tripod, moving on a vehicle, etc.
  7149. The filter accepts the following options:
  7150. @table @option
  7151. @item x
  7152. @item y
  7153. @item w
  7154. @item h
  7155. Specify a rectangular area where to limit the search for motion
  7156. vectors.
  7157. If desired the search for motion vectors can be limited to a
  7158. rectangular area of the frame defined by its top left corner, width
  7159. and height. These parameters have the same meaning as the drawbox
  7160. filter which can be used to visualise the position of the bounding
  7161. box.
  7162. This is useful when simultaneous movement of subjects within the frame
  7163. might be confused for camera motion by the motion vector search.
  7164. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7165. then the full frame is used. This allows later options to be set
  7166. without specifying the bounding box for the motion vector search.
  7167. Default - search the whole frame.
  7168. @item rx
  7169. @item ry
  7170. Specify the maximum extent of movement in x and y directions in the
  7171. range 0-64 pixels. Default 16.
  7172. @item edge
  7173. Specify how to generate pixels to fill blanks at the edge of the
  7174. frame. Available values are:
  7175. @table @samp
  7176. @item blank, 0
  7177. Fill zeroes at blank locations
  7178. @item original, 1
  7179. Original image at blank locations
  7180. @item clamp, 2
  7181. Extruded edge value at blank locations
  7182. @item mirror, 3
  7183. Mirrored edge at blank locations
  7184. @end table
  7185. Default value is @samp{mirror}.
  7186. @item blocksize
  7187. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7188. default 8.
  7189. @item contrast
  7190. Specify the contrast threshold for blocks. Only blocks with more than
  7191. the specified contrast (difference between darkest and lightest
  7192. pixels) will be considered. Range 1-255, default 125.
  7193. @item search
  7194. Specify the search strategy. Available values are:
  7195. @table @samp
  7196. @item exhaustive, 0
  7197. Set exhaustive search
  7198. @item less, 1
  7199. Set less exhaustive search.
  7200. @end table
  7201. Default value is @samp{exhaustive}.
  7202. @item filename
  7203. If set then a detailed log of the motion search is written to the
  7204. specified file.
  7205. @end table
  7206. @section despill
  7207. Remove unwanted contamination of foreground colors, caused by reflected color of
  7208. greenscreen or bluescreen.
  7209. This filter accepts the following options:
  7210. @table @option
  7211. @item type
  7212. Set what type of despill to use.
  7213. @item mix
  7214. Set how spillmap will be generated.
  7215. @item expand
  7216. Set how much to get rid of still remaining spill.
  7217. @item red
  7218. Controls amount of red in spill area.
  7219. @item green
  7220. Controls amount of green in spill area.
  7221. Should be -1 for greenscreen.
  7222. @item blue
  7223. Controls amount of blue in spill area.
  7224. Should be -1 for bluescreen.
  7225. @item brightness
  7226. Controls brightness of spill area, preserving colors.
  7227. @item alpha
  7228. Modify alpha from generated spillmap.
  7229. @end table
  7230. @subsection Commands
  7231. This filter supports the all above options as @ref{commands}.
  7232. @section detelecine
  7233. Apply an exact inverse of the telecine operation. It requires a predefined
  7234. pattern specified using the pattern option which must be the same as that passed
  7235. to the telecine filter.
  7236. This filter accepts the following options:
  7237. @table @option
  7238. @item first_field
  7239. @table @samp
  7240. @item top, t
  7241. top field first
  7242. @item bottom, b
  7243. bottom field first
  7244. The default value is @code{top}.
  7245. @end table
  7246. @item pattern
  7247. A string of numbers representing the pulldown pattern you wish to apply.
  7248. The default value is @code{23}.
  7249. @item start_frame
  7250. A number representing position of the first frame with respect to the telecine
  7251. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7252. @end table
  7253. @section dilation
  7254. Apply dilation effect to the video.
  7255. This filter replaces the pixel by the local(3x3) maximum.
  7256. It accepts the following options:
  7257. @table @option
  7258. @item threshold0
  7259. @item threshold1
  7260. @item threshold2
  7261. @item threshold3
  7262. Limit the maximum change for each plane, default is 65535.
  7263. If 0, plane will remain unchanged.
  7264. @item coordinates
  7265. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7266. pixels are used.
  7267. Flags to local 3x3 coordinates maps like this:
  7268. 1 2 3
  7269. 4 5
  7270. 6 7 8
  7271. @end table
  7272. @subsection Commands
  7273. This filter supports the all above options as @ref{commands}.
  7274. @section displace
  7275. Displace pixels as indicated by second and third input stream.
  7276. It takes three input streams and outputs one stream, the first input is the
  7277. source, and second and third input are displacement maps.
  7278. The second input specifies how much to displace pixels along the
  7279. x-axis, while the third input specifies how much to displace pixels
  7280. along the y-axis.
  7281. If one of displacement map streams terminates, last frame from that
  7282. displacement map will be used.
  7283. Note that once generated, displacements maps can be reused over and over again.
  7284. A description of the accepted options follows.
  7285. @table @option
  7286. @item edge
  7287. Set displace behavior for pixels that are out of range.
  7288. Available values are:
  7289. @table @samp
  7290. @item blank
  7291. Missing pixels are replaced by black pixels.
  7292. @item smear
  7293. Adjacent pixels will spread out to replace missing pixels.
  7294. @item wrap
  7295. Out of range pixels are wrapped so they point to pixels of other side.
  7296. @item mirror
  7297. Out of range pixels will be replaced with mirrored pixels.
  7298. @end table
  7299. Default is @samp{smear}.
  7300. @end table
  7301. @subsection Examples
  7302. @itemize
  7303. @item
  7304. Add ripple effect to rgb input of video size hd720:
  7305. @example
  7306. 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
  7307. @end example
  7308. @item
  7309. Add wave effect to rgb input of video size hd720:
  7310. @example
  7311. 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
  7312. @end example
  7313. @end itemize
  7314. @anchor{dnn_processing}
  7315. @section dnn_processing
  7316. Do image processing with deep neural networks. It works together with another filter
  7317. which converts the pixel format of the Frame to what the dnn network requires.
  7318. The filter accepts the following options:
  7319. @table @option
  7320. @item dnn_backend
  7321. Specify which DNN backend to use for model loading and execution. This option accepts
  7322. the following values:
  7323. @table @samp
  7324. @item native
  7325. Native implementation of DNN loading and execution.
  7326. @item tensorflow
  7327. TensorFlow backend. To enable this backend you
  7328. need to install the TensorFlow for C library (see
  7329. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7330. @code{--enable-libtensorflow}
  7331. @item openvino
  7332. OpenVINO backend. To enable this backend you
  7333. need to build and install the OpenVINO for C library (see
  7334. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7335. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7336. be needed if the header files and libraries are not installed into system path)
  7337. @end table
  7338. Default value is @samp{native}.
  7339. @item model
  7340. Set path to model file specifying network architecture and its parameters.
  7341. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7342. backend can load files for only its format.
  7343. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7344. @item input
  7345. Set the input name of the dnn network.
  7346. @item output
  7347. Set the output name of the dnn network.
  7348. @end table
  7349. @subsection Examples
  7350. @itemize
  7351. @item
  7352. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7353. @example
  7354. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7355. @end example
  7356. @item
  7357. Halve the pixel value of the frame with format gray32f:
  7358. @example
  7359. 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
  7360. @end example
  7361. @item
  7362. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7363. @example
  7364. ./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
  7365. @end example
  7366. @item
  7367. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7368. @example
  7369. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7370. @end example
  7371. @end itemize
  7372. @section drawbox
  7373. Draw a colored box on the input image.
  7374. It accepts the following parameters:
  7375. @table @option
  7376. @item x
  7377. @item y
  7378. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7379. @item width, w
  7380. @item height, h
  7381. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7382. the input width and height. It defaults to 0.
  7383. @item color, c
  7384. Specify the color of the box to write. For the general syntax of this option,
  7385. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7386. value @code{invert} is used, the box edge color is the same as the
  7387. video with inverted luma.
  7388. @item thickness, t
  7389. The expression which sets the thickness of the box edge.
  7390. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7391. See below for the list of accepted constants.
  7392. @item replace
  7393. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7394. will overwrite the video's color and alpha pixels.
  7395. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7396. @end table
  7397. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7398. following constants:
  7399. @table @option
  7400. @item dar
  7401. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7402. @item hsub
  7403. @item vsub
  7404. horizontal and vertical chroma subsample values. For example for the
  7405. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7406. @item in_h, ih
  7407. @item in_w, iw
  7408. The input width and height.
  7409. @item sar
  7410. The input sample aspect ratio.
  7411. @item x
  7412. @item y
  7413. The x and y offset coordinates where the box is drawn.
  7414. @item w
  7415. @item h
  7416. The width and height of the drawn box.
  7417. @item t
  7418. The thickness of the drawn box.
  7419. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7420. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7421. @end table
  7422. @subsection Examples
  7423. @itemize
  7424. @item
  7425. Draw a black box around the edge of the input image:
  7426. @example
  7427. drawbox
  7428. @end example
  7429. @item
  7430. Draw a box with color red and an opacity of 50%:
  7431. @example
  7432. drawbox=10:20:200:60:red@@0.5
  7433. @end example
  7434. The previous example can be specified as:
  7435. @example
  7436. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7437. @end example
  7438. @item
  7439. Fill the box with pink color:
  7440. @example
  7441. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7442. @end example
  7443. @item
  7444. Draw a 2-pixel red 2.40:1 mask:
  7445. @example
  7446. 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
  7447. @end example
  7448. @end itemize
  7449. @subsection Commands
  7450. This filter supports same commands as options.
  7451. The command accepts the same syntax of the corresponding option.
  7452. If the specified expression is not valid, it is kept at its current
  7453. value.
  7454. @anchor{drawgraph}
  7455. @section drawgraph
  7456. Draw a graph using input video metadata.
  7457. It accepts the following parameters:
  7458. @table @option
  7459. @item m1
  7460. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7461. @item fg1
  7462. Set 1st foreground color expression.
  7463. @item m2
  7464. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7465. @item fg2
  7466. Set 2nd foreground color expression.
  7467. @item m3
  7468. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7469. @item fg3
  7470. Set 3rd foreground color expression.
  7471. @item m4
  7472. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7473. @item fg4
  7474. Set 4th foreground color expression.
  7475. @item min
  7476. Set minimal value of metadata value.
  7477. @item max
  7478. Set maximal value of metadata value.
  7479. @item bg
  7480. Set graph background color. Default is white.
  7481. @item mode
  7482. Set graph mode.
  7483. Available values for mode is:
  7484. @table @samp
  7485. @item bar
  7486. @item dot
  7487. @item line
  7488. @end table
  7489. Default is @code{line}.
  7490. @item slide
  7491. Set slide mode.
  7492. Available values for slide is:
  7493. @table @samp
  7494. @item frame
  7495. Draw new frame when right border is reached.
  7496. @item replace
  7497. Replace old columns with new ones.
  7498. @item scroll
  7499. Scroll from right to left.
  7500. @item rscroll
  7501. Scroll from left to right.
  7502. @item picture
  7503. Draw single picture.
  7504. @end table
  7505. Default is @code{frame}.
  7506. @item size
  7507. Set size of graph video. For the syntax of this option, check the
  7508. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7509. The default value is @code{900x256}.
  7510. @item rate, r
  7511. Set the output frame rate. Default value is @code{25}.
  7512. The foreground color expressions can use the following variables:
  7513. @table @option
  7514. @item MIN
  7515. Minimal value of metadata value.
  7516. @item MAX
  7517. Maximal value of metadata value.
  7518. @item VAL
  7519. Current metadata key value.
  7520. @end table
  7521. The color is defined as 0xAABBGGRR.
  7522. @end table
  7523. Example using metadata from @ref{signalstats} filter:
  7524. @example
  7525. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7526. @end example
  7527. Example using metadata from @ref{ebur128} filter:
  7528. @example
  7529. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7530. @end example
  7531. @section drawgrid
  7532. Draw a grid on the input image.
  7533. It accepts the following parameters:
  7534. @table @option
  7535. @item x
  7536. @item y
  7537. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7538. @item width, w
  7539. @item height, h
  7540. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7541. input width and height, respectively, minus @code{thickness}, so image gets
  7542. framed. Default to 0.
  7543. @item color, c
  7544. Specify the color of the grid. For the general syntax of this option,
  7545. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7546. value @code{invert} is used, the grid color is the same as the
  7547. video with inverted luma.
  7548. @item thickness, t
  7549. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7550. See below for the list of accepted constants.
  7551. @item replace
  7552. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7553. will overwrite the video's color and alpha pixels.
  7554. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7555. @end table
  7556. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7557. following constants:
  7558. @table @option
  7559. @item dar
  7560. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7561. @item hsub
  7562. @item vsub
  7563. horizontal and vertical chroma subsample values. For example for the
  7564. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7565. @item in_h, ih
  7566. @item in_w, iw
  7567. The input grid cell width and height.
  7568. @item sar
  7569. The input sample aspect ratio.
  7570. @item x
  7571. @item y
  7572. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7573. @item w
  7574. @item h
  7575. The width and height of the drawn cell.
  7576. @item t
  7577. The thickness of the drawn cell.
  7578. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7579. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7580. @end table
  7581. @subsection Examples
  7582. @itemize
  7583. @item
  7584. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7585. @example
  7586. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7587. @end example
  7588. @item
  7589. Draw a white 3x3 grid with an opacity of 50%:
  7590. @example
  7591. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7592. @end example
  7593. @end itemize
  7594. @subsection Commands
  7595. This filter supports same commands as options.
  7596. The command accepts the same syntax of the corresponding option.
  7597. If the specified expression is not valid, it is kept at its current
  7598. value.
  7599. @anchor{drawtext}
  7600. @section drawtext
  7601. Draw a text string or text from a specified file on top of a video, using the
  7602. libfreetype library.
  7603. To enable compilation of this filter, you need to configure FFmpeg with
  7604. @code{--enable-libfreetype}.
  7605. To enable default font fallback and the @var{font} option you need to
  7606. configure FFmpeg with @code{--enable-libfontconfig}.
  7607. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7608. @code{--enable-libfribidi}.
  7609. @subsection Syntax
  7610. It accepts the following parameters:
  7611. @table @option
  7612. @item box
  7613. Used to draw a box around text using the background color.
  7614. The value must be either 1 (enable) or 0 (disable).
  7615. The default value of @var{box} is 0.
  7616. @item boxborderw
  7617. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7618. The default value of @var{boxborderw} is 0.
  7619. @item boxcolor
  7620. The color to be used for drawing box around text. For the syntax of this
  7621. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7622. The default value of @var{boxcolor} is "white".
  7623. @item line_spacing
  7624. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7625. The default value of @var{line_spacing} is 0.
  7626. @item borderw
  7627. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7628. The default value of @var{borderw} is 0.
  7629. @item bordercolor
  7630. Set the color to be used for drawing border around text. For the syntax of this
  7631. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7632. The default value of @var{bordercolor} is "black".
  7633. @item expansion
  7634. Select how the @var{text} is expanded. Can be either @code{none},
  7635. @code{strftime} (deprecated) or
  7636. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7637. below for details.
  7638. @item basetime
  7639. Set a start time for the count. Value is in microseconds. Only applied
  7640. in the deprecated strftime expansion mode. To emulate in normal expansion
  7641. mode use the @code{pts} function, supplying the start time (in seconds)
  7642. as the second argument.
  7643. @item fix_bounds
  7644. If true, check and fix text coords to avoid clipping.
  7645. @item fontcolor
  7646. The color to be used for drawing fonts. For the syntax of this option, check
  7647. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7648. The default value of @var{fontcolor} is "black".
  7649. @item fontcolor_expr
  7650. String which is expanded the same way as @var{text} to obtain dynamic
  7651. @var{fontcolor} value. By default this option has empty value and is not
  7652. processed. When this option is set, it overrides @var{fontcolor} option.
  7653. @item font
  7654. The font family to be used for drawing text. By default Sans.
  7655. @item fontfile
  7656. The font file to be used for drawing text. The path must be included.
  7657. This parameter is mandatory if the fontconfig support is disabled.
  7658. @item alpha
  7659. Draw the text applying alpha blending. The value can
  7660. be a number between 0.0 and 1.0.
  7661. The expression accepts the same variables @var{x, y} as well.
  7662. The default value is 1.
  7663. Please see @var{fontcolor_expr}.
  7664. @item fontsize
  7665. The font size to be used for drawing text.
  7666. The default value of @var{fontsize} is 16.
  7667. @item text_shaping
  7668. If set to 1, attempt to shape the text (for example, reverse the order of
  7669. right-to-left text and join Arabic characters) before drawing it.
  7670. Otherwise, just draw the text exactly as given.
  7671. By default 1 (if supported).
  7672. @item ft_load_flags
  7673. The flags to be used for loading the fonts.
  7674. The flags map the corresponding flags supported by libfreetype, and are
  7675. a combination of the following values:
  7676. @table @var
  7677. @item default
  7678. @item no_scale
  7679. @item no_hinting
  7680. @item render
  7681. @item no_bitmap
  7682. @item vertical_layout
  7683. @item force_autohint
  7684. @item crop_bitmap
  7685. @item pedantic
  7686. @item ignore_global_advance_width
  7687. @item no_recurse
  7688. @item ignore_transform
  7689. @item monochrome
  7690. @item linear_design
  7691. @item no_autohint
  7692. @end table
  7693. Default value is "default".
  7694. For more information consult the documentation for the FT_LOAD_*
  7695. libfreetype flags.
  7696. @item shadowcolor
  7697. The color to be used for drawing a shadow behind the drawn text. For the
  7698. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7699. ffmpeg-utils manual,ffmpeg-utils}.
  7700. The default value of @var{shadowcolor} is "black".
  7701. @item shadowx
  7702. @item shadowy
  7703. The x and y offsets for the text shadow position with respect to the
  7704. position of the text. They can be either positive or negative
  7705. values. The default value for both is "0".
  7706. @item start_number
  7707. The starting frame number for the n/frame_num variable. The default value
  7708. is "0".
  7709. @item tabsize
  7710. The size in number of spaces to use for rendering the tab.
  7711. Default value is 4.
  7712. @item timecode
  7713. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7714. format. It can be used with or without text parameter. @var{timecode_rate}
  7715. option must be specified.
  7716. @item timecode_rate, rate, r
  7717. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7718. integer. Minimum value is "1".
  7719. Drop-frame timecode is supported for frame rates 30 & 60.
  7720. @item tc24hmax
  7721. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7722. Default is 0 (disabled).
  7723. @item text
  7724. The text string to be drawn. The text must be a sequence of UTF-8
  7725. encoded characters.
  7726. This parameter is mandatory if no file is specified with the parameter
  7727. @var{textfile}.
  7728. @item textfile
  7729. A text file containing text to be drawn. The text must be a sequence
  7730. of UTF-8 encoded characters.
  7731. This parameter is mandatory if no text string is specified with the
  7732. parameter @var{text}.
  7733. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7734. @item reload
  7735. If set to 1, the @var{textfile} will be reloaded before each frame.
  7736. Be sure to update it atomically, or it may be read partially, or even fail.
  7737. @item x
  7738. @item y
  7739. The expressions which specify the offsets where text will be drawn
  7740. within the video frame. They are relative to the top/left border of the
  7741. output image.
  7742. The default value of @var{x} and @var{y} is "0".
  7743. See below for the list of accepted constants and functions.
  7744. @end table
  7745. The parameters for @var{x} and @var{y} are expressions containing the
  7746. following constants and functions:
  7747. @table @option
  7748. @item dar
  7749. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7750. @item hsub
  7751. @item vsub
  7752. horizontal and vertical chroma subsample values. For example for the
  7753. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7754. @item line_h, lh
  7755. the height of each text line
  7756. @item main_h, h, H
  7757. the input height
  7758. @item main_w, w, W
  7759. the input width
  7760. @item max_glyph_a, ascent
  7761. the maximum distance from the baseline to the highest/upper grid
  7762. coordinate used to place a glyph outline point, for all the rendered
  7763. glyphs.
  7764. It is a positive value, due to the grid's orientation with the Y axis
  7765. upwards.
  7766. @item max_glyph_d, descent
  7767. the maximum distance from the baseline to the lowest grid coordinate
  7768. used to place a glyph outline point, for all the rendered glyphs.
  7769. This is a negative value, due to the grid's orientation, with the Y axis
  7770. upwards.
  7771. @item max_glyph_h
  7772. maximum glyph height, that is the maximum height for all the glyphs
  7773. contained in the rendered text, it is equivalent to @var{ascent} -
  7774. @var{descent}.
  7775. @item max_glyph_w
  7776. maximum glyph width, that is the maximum width for all the glyphs
  7777. contained in the rendered text
  7778. @item n
  7779. the number of input frame, starting from 0
  7780. @item rand(min, max)
  7781. return a random number included between @var{min} and @var{max}
  7782. @item sar
  7783. The input sample aspect ratio.
  7784. @item t
  7785. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7786. @item text_h, th
  7787. the height of the rendered text
  7788. @item text_w, tw
  7789. the width of the rendered text
  7790. @item x
  7791. @item y
  7792. the x and y offset coordinates where the text is drawn.
  7793. These parameters allow the @var{x} and @var{y} expressions to refer
  7794. to each other, so you can for example specify @code{y=x/dar}.
  7795. @item pict_type
  7796. A one character description of the current frame's picture type.
  7797. @item pkt_pos
  7798. The current packet's position in the input file or stream
  7799. (in bytes, from the start of the input). A value of -1 indicates
  7800. this info is not available.
  7801. @item pkt_duration
  7802. The current packet's duration, in seconds.
  7803. @item pkt_size
  7804. The current packet's size (in bytes).
  7805. @end table
  7806. @anchor{drawtext_expansion}
  7807. @subsection Text expansion
  7808. If @option{expansion} is set to @code{strftime},
  7809. the filter recognizes strftime() sequences in the provided text and
  7810. expands them accordingly. Check the documentation of strftime(). This
  7811. feature is deprecated.
  7812. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7813. If @option{expansion} is set to @code{normal} (which is the default),
  7814. the following expansion mechanism is used.
  7815. The backslash character @samp{\}, followed by any character, always expands to
  7816. the second character.
  7817. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7818. braces is a function name, possibly followed by arguments separated by ':'.
  7819. If the arguments contain special characters or delimiters (':' or '@}'),
  7820. they should be escaped.
  7821. Note that they probably must also be escaped as the value for the
  7822. @option{text} option in the filter argument string and as the filter
  7823. argument in the filtergraph description, and possibly also for the shell,
  7824. that makes up to four levels of escaping; using a text file avoids these
  7825. problems.
  7826. The following functions are available:
  7827. @table @command
  7828. @item expr, e
  7829. The expression evaluation result.
  7830. It must take one argument specifying the expression to be evaluated,
  7831. which accepts the same constants and functions as the @var{x} and
  7832. @var{y} values. Note that not all constants should be used, for
  7833. example the text size is not known when evaluating the expression, so
  7834. the constants @var{text_w} and @var{text_h} will have an undefined
  7835. value.
  7836. @item expr_int_format, eif
  7837. Evaluate the expression's value and output as formatted integer.
  7838. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7839. The second argument specifies the output format. Allowed values are @samp{x},
  7840. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7841. @code{printf} function.
  7842. The third parameter is optional and sets the number of positions taken by the output.
  7843. It can be used to add padding with zeros from the left.
  7844. @item gmtime
  7845. The time at which the filter is running, expressed in UTC.
  7846. It can accept an argument: a strftime() format string.
  7847. @item localtime
  7848. The time at which the filter is running, expressed in the local time zone.
  7849. It can accept an argument: a strftime() format string.
  7850. @item metadata
  7851. Frame metadata. Takes one or two arguments.
  7852. The first argument is mandatory and specifies the metadata key.
  7853. The second argument is optional and specifies a default value, used when the
  7854. metadata key is not found or empty.
  7855. Available metadata can be identified by inspecting entries
  7856. starting with TAG included within each frame section
  7857. printed by running @code{ffprobe -show_frames}.
  7858. String metadata generated in filters leading to
  7859. the drawtext filter are also available.
  7860. @item n, frame_num
  7861. The frame number, starting from 0.
  7862. @item pict_type
  7863. A one character description of the current picture type.
  7864. @item pts
  7865. The timestamp of the current frame.
  7866. It can take up to three arguments.
  7867. The first argument is the format of the timestamp; it defaults to @code{flt}
  7868. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7869. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7870. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7871. @code{localtime} stands for the timestamp of the frame formatted as
  7872. local time zone time.
  7873. The second argument is an offset added to the timestamp.
  7874. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7875. supplied to present the hour part of the formatted timestamp in 24h format
  7876. (00-23).
  7877. If the format is set to @code{localtime} or @code{gmtime},
  7878. a third argument may be supplied: a strftime() format string.
  7879. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7880. @end table
  7881. @subsection Commands
  7882. This filter supports altering parameters via commands:
  7883. @table @option
  7884. @item reinit
  7885. Alter existing filter parameters.
  7886. Syntax for the argument is the same as for filter invocation, e.g.
  7887. @example
  7888. fontsize=56:fontcolor=green:text='Hello World'
  7889. @end example
  7890. Full filter invocation with sendcmd would look like this:
  7891. @example
  7892. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7893. @end example
  7894. @end table
  7895. If the entire argument can't be parsed or applied as valid values then the filter will
  7896. continue with its existing parameters.
  7897. @subsection Examples
  7898. @itemize
  7899. @item
  7900. Draw "Test Text" with font FreeSerif, using the default values for the
  7901. optional parameters.
  7902. @example
  7903. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7904. @end example
  7905. @item
  7906. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7907. and y=50 (counting from the top-left corner of the screen), text is
  7908. yellow with a red box around it. Both the text and the box have an
  7909. opacity of 20%.
  7910. @example
  7911. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7912. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7913. @end example
  7914. Note that the double quotes are not necessary if spaces are not used
  7915. within the parameter list.
  7916. @item
  7917. Show the text at the center of the video frame:
  7918. @example
  7919. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7920. @end example
  7921. @item
  7922. Show the text at a random position, switching to a new position every 30 seconds:
  7923. @example
  7924. 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)"
  7925. @end example
  7926. @item
  7927. Show a text line sliding from right to left in the last row of the video
  7928. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7929. with no newlines.
  7930. @example
  7931. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7932. @end example
  7933. @item
  7934. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7935. @example
  7936. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7937. @end example
  7938. @item
  7939. Draw a single green letter "g", at the center of the input video.
  7940. The glyph baseline is placed at half screen height.
  7941. @example
  7942. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7943. @end example
  7944. @item
  7945. Show text for 1 second every 3 seconds:
  7946. @example
  7947. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7948. @end example
  7949. @item
  7950. Use fontconfig to set the font. Note that the colons need to be escaped.
  7951. @example
  7952. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7953. @end example
  7954. @item
  7955. Draw "Test Text" with font size dependent on height of the video.
  7956. @example
  7957. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  7958. @end example
  7959. @item
  7960. Print the date of a real-time encoding (see strftime(3)):
  7961. @example
  7962. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7963. @end example
  7964. @item
  7965. Show text fading in and out (appearing/disappearing):
  7966. @example
  7967. #!/bin/sh
  7968. DS=1.0 # display start
  7969. DE=10.0 # display end
  7970. FID=1.5 # fade in duration
  7971. FOD=5 # fade out duration
  7972. 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 @}"
  7973. @end example
  7974. @item
  7975. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7976. and the @option{fontsize} value are included in the @option{y} offset.
  7977. @example
  7978. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7979. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7980. @end example
  7981. @item
  7982. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7983. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7984. must have option @option{-export_path_metadata 1} for the special metadata fields
  7985. to be available for filters.
  7986. @example
  7987. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7988. @end example
  7989. @end itemize
  7990. For more information about libfreetype, check:
  7991. @url{http://www.freetype.org/}.
  7992. For more information about fontconfig, check:
  7993. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7994. For more information about libfribidi, check:
  7995. @url{http://fribidi.org/}.
  7996. @section edgedetect
  7997. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7998. The filter accepts the following options:
  7999. @table @option
  8000. @item low
  8001. @item high
  8002. Set low and high threshold values used by the Canny thresholding
  8003. algorithm.
  8004. The high threshold selects the "strong" edge pixels, which are then
  8005. connected through 8-connectivity with the "weak" edge pixels selected
  8006. by the low threshold.
  8007. @var{low} and @var{high} threshold values must be chosen in the range
  8008. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8009. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8010. is @code{50/255}.
  8011. @item mode
  8012. Define the drawing mode.
  8013. @table @samp
  8014. @item wires
  8015. Draw white/gray wires on black background.
  8016. @item colormix
  8017. Mix the colors to create a paint/cartoon effect.
  8018. @item canny
  8019. Apply Canny edge detector on all selected planes.
  8020. @end table
  8021. Default value is @var{wires}.
  8022. @item planes
  8023. Select planes for filtering. By default all available planes are filtered.
  8024. @end table
  8025. @subsection Examples
  8026. @itemize
  8027. @item
  8028. Standard edge detection with custom values for the hysteresis thresholding:
  8029. @example
  8030. edgedetect=low=0.1:high=0.4
  8031. @end example
  8032. @item
  8033. Painting effect without thresholding:
  8034. @example
  8035. edgedetect=mode=colormix:high=0
  8036. @end example
  8037. @end itemize
  8038. @section elbg
  8039. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8040. For each input image, the filter will compute the optimal mapping from
  8041. the input to the output given the codebook length, that is the number
  8042. of distinct output colors.
  8043. This filter accepts the following options.
  8044. @table @option
  8045. @item codebook_length, l
  8046. Set codebook length. The value must be a positive integer, and
  8047. represents the number of distinct output colors. Default value is 256.
  8048. @item nb_steps, n
  8049. Set the maximum number of iterations to apply for computing the optimal
  8050. mapping. The higher the value the better the result and the higher the
  8051. computation time. Default value is 1.
  8052. @item seed, s
  8053. Set a random seed, must be an integer included between 0 and
  8054. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8055. will try to use a good random seed on a best effort basis.
  8056. @item pal8
  8057. Set pal8 output pixel format. This option does not work with codebook
  8058. length greater than 256.
  8059. @end table
  8060. @section entropy
  8061. Measure graylevel entropy in histogram of color channels of video frames.
  8062. It accepts the following parameters:
  8063. @table @option
  8064. @item mode
  8065. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8066. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8067. between neighbour histogram values.
  8068. @end table
  8069. @section eq
  8070. Set brightness, contrast, saturation and approximate gamma adjustment.
  8071. The filter accepts the following options:
  8072. @table @option
  8073. @item contrast
  8074. Set the contrast expression. The value must be a float value in range
  8075. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8076. @item brightness
  8077. Set the brightness expression. The value must be a float value in
  8078. range @code{-1.0} to @code{1.0}. The default value is "0".
  8079. @item saturation
  8080. Set the saturation expression. The value must be a float in
  8081. range @code{0.0} to @code{3.0}. The default value is "1".
  8082. @item gamma
  8083. Set the gamma expression. The value must be a float in range
  8084. @code{0.1} to @code{10.0}. The default value is "1".
  8085. @item gamma_r
  8086. Set the gamma expression for red. The value must be a float in
  8087. range @code{0.1} to @code{10.0}. The default value is "1".
  8088. @item gamma_g
  8089. Set the gamma expression for green. The value must be a float in range
  8090. @code{0.1} to @code{10.0}. The default value is "1".
  8091. @item gamma_b
  8092. Set the gamma expression for blue. The value must be a float in range
  8093. @code{0.1} to @code{10.0}. The default value is "1".
  8094. @item gamma_weight
  8095. Set the gamma weight expression. It can be used to reduce the effect
  8096. of a high gamma value on bright image areas, e.g. keep them from
  8097. getting overamplified and just plain white. The value must be a float
  8098. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8099. gamma correction all the way down while @code{1.0} leaves it at its
  8100. full strength. Default is "1".
  8101. @item eval
  8102. Set when the expressions for brightness, contrast, saturation and
  8103. gamma expressions are evaluated.
  8104. It accepts the following values:
  8105. @table @samp
  8106. @item init
  8107. only evaluate expressions once during the filter initialization or
  8108. when a command is processed
  8109. @item frame
  8110. evaluate expressions for each incoming frame
  8111. @end table
  8112. Default value is @samp{init}.
  8113. @end table
  8114. The expressions accept the following parameters:
  8115. @table @option
  8116. @item n
  8117. frame count of the input frame starting from 0
  8118. @item pos
  8119. byte position of the corresponding packet in the input file, NAN if
  8120. unspecified
  8121. @item r
  8122. frame rate of the input video, NAN if the input frame rate is unknown
  8123. @item t
  8124. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8125. @end table
  8126. @subsection Commands
  8127. The filter supports the following commands:
  8128. @table @option
  8129. @item contrast
  8130. Set the contrast expression.
  8131. @item brightness
  8132. Set the brightness expression.
  8133. @item saturation
  8134. Set the saturation expression.
  8135. @item gamma
  8136. Set the gamma expression.
  8137. @item gamma_r
  8138. Set the gamma_r expression.
  8139. @item gamma_g
  8140. Set gamma_g expression.
  8141. @item gamma_b
  8142. Set gamma_b expression.
  8143. @item gamma_weight
  8144. Set gamma_weight expression.
  8145. The command accepts the same syntax of the corresponding option.
  8146. If the specified expression is not valid, it is kept at its current
  8147. value.
  8148. @end table
  8149. @section erosion
  8150. Apply erosion effect to the video.
  8151. This filter replaces the pixel by the local(3x3) minimum.
  8152. It accepts the following options:
  8153. @table @option
  8154. @item threshold0
  8155. @item threshold1
  8156. @item threshold2
  8157. @item threshold3
  8158. Limit the maximum change for each plane, default is 65535.
  8159. If 0, plane will remain unchanged.
  8160. @item coordinates
  8161. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8162. pixels are used.
  8163. Flags to local 3x3 coordinates maps like this:
  8164. 1 2 3
  8165. 4 5
  8166. 6 7 8
  8167. @end table
  8168. @subsection Commands
  8169. This filter supports the all above options as @ref{commands}.
  8170. @section extractplanes
  8171. Extract color channel components from input video stream into
  8172. separate grayscale video streams.
  8173. The filter accepts the following option:
  8174. @table @option
  8175. @item planes
  8176. Set plane(s) to extract.
  8177. Available values for planes are:
  8178. @table @samp
  8179. @item y
  8180. @item u
  8181. @item v
  8182. @item a
  8183. @item r
  8184. @item g
  8185. @item b
  8186. @end table
  8187. Choosing planes not available in the input will result in an error.
  8188. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8189. with @code{y}, @code{u}, @code{v} planes at same time.
  8190. @end table
  8191. @subsection Examples
  8192. @itemize
  8193. @item
  8194. Extract luma, u and v color channel component from input video frame
  8195. into 3 grayscale outputs:
  8196. @example
  8197. 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
  8198. @end example
  8199. @end itemize
  8200. @section fade
  8201. Apply a fade-in/out effect to the input video.
  8202. It accepts the following parameters:
  8203. @table @option
  8204. @item type, t
  8205. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8206. effect.
  8207. Default is @code{in}.
  8208. @item start_frame, s
  8209. Specify the number of the frame to start applying the fade
  8210. effect at. Default is 0.
  8211. @item nb_frames, n
  8212. The number of frames that the fade effect lasts. At the end of the
  8213. fade-in effect, the output video will have the same intensity as the input video.
  8214. At the end of the fade-out transition, the output video will be filled with the
  8215. selected @option{color}.
  8216. Default is 25.
  8217. @item alpha
  8218. If set to 1, fade only alpha channel, if one exists on the input.
  8219. Default value is 0.
  8220. @item start_time, st
  8221. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8222. effect. If both start_frame and start_time are specified, the fade will start at
  8223. whichever comes last. Default is 0.
  8224. @item duration, d
  8225. The number of seconds for which the fade effect has to last. At the end of the
  8226. fade-in effect the output video will have the same intensity as the input video,
  8227. at the end of the fade-out transition the output video will be filled with the
  8228. selected @option{color}.
  8229. If both duration and nb_frames are specified, duration is used. Default is 0
  8230. (nb_frames is used by default).
  8231. @item color, c
  8232. Specify the color of the fade. Default is "black".
  8233. @end table
  8234. @subsection Examples
  8235. @itemize
  8236. @item
  8237. Fade in the first 30 frames of video:
  8238. @example
  8239. fade=in:0:30
  8240. @end example
  8241. The command above is equivalent to:
  8242. @example
  8243. fade=t=in:s=0:n=30
  8244. @end example
  8245. @item
  8246. Fade out the last 45 frames of a 200-frame video:
  8247. @example
  8248. fade=out:155:45
  8249. fade=type=out:start_frame=155:nb_frames=45
  8250. @end example
  8251. @item
  8252. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8253. @example
  8254. fade=in:0:25, fade=out:975:25
  8255. @end example
  8256. @item
  8257. Make the first 5 frames yellow, then fade in from frame 5-24:
  8258. @example
  8259. fade=in:5:20:color=yellow
  8260. @end example
  8261. @item
  8262. Fade in alpha over first 25 frames of video:
  8263. @example
  8264. fade=in:0:25:alpha=1
  8265. @end example
  8266. @item
  8267. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8268. @example
  8269. fade=t=in:st=5.5:d=0.5
  8270. @end example
  8271. @end itemize
  8272. @section fftdnoiz
  8273. Denoise frames using 3D FFT (frequency domain filtering).
  8274. The filter accepts the following options:
  8275. @table @option
  8276. @item sigma
  8277. Set the noise sigma constant. This sets denoising strength.
  8278. Default value is 1. Allowed range is from 0 to 30.
  8279. Using very high sigma with low overlap may give blocking artifacts.
  8280. @item amount
  8281. Set amount of denoising. By default all detected noise is reduced.
  8282. Default value is 1. Allowed range is from 0 to 1.
  8283. @item block
  8284. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8285. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8286. block size in pixels is 2^4 which is 16.
  8287. @item overlap
  8288. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8289. @item prev
  8290. Set number of previous frames to use for denoising. By default is set to 0.
  8291. @item next
  8292. Set number of next frames to to use for denoising. By default is set to 0.
  8293. @item planes
  8294. Set planes which will be filtered, by default are all available filtered
  8295. except alpha.
  8296. @end table
  8297. @section fftfilt
  8298. Apply arbitrary expressions to samples in frequency domain
  8299. @table @option
  8300. @item dc_Y
  8301. Adjust the dc value (gain) of the luma plane of the image. The filter
  8302. accepts an integer value in range @code{0} to @code{1000}. The default
  8303. value is set to @code{0}.
  8304. @item dc_U
  8305. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8306. filter accepts an integer value in range @code{0} to @code{1000}. The
  8307. default value is set to @code{0}.
  8308. @item dc_V
  8309. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8310. filter accepts an integer value in range @code{0} to @code{1000}. The
  8311. default value is set to @code{0}.
  8312. @item weight_Y
  8313. Set the frequency domain weight expression for the luma plane.
  8314. @item weight_U
  8315. Set the frequency domain weight expression for the 1st chroma plane.
  8316. @item weight_V
  8317. Set the frequency domain weight expression for the 2nd chroma plane.
  8318. @item eval
  8319. Set when the expressions are evaluated.
  8320. It accepts the following values:
  8321. @table @samp
  8322. @item init
  8323. Only evaluate expressions once during the filter initialization.
  8324. @item frame
  8325. Evaluate expressions for each incoming frame.
  8326. @end table
  8327. Default value is @samp{init}.
  8328. The filter accepts the following variables:
  8329. @item X
  8330. @item Y
  8331. The coordinates of the current sample.
  8332. @item W
  8333. @item H
  8334. The width and height of the image.
  8335. @item N
  8336. The number of input frame, starting from 0.
  8337. @end table
  8338. @subsection Examples
  8339. @itemize
  8340. @item
  8341. High-pass:
  8342. @example
  8343. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8344. @end example
  8345. @item
  8346. Low-pass:
  8347. @example
  8348. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8349. @end example
  8350. @item
  8351. Sharpen:
  8352. @example
  8353. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8354. @end example
  8355. @item
  8356. Blur:
  8357. @example
  8358. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8359. @end example
  8360. @end itemize
  8361. @section field
  8362. Extract a single field from an interlaced image using stride
  8363. arithmetic to avoid wasting CPU time. The output frames are marked as
  8364. non-interlaced.
  8365. The filter accepts the following options:
  8366. @table @option
  8367. @item type
  8368. Specify whether to extract the top (if the value is @code{0} or
  8369. @code{top}) or the bottom field (if the value is @code{1} or
  8370. @code{bottom}).
  8371. @end table
  8372. @section fieldhint
  8373. Create new frames by copying the top and bottom fields from surrounding frames
  8374. supplied as numbers by the hint file.
  8375. @table @option
  8376. @item hint
  8377. Set file containing hints: absolute/relative frame numbers.
  8378. There must be one line for each frame in a clip. Each line must contain two
  8379. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8380. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8381. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8382. for @code{relative} mode. First number tells from which frame to pick up top
  8383. field and second number tells from which frame to pick up bottom field.
  8384. If optionally followed by @code{+} output frame will be marked as interlaced,
  8385. else if followed by @code{-} output frame will be marked as progressive, else
  8386. it will be marked same as input frame.
  8387. If optionally followed by @code{t} output frame will use only top field, or in
  8388. case of @code{b} it will use only bottom field.
  8389. If line starts with @code{#} or @code{;} that line is skipped.
  8390. @item mode
  8391. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8392. @end table
  8393. Example of first several lines of @code{hint} file for @code{relative} mode:
  8394. @example
  8395. 0,0 - # first frame
  8396. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8397. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8398. 1,0 -
  8399. 0,0 -
  8400. 0,0 -
  8401. 1,0 -
  8402. 1,0 -
  8403. 1,0 -
  8404. 0,0 -
  8405. 0,0 -
  8406. 1,0 -
  8407. 1,0 -
  8408. 1,0 -
  8409. 0,0 -
  8410. @end example
  8411. @section fieldmatch
  8412. Field matching filter for inverse telecine. It is meant to reconstruct the
  8413. progressive frames from a telecined stream. The filter does not drop duplicated
  8414. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8415. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8416. The separation of the field matching and the decimation is notably motivated by
  8417. the possibility of inserting a de-interlacing filter fallback between the two.
  8418. If the source has mixed telecined and real interlaced content,
  8419. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8420. But these remaining combed frames will be marked as interlaced, and thus can be
  8421. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8422. In addition to the various configuration options, @code{fieldmatch} can take an
  8423. optional second stream, activated through the @option{ppsrc} option. If
  8424. enabled, the frames reconstruction will be based on the fields and frames from
  8425. this second stream. This allows the first input to be pre-processed in order to
  8426. help the various algorithms of the filter, while keeping the output lossless
  8427. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8428. or brightness/contrast adjustments can help.
  8429. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8430. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8431. which @code{fieldmatch} is based on. While the semantic and usage are very
  8432. close, some behaviour and options names can differ.
  8433. The @ref{decimate} filter currently only works for constant frame rate input.
  8434. If your input has mixed telecined (30fps) and progressive content with a lower
  8435. framerate like 24fps use the following filterchain to produce the necessary cfr
  8436. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8437. The filter accepts the following options:
  8438. @table @option
  8439. @item order
  8440. Specify the assumed field order of the input stream. Available values are:
  8441. @table @samp
  8442. @item auto
  8443. Auto detect parity (use FFmpeg's internal parity value).
  8444. @item bff
  8445. Assume bottom field first.
  8446. @item tff
  8447. Assume top field first.
  8448. @end table
  8449. Note that it is sometimes recommended not to trust the parity announced by the
  8450. stream.
  8451. Default value is @var{auto}.
  8452. @item mode
  8453. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8454. sense that it won't risk creating jerkiness due to duplicate frames when
  8455. possible, but if there are bad edits or blended fields it will end up
  8456. outputting combed frames when a good match might actually exist. On the other
  8457. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8458. but will almost always find a good frame if there is one. The other values are
  8459. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8460. jerkiness and creating duplicate frames versus finding good matches in sections
  8461. with bad edits, orphaned fields, blended fields, etc.
  8462. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8463. Available values are:
  8464. @table @samp
  8465. @item pc
  8466. 2-way matching (p/c)
  8467. @item pc_n
  8468. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8469. @item pc_u
  8470. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8471. @item pc_n_ub
  8472. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8473. still combed (p/c + n + u/b)
  8474. @item pcn
  8475. 3-way matching (p/c/n)
  8476. @item pcn_ub
  8477. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8478. detected as combed (p/c/n + u/b)
  8479. @end table
  8480. The parenthesis at the end indicate the matches that would be used for that
  8481. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8482. @var{top}).
  8483. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8484. the slowest.
  8485. Default value is @var{pc_n}.
  8486. @item ppsrc
  8487. Mark the main input stream as a pre-processed input, and enable the secondary
  8488. input stream as the clean source to pick the fields from. See the filter
  8489. introduction for more details. It is similar to the @option{clip2} feature from
  8490. VFM/TFM.
  8491. Default value is @code{0} (disabled).
  8492. @item field
  8493. Set the field to match from. It is recommended to set this to the same value as
  8494. @option{order} unless you experience matching failures with that setting. In
  8495. certain circumstances changing the field that is used to match from can have a
  8496. large impact on matching performance. Available values are:
  8497. @table @samp
  8498. @item auto
  8499. Automatic (same value as @option{order}).
  8500. @item bottom
  8501. Match from the bottom field.
  8502. @item top
  8503. Match from the top field.
  8504. @end table
  8505. Default value is @var{auto}.
  8506. @item mchroma
  8507. Set whether or not chroma is included during the match comparisons. In most
  8508. cases it is recommended to leave this enabled. You should set this to @code{0}
  8509. only if your clip has bad chroma problems such as heavy rainbowing or other
  8510. artifacts. Setting this to @code{0} could also be used to speed things up at
  8511. the cost of some accuracy.
  8512. Default value is @code{1}.
  8513. @item y0
  8514. @item y1
  8515. These define an exclusion band which excludes the lines between @option{y0} and
  8516. @option{y1} from being included in the field matching decision. An exclusion
  8517. band can be used to ignore subtitles, a logo, or other things that may
  8518. interfere with the matching. @option{y0} sets the starting scan line and
  8519. @option{y1} sets the ending line; all lines in between @option{y0} and
  8520. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8521. @option{y0} and @option{y1} to the same value will disable the feature.
  8522. @option{y0} and @option{y1} defaults to @code{0}.
  8523. @item scthresh
  8524. Set the scene change detection threshold as a percentage of maximum change on
  8525. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8526. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8527. @option{scthresh} is @code{[0.0, 100.0]}.
  8528. Default value is @code{12.0}.
  8529. @item combmatch
  8530. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8531. account the combed scores of matches when deciding what match to use as the
  8532. final match. Available values are:
  8533. @table @samp
  8534. @item none
  8535. No final matching based on combed scores.
  8536. @item sc
  8537. Combed scores are only used when a scene change is detected.
  8538. @item full
  8539. Use combed scores all the time.
  8540. @end table
  8541. Default is @var{sc}.
  8542. @item combdbg
  8543. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8544. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8545. Available values are:
  8546. @table @samp
  8547. @item none
  8548. No forced calculation.
  8549. @item pcn
  8550. Force p/c/n calculations.
  8551. @item pcnub
  8552. Force p/c/n/u/b calculations.
  8553. @end table
  8554. Default value is @var{none}.
  8555. @item cthresh
  8556. This is the area combing threshold used for combed frame detection. This
  8557. essentially controls how "strong" or "visible" combing must be to be detected.
  8558. Larger values mean combing must be more visible and smaller values mean combing
  8559. can be less visible or strong and still be detected. Valid settings are from
  8560. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8561. be detected as combed). This is basically a pixel difference value. A good
  8562. range is @code{[8, 12]}.
  8563. Default value is @code{9}.
  8564. @item chroma
  8565. Sets whether or not chroma is considered in the combed frame decision. Only
  8566. disable this if your source has chroma problems (rainbowing, etc.) that are
  8567. causing problems for the combed frame detection with chroma enabled. Actually,
  8568. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8569. where there is chroma only combing in the source.
  8570. Default value is @code{0}.
  8571. @item blockx
  8572. @item blocky
  8573. Respectively set the x-axis and y-axis size of the window used during combed
  8574. frame detection. This has to do with the size of the area in which
  8575. @option{combpel} pixels are required to be detected as combed for a frame to be
  8576. declared combed. See the @option{combpel} parameter description for more info.
  8577. Possible values are any number that is a power of 2 starting at 4 and going up
  8578. to 512.
  8579. Default value is @code{16}.
  8580. @item combpel
  8581. The number of combed pixels inside any of the @option{blocky} by
  8582. @option{blockx} size blocks on the frame for the frame to be detected as
  8583. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8584. setting controls "how much" combing there must be in any localized area (a
  8585. window defined by the @option{blockx} and @option{blocky} settings) on the
  8586. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8587. which point no frames will ever be detected as combed). This setting is known
  8588. as @option{MI} in TFM/VFM vocabulary.
  8589. Default value is @code{80}.
  8590. @end table
  8591. @anchor{p/c/n/u/b meaning}
  8592. @subsection p/c/n/u/b meaning
  8593. @subsubsection p/c/n
  8594. We assume the following telecined stream:
  8595. @example
  8596. Top fields: 1 2 2 3 4
  8597. Bottom fields: 1 2 3 4 4
  8598. @end example
  8599. The numbers correspond to the progressive frame the fields relate to. Here, the
  8600. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8601. When @code{fieldmatch} is configured to run a matching from bottom
  8602. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8603. @example
  8604. Input stream:
  8605. T 1 2 2 3 4
  8606. B 1 2 3 4 4 <-- matching reference
  8607. Matches: c c n n c
  8608. Output stream:
  8609. T 1 2 3 4 4
  8610. B 1 2 3 4 4
  8611. @end example
  8612. As a result of the field matching, we can see that some frames get duplicated.
  8613. To perform a complete inverse telecine, you need to rely on a decimation filter
  8614. after this operation. See for instance the @ref{decimate} filter.
  8615. The same operation now matching from top fields (@option{field}=@var{top})
  8616. looks like this:
  8617. @example
  8618. Input stream:
  8619. T 1 2 2 3 4 <-- matching reference
  8620. B 1 2 3 4 4
  8621. Matches: c c p p c
  8622. Output stream:
  8623. T 1 2 2 3 4
  8624. B 1 2 2 3 4
  8625. @end example
  8626. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8627. basically, they refer to the frame and field of the opposite parity:
  8628. @itemize
  8629. @item @var{p} matches the field of the opposite parity in the previous frame
  8630. @item @var{c} matches the field of the opposite parity in the current frame
  8631. @item @var{n} matches the field of the opposite parity in the next frame
  8632. @end itemize
  8633. @subsubsection u/b
  8634. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8635. from the opposite parity flag. In the following examples, we assume that we are
  8636. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8637. 'x' is placed above and below each matched fields.
  8638. With bottom matching (@option{field}=@var{bottom}):
  8639. @example
  8640. Match: c p n b u
  8641. x x x x x
  8642. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8643. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8644. x x x x x
  8645. Output frames:
  8646. 2 1 2 2 2
  8647. 2 2 2 1 3
  8648. @end example
  8649. With top matching (@option{field}=@var{top}):
  8650. @example
  8651. Match: c p n b u
  8652. x x x x x
  8653. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8654. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8655. x x x x x
  8656. Output frames:
  8657. 2 2 2 1 2
  8658. 2 1 3 2 2
  8659. @end example
  8660. @subsection Examples
  8661. Simple IVTC of a top field first telecined stream:
  8662. @example
  8663. fieldmatch=order=tff:combmatch=none, decimate
  8664. @end example
  8665. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8666. @example
  8667. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8668. @end example
  8669. @section fieldorder
  8670. Transform the field order of the input video.
  8671. It accepts the following parameters:
  8672. @table @option
  8673. @item order
  8674. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8675. for bottom field first.
  8676. @end table
  8677. The default value is @samp{tff}.
  8678. The transformation is done by shifting the picture content up or down
  8679. by one line, and filling the remaining line with appropriate picture content.
  8680. This method is consistent with most broadcast field order converters.
  8681. If the input video is not flagged as being interlaced, or it is already
  8682. flagged as being of the required output field order, then this filter does
  8683. not alter the incoming video.
  8684. It is very useful when converting to or from PAL DV material,
  8685. which is bottom field first.
  8686. For example:
  8687. @example
  8688. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8689. @end example
  8690. @section fifo, afifo
  8691. Buffer input images and send them when they are requested.
  8692. It is mainly useful when auto-inserted by the libavfilter
  8693. framework.
  8694. It does not take parameters.
  8695. @section fillborders
  8696. Fill borders of the input video, without changing video stream dimensions.
  8697. Sometimes video can have garbage at the four edges and you may not want to
  8698. crop video input to keep size multiple of some number.
  8699. This filter accepts the following options:
  8700. @table @option
  8701. @item left
  8702. Number of pixels to fill from left border.
  8703. @item right
  8704. Number of pixels to fill from right border.
  8705. @item top
  8706. Number of pixels to fill from top border.
  8707. @item bottom
  8708. Number of pixels to fill from bottom border.
  8709. @item mode
  8710. Set fill mode.
  8711. It accepts the following values:
  8712. @table @samp
  8713. @item smear
  8714. fill pixels using outermost pixels
  8715. @item mirror
  8716. fill pixels using mirroring
  8717. @item fixed
  8718. fill pixels with constant value
  8719. @end table
  8720. Default is @var{smear}.
  8721. @item color
  8722. Set color for pixels in fixed mode. Default is @var{black}.
  8723. @end table
  8724. @subsection Commands
  8725. This filter supports same @ref{commands} as options.
  8726. The command accepts the same syntax of the corresponding option.
  8727. If the specified expression is not valid, it is kept at its current
  8728. value.
  8729. @section find_rect
  8730. Find a rectangular object
  8731. It accepts the following options:
  8732. @table @option
  8733. @item object
  8734. Filepath of the object image, needs to be in gray8.
  8735. @item threshold
  8736. Detection threshold, default is 0.5.
  8737. @item mipmaps
  8738. Number of mipmaps, default is 3.
  8739. @item xmin, ymin, xmax, ymax
  8740. Specifies the rectangle in which to search.
  8741. @end table
  8742. @subsection Examples
  8743. @itemize
  8744. @item
  8745. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8746. @example
  8747. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8748. @end example
  8749. @end itemize
  8750. @section floodfill
  8751. Flood area with values of same pixel components with another values.
  8752. It accepts the following options:
  8753. @table @option
  8754. @item x
  8755. Set pixel x coordinate.
  8756. @item y
  8757. Set pixel y coordinate.
  8758. @item s0
  8759. Set source #0 component value.
  8760. @item s1
  8761. Set source #1 component value.
  8762. @item s2
  8763. Set source #2 component value.
  8764. @item s3
  8765. Set source #3 component value.
  8766. @item d0
  8767. Set destination #0 component value.
  8768. @item d1
  8769. Set destination #1 component value.
  8770. @item d2
  8771. Set destination #2 component value.
  8772. @item d3
  8773. Set destination #3 component value.
  8774. @end table
  8775. @anchor{format}
  8776. @section format
  8777. Convert the input video to one of the specified pixel formats.
  8778. Libavfilter will try to pick one that is suitable as input to
  8779. the next filter.
  8780. It accepts the following parameters:
  8781. @table @option
  8782. @item pix_fmts
  8783. A '|'-separated list of pixel format names, such as
  8784. "pix_fmts=yuv420p|monow|rgb24".
  8785. @end table
  8786. @subsection Examples
  8787. @itemize
  8788. @item
  8789. Convert the input video to the @var{yuv420p} format
  8790. @example
  8791. format=pix_fmts=yuv420p
  8792. @end example
  8793. Convert the input video to any of the formats in the list
  8794. @example
  8795. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8796. @end example
  8797. @end itemize
  8798. @anchor{fps}
  8799. @section fps
  8800. Convert the video to specified constant frame rate by duplicating or dropping
  8801. frames as necessary.
  8802. It accepts the following parameters:
  8803. @table @option
  8804. @item fps
  8805. The desired output frame rate. The default is @code{25}.
  8806. @item start_time
  8807. Assume the first PTS should be the given value, in seconds. This allows for
  8808. padding/trimming at the start of stream. By default, no assumption is made
  8809. about the first frame's expected PTS, so no padding or trimming is done.
  8810. For example, this could be set to 0 to pad the beginning with duplicates of
  8811. the first frame if a video stream starts after the audio stream or to trim any
  8812. frames with a negative PTS.
  8813. @item round
  8814. Timestamp (PTS) rounding method.
  8815. Possible values are:
  8816. @table @option
  8817. @item zero
  8818. round towards 0
  8819. @item inf
  8820. round away from 0
  8821. @item down
  8822. round towards -infinity
  8823. @item up
  8824. round towards +infinity
  8825. @item near
  8826. round to nearest
  8827. @end table
  8828. The default is @code{near}.
  8829. @item eof_action
  8830. Action performed when reading the last frame.
  8831. Possible values are:
  8832. @table @option
  8833. @item round
  8834. Use same timestamp rounding method as used for other frames.
  8835. @item pass
  8836. Pass through last frame if input duration has not been reached yet.
  8837. @end table
  8838. The default is @code{round}.
  8839. @end table
  8840. Alternatively, the options can be specified as a flat string:
  8841. @var{fps}[:@var{start_time}[:@var{round}]].
  8842. See also the @ref{setpts} filter.
  8843. @subsection Examples
  8844. @itemize
  8845. @item
  8846. A typical usage in order to set the fps to 25:
  8847. @example
  8848. fps=fps=25
  8849. @end example
  8850. @item
  8851. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8852. @example
  8853. fps=fps=film:round=near
  8854. @end example
  8855. @end itemize
  8856. @section framepack
  8857. Pack two different video streams into a stereoscopic video, setting proper
  8858. metadata on supported codecs. The two views should have the same size and
  8859. framerate and processing will stop when the shorter video ends. Please note
  8860. that you may conveniently adjust view properties with the @ref{scale} and
  8861. @ref{fps} filters.
  8862. It accepts the following parameters:
  8863. @table @option
  8864. @item format
  8865. The desired packing format. Supported values are:
  8866. @table @option
  8867. @item sbs
  8868. The views are next to each other (default).
  8869. @item tab
  8870. The views are on top of each other.
  8871. @item lines
  8872. The views are packed by line.
  8873. @item columns
  8874. The views are packed by column.
  8875. @item frameseq
  8876. The views are temporally interleaved.
  8877. @end table
  8878. @end table
  8879. Some examples:
  8880. @example
  8881. # Convert left and right views into a frame-sequential video
  8882. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8883. # Convert views into a side-by-side video with the same output resolution as the input
  8884. 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
  8885. @end example
  8886. @section framerate
  8887. Change the frame rate by interpolating new video output frames from the source
  8888. frames.
  8889. This filter is not designed to function correctly with interlaced media. If
  8890. you wish to change the frame rate of interlaced media then you are required
  8891. to deinterlace before this filter and re-interlace after this filter.
  8892. A description of the accepted options follows.
  8893. @table @option
  8894. @item fps
  8895. Specify the output frames per second. This option can also be specified
  8896. as a value alone. The default is @code{50}.
  8897. @item interp_start
  8898. Specify the start of a range where the output frame will be created as a
  8899. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8900. the default is @code{15}.
  8901. @item interp_end
  8902. Specify the end of a range where the output frame will be created as a
  8903. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8904. the default is @code{240}.
  8905. @item scene
  8906. Specify the level at which a scene change is detected as a value between
  8907. 0 and 100 to indicate a new scene; a low value reflects a low
  8908. probability for the current frame to introduce a new scene, while a higher
  8909. value means the current frame is more likely to be one.
  8910. The default is @code{8.2}.
  8911. @item flags
  8912. Specify flags influencing the filter process.
  8913. Available value for @var{flags} is:
  8914. @table @option
  8915. @item scene_change_detect, scd
  8916. Enable scene change detection using the value of the option @var{scene}.
  8917. This flag is enabled by default.
  8918. @end table
  8919. @end table
  8920. @section framestep
  8921. Select one frame every N-th frame.
  8922. This filter accepts the following option:
  8923. @table @option
  8924. @item step
  8925. Select frame after every @code{step} frames.
  8926. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8927. @end table
  8928. @section freezedetect
  8929. Detect frozen video.
  8930. This filter logs a message and sets frame metadata when it detects that the
  8931. input video has no significant change in content during a specified duration.
  8932. Video freeze detection calculates the mean average absolute difference of all
  8933. the components of video frames and compares it to a noise floor.
  8934. The printed times and duration are expressed in seconds. The
  8935. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8936. whose timestamp equals or exceeds the detection duration and it contains the
  8937. timestamp of the first frame of the freeze. The
  8938. @code{lavfi.freezedetect.freeze_duration} and
  8939. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8940. after the freeze.
  8941. The filter accepts the following options:
  8942. @table @option
  8943. @item noise, n
  8944. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8945. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8946. 0.001.
  8947. @item duration, d
  8948. Set freeze duration until notification (default is 2 seconds).
  8949. @end table
  8950. @section freezeframes
  8951. Freeze video frames.
  8952. This filter freezes video frames using frame from 2nd input.
  8953. The filter accepts the following options:
  8954. @table @option
  8955. @item first
  8956. Set number of first frame from which to start freeze.
  8957. @item last
  8958. Set number of last frame from which to end freeze.
  8959. @item replace
  8960. Set number of frame from 2nd input which will be used instead of replaced frames.
  8961. @end table
  8962. @anchor{frei0r}
  8963. @section frei0r
  8964. Apply a frei0r effect to the input video.
  8965. To enable the compilation of this filter, you need to install the frei0r
  8966. header and configure FFmpeg with @code{--enable-frei0r}.
  8967. It accepts the following parameters:
  8968. @table @option
  8969. @item filter_name
  8970. The name of the frei0r effect to load. If the environment variable
  8971. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8972. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8973. Otherwise, the standard frei0r paths are searched, in this order:
  8974. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8975. @file{/usr/lib/frei0r-1/}.
  8976. @item filter_params
  8977. A '|'-separated list of parameters to pass to the frei0r effect.
  8978. @end table
  8979. A frei0r effect parameter can be a boolean (its value is either
  8980. "y" or "n"), a double, a color (specified as
  8981. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8982. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8983. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8984. a position (specified as @var{X}/@var{Y}, where
  8985. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8986. The number and types of parameters depend on the loaded effect. If an
  8987. effect parameter is not specified, the default value is set.
  8988. @subsection Examples
  8989. @itemize
  8990. @item
  8991. Apply the distort0r effect, setting the first two double parameters:
  8992. @example
  8993. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8994. @end example
  8995. @item
  8996. Apply the colordistance effect, taking a color as the first parameter:
  8997. @example
  8998. frei0r=colordistance:0.2/0.3/0.4
  8999. frei0r=colordistance:violet
  9000. frei0r=colordistance:0x112233
  9001. @end example
  9002. @item
  9003. Apply the perspective effect, specifying the top left and top right image
  9004. positions:
  9005. @example
  9006. frei0r=perspective:0.2/0.2|0.8/0.2
  9007. @end example
  9008. @end itemize
  9009. For more information, see
  9010. @url{http://frei0r.dyne.org}
  9011. @subsection Commands
  9012. This filter supports the @option{filter_params} option as @ref{commands}.
  9013. @section fspp
  9014. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  9015. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  9016. processing filter, one of them is performed once per block, not per pixel.
  9017. This allows for much higher speed.
  9018. The filter accepts the following options:
  9019. @table @option
  9020. @item quality
  9021. Set quality. This option defines the number of levels for averaging. It accepts
  9022. an integer in the range 4-5. Default value is @code{4}.
  9023. @item qp
  9024. Force a constant quantization parameter. It accepts an integer in range 0-63.
  9025. If not set, the filter will use the QP from the video stream (if available).
  9026. @item strength
  9027. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  9028. more details but also more artifacts, while higher values make the image smoother
  9029. but also blurrier. Default value is @code{0} − PSNR optimal.
  9030. @item use_bframe_qp
  9031. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9032. option may cause flicker since the B-Frames have often larger QP. Default is
  9033. @code{0} (not enabled).
  9034. @end table
  9035. @section gblur
  9036. Apply Gaussian blur filter.
  9037. The filter accepts the following options:
  9038. @table @option
  9039. @item sigma
  9040. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  9041. @item steps
  9042. Set number of steps for Gaussian approximation. Default is @code{1}.
  9043. @item planes
  9044. Set which planes to filter. By default all planes are filtered.
  9045. @item sigmaV
  9046. Set vertical sigma, if negative it will be same as @code{sigma}.
  9047. Default is @code{-1}.
  9048. @end table
  9049. @subsection Commands
  9050. This filter supports same commands as options.
  9051. The command accepts the same syntax of the corresponding option.
  9052. If the specified expression is not valid, it is kept at its current
  9053. value.
  9054. @section geq
  9055. Apply generic equation to each pixel.
  9056. The filter accepts the following options:
  9057. @table @option
  9058. @item lum_expr, lum
  9059. Set the luminance expression.
  9060. @item cb_expr, cb
  9061. Set the chrominance blue expression.
  9062. @item cr_expr, cr
  9063. Set the chrominance red expression.
  9064. @item alpha_expr, a
  9065. Set the alpha expression.
  9066. @item red_expr, r
  9067. Set the red expression.
  9068. @item green_expr, g
  9069. Set the green expression.
  9070. @item blue_expr, b
  9071. Set the blue expression.
  9072. @end table
  9073. The colorspace is selected according to the specified options. If one
  9074. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9075. options is specified, the filter will automatically select a YCbCr
  9076. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9077. @option{blue_expr} options is specified, it will select an RGB
  9078. colorspace.
  9079. If one of the chrominance expression is not defined, it falls back on the other
  9080. one. If no alpha expression is specified it will evaluate to opaque value.
  9081. If none of chrominance expressions are specified, they will evaluate
  9082. to the luminance expression.
  9083. The expressions can use the following variables and functions:
  9084. @table @option
  9085. @item N
  9086. The sequential number of the filtered frame, starting from @code{0}.
  9087. @item X
  9088. @item Y
  9089. The coordinates of the current sample.
  9090. @item W
  9091. @item H
  9092. The width and height of the image.
  9093. @item SW
  9094. @item SH
  9095. Width and height scale depending on the currently filtered plane. It is the
  9096. ratio between the corresponding luma plane number of pixels and the current
  9097. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9098. @code{0.5,0.5} for chroma planes.
  9099. @item T
  9100. Time of the current frame, expressed in seconds.
  9101. @item p(x, y)
  9102. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9103. plane.
  9104. @item lum(x, y)
  9105. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9106. plane.
  9107. @item cb(x, y)
  9108. Return the value of the pixel at location (@var{x},@var{y}) of the
  9109. blue-difference chroma plane. Return 0 if there is no such plane.
  9110. @item cr(x, y)
  9111. Return the value of the pixel at location (@var{x},@var{y}) of the
  9112. red-difference chroma plane. Return 0 if there is no such plane.
  9113. @item r(x, y)
  9114. @item g(x, y)
  9115. @item b(x, y)
  9116. Return the value of the pixel at location (@var{x},@var{y}) of the
  9117. red/green/blue component. Return 0 if there is no such component.
  9118. @item alpha(x, y)
  9119. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9120. plane. Return 0 if there is no such plane.
  9121. @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)
  9122. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9123. sums of samples within a rectangle. See the functions without the sum postfix.
  9124. @item interpolation
  9125. Set one of interpolation methods:
  9126. @table @option
  9127. @item nearest, n
  9128. @item bilinear, b
  9129. @end table
  9130. Default is bilinear.
  9131. @end table
  9132. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9133. automatically clipped to the closer edge.
  9134. Please note that this filter can use multiple threads in which case each slice
  9135. will have its own expression state. If you want to use only a single expression
  9136. state because your expressions depend on previous state then you should limit
  9137. the number of filter threads to 1.
  9138. @subsection Examples
  9139. @itemize
  9140. @item
  9141. Flip the image horizontally:
  9142. @example
  9143. geq=p(W-X\,Y)
  9144. @end example
  9145. @item
  9146. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9147. wavelength of 100 pixels:
  9148. @example
  9149. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9150. @end example
  9151. @item
  9152. Generate a fancy enigmatic moving light:
  9153. @example
  9154. 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
  9155. @end example
  9156. @item
  9157. Generate a quick emboss effect:
  9158. @example
  9159. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9160. @end example
  9161. @item
  9162. Modify RGB components depending on pixel position:
  9163. @example
  9164. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9165. @end example
  9166. @item
  9167. Create a radial gradient that is the same size as the input (also see
  9168. the @ref{vignette} filter):
  9169. @example
  9170. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9171. @end example
  9172. @end itemize
  9173. @section gradfun
  9174. Fix the banding artifacts that are sometimes introduced into nearly flat
  9175. regions by truncation to 8-bit color depth.
  9176. Interpolate the gradients that should go where the bands are, and
  9177. dither them.
  9178. It is designed for playback only. Do not use it prior to
  9179. lossy compression, because compression tends to lose the dither and
  9180. bring back the bands.
  9181. It accepts the following parameters:
  9182. @table @option
  9183. @item strength
  9184. The maximum amount by which the filter will change any one pixel. This is also
  9185. the threshold for detecting nearly flat regions. Acceptable values range from
  9186. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9187. valid range.
  9188. @item radius
  9189. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9190. gradients, but also prevents the filter from modifying the pixels near detailed
  9191. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9192. values will be clipped to the valid range.
  9193. @end table
  9194. Alternatively, the options can be specified as a flat string:
  9195. @var{strength}[:@var{radius}]
  9196. @subsection Examples
  9197. @itemize
  9198. @item
  9199. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9200. @example
  9201. gradfun=3.5:8
  9202. @end example
  9203. @item
  9204. Specify radius, omitting the strength (which will fall-back to the default
  9205. value):
  9206. @example
  9207. gradfun=radius=8
  9208. @end example
  9209. @end itemize
  9210. @anchor{graphmonitor}
  9211. @section graphmonitor
  9212. Show various filtergraph stats.
  9213. With this filter one can debug complete filtergraph.
  9214. Especially issues with links filling with queued frames.
  9215. The filter accepts the following options:
  9216. @table @option
  9217. @item size, s
  9218. Set video output size. Default is @var{hd720}.
  9219. @item opacity, o
  9220. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9221. @item mode, m
  9222. Set output mode, can be @var{fulll} or @var{compact}.
  9223. In @var{compact} mode only filters with some queued frames have displayed stats.
  9224. @item flags, f
  9225. Set flags which enable which stats are shown in video.
  9226. Available values for flags are:
  9227. @table @samp
  9228. @item queue
  9229. Display number of queued frames in each link.
  9230. @item frame_count_in
  9231. Display number of frames taken from filter.
  9232. @item frame_count_out
  9233. Display number of frames given out from filter.
  9234. @item pts
  9235. Display current filtered frame pts.
  9236. @item time
  9237. Display current filtered frame time.
  9238. @item timebase
  9239. Display time base for filter link.
  9240. @item format
  9241. Display used format for filter link.
  9242. @item size
  9243. Display video size or number of audio channels in case of audio used by filter link.
  9244. @item rate
  9245. Display video frame rate or sample rate in case of audio used by filter link.
  9246. @item eof
  9247. Display link output status.
  9248. @end table
  9249. @item rate, r
  9250. Set upper limit for video rate of output stream, Default value is @var{25}.
  9251. This guarantee that output video frame rate will not be higher than this value.
  9252. @end table
  9253. @section greyedge
  9254. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9255. and corrects the scene colors accordingly.
  9256. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9257. The filter accepts the following options:
  9258. @table @option
  9259. @item difford
  9260. The order of differentiation to be applied on the scene. Must be chosen in the range
  9261. [0,2] and default value is 1.
  9262. @item minknorm
  9263. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9264. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9265. max value instead of calculating Minkowski distance.
  9266. @item sigma
  9267. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9268. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9269. can't be equal to 0 if @var{difford} is greater than 0.
  9270. @end table
  9271. @subsection Examples
  9272. @itemize
  9273. @item
  9274. Grey Edge:
  9275. @example
  9276. greyedge=difford=1:minknorm=5:sigma=2
  9277. @end example
  9278. @item
  9279. Max Edge:
  9280. @example
  9281. greyedge=difford=1:minknorm=0:sigma=2
  9282. @end example
  9283. @end itemize
  9284. @anchor{haldclut}
  9285. @section haldclut
  9286. Apply a Hald CLUT to a video stream.
  9287. First input is the video stream to process, and second one is the Hald CLUT.
  9288. The Hald CLUT input can be a simple picture or a complete video stream.
  9289. The filter accepts the following options:
  9290. @table @option
  9291. @item shortest
  9292. Force termination when the shortest input terminates. Default is @code{0}.
  9293. @item repeatlast
  9294. Continue applying the last CLUT after the end of the stream. A value of
  9295. @code{0} disable the filter after the last frame of the CLUT is reached.
  9296. Default is @code{1}.
  9297. @end table
  9298. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9299. filters share the same internals).
  9300. This filter also supports the @ref{framesync} options.
  9301. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9302. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9303. @subsection Workflow examples
  9304. @subsubsection Hald CLUT video stream
  9305. Generate an identity Hald CLUT stream altered with various effects:
  9306. @example
  9307. 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
  9308. @end example
  9309. Note: make sure you use a lossless codec.
  9310. Then use it with @code{haldclut} to apply it on some random stream:
  9311. @example
  9312. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9313. @end example
  9314. The Hald CLUT will be applied to the 10 first seconds (duration of
  9315. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9316. to the remaining frames of the @code{mandelbrot} stream.
  9317. @subsubsection Hald CLUT with preview
  9318. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9319. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9320. biggest possible square starting at the top left of the picture. The remaining
  9321. padding pixels (bottom or right) will be ignored. This area can be used to add
  9322. a preview of the Hald CLUT.
  9323. Typically, the following generated Hald CLUT will be supported by the
  9324. @code{haldclut} filter:
  9325. @example
  9326. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9327. pad=iw+320 [padded_clut];
  9328. smptebars=s=320x256, split [a][b];
  9329. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9330. [main][b] overlay=W-320" -frames:v 1 clut.png
  9331. @end example
  9332. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9333. bars are displayed on the right-top, and below the same color bars processed by
  9334. the color changes.
  9335. Then, the effect of this Hald CLUT can be visualized with:
  9336. @example
  9337. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9338. @end example
  9339. @section hflip
  9340. Flip the input video horizontally.
  9341. For example, to horizontally flip the input video with @command{ffmpeg}:
  9342. @example
  9343. ffmpeg -i in.avi -vf "hflip" out.avi
  9344. @end example
  9345. @section histeq
  9346. This filter applies a global color histogram equalization on a
  9347. per-frame basis.
  9348. It can be used to correct video that has a compressed range of pixel
  9349. intensities. The filter redistributes the pixel intensities to
  9350. equalize their distribution across the intensity range. It may be
  9351. viewed as an "automatically adjusting contrast filter". This filter is
  9352. useful only for correcting degraded or poorly captured source
  9353. video.
  9354. The filter accepts the following options:
  9355. @table @option
  9356. @item strength
  9357. Determine the amount of equalization to be applied. As the strength
  9358. is reduced, the distribution of pixel intensities more-and-more
  9359. approaches that of the input frame. The value must be a float number
  9360. in the range [0,1] and defaults to 0.200.
  9361. @item intensity
  9362. Set the maximum intensity that can generated and scale the output
  9363. values appropriately. The strength should be set as desired and then
  9364. the intensity can be limited if needed to avoid washing-out. The value
  9365. must be a float number in the range [0,1] and defaults to 0.210.
  9366. @item antibanding
  9367. Set the antibanding level. If enabled the filter will randomly vary
  9368. the luminance of output pixels by a small amount to avoid banding of
  9369. the histogram. Possible values are @code{none}, @code{weak} or
  9370. @code{strong}. It defaults to @code{none}.
  9371. @end table
  9372. @anchor{histogram}
  9373. @section histogram
  9374. Compute and draw a color distribution histogram for the input video.
  9375. The computed histogram is a representation of the color component
  9376. distribution in an image.
  9377. Standard histogram displays the color components distribution in an image.
  9378. Displays color graph for each color component. Shows distribution of
  9379. the Y, U, V, A or R, G, B components, depending on input format, in the
  9380. current frame. Below each graph a color component scale meter is shown.
  9381. The filter accepts the following options:
  9382. @table @option
  9383. @item level_height
  9384. Set height of level. Default value is @code{200}.
  9385. Allowed range is [50, 2048].
  9386. @item scale_height
  9387. Set height of color scale. Default value is @code{12}.
  9388. Allowed range is [0, 40].
  9389. @item display_mode
  9390. Set display mode.
  9391. It accepts the following values:
  9392. @table @samp
  9393. @item stack
  9394. Per color component graphs are placed below each other.
  9395. @item parade
  9396. Per color component graphs are placed side by side.
  9397. @item overlay
  9398. Presents information identical to that in the @code{parade}, except
  9399. that the graphs representing color components are superimposed directly
  9400. over one another.
  9401. @end table
  9402. Default is @code{stack}.
  9403. @item levels_mode
  9404. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9405. Default is @code{linear}.
  9406. @item components
  9407. Set what color components to display.
  9408. Default is @code{7}.
  9409. @item fgopacity
  9410. Set foreground opacity. Default is @code{0.7}.
  9411. @item bgopacity
  9412. Set background opacity. Default is @code{0.5}.
  9413. @end table
  9414. @subsection Examples
  9415. @itemize
  9416. @item
  9417. Calculate and draw histogram:
  9418. @example
  9419. ffplay -i input -vf histogram
  9420. @end example
  9421. @end itemize
  9422. @anchor{hqdn3d}
  9423. @section hqdn3d
  9424. This is a high precision/quality 3d denoise filter. It aims to reduce
  9425. image noise, producing smooth images and making still images really
  9426. still. It should enhance compressibility.
  9427. It accepts the following optional parameters:
  9428. @table @option
  9429. @item luma_spatial
  9430. A non-negative floating point number which specifies spatial luma strength.
  9431. It defaults to 4.0.
  9432. @item chroma_spatial
  9433. A non-negative floating point number which specifies spatial chroma strength.
  9434. It defaults to 3.0*@var{luma_spatial}/4.0.
  9435. @item luma_tmp
  9436. A floating point number which specifies luma temporal strength. It defaults to
  9437. 6.0*@var{luma_spatial}/4.0.
  9438. @item chroma_tmp
  9439. A floating point number which specifies chroma temporal strength. It defaults to
  9440. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9441. @end table
  9442. @subsection Commands
  9443. This filter supports same @ref{commands} as options.
  9444. The command accepts the same syntax of the corresponding option.
  9445. If the specified expression is not valid, it is kept at its current
  9446. value.
  9447. @anchor{hwdownload}
  9448. @section hwdownload
  9449. Download hardware frames to system memory.
  9450. The input must be in hardware frames, and the output a non-hardware format.
  9451. Not all formats will be supported on the output - it may be necessary to insert
  9452. an additional @option{format} filter immediately following in the graph to get
  9453. the output in a supported format.
  9454. @section hwmap
  9455. Map hardware frames to system memory or to another device.
  9456. This filter has several different modes of operation; which one is used depends
  9457. on the input and output formats:
  9458. @itemize
  9459. @item
  9460. Hardware frame input, normal frame output
  9461. Map the input frames to system memory and pass them to the output. If the
  9462. original hardware frame is later required (for example, after overlaying
  9463. something else on part of it), the @option{hwmap} filter can be used again
  9464. in the next mode to retrieve it.
  9465. @item
  9466. Normal frame input, hardware frame output
  9467. If the input is actually a software-mapped hardware frame, then unmap it -
  9468. that is, return the original hardware frame.
  9469. Otherwise, a device must be provided. Create new hardware surfaces on that
  9470. device for the output, then map them back to the software format at the input
  9471. and give those frames to the preceding filter. This will then act like the
  9472. @option{hwupload} filter, but may be able to avoid an additional copy when
  9473. the input is already in a compatible format.
  9474. @item
  9475. Hardware frame input and output
  9476. A device must be supplied for the output, either directly or with the
  9477. @option{derive_device} option. The input and output devices must be of
  9478. different types and compatible - the exact meaning of this is
  9479. system-dependent, but typically it means that they must refer to the same
  9480. underlying hardware context (for example, refer to the same graphics card).
  9481. If the input frames were originally created on the output device, then unmap
  9482. to retrieve the original frames.
  9483. Otherwise, map the frames to the output device - create new hardware frames
  9484. on the output corresponding to the frames on the input.
  9485. @end itemize
  9486. The following additional parameters are accepted:
  9487. @table @option
  9488. @item mode
  9489. Set the frame mapping mode. Some combination of:
  9490. @table @var
  9491. @item read
  9492. The mapped frame should be readable.
  9493. @item write
  9494. The mapped frame should be writeable.
  9495. @item overwrite
  9496. The mapping will always overwrite the entire frame.
  9497. This may improve performance in some cases, as the original contents of the
  9498. frame need not be loaded.
  9499. @item direct
  9500. The mapping must not involve any copying.
  9501. Indirect mappings to copies of frames are created in some cases where either
  9502. direct mapping is not possible or it would have unexpected properties.
  9503. Setting this flag ensures that the mapping is direct and will fail if that is
  9504. not possible.
  9505. @end table
  9506. Defaults to @var{read+write} if not specified.
  9507. @item derive_device @var{type}
  9508. Rather than using the device supplied at initialisation, instead derive a new
  9509. device of type @var{type} from the device the input frames exist on.
  9510. @item reverse
  9511. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9512. and map them back to the source. This may be necessary in some cases where
  9513. a mapping in one direction is required but only the opposite direction is
  9514. supported by the devices being used.
  9515. This option is dangerous - it may break the preceding filter in undefined
  9516. ways if there are any additional constraints on that filter's output.
  9517. Do not use it without fully understanding the implications of its use.
  9518. @end table
  9519. @anchor{hwupload}
  9520. @section hwupload
  9521. Upload system memory frames to hardware surfaces.
  9522. The device to upload to must be supplied when the filter is initialised. If
  9523. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9524. option or with the @option{derive_device} option. The input and output devices
  9525. must be of different types and compatible - the exact meaning of this is
  9526. system-dependent, but typically it means that they must refer to the same
  9527. underlying hardware context (for example, refer to the same graphics card).
  9528. The following additional parameters are accepted:
  9529. @table @option
  9530. @item derive_device @var{type}
  9531. Rather than using the device supplied at initialisation, instead derive a new
  9532. device of type @var{type} from the device the input frames exist on.
  9533. @end table
  9534. @anchor{hwupload_cuda}
  9535. @section hwupload_cuda
  9536. Upload system memory frames to a CUDA device.
  9537. It accepts the following optional parameters:
  9538. @table @option
  9539. @item device
  9540. The number of the CUDA device to use
  9541. @end table
  9542. @section hqx
  9543. Apply a high-quality magnification filter designed for pixel art. This filter
  9544. was originally created by Maxim Stepin.
  9545. It accepts the following option:
  9546. @table @option
  9547. @item n
  9548. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9549. @code{hq3x} and @code{4} for @code{hq4x}.
  9550. Default is @code{3}.
  9551. @end table
  9552. @section hstack
  9553. Stack input videos horizontally.
  9554. All streams must be of same pixel format and of same height.
  9555. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9556. to create same output.
  9557. The filter accepts the following option:
  9558. @table @option
  9559. @item inputs
  9560. Set number of input streams. Default is 2.
  9561. @item shortest
  9562. If set to 1, force the output to terminate when the shortest input
  9563. terminates. Default value is 0.
  9564. @end table
  9565. @section hue
  9566. Modify the hue and/or the saturation of the input.
  9567. It accepts the following parameters:
  9568. @table @option
  9569. @item h
  9570. Specify the hue angle as a number of degrees. It accepts an expression,
  9571. and defaults to "0".
  9572. @item s
  9573. Specify the saturation in the [-10,10] range. It accepts an expression and
  9574. defaults to "1".
  9575. @item H
  9576. Specify the hue angle as a number of radians. It accepts an
  9577. expression, and defaults to "0".
  9578. @item b
  9579. Specify the brightness in the [-10,10] range. It accepts an expression and
  9580. defaults to "0".
  9581. @end table
  9582. @option{h} and @option{H} are mutually exclusive, and can't be
  9583. specified at the same time.
  9584. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9585. expressions containing the following constants:
  9586. @table @option
  9587. @item n
  9588. frame count of the input frame starting from 0
  9589. @item pts
  9590. presentation timestamp of the input frame expressed in time base units
  9591. @item r
  9592. frame rate of the input video, NAN if the input frame rate is unknown
  9593. @item t
  9594. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9595. @item tb
  9596. time base of the input video
  9597. @end table
  9598. @subsection Examples
  9599. @itemize
  9600. @item
  9601. Set the hue to 90 degrees and the saturation to 1.0:
  9602. @example
  9603. hue=h=90:s=1
  9604. @end example
  9605. @item
  9606. Same command but expressing the hue in radians:
  9607. @example
  9608. hue=H=PI/2:s=1
  9609. @end example
  9610. @item
  9611. Rotate hue and make the saturation swing between 0
  9612. and 2 over a period of 1 second:
  9613. @example
  9614. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9615. @end example
  9616. @item
  9617. Apply a 3 seconds saturation fade-in effect starting at 0:
  9618. @example
  9619. hue="s=min(t/3\,1)"
  9620. @end example
  9621. The general fade-in expression can be written as:
  9622. @example
  9623. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9624. @end example
  9625. @item
  9626. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9627. @example
  9628. hue="s=max(0\, min(1\, (8-t)/3))"
  9629. @end example
  9630. The general fade-out expression can be written as:
  9631. @example
  9632. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9633. @end example
  9634. @end itemize
  9635. @subsection Commands
  9636. This filter supports the following commands:
  9637. @table @option
  9638. @item b
  9639. @item s
  9640. @item h
  9641. @item H
  9642. Modify the hue and/or the saturation and/or brightness of the input video.
  9643. The command accepts the same syntax of the corresponding option.
  9644. If the specified expression is not valid, it is kept at its current
  9645. value.
  9646. @end table
  9647. @section hysteresis
  9648. Grow first stream into second stream by connecting components.
  9649. This makes it possible to build more robust edge masks.
  9650. This filter accepts the following options:
  9651. @table @option
  9652. @item planes
  9653. Set which planes will be processed as bitmap, unprocessed planes will be
  9654. copied from first stream.
  9655. By default value 0xf, all planes will be processed.
  9656. @item threshold
  9657. Set threshold which is used in filtering. If pixel component value is higher than
  9658. this value filter algorithm for connecting components is activated.
  9659. By default value is 0.
  9660. @end table
  9661. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9662. @section idet
  9663. Detect video interlacing type.
  9664. This filter tries to detect if the input frames are interlaced, progressive,
  9665. top or bottom field first. It will also try to detect fields that are
  9666. repeated between adjacent frames (a sign of telecine).
  9667. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9668. Multiple frame detection incorporates the classification history of previous frames.
  9669. The filter will log these metadata values:
  9670. @table @option
  9671. @item single.current_frame
  9672. Detected type of current frame using single-frame detection. One of:
  9673. ``tff'' (top field first), ``bff'' (bottom field first),
  9674. ``progressive'', or ``undetermined''
  9675. @item single.tff
  9676. Cumulative number of frames detected as top field first using single-frame detection.
  9677. @item multiple.tff
  9678. Cumulative number of frames detected as top field first using multiple-frame detection.
  9679. @item single.bff
  9680. Cumulative number of frames detected as bottom field first using single-frame detection.
  9681. @item multiple.current_frame
  9682. Detected type of current frame using multiple-frame detection. One of:
  9683. ``tff'' (top field first), ``bff'' (bottom field first),
  9684. ``progressive'', or ``undetermined''
  9685. @item multiple.bff
  9686. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9687. @item single.progressive
  9688. Cumulative number of frames detected as progressive using single-frame detection.
  9689. @item multiple.progressive
  9690. Cumulative number of frames detected as progressive using multiple-frame detection.
  9691. @item single.undetermined
  9692. Cumulative number of frames that could not be classified using single-frame detection.
  9693. @item multiple.undetermined
  9694. Cumulative number of frames that could not be classified using multiple-frame detection.
  9695. @item repeated.current_frame
  9696. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9697. @item repeated.neither
  9698. Cumulative number of frames with no repeated field.
  9699. @item repeated.top
  9700. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9701. @item repeated.bottom
  9702. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9703. @end table
  9704. The filter accepts the following options:
  9705. @table @option
  9706. @item intl_thres
  9707. Set interlacing threshold.
  9708. @item prog_thres
  9709. Set progressive threshold.
  9710. @item rep_thres
  9711. Threshold for repeated field detection.
  9712. @item half_life
  9713. Number of frames after which a given frame's contribution to the
  9714. statistics is halved (i.e., it contributes only 0.5 to its
  9715. classification). The default of 0 means that all frames seen are given
  9716. full weight of 1.0 forever.
  9717. @item analyze_interlaced_flag
  9718. When this is not 0 then idet will use the specified number of frames to determine
  9719. if the interlaced flag is accurate, it will not count undetermined frames.
  9720. If the flag is found to be accurate it will be used without any further
  9721. computations, if it is found to be inaccurate it will be cleared without any
  9722. further computations. This allows inserting the idet filter as a low computational
  9723. method to clean up the interlaced flag
  9724. @end table
  9725. @section il
  9726. Deinterleave or interleave fields.
  9727. This filter allows one to process interlaced images fields without
  9728. deinterlacing them. Deinterleaving splits the input frame into 2
  9729. fields (so called half pictures). Odd lines are moved to the top
  9730. half of the output image, even lines to the bottom half.
  9731. You can process (filter) them independently and then re-interleave them.
  9732. The filter accepts the following options:
  9733. @table @option
  9734. @item luma_mode, l
  9735. @item chroma_mode, c
  9736. @item alpha_mode, a
  9737. Available values for @var{luma_mode}, @var{chroma_mode} and
  9738. @var{alpha_mode} are:
  9739. @table @samp
  9740. @item none
  9741. Do nothing.
  9742. @item deinterleave, d
  9743. Deinterleave fields, placing one above the other.
  9744. @item interleave, i
  9745. Interleave fields. Reverse the effect of deinterleaving.
  9746. @end table
  9747. Default value is @code{none}.
  9748. @item luma_swap, ls
  9749. @item chroma_swap, cs
  9750. @item alpha_swap, as
  9751. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9752. @end table
  9753. @subsection Commands
  9754. This filter supports the all above options as @ref{commands}.
  9755. @section inflate
  9756. Apply inflate effect to the video.
  9757. This filter replaces the pixel by the local(3x3) average by taking into account
  9758. only values higher than the pixel.
  9759. It accepts the following options:
  9760. @table @option
  9761. @item threshold0
  9762. @item threshold1
  9763. @item threshold2
  9764. @item threshold3
  9765. Limit the maximum change for each plane, default is 65535.
  9766. If 0, plane will remain unchanged.
  9767. @end table
  9768. @subsection Commands
  9769. This filter supports the all above options as @ref{commands}.
  9770. @section interlace
  9771. Simple interlacing filter from progressive contents. This interleaves upper (or
  9772. lower) lines from odd frames with lower (or upper) lines from even frames,
  9773. halving the frame rate and preserving image height.
  9774. @example
  9775. Original Original New Frame
  9776. Frame 'j' Frame 'j+1' (tff)
  9777. ========== =========== ==================
  9778. Line 0 --------------------> Frame 'j' Line 0
  9779. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9780. Line 2 ---------------------> Frame 'j' Line 2
  9781. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9782. ... ... ...
  9783. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9784. @end example
  9785. It accepts the following optional parameters:
  9786. @table @option
  9787. @item scan
  9788. This determines whether the interlaced frame is taken from the even
  9789. (tff - default) or odd (bff) lines of the progressive frame.
  9790. @item lowpass
  9791. Vertical lowpass filter to avoid twitter interlacing and
  9792. reduce moire patterns.
  9793. @table @samp
  9794. @item 0, off
  9795. Disable vertical lowpass filter
  9796. @item 1, linear
  9797. Enable linear filter (default)
  9798. @item 2, complex
  9799. Enable complex filter. This will slightly less reduce twitter and moire
  9800. but better retain detail and subjective sharpness impression.
  9801. @end table
  9802. @end table
  9803. @section kerndeint
  9804. Deinterlace input video by applying Donald Graft's adaptive kernel
  9805. deinterling. Work on interlaced parts of a video to produce
  9806. progressive frames.
  9807. The description of the accepted parameters follows.
  9808. @table @option
  9809. @item thresh
  9810. Set the threshold which affects the filter's tolerance when
  9811. determining if a pixel line must be processed. It must be an integer
  9812. in the range [0,255] and defaults to 10. A value of 0 will result in
  9813. applying the process on every pixels.
  9814. @item map
  9815. Paint pixels exceeding the threshold value to white if set to 1.
  9816. Default is 0.
  9817. @item order
  9818. Set the fields order. Swap fields if set to 1, leave fields alone if
  9819. 0. Default is 0.
  9820. @item sharp
  9821. Enable additional sharpening if set to 1. Default is 0.
  9822. @item twoway
  9823. Enable twoway sharpening if set to 1. Default is 0.
  9824. @end table
  9825. @subsection Examples
  9826. @itemize
  9827. @item
  9828. Apply default values:
  9829. @example
  9830. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9831. @end example
  9832. @item
  9833. Enable additional sharpening:
  9834. @example
  9835. kerndeint=sharp=1
  9836. @end example
  9837. @item
  9838. Paint processed pixels in white:
  9839. @example
  9840. kerndeint=map=1
  9841. @end example
  9842. @end itemize
  9843. @section lagfun
  9844. Slowly update darker pixels.
  9845. This filter makes short flashes of light appear longer.
  9846. This filter accepts the following options:
  9847. @table @option
  9848. @item decay
  9849. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9850. @item planes
  9851. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9852. @end table
  9853. @section lenscorrection
  9854. Correct radial lens distortion
  9855. This filter can be used to correct for radial distortion as can result from the use
  9856. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9857. one can use tools available for example as part of opencv or simply trial-and-error.
  9858. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9859. and extract the k1 and k2 coefficients from the resulting matrix.
  9860. Note that effectively the same filter is available in the open-source tools Krita and
  9861. Digikam from the KDE project.
  9862. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9863. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9864. brightness distribution, so you may want to use both filters together in certain
  9865. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9866. be applied before or after lens correction.
  9867. @subsection Options
  9868. The filter accepts the following options:
  9869. @table @option
  9870. @item cx
  9871. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9872. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9873. width. Default is 0.5.
  9874. @item cy
  9875. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9876. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9877. height. Default is 0.5.
  9878. @item k1
  9879. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9880. no correction. Default is 0.
  9881. @item k2
  9882. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9883. 0 means no correction. Default is 0.
  9884. @end table
  9885. The formula that generates the correction is:
  9886. @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)
  9887. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9888. distances from the focal point in the source and target images, respectively.
  9889. @section lensfun
  9890. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9891. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9892. to apply the lens correction. The filter will load the lensfun database and
  9893. query it to find the corresponding camera and lens entries in the database. As
  9894. long as these entries can be found with the given options, the filter can
  9895. perform corrections on frames. Note that incomplete strings will result in the
  9896. filter choosing the best match with the given options, and the filter will
  9897. output the chosen camera and lens models (logged with level "info"). You must
  9898. provide the make, camera model, and lens model as they are required.
  9899. The filter accepts the following options:
  9900. @table @option
  9901. @item make
  9902. The make of the camera (for example, "Canon"). This option is required.
  9903. @item model
  9904. The model of the camera (for example, "Canon EOS 100D"). This option is
  9905. required.
  9906. @item lens_model
  9907. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9908. option is required.
  9909. @item mode
  9910. The type of correction to apply. The following values are valid options:
  9911. @table @samp
  9912. @item vignetting
  9913. Enables fixing lens vignetting.
  9914. @item geometry
  9915. Enables fixing lens geometry. This is the default.
  9916. @item subpixel
  9917. Enables fixing chromatic aberrations.
  9918. @item vig_geo
  9919. Enables fixing lens vignetting and lens geometry.
  9920. @item vig_subpixel
  9921. Enables fixing lens vignetting and chromatic aberrations.
  9922. @item distortion
  9923. Enables fixing both lens geometry and chromatic aberrations.
  9924. @item all
  9925. Enables all possible corrections.
  9926. @end table
  9927. @item focal_length
  9928. The focal length of the image/video (zoom; expected constant for video). For
  9929. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9930. range should be chosen when using that lens. Default 18.
  9931. @item aperture
  9932. The aperture of the image/video (expected constant for video). Note that
  9933. aperture is only used for vignetting correction. Default 3.5.
  9934. @item focus_distance
  9935. The focus distance of the image/video (expected constant for video). Note that
  9936. focus distance is only used for vignetting and only slightly affects the
  9937. vignetting correction process. If unknown, leave it at the default value (which
  9938. is 1000).
  9939. @item scale
  9940. The scale factor which is applied after transformation. After correction the
  9941. video is no longer necessarily rectangular. This parameter controls how much of
  9942. the resulting image is visible. The value 0 means that a value will be chosen
  9943. automatically such that there is little or no unmapped area in the output
  9944. image. 1.0 means that no additional scaling is done. Lower values may result
  9945. in more of the corrected image being visible, while higher values may avoid
  9946. unmapped areas in the output.
  9947. @item target_geometry
  9948. The target geometry of the output image/video. The following values are valid
  9949. options:
  9950. @table @samp
  9951. @item rectilinear (default)
  9952. @item fisheye
  9953. @item panoramic
  9954. @item equirectangular
  9955. @item fisheye_orthographic
  9956. @item fisheye_stereographic
  9957. @item fisheye_equisolid
  9958. @item fisheye_thoby
  9959. @end table
  9960. @item reverse
  9961. Apply the reverse of image correction (instead of correcting distortion, apply
  9962. it).
  9963. @item interpolation
  9964. The type of interpolation used when correcting distortion. The following values
  9965. are valid options:
  9966. @table @samp
  9967. @item nearest
  9968. @item linear (default)
  9969. @item lanczos
  9970. @end table
  9971. @end table
  9972. @subsection Examples
  9973. @itemize
  9974. @item
  9975. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9976. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9977. aperture of "8.0".
  9978. @example
  9979. 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
  9980. @end example
  9981. @item
  9982. Apply the same as before, but only for the first 5 seconds of video.
  9983. @example
  9984. 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
  9985. @end example
  9986. @end itemize
  9987. @section libvmaf
  9988. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9989. score between two input videos.
  9990. The obtained VMAF score is printed through the logging system.
  9991. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9992. After installing the library it can be enabled using:
  9993. @code{./configure --enable-libvmaf}.
  9994. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9995. The filter has following options:
  9996. @table @option
  9997. @item model_path
  9998. Set the model path which is to be used for SVM.
  9999. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  10000. @item log_path
  10001. Set the file path to be used to store logs.
  10002. @item log_fmt
  10003. Set the format of the log file (csv, json or xml).
  10004. @item enable_transform
  10005. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  10006. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  10007. Default value: @code{false}
  10008. @item phone_model
  10009. Invokes the phone model which will generate VMAF scores higher than in the
  10010. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  10011. Default value: @code{false}
  10012. @item psnr
  10013. Enables computing psnr along with vmaf.
  10014. Default value: @code{false}
  10015. @item ssim
  10016. Enables computing ssim along with vmaf.
  10017. Default value: @code{false}
  10018. @item ms_ssim
  10019. Enables computing ms_ssim along with vmaf.
  10020. Default value: @code{false}
  10021. @item pool
  10022. Set the pool method to be used for computing vmaf.
  10023. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  10024. @item n_threads
  10025. Set number of threads to be used when computing vmaf.
  10026. Default value: @code{0}, which makes use of all available logical processors.
  10027. @item n_subsample
  10028. Set interval for frame subsampling used when computing vmaf.
  10029. Default value: @code{1}
  10030. @item enable_conf_interval
  10031. Enables confidence interval.
  10032. Default value: @code{false}
  10033. @end table
  10034. This filter also supports the @ref{framesync} options.
  10035. @subsection Examples
  10036. @itemize
  10037. @item
  10038. On the below examples the input file @file{main.mpg} being processed is
  10039. compared with the reference file @file{ref.mpg}.
  10040. @example
  10041. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  10042. @end example
  10043. @item
  10044. Example with options:
  10045. @example
  10046. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  10047. @end example
  10048. @item
  10049. Example with options and different containers:
  10050. @example
  10051. 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 -
  10052. @end example
  10053. @end itemize
  10054. @section limiter
  10055. Limits the pixel components values to the specified range [min, max].
  10056. The filter accepts the following options:
  10057. @table @option
  10058. @item min
  10059. Lower bound. Defaults to the lowest allowed value for the input.
  10060. @item max
  10061. Upper bound. Defaults to the highest allowed value for the input.
  10062. @item planes
  10063. Specify which planes will be processed. Defaults to all available.
  10064. @end table
  10065. @section loop
  10066. Loop video frames.
  10067. The filter accepts the following options:
  10068. @table @option
  10069. @item loop
  10070. Set the number of loops. Setting this value to -1 will result in infinite loops.
  10071. Default is 0.
  10072. @item size
  10073. Set maximal size in number of frames. Default is 0.
  10074. @item start
  10075. Set first frame of loop. Default is 0.
  10076. @end table
  10077. @subsection Examples
  10078. @itemize
  10079. @item
  10080. Loop single first frame infinitely:
  10081. @example
  10082. loop=loop=-1:size=1:start=0
  10083. @end example
  10084. @item
  10085. Loop single first frame 10 times:
  10086. @example
  10087. loop=loop=10:size=1:start=0
  10088. @end example
  10089. @item
  10090. Loop 10 first frames 5 times:
  10091. @example
  10092. loop=loop=5:size=10:start=0
  10093. @end example
  10094. @end itemize
  10095. @section lut1d
  10096. Apply a 1D LUT to an input video.
  10097. The filter accepts the following options:
  10098. @table @option
  10099. @item file
  10100. Set the 1D LUT file name.
  10101. Currently supported formats:
  10102. @table @samp
  10103. @item cube
  10104. Iridas
  10105. @item csp
  10106. cineSpace
  10107. @end table
  10108. @item interp
  10109. Select interpolation mode.
  10110. Available values are:
  10111. @table @samp
  10112. @item nearest
  10113. Use values from the nearest defined point.
  10114. @item linear
  10115. Interpolate values using the linear interpolation.
  10116. @item cosine
  10117. Interpolate values using the cosine interpolation.
  10118. @item cubic
  10119. Interpolate values using the cubic interpolation.
  10120. @item spline
  10121. Interpolate values using the spline interpolation.
  10122. @end table
  10123. @end table
  10124. @anchor{lut3d}
  10125. @section lut3d
  10126. Apply a 3D LUT to an input video.
  10127. The filter accepts the following options:
  10128. @table @option
  10129. @item file
  10130. Set the 3D LUT file name.
  10131. Currently supported formats:
  10132. @table @samp
  10133. @item 3dl
  10134. AfterEffects
  10135. @item cube
  10136. Iridas
  10137. @item dat
  10138. DaVinci
  10139. @item m3d
  10140. Pandora
  10141. @item csp
  10142. cineSpace
  10143. @end table
  10144. @item interp
  10145. Select interpolation mode.
  10146. Available values are:
  10147. @table @samp
  10148. @item nearest
  10149. Use values from the nearest defined point.
  10150. @item trilinear
  10151. Interpolate values using the 8 points defining a cube.
  10152. @item tetrahedral
  10153. Interpolate values using a tetrahedron.
  10154. @end table
  10155. @end table
  10156. @section lumakey
  10157. Turn certain luma values into transparency.
  10158. The filter accepts the following options:
  10159. @table @option
  10160. @item threshold
  10161. Set the luma which will be used as base for transparency.
  10162. Default value is @code{0}.
  10163. @item tolerance
  10164. Set the range of luma values to be keyed out.
  10165. Default value is @code{0.01}.
  10166. @item softness
  10167. Set the range of softness. Default value is @code{0}.
  10168. Use this to control gradual transition from zero to full transparency.
  10169. @end table
  10170. @subsection Commands
  10171. This filter supports same @ref{commands} as options.
  10172. The command accepts the same syntax of the corresponding option.
  10173. If the specified expression is not valid, it is kept at its current
  10174. value.
  10175. @section lut, lutrgb, lutyuv
  10176. Compute a look-up table for binding each pixel component input value
  10177. to an output value, and apply it to the input video.
  10178. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10179. to an RGB input video.
  10180. These filters accept the following parameters:
  10181. @table @option
  10182. @item c0
  10183. set first pixel component expression
  10184. @item c1
  10185. set second pixel component expression
  10186. @item c2
  10187. set third pixel component expression
  10188. @item c3
  10189. set fourth pixel component expression, corresponds to the alpha component
  10190. @item r
  10191. set red component expression
  10192. @item g
  10193. set green component expression
  10194. @item b
  10195. set blue component expression
  10196. @item a
  10197. alpha component expression
  10198. @item y
  10199. set Y/luminance component expression
  10200. @item u
  10201. set U/Cb component expression
  10202. @item v
  10203. set V/Cr component expression
  10204. @end table
  10205. Each of them specifies the expression to use for computing the lookup table for
  10206. the corresponding pixel component values.
  10207. The exact component associated to each of the @var{c*} options depends on the
  10208. format in input.
  10209. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10210. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10211. The expressions can contain the following constants and functions:
  10212. @table @option
  10213. @item w
  10214. @item h
  10215. The input width and height.
  10216. @item val
  10217. The input value for the pixel component.
  10218. @item clipval
  10219. The input value, clipped to the @var{minval}-@var{maxval} range.
  10220. @item maxval
  10221. The maximum value for the pixel component.
  10222. @item minval
  10223. The minimum value for the pixel component.
  10224. @item negval
  10225. The negated value for the pixel component value, clipped to the
  10226. @var{minval}-@var{maxval} range; it corresponds to the expression
  10227. "maxval-clipval+minval".
  10228. @item clip(val)
  10229. The computed value in @var{val}, clipped to the
  10230. @var{minval}-@var{maxval} range.
  10231. @item gammaval(gamma)
  10232. The computed gamma correction value of the pixel component value,
  10233. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10234. expression
  10235. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10236. @end table
  10237. All expressions default to "val".
  10238. @subsection Examples
  10239. @itemize
  10240. @item
  10241. Negate input video:
  10242. @example
  10243. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10244. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10245. @end example
  10246. The above is the same as:
  10247. @example
  10248. lutrgb="r=negval:g=negval:b=negval"
  10249. lutyuv="y=negval:u=negval:v=negval"
  10250. @end example
  10251. @item
  10252. Negate luminance:
  10253. @example
  10254. lutyuv=y=negval
  10255. @end example
  10256. @item
  10257. Remove chroma components, turning the video into a graytone image:
  10258. @example
  10259. lutyuv="u=128:v=128"
  10260. @end example
  10261. @item
  10262. Apply a luma burning effect:
  10263. @example
  10264. lutyuv="y=2*val"
  10265. @end example
  10266. @item
  10267. Remove green and blue components:
  10268. @example
  10269. lutrgb="g=0:b=0"
  10270. @end example
  10271. @item
  10272. Set a constant alpha channel value on input:
  10273. @example
  10274. format=rgba,lutrgb=a="maxval-minval/2"
  10275. @end example
  10276. @item
  10277. Correct luminance gamma by a factor of 0.5:
  10278. @example
  10279. lutyuv=y=gammaval(0.5)
  10280. @end example
  10281. @item
  10282. Discard least significant bits of luma:
  10283. @example
  10284. lutyuv=y='bitand(val, 128+64+32)'
  10285. @end example
  10286. @item
  10287. Technicolor like effect:
  10288. @example
  10289. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10290. @end example
  10291. @end itemize
  10292. @section lut2, tlut2
  10293. The @code{lut2} filter takes two input streams and outputs one
  10294. stream.
  10295. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10296. from one single stream.
  10297. This filter accepts the following parameters:
  10298. @table @option
  10299. @item c0
  10300. set first pixel component expression
  10301. @item c1
  10302. set second pixel component expression
  10303. @item c2
  10304. set third pixel component expression
  10305. @item c3
  10306. set fourth pixel component expression, corresponds to the alpha component
  10307. @item d
  10308. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10309. which means bit depth is automatically picked from first input format.
  10310. @end table
  10311. The @code{lut2} filter also supports the @ref{framesync} options.
  10312. Each of them specifies the expression to use for computing the lookup table for
  10313. the corresponding pixel component values.
  10314. The exact component associated to each of the @var{c*} options depends on the
  10315. format in inputs.
  10316. The expressions can contain the following constants:
  10317. @table @option
  10318. @item w
  10319. @item h
  10320. The input width and height.
  10321. @item x
  10322. The first input value for the pixel component.
  10323. @item y
  10324. The second input value for the pixel component.
  10325. @item bdx
  10326. The first input video bit depth.
  10327. @item bdy
  10328. The second input video bit depth.
  10329. @end table
  10330. All expressions default to "x".
  10331. @subsection Examples
  10332. @itemize
  10333. @item
  10334. Highlight differences between two RGB video streams:
  10335. @example
  10336. 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)'
  10337. @end example
  10338. @item
  10339. Highlight differences between two YUV video streams:
  10340. @example
  10341. 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)'
  10342. @end example
  10343. @item
  10344. Show max difference between two video streams:
  10345. @example
  10346. 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)))'
  10347. @end example
  10348. @end itemize
  10349. @section maskedclamp
  10350. Clamp the first input stream with the second input and third input stream.
  10351. Returns the value of first stream to be between second input
  10352. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10353. This filter accepts the following options:
  10354. @table @option
  10355. @item undershoot
  10356. Default value is @code{0}.
  10357. @item overshoot
  10358. Default value is @code{0}.
  10359. @item planes
  10360. Set which planes will be processed as bitmap, unprocessed planes will be
  10361. copied from first stream.
  10362. By default value 0xf, all planes will be processed.
  10363. @end table
  10364. @section maskedmax
  10365. Merge the second and third input stream into output stream using absolute differences
  10366. between second input stream and first input stream and absolute difference between
  10367. third input stream and first input stream. The picked value will be from second input
  10368. stream if second absolute difference is greater than first one or from third input stream
  10369. otherwise.
  10370. This filter accepts the following options:
  10371. @table @option
  10372. @item planes
  10373. Set which planes will be processed as bitmap, unprocessed planes will be
  10374. copied from first stream.
  10375. By default value 0xf, all planes will be processed.
  10376. @end table
  10377. @section maskedmerge
  10378. Merge the first input stream with the second input stream using per pixel
  10379. weights in the third input stream.
  10380. A value of 0 in the third stream pixel component means that pixel component
  10381. from first stream is returned unchanged, while maximum value (eg. 255 for
  10382. 8-bit videos) means that pixel component from second stream is returned
  10383. unchanged. Intermediate values define the amount of merging between both
  10384. input stream's pixel components.
  10385. This filter accepts the following options:
  10386. @table @option
  10387. @item planes
  10388. Set which planes will be processed as bitmap, unprocessed planes will be
  10389. copied from first stream.
  10390. By default value 0xf, all planes will be processed.
  10391. @end table
  10392. @section maskedmin
  10393. Merge the second and third input stream into output stream using absolute differences
  10394. between second input stream and first input stream and absolute difference between
  10395. third input stream and first input stream. The picked value will be from second input
  10396. stream if second absolute difference is less than first one or from third input stream
  10397. otherwise.
  10398. This filter accepts the following options:
  10399. @table @option
  10400. @item planes
  10401. Set which planes will be processed as bitmap, unprocessed planes will be
  10402. copied from first stream.
  10403. By default value 0xf, all planes will be processed.
  10404. @end table
  10405. @section maskedthreshold
  10406. Pick pixels comparing absolute difference of two video streams with fixed
  10407. threshold.
  10408. If absolute difference between pixel component of first and second video
  10409. stream is equal or lower than user supplied threshold than pixel component
  10410. from first video stream is picked, otherwise pixel component from second
  10411. video stream is picked.
  10412. This filter accepts the following options:
  10413. @table @option
  10414. @item threshold
  10415. Set threshold used when picking pixels from absolute difference from two input
  10416. video streams.
  10417. @item planes
  10418. Set which planes will be processed as bitmap, unprocessed planes will be
  10419. copied from second stream.
  10420. By default value 0xf, all planes will be processed.
  10421. @end table
  10422. @section maskfun
  10423. Create mask from input video.
  10424. For example it is useful to create motion masks after @code{tblend} filter.
  10425. This filter accepts the following options:
  10426. @table @option
  10427. @item low
  10428. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10429. @item high
  10430. Set high threshold. Any pixel component higher than this value will be set to max value
  10431. allowed for current pixel format.
  10432. @item planes
  10433. Set planes to filter, by default all available planes are filtered.
  10434. @item fill
  10435. Fill all frame pixels with this value.
  10436. @item sum
  10437. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10438. average, output frame will be completely filled with value set by @var{fill} option.
  10439. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10440. @end table
  10441. @section mcdeint
  10442. Apply motion-compensation deinterlacing.
  10443. It needs one field per frame as input and must thus be used together
  10444. with yadif=1/3 or equivalent.
  10445. This filter accepts the following options:
  10446. @table @option
  10447. @item mode
  10448. Set the deinterlacing mode.
  10449. It accepts one of the following values:
  10450. @table @samp
  10451. @item fast
  10452. @item medium
  10453. @item slow
  10454. use iterative motion estimation
  10455. @item extra_slow
  10456. like @samp{slow}, but use multiple reference frames.
  10457. @end table
  10458. Default value is @samp{fast}.
  10459. @item parity
  10460. Set the picture field parity assumed for the input video. It must be
  10461. one of the following values:
  10462. @table @samp
  10463. @item 0, tff
  10464. assume top field first
  10465. @item 1, bff
  10466. assume bottom field first
  10467. @end table
  10468. Default value is @samp{bff}.
  10469. @item qp
  10470. Set per-block quantization parameter (QP) used by the internal
  10471. encoder.
  10472. Higher values should result in a smoother motion vector field but less
  10473. optimal individual vectors. Default value is 1.
  10474. @end table
  10475. @section median
  10476. Pick median pixel from certain rectangle defined by radius.
  10477. This filter accepts the following options:
  10478. @table @option
  10479. @item radius
  10480. Set horizontal radius size. Default value is @code{1}.
  10481. Allowed range is integer from 1 to 127.
  10482. @item planes
  10483. Set which planes to process. Default is @code{15}, which is all available planes.
  10484. @item radiusV
  10485. Set vertical radius size. Default value is @code{0}.
  10486. Allowed range is integer from 0 to 127.
  10487. If it is 0, value will be picked from horizontal @code{radius} option.
  10488. @item percentile
  10489. Set median percentile. Default value is @code{0.5}.
  10490. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10491. minimum values, and @code{1} maximum values.
  10492. @end table
  10493. @subsection Commands
  10494. This filter supports same @ref{commands} as options.
  10495. The command accepts the same syntax of the corresponding option.
  10496. If the specified expression is not valid, it is kept at its current
  10497. value.
  10498. @section mergeplanes
  10499. Merge color channel components from several video streams.
  10500. The filter accepts up to 4 input streams, and merge selected input
  10501. planes to the output video.
  10502. This filter accepts the following options:
  10503. @table @option
  10504. @item mapping
  10505. Set input to output plane mapping. Default is @code{0}.
  10506. The mappings is specified as a bitmap. It should be specified as a
  10507. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10508. mapping for the first plane of the output stream. 'A' sets the number of
  10509. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10510. corresponding input to use (from 0 to 3). The rest of the mappings is
  10511. similar, 'Bb' describes the mapping for the output stream second
  10512. plane, 'Cc' describes the mapping for the output stream third plane and
  10513. 'Dd' describes the mapping for the output stream fourth plane.
  10514. @item format
  10515. Set output pixel format. Default is @code{yuva444p}.
  10516. @end table
  10517. @subsection Examples
  10518. @itemize
  10519. @item
  10520. Merge three gray video streams of same width and height into single video stream:
  10521. @example
  10522. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10523. @end example
  10524. @item
  10525. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10526. @example
  10527. [a0][a1]mergeplanes=0x00010210:yuva444p
  10528. @end example
  10529. @item
  10530. Swap Y and A plane in yuva444p stream:
  10531. @example
  10532. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10533. @end example
  10534. @item
  10535. Swap U and V plane in yuv420p stream:
  10536. @example
  10537. format=yuv420p,mergeplanes=0x000201:yuv420p
  10538. @end example
  10539. @item
  10540. Cast a rgb24 clip to yuv444p:
  10541. @example
  10542. format=rgb24,mergeplanes=0x000102:yuv444p
  10543. @end example
  10544. @end itemize
  10545. @section mestimate
  10546. Estimate and export motion vectors using block matching algorithms.
  10547. Motion vectors are stored in frame side data to be used by other filters.
  10548. This filter accepts the following options:
  10549. @table @option
  10550. @item method
  10551. Specify the motion estimation method. Accepts one of the following values:
  10552. @table @samp
  10553. @item esa
  10554. Exhaustive search algorithm.
  10555. @item tss
  10556. Three step search algorithm.
  10557. @item tdls
  10558. Two dimensional logarithmic search algorithm.
  10559. @item ntss
  10560. New three step search algorithm.
  10561. @item fss
  10562. Four step search algorithm.
  10563. @item ds
  10564. Diamond search algorithm.
  10565. @item hexbs
  10566. Hexagon-based search algorithm.
  10567. @item epzs
  10568. Enhanced predictive zonal search algorithm.
  10569. @item umh
  10570. Uneven multi-hexagon search algorithm.
  10571. @end table
  10572. Default value is @samp{esa}.
  10573. @item mb_size
  10574. Macroblock size. Default @code{16}.
  10575. @item search_param
  10576. Search parameter. Default @code{7}.
  10577. @end table
  10578. @section midequalizer
  10579. Apply Midway Image Equalization effect using two video streams.
  10580. Midway Image Equalization adjusts a pair of images to have the same
  10581. histogram, while maintaining their dynamics as much as possible. It's
  10582. useful for e.g. matching exposures from a pair of stereo cameras.
  10583. This filter has two inputs and one output, which must be of same pixel format, but
  10584. may be of different sizes. The output of filter is first input adjusted with
  10585. midway histogram of both inputs.
  10586. This filter accepts the following option:
  10587. @table @option
  10588. @item planes
  10589. Set which planes to process. Default is @code{15}, which is all available planes.
  10590. @end table
  10591. @section minterpolate
  10592. Convert the video to specified frame rate using motion interpolation.
  10593. This filter accepts the following options:
  10594. @table @option
  10595. @item fps
  10596. 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}.
  10597. @item mi_mode
  10598. Motion interpolation mode. Following values are accepted:
  10599. @table @samp
  10600. @item dup
  10601. Duplicate previous or next frame for interpolating new ones.
  10602. @item blend
  10603. Blend source frames. Interpolated frame is mean of previous and next frames.
  10604. @item mci
  10605. Motion compensated interpolation. Following options are effective when this mode is selected:
  10606. @table @samp
  10607. @item mc_mode
  10608. Motion compensation mode. Following values are accepted:
  10609. @table @samp
  10610. @item obmc
  10611. Overlapped block motion compensation.
  10612. @item aobmc
  10613. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10614. @end table
  10615. Default mode is @samp{obmc}.
  10616. @item me_mode
  10617. Motion estimation mode. Following values are accepted:
  10618. @table @samp
  10619. @item bidir
  10620. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10621. @item bilat
  10622. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10623. @end table
  10624. Default mode is @samp{bilat}.
  10625. @item me
  10626. The algorithm to be used for motion estimation. Following values are accepted:
  10627. @table @samp
  10628. @item esa
  10629. Exhaustive search algorithm.
  10630. @item tss
  10631. Three step search algorithm.
  10632. @item tdls
  10633. Two dimensional logarithmic search algorithm.
  10634. @item ntss
  10635. New three step search algorithm.
  10636. @item fss
  10637. Four step search algorithm.
  10638. @item ds
  10639. Diamond search algorithm.
  10640. @item hexbs
  10641. Hexagon-based search algorithm.
  10642. @item epzs
  10643. Enhanced predictive zonal search algorithm.
  10644. @item umh
  10645. Uneven multi-hexagon search algorithm.
  10646. @end table
  10647. Default algorithm is @samp{epzs}.
  10648. @item mb_size
  10649. Macroblock size. Default @code{16}.
  10650. @item search_param
  10651. Motion estimation search parameter. Default @code{32}.
  10652. @item vsbmc
  10653. 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).
  10654. @end table
  10655. @end table
  10656. @item scd
  10657. 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:
  10658. @table @samp
  10659. @item none
  10660. Disable scene change detection.
  10661. @item fdiff
  10662. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10663. @end table
  10664. Default method is @samp{fdiff}.
  10665. @item scd_threshold
  10666. Scene change detection threshold. Default is @code{10.}.
  10667. @end table
  10668. @section mix
  10669. Mix several video input streams into one video stream.
  10670. A description of the accepted options follows.
  10671. @table @option
  10672. @item nb_inputs
  10673. The number of inputs. If unspecified, it defaults to 2.
  10674. @item weights
  10675. Specify weight of each input video stream as sequence.
  10676. Each weight is separated by space. If number of weights
  10677. is smaller than number of @var{frames} last specified
  10678. weight will be used for all remaining unset weights.
  10679. @item scale
  10680. Specify scale, if it is set it will be multiplied with sum
  10681. of each weight multiplied with pixel values to give final destination
  10682. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10683. @item duration
  10684. Specify how end of stream is determined.
  10685. @table @samp
  10686. @item longest
  10687. The duration of the longest input. (default)
  10688. @item shortest
  10689. The duration of the shortest input.
  10690. @item first
  10691. The duration of the first input.
  10692. @end table
  10693. @end table
  10694. @section mpdecimate
  10695. Drop frames that do not differ greatly from the previous frame in
  10696. order to reduce frame rate.
  10697. The main use of this filter is for very-low-bitrate encoding
  10698. (e.g. streaming over dialup modem), but it could in theory be used for
  10699. fixing movies that were inverse-telecined incorrectly.
  10700. A description of the accepted options follows.
  10701. @table @option
  10702. @item max
  10703. Set the maximum number of consecutive frames which can be dropped (if
  10704. positive), or the minimum interval between dropped frames (if
  10705. negative). If the value is 0, the frame is dropped disregarding the
  10706. number of previous sequentially dropped frames.
  10707. Default value is 0.
  10708. @item hi
  10709. @item lo
  10710. @item frac
  10711. Set the dropping threshold values.
  10712. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10713. represent actual pixel value differences, so a threshold of 64
  10714. corresponds to 1 unit of difference for each pixel, or the same spread
  10715. out differently over the block.
  10716. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10717. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10718. meaning the whole image) differ by more than a threshold of @option{lo}.
  10719. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10720. 64*5, and default value for @option{frac} is 0.33.
  10721. @end table
  10722. @section negate
  10723. Negate (invert) the input video.
  10724. It accepts the following option:
  10725. @table @option
  10726. @item negate_alpha
  10727. With value 1, it negates the alpha component, if present. Default value is 0.
  10728. @end table
  10729. @anchor{nlmeans}
  10730. @section nlmeans
  10731. Denoise frames using Non-Local Means algorithm.
  10732. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10733. context similarity is defined by comparing their surrounding patches of size
  10734. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10735. around the pixel.
  10736. Note that the research area defines centers for patches, which means some
  10737. patches will be made of pixels outside that research area.
  10738. The filter accepts the following options.
  10739. @table @option
  10740. @item s
  10741. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10742. @item p
  10743. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10744. @item pc
  10745. Same as @option{p} but for chroma planes.
  10746. The default value is @var{0} and means automatic.
  10747. @item r
  10748. Set research size. Default is 15. Must be odd number in range [0, 99].
  10749. @item rc
  10750. Same as @option{r} but for chroma planes.
  10751. The default value is @var{0} and means automatic.
  10752. @end table
  10753. @section nnedi
  10754. Deinterlace video using neural network edge directed interpolation.
  10755. This filter accepts the following options:
  10756. @table @option
  10757. @item weights
  10758. Mandatory option, without binary file filter can not work.
  10759. Currently file can be found here:
  10760. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10761. @item deint
  10762. Set which frames to deinterlace, by default it is @code{all}.
  10763. Can be @code{all} or @code{interlaced}.
  10764. @item field
  10765. Set mode of operation.
  10766. Can be one of the following:
  10767. @table @samp
  10768. @item af
  10769. Use frame flags, both fields.
  10770. @item a
  10771. Use frame flags, single field.
  10772. @item t
  10773. Use top field only.
  10774. @item b
  10775. Use bottom field only.
  10776. @item tf
  10777. Use both fields, top first.
  10778. @item bf
  10779. Use both fields, bottom first.
  10780. @end table
  10781. @item planes
  10782. Set which planes to process, by default filter process all frames.
  10783. @item nsize
  10784. Set size of local neighborhood around each pixel, used by the predictor neural
  10785. network.
  10786. Can be one of the following:
  10787. @table @samp
  10788. @item s8x6
  10789. @item s16x6
  10790. @item s32x6
  10791. @item s48x6
  10792. @item s8x4
  10793. @item s16x4
  10794. @item s32x4
  10795. @end table
  10796. @item nns
  10797. Set the number of neurons in predictor neural network.
  10798. Can be one of the following:
  10799. @table @samp
  10800. @item n16
  10801. @item n32
  10802. @item n64
  10803. @item n128
  10804. @item n256
  10805. @end table
  10806. @item qual
  10807. Controls the number of different neural network predictions that are blended
  10808. together to compute the final output value. Can be @code{fast}, default or
  10809. @code{slow}.
  10810. @item etype
  10811. Set which set of weights to use in the predictor.
  10812. Can be one of the following:
  10813. @table @samp
  10814. @item a
  10815. weights trained to minimize absolute error
  10816. @item s
  10817. weights trained to minimize squared error
  10818. @end table
  10819. @item pscrn
  10820. Controls whether or not the prescreener neural network is used to decide
  10821. which pixels should be processed by the predictor neural network and which
  10822. can be handled by simple cubic interpolation.
  10823. The prescreener is trained to know whether cubic interpolation will be
  10824. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10825. The computational complexity of the prescreener nn is much less than that of
  10826. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10827. using the prescreener generally results in much faster processing.
  10828. The prescreener is pretty accurate, so the difference between using it and not
  10829. using it is almost always unnoticeable.
  10830. Can be one of the following:
  10831. @table @samp
  10832. @item none
  10833. @item original
  10834. @item new
  10835. @end table
  10836. Default is @code{new}.
  10837. @item fapprox
  10838. Set various debugging flags.
  10839. @end table
  10840. @section noformat
  10841. Force libavfilter not to use any of the specified pixel formats for the
  10842. input to the next filter.
  10843. It accepts the following parameters:
  10844. @table @option
  10845. @item pix_fmts
  10846. A '|'-separated list of pixel format names, such as
  10847. pix_fmts=yuv420p|monow|rgb24".
  10848. @end table
  10849. @subsection Examples
  10850. @itemize
  10851. @item
  10852. Force libavfilter to use a format different from @var{yuv420p} for the
  10853. input to the vflip filter:
  10854. @example
  10855. noformat=pix_fmts=yuv420p,vflip
  10856. @end example
  10857. @item
  10858. Convert the input video to any of the formats not contained in the list:
  10859. @example
  10860. noformat=yuv420p|yuv444p|yuv410p
  10861. @end example
  10862. @end itemize
  10863. @section noise
  10864. Add noise on video input frame.
  10865. The filter accepts the following options:
  10866. @table @option
  10867. @item all_seed
  10868. @item c0_seed
  10869. @item c1_seed
  10870. @item c2_seed
  10871. @item c3_seed
  10872. Set noise seed for specific pixel component or all pixel components in case
  10873. of @var{all_seed}. Default value is @code{123457}.
  10874. @item all_strength, alls
  10875. @item c0_strength, c0s
  10876. @item c1_strength, c1s
  10877. @item c2_strength, c2s
  10878. @item c3_strength, c3s
  10879. Set noise strength for specific pixel component or all pixel components in case
  10880. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10881. @item all_flags, allf
  10882. @item c0_flags, c0f
  10883. @item c1_flags, c1f
  10884. @item c2_flags, c2f
  10885. @item c3_flags, c3f
  10886. Set pixel component flags or set flags for all components if @var{all_flags}.
  10887. Available values for component flags are:
  10888. @table @samp
  10889. @item a
  10890. averaged temporal noise (smoother)
  10891. @item p
  10892. mix random noise with a (semi)regular pattern
  10893. @item t
  10894. temporal noise (noise pattern changes between frames)
  10895. @item u
  10896. uniform noise (gaussian otherwise)
  10897. @end table
  10898. @end table
  10899. @subsection Examples
  10900. Add temporal and uniform noise to input video:
  10901. @example
  10902. noise=alls=20:allf=t+u
  10903. @end example
  10904. @section normalize
  10905. Normalize RGB video (aka histogram stretching, contrast stretching).
  10906. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10907. For each channel of each frame, the filter computes the input range and maps
  10908. it linearly to the user-specified output range. The output range defaults
  10909. to the full dynamic range from pure black to pure white.
  10910. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10911. changes in brightness) caused when small dark or bright objects enter or leave
  10912. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10913. video camera, and, like a video camera, it may cause a period of over- or
  10914. under-exposure of the video.
  10915. The R,G,B channels can be normalized independently, which may cause some
  10916. color shifting, or linked together as a single channel, which prevents
  10917. color shifting. Linked normalization preserves hue. Independent normalization
  10918. does not, so it can be used to remove some color casts. Independent and linked
  10919. normalization can be combined in any ratio.
  10920. The normalize filter accepts the following options:
  10921. @table @option
  10922. @item blackpt
  10923. @item whitept
  10924. Colors which define the output range. The minimum input value is mapped to
  10925. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10926. The defaults are black and white respectively. Specifying white for
  10927. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10928. normalized video. Shades of grey can be used to reduce the dynamic range
  10929. (contrast). Specifying saturated colors here can create some interesting
  10930. effects.
  10931. @item smoothing
  10932. The number of previous frames to use for temporal smoothing. The input range
  10933. of each channel is smoothed using a rolling average over the current frame
  10934. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10935. smoothing).
  10936. @item independence
  10937. Controls the ratio of independent (color shifting) channel normalization to
  10938. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10939. independent. Defaults to 1.0 (fully independent).
  10940. @item strength
  10941. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10942. expensive no-op. Defaults to 1.0 (full strength).
  10943. @end table
  10944. @subsection Commands
  10945. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10946. The command accepts the same syntax of the corresponding option.
  10947. If the specified expression is not valid, it is kept at its current
  10948. value.
  10949. @subsection Examples
  10950. Stretch video contrast to use the full dynamic range, with no temporal
  10951. smoothing; may flicker depending on the source content:
  10952. @example
  10953. normalize=blackpt=black:whitept=white:smoothing=0
  10954. @end example
  10955. As above, but with 50 frames of temporal smoothing; flicker should be
  10956. reduced, depending on the source content:
  10957. @example
  10958. normalize=blackpt=black:whitept=white:smoothing=50
  10959. @end example
  10960. As above, but with hue-preserving linked channel normalization:
  10961. @example
  10962. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10963. @end example
  10964. As above, but with half strength:
  10965. @example
  10966. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10967. @end example
  10968. Map the darkest input color to red, the brightest input color to cyan:
  10969. @example
  10970. normalize=blackpt=red:whitept=cyan
  10971. @end example
  10972. @section null
  10973. Pass the video source unchanged to the output.
  10974. @section ocr
  10975. Optical Character Recognition
  10976. This filter uses Tesseract for optical character recognition. To enable
  10977. compilation of this filter, you need to configure FFmpeg with
  10978. @code{--enable-libtesseract}.
  10979. It accepts the following options:
  10980. @table @option
  10981. @item datapath
  10982. Set datapath to tesseract data. Default is to use whatever was
  10983. set at installation.
  10984. @item language
  10985. Set language, default is "eng".
  10986. @item whitelist
  10987. Set character whitelist.
  10988. @item blacklist
  10989. Set character blacklist.
  10990. @end table
  10991. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10992. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10993. @section ocv
  10994. Apply a video transform using libopencv.
  10995. To enable this filter, install the libopencv library and headers and
  10996. configure FFmpeg with @code{--enable-libopencv}.
  10997. It accepts the following parameters:
  10998. @table @option
  10999. @item filter_name
  11000. The name of the libopencv filter to apply.
  11001. @item filter_params
  11002. The parameters to pass to the libopencv filter. If not specified, the default
  11003. values are assumed.
  11004. @end table
  11005. Refer to the official libopencv documentation for more precise
  11006. information:
  11007. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  11008. Several libopencv filters are supported; see the following subsections.
  11009. @anchor{dilate}
  11010. @subsection dilate
  11011. Dilate an image by using a specific structuring element.
  11012. It corresponds to the libopencv function @code{cvDilate}.
  11013. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  11014. @var{struct_el} represents a structuring element, and has the syntax:
  11015. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  11016. @var{cols} and @var{rows} represent the number of columns and rows of
  11017. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  11018. point, and @var{shape} the shape for the structuring element. @var{shape}
  11019. must be "rect", "cross", "ellipse", or "custom".
  11020. If the value for @var{shape} is "custom", it must be followed by a
  11021. string of the form "=@var{filename}". The file with name
  11022. @var{filename} is assumed to represent a binary image, with each
  11023. printable character corresponding to a bright pixel. When a custom
  11024. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  11025. or columns and rows of the read file are assumed instead.
  11026. The default value for @var{struct_el} is "3x3+0x0/rect".
  11027. @var{nb_iterations} specifies the number of times the transform is
  11028. applied to the image, and defaults to 1.
  11029. Some examples:
  11030. @example
  11031. # Use the default values
  11032. ocv=dilate
  11033. # Dilate using a structuring element with a 5x5 cross, iterating two times
  11034. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  11035. # Read the shape from the file diamond.shape, iterating two times.
  11036. # The file diamond.shape may contain a pattern of characters like this
  11037. # *
  11038. # ***
  11039. # *****
  11040. # ***
  11041. # *
  11042. # The specified columns and rows are ignored
  11043. # but the anchor point coordinates are not
  11044. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  11045. @end example
  11046. @subsection erode
  11047. Erode an image by using a specific structuring element.
  11048. It corresponds to the libopencv function @code{cvErode}.
  11049. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  11050. with the same syntax and semantics as the @ref{dilate} filter.
  11051. @subsection smooth
  11052. Smooth the input video.
  11053. The filter takes the following parameters:
  11054. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  11055. @var{type} is the type of smooth filter to apply, and must be one of
  11056. the following values: "blur", "blur_no_scale", "median", "gaussian",
  11057. or "bilateral". The default value is "gaussian".
  11058. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  11059. depends on the smooth type. @var{param1} and
  11060. @var{param2} accept integer positive values or 0. @var{param3} and
  11061. @var{param4} accept floating point values.
  11062. The default value for @var{param1} is 3. The default value for the
  11063. other parameters is 0.
  11064. These parameters correspond to the parameters assigned to the
  11065. libopencv function @code{cvSmooth}.
  11066. @section oscilloscope
  11067. 2D Video Oscilloscope.
  11068. Useful to measure spatial impulse, step responses, chroma delays, etc.
  11069. It accepts the following parameters:
  11070. @table @option
  11071. @item x
  11072. Set scope center x position.
  11073. @item y
  11074. Set scope center y position.
  11075. @item s
  11076. Set scope size, relative to frame diagonal.
  11077. @item t
  11078. Set scope tilt/rotation.
  11079. @item o
  11080. Set trace opacity.
  11081. @item tx
  11082. Set trace center x position.
  11083. @item ty
  11084. Set trace center y position.
  11085. @item tw
  11086. Set trace width, relative to width of frame.
  11087. @item th
  11088. Set trace height, relative to height of frame.
  11089. @item c
  11090. Set which components to trace. By default it traces first three components.
  11091. @item g
  11092. Draw trace grid. By default is enabled.
  11093. @item st
  11094. Draw some statistics. By default is enabled.
  11095. @item sc
  11096. Draw scope. By default is enabled.
  11097. @end table
  11098. @subsection Commands
  11099. This filter supports same @ref{commands} as options.
  11100. The command accepts the same syntax of the corresponding option.
  11101. If the specified expression is not valid, it is kept at its current
  11102. value.
  11103. @subsection Examples
  11104. @itemize
  11105. @item
  11106. Inspect full first row of video frame.
  11107. @example
  11108. oscilloscope=x=0.5:y=0:s=1
  11109. @end example
  11110. @item
  11111. Inspect full last row of video frame.
  11112. @example
  11113. oscilloscope=x=0.5:y=1:s=1
  11114. @end example
  11115. @item
  11116. Inspect full 5th line of video frame of height 1080.
  11117. @example
  11118. oscilloscope=x=0.5:y=5/1080:s=1
  11119. @end example
  11120. @item
  11121. Inspect full last column of video frame.
  11122. @example
  11123. oscilloscope=x=1:y=0.5:s=1:t=1
  11124. @end example
  11125. @end itemize
  11126. @anchor{overlay}
  11127. @section overlay
  11128. Overlay one video on top of another.
  11129. It takes two inputs and has one output. The first input is the "main"
  11130. video on which the second input is overlaid.
  11131. It accepts the following parameters:
  11132. A description of the accepted options follows.
  11133. @table @option
  11134. @item x
  11135. @item y
  11136. Set the expression for the x and y coordinates of the overlaid video
  11137. on the main video. Default value is "0" for both expressions. In case
  11138. the expression is invalid, it is set to a huge value (meaning that the
  11139. overlay will not be displayed within the output visible area).
  11140. @item eof_action
  11141. See @ref{framesync}.
  11142. @item eval
  11143. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11144. It accepts the following values:
  11145. @table @samp
  11146. @item init
  11147. only evaluate expressions once during the filter initialization or
  11148. when a command is processed
  11149. @item frame
  11150. evaluate expressions for each incoming frame
  11151. @end table
  11152. Default value is @samp{frame}.
  11153. @item shortest
  11154. See @ref{framesync}.
  11155. @item format
  11156. Set the format for the output video.
  11157. It accepts the following values:
  11158. @table @samp
  11159. @item yuv420
  11160. force YUV420 output
  11161. @item yuv420p10
  11162. force YUV420p10 output
  11163. @item yuv422
  11164. force YUV422 output
  11165. @item yuv422p10
  11166. force YUV422p10 output
  11167. @item yuv444
  11168. force YUV444 output
  11169. @item rgb
  11170. force packed RGB output
  11171. @item gbrp
  11172. force planar RGB output
  11173. @item auto
  11174. automatically pick format
  11175. @end table
  11176. Default value is @samp{yuv420}.
  11177. @item repeatlast
  11178. See @ref{framesync}.
  11179. @item alpha
  11180. Set format of alpha of the overlaid video, it can be @var{straight} or
  11181. @var{premultiplied}. Default is @var{straight}.
  11182. @end table
  11183. The @option{x}, and @option{y} expressions can contain the following
  11184. parameters.
  11185. @table @option
  11186. @item main_w, W
  11187. @item main_h, H
  11188. The main input width and height.
  11189. @item overlay_w, w
  11190. @item overlay_h, h
  11191. The overlay input width and height.
  11192. @item x
  11193. @item y
  11194. The computed values for @var{x} and @var{y}. They are evaluated for
  11195. each new frame.
  11196. @item hsub
  11197. @item vsub
  11198. horizontal and vertical chroma subsample values of the output
  11199. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11200. @var{vsub} is 1.
  11201. @item n
  11202. the number of input frame, starting from 0
  11203. @item pos
  11204. the position in the file of the input frame, NAN if unknown
  11205. @item t
  11206. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11207. @end table
  11208. This filter also supports the @ref{framesync} options.
  11209. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11210. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11211. when @option{eval} is set to @samp{init}.
  11212. Be aware that frames are taken from each input video in timestamp
  11213. order, hence, if their initial timestamps differ, it is a good idea
  11214. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11215. have them begin in the same zero timestamp, as the example for
  11216. the @var{movie} filter does.
  11217. You can chain together more overlays but you should test the
  11218. efficiency of such approach.
  11219. @subsection Commands
  11220. This filter supports the following commands:
  11221. @table @option
  11222. @item x
  11223. @item y
  11224. Modify the x and y of the overlay input.
  11225. The command accepts the same syntax of the corresponding option.
  11226. If the specified expression is not valid, it is kept at its current
  11227. value.
  11228. @end table
  11229. @subsection Examples
  11230. @itemize
  11231. @item
  11232. Draw the overlay at 10 pixels from the bottom right corner of the main
  11233. video:
  11234. @example
  11235. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11236. @end example
  11237. Using named options the example above becomes:
  11238. @example
  11239. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11240. @end example
  11241. @item
  11242. Insert a transparent PNG logo in the bottom left corner of the input,
  11243. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11244. @example
  11245. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11246. @end example
  11247. @item
  11248. Insert 2 different transparent PNG logos (second logo on bottom
  11249. right corner) using the @command{ffmpeg} tool:
  11250. @example
  11251. 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
  11252. @end example
  11253. @item
  11254. Add a transparent color layer on top of the main video; @code{WxH}
  11255. must specify the size of the main input to the overlay filter:
  11256. @example
  11257. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11258. @end example
  11259. @item
  11260. Play an original video and a filtered version (here with the deshake
  11261. filter) side by side using the @command{ffplay} tool:
  11262. @example
  11263. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11264. @end example
  11265. The above command is the same as:
  11266. @example
  11267. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11268. @end example
  11269. @item
  11270. Make a sliding overlay appearing from the left to the right top part of the
  11271. screen starting since time 2:
  11272. @example
  11273. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11274. @end example
  11275. @item
  11276. Compose output by putting two input videos side to side:
  11277. @example
  11278. ffmpeg -i left.avi -i right.avi -filter_complex "
  11279. nullsrc=size=200x100 [background];
  11280. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11281. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11282. [background][left] overlay=shortest=1 [background+left];
  11283. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11284. "
  11285. @end example
  11286. @item
  11287. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11288. @example
  11289. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11290. -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]'
  11291. masked.avi
  11292. @end example
  11293. @item
  11294. Chain several overlays in cascade:
  11295. @example
  11296. nullsrc=s=200x200 [bg];
  11297. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11298. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11299. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11300. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11301. [in3] null, [mid2] overlay=100:100 [out0]
  11302. @end example
  11303. @end itemize
  11304. @anchor{overlay_cuda}
  11305. @section overlay_cuda
  11306. Overlay one video on top of another.
  11307. This is the CUDA cariant of the @ref{overlay} filter.
  11308. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11309. It takes two inputs and has one output. The first input is the "main"
  11310. video on which the second input is overlaid.
  11311. It accepts the following parameters:
  11312. @table @option
  11313. @item x
  11314. @item y
  11315. Set the x and y coordinates of the overlaid video on the main video.
  11316. Default value is "0" for both expressions.
  11317. @item eof_action
  11318. See @ref{framesync}.
  11319. @item shortest
  11320. See @ref{framesync}.
  11321. @item repeatlast
  11322. See @ref{framesync}.
  11323. @end table
  11324. This filter also supports the @ref{framesync} options.
  11325. @section owdenoise
  11326. Apply Overcomplete Wavelet denoiser.
  11327. The filter accepts the following options:
  11328. @table @option
  11329. @item depth
  11330. Set depth.
  11331. Larger depth values will denoise lower frequency components more, but
  11332. slow down filtering.
  11333. Must be an int in the range 8-16, default is @code{8}.
  11334. @item luma_strength, ls
  11335. Set luma strength.
  11336. Must be a double value in the range 0-1000, default is @code{1.0}.
  11337. @item chroma_strength, cs
  11338. Set chroma strength.
  11339. Must be a double value in the range 0-1000, default is @code{1.0}.
  11340. @end table
  11341. @anchor{pad}
  11342. @section pad
  11343. Add paddings to the input image, and place the original input at the
  11344. provided @var{x}, @var{y} coordinates.
  11345. It accepts the following parameters:
  11346. @table @option
  11347. @item width, w
  11348. @item height, h
  11349. Specify an expression for the size of the output image with the
  11350. paddings added. If the value for @var{width} or @var{height} is 0, the
  11351. corresponding input size is used for the output.
  11352. The @var{width} expression can reference the value set by the
  11353. @var{height} expression, and vice versa.
  11354. The default value of @var{width} and @var{height} is 0.
  11355. @item x
  11356. @item y
  11357. Specify the offsets to place the input image at within the padded area,
  11358. with respect to the top/left border of the output image.
  11359. The @var{x} expression can reference the value set by the @var{y}
  11360. expression, and vice versa.
  11361. The default value of @var{x} and @var{y} is 0.
  11362. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11363. so the input image is centered on the padded area.
  11364. @item color
  11365. Specify the color of the padded area. For the syntax of this option,
  11366. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11367. manual,ffmpeg-utils}.
  11368. The default value of @var{color} is "black".
  11369. @item eval
  11370. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11371. It accepts the following values:
  11372. @table @samp
  11373. @item init
  11374. Only evaluate expressions once during the filter initialization or when
  11375. a command is processed.
  11376. @item frame
  11377. Evaluate expressions for each incoming frame.
  11378. @end table
  11379. Default value is @samp{init}.
  11380. @item aspect
  11381. Pad to aspect instead to a resolution.
  11382. @end table
  11383. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11384. options are expressions containing the following constants:
  11385. @table @option
  11386. @item in_w
  11387. @item in_h
  11388. The input video width and height.
  11389. @item iw
  11390. @item ih
  11391. These are the same as @var{in_w} and @var{in_h}.
  11392. @item out_w
  11393. @item out_h
  11394. The output width and height (the size of the padded area), as
  11395. specified by the @var{width} and @var{height} expressions.
  11396. @item ow
  11397. @item oh
  11398. These are the same as @var{out_w} and @var{out_h}.
  11399. @item x
  11400. @item y
  11401. The x and y offsets as specified by the @var{x} and @var{y}
  11402. expressions, or NAN if not yet specified.
  11403. @item a
  11404. same as @var{iw} / @var{ih}
  11405. @item sar
  11406. input sample aspect ratio
  11407. @item dar
  11408. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11409. @item hsub
  11410. @item vsub
  11411. The horizontal and vertical chroma subsample values. For example for the
  11412. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11413. @end table
  11414. @subsection Examples
  11415. @itemize
  11416. @item
  11417. Add paddings with the color "violet" to the input video. The output video
  11418. size is 640x480, and the top-left corner of the input video is placed at
  11419. column 0, row 40
  11420. @example
  11421. pad=640:480:0:40:violet
  11422. @end example
  11423. The example above is equivalent to the following command:
  11424. @example
  11425. pad=width=640:height=480:x=0:y=40:color=violet
  11426. @end example
  11427. @item
  11428. Pad the input to get an output with dimensions increased by 3/2,
  11429. and put the input video at the center of the padded area:
  11430. @example
  11431. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11432. @end example
  11433. @item
  11434. Pad the input to get a squared output with size equal to the maximum
  11435. value between the input width and height, and put the input video at
  11436. the center of the padded area:
  11437. @example
  11438. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11439. @end example
  11440. @item
  11441. Pad the input to get a final w/h ratio of 16:9:
  11442. @example
  11443. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11444. @end example
  11445. @item
  11446. In case of anamorphic video, in order to set the output display aspect
  11447. correctly, it is necessary to use @var{sar} in the expression,
  11448. according to the relation:
  11449. @example
  11450. (ih * X / ih) * sar = output_dar
  11451. X = output_dar / sar
  11452. @end example
  11453. Thus the previous example needs to be modified to:
  11454. @example
  11455. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11456. @end example
  11457. @item
  11458. Double the output size and put the input video in the bottom-right
  11459. corner of the output padded area:
  11460. @example
  11461. pad="2*iw:2*ih:ow-iw:oh-ih"
  11462. @end example
  11463. @end itemize
  11464. @anchor{palettegen}
  11465. @section palettegen
  11466. Generate one palette for a whole video stream.
  11467. It accepts the following options:
  11468. @table @option
  11469. @item max_colors
  11470. Set the maximum number of colors to quantize in the palette.
  11471. Note: the palette will still contain 256 colors; the unused palette entries
  11472. will be black.
  11473. @item reserve_transparent
  11474. Create a palette of 255 colors maximum and reserve the last one for
  11475. transparency. Reserving the transparency color is useful for GIF optimization.
  11476. If not set, the maximum of colors in the palette will be 256. You probably want
  11477. to disable this option for a standalone image.
  11478. Set by default.
  11479. @item transparency_color
  11480. Set the color that will be used as background for transparency.
  11481. @item stats_mode
  11482. Set statistics mode.
  11483. It accepts the following values:
  11484. @table @samp
  11485. @item full
  11486. Compute full frame histograms.
  11487. @item diff
  11488. Compute histograms only for the part that differs from previous frame. This
  11489. might be relevant to give more importance to the moving part of your input if
  11490. the background is static.
  11491. @item single
  11492. Compute new histogram for each frame.
  11493. @end table
  11494. Default value is @var{full}.
  11495. @end table
  11496. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11497. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11498. color quantization of the palette. This information is also visible at
  11499. @var{info} logging level.
  11500. @subsection Examples
  11501. @itemize
  11502. @item
  11503. Generate a representative palette of a given video using @command{ffmpeg}:
  11504. @example
  11505. ffmpeg -i input.mkv -vf palettegen palette.png
  11506. @end example
  11507. @end itemize
  11508. @section paletteuse
  11509. Use a palette to downsample an input video stream.
  11510. The filter takes two inputs: one video stream and a palette. The palette must
  11511. be a 256 pixels image.
  11512. It accepts the following options:
  11513. @table @option
  11514. @item dither
  11515. Select dithering mode. Available algorithms are:
  11516. @table @samp
  11517. @item bayer
  11518. Ordered 8x8 bayer dithering (deterministic)
  11519. @item heckbert
  11520. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11521. Note: this dithering is sometimes considered "wrong" and is included as a
  11522. reference.
  11523. @item floyd_steinberg
  11524. Floyd and Steingberg dithering (error diffusion)
  11525. @item sierra2
  11526. Frankie Sierra dithering v2 (error diffusion)
  11527. @item sierra2_4a
  11528. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11529. @end table
  11530. Default is @var{sierra2_4a}.
  11531. @item bayer_scale
  11532. When @var{bayer} dithering is selected, this option defines the scale of the
  11533. pattern (how much the crosshatch pattern is visible). A low value means more
  11534. visible pattern for less banding, and higher value means less visible pattern
  11535. at the cost of more banding.
  11536. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11537. @item diff_mode
  11538. If set, define the zone to process
  11539. @table @samp
  11540. @item rectangle
  11541. Only the changing rectangle will be reprocessed. This is similar to GIF
  11542. cropping/offsetting compression mechanism. This option can be useful for speed
  11543. if only a part of the image is changing, and has use cases such as limiting the
  11544. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11545. moving scene (it leads to more deterministic output if the scene doesn't change
  11546. much, and as a result less moving noise and better GIF compression).
  11547. @end table
  11548. Default is @var{none}.
  11549. @item new
  11550. Take new palette for each output frame.
  11551. @item alpha_threshold
  11552. Sets the alpha threshold for transparency. Alpha values above this threshold
  11553. will be treated as completely opaque, and values below this threshold will be
  11554. treated as completely transparent.
  11555. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11556. @end table
  11557. @subsection Examples
  11558. @itemize
  11559. @item
  11560. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11561. using @command{ffmpeg}:
  11562. @example
  11563. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11564. @end example
  11565. @end itemize
  11566. @section perspective
  11567. Correct perspective of video not recorded perpendicular to the screen.
  11568. A description of the accepted parameters follows.
  11569. @table @option
  11570. @item x0
  11571. @item y0
  11572. @item x1
  11573. @item y1
  11574. @item x2
  11575. @item y2
  11576. @item x3
  11577. @item y3
  11578. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11579. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11580. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11581. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11582. then the corners of the source will be sent to the specified coordinates.
  11583. The expressions can use the following variables:
  11584. @table @option
  11585. @item W
  11586. @item H
  11587. the width and height of video frame.
  11588. @item in
  11589. Input frame count.
  11590. @item on
  11591. Output frame count.
  11592. @end table
  11593. @item interpolation
  11594. Set interpolation for perspective correction.
  11595. It accepts the following values:
  11596. @table @samp
  11597. @item linear
  11598. @item cubic
  11599. @end table
  11600. Default value is @samp{linear}.
  11601. @item sense
  11602. Set interpretation of coordinate options.
  11603. It accepts the following values:
  11604. @table @samp
  11605. @item 0, source
  11606. Send point in the source specified by the given coordinates to
  11607. the corners of the destination.
  11608. @item 1, destination
  11609. Send the corners of the source to the point in the destination specified
  11610. by the given coordinates.
  11611. Default value is @samp{source}.
  11612. @end table
  11613. @item eval
  11614. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11615. It accepts the following values:
  11616. @table @samp
  11617. @item init
  11618. only evaluate expressions once during the filter initialization or
  11619. when a command is processed
  11620. @item frame
  11621. evaluate expressions for each incoming frame
  11622. @end table
  11623. Default value is @samp{init}.
  11624. @end table
  11625. @section phase
  11626. Delay interlaced video by one field time so that the field order changes.
  11627. The intended use is to fix PAL movies that have been captured with the
  11628. opposite field order to the film-to-video transfer.
  11629. A description of the accepted parameters follows.
  11630. @table @option
  11631. @item mode
  11632. Set phase mode.
  11633. It accepts the following values:
  11634. @table @samp
  11635. @item t
  11636. Capture field order top-first, transfer bottom-first.
  11637. Filter will delay the bottom field.
  11638. @item b
  11639. Capture field order bottom-first, transfer top-first.
  11640. Filter will delay the top field.
  11641. @item p
  11642. Capture and transfer with the same field order. This mode only exists
  11643. for the documentation of the other options to refer to, but if you
  11644. actually select it, the filter will faithfully do nothing.
  11645. @item a
  11646. Capture field order determined automatically by field flags, transfer
  11647. opposite.
  11648. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11649. basis using field flags. If no field information is available,
  11650. then this works just like @samp{u}.
  11651. @item u
  11652. Capture unknown or varying, transfer opposite.
  11653. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11654. analyzing the images and selecting the alternative that produces best
  11655. match between the fields.
  11656. @item T
  11657. Capture top-first, transfer unknown or varying.
  11658. Filter selects among @samp{t} and @samp{p} using image analysis.
  11659. @item B
  11660. Capture bottom-first, transfer unknown or varying.
  11661. Filter selects among @samp{b} and @samp{p} using image analysis.
  11662. @item A
  11663. Capture determined by field flags, transfer unknown or varying.
  11664. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11665. image analysis. If no field information is available, then this works just
  11666. like @samp{U}. This is the default mode.
  11667. @item U
  11668. Both capture and transfer unknown or varying.
  11669. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11670. @end table
  11671. @end table
  11672. @section photosensitivity
  11673. Reduce various flashes in video, so to help users with epilepsy.
  11674. It accepts the following options:
  11675. @table @option
  11676. @item frames, f
  11677. Set how many frames to use when filtering. Default is 30.
  11678. @item threshold, t
  11679. Set detection threshold factor. Default is 1.
  11680. Lower is stricter.
  11681. @item skip
  11682. Set how many pixels to skip when sampling frames. Default is 1.
  11683. Allowed range is from 1 to 1024.
  11684. @item bypass
  11685. Leave frames unchanged. Default is disabled.
  11686. @end table
  11687. @section pixdesctest
  11688. Pixel format descriptor test filter, mainly useful for internal
  11689. testing. The output video should be equal to the input video.
  11690. For example:
  11691. @example
  11692. format=monow, pixdesctest
  11693. @end example
  11694. can be used to test the monowhite pixel format descriptor definition.
  11695. @section pixscope
  11696. Display sample values of color channels. Mainly useful for checking color
  11697. and levels. Minimum supported resolution is 640x480.
  11698. The filters accept the following options:
  11699. @table @option
  11700. @item x
  11701. Set scope X position, relative offset on X axis.
  11702. @item y
  11703. Set scope Y position, relative offset on Y axis.
  11704. @item w
  11705. Set scope width.
  11706. @item h
  11707. Set scope height.
  11708. @item o
  11709. Set window opacity. This window also holds statistics about pixel area.
  11710. @item wx
  11711. Set window X position, relative offset on X axis.
  11712. @item wy
  11713. Set window Y position, relative offset on Y axis.
  11714. @end table
  11715. @section pp
  11716. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11717. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11718. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11719. Each subfilter and some options have a short and a long name that can be used
  11720. interchangeably, i.e. dr/dering are the same.
  11721. The filters accept the following options:
  11722. @table @option
  11723. @item subfilters
  11724. Set postprocessing subfilters string.
  11725. @end table
  11726. All subfilters share common options to determine their scope:
  11727. @table @option
  11728. @item a/autoq
  11729. Honor the quality commands for this subfilter.
  11730. @item c/chrom
  11731. Do chrominance filtering, too (default).
  11732. @item y/nochrom
  11733. Do luminance filtering only (no chrominance).
  11734. @item n/noluma
  11735. Do chrominance filtering only (no luminance).
  11736. @end table
  11737. These options can be appended after the subfilter name, separated by a '|'.
  11738. Available subfilters are:
  11739. @table @option
  11740. @item hb/hdeblock[|difference[|flatness]]
  11741. Horizontal deblocking filter
  11742. @table @option
  11743. @item difference
  11744. Difference factor where higher values mean more deblocking (default: @code{32}).
  11745. @item flatness
  11746. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11747. @end table
  11748. @item vb/vdeblock[|difference[|flatness]]
  11749. Vertical deblocking filter
  11750. @table @option
  11751. @item difference
  11752. Difference factor where higher values mean more deblocking (default: @code{32}).
  11753. @item flatness
  11754. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11755. @end table
  11756. @item ha/hadeblock[|difference[|flatness]]
  11757. Accurate horizontal deblocking filter
  11758. @table @option
  11759. @item difference
  11760. Difference factor where higher values mean more deblocking (default: @code{32}).
  11761. @item flatness
  11762. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11763. @end table
  11764. @item va/vadeblock[|difference[|flatness]]
  11765. Accurate vertical deblocking filter
  11766. @table @option
  11767. @item difference
  11768. Difference factor where higher values mean more deblocking (default: @code{32}).
  11769. @item flatness
  11770. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11771. @end table
  11772. @end table
  11773. The horizontal and vertical deblocking filters share the difference and
  11774. flatness values so you cannot set different horizontal and vertical
  11775. thresholds.
  11776. @table @option
  11777. @item h1/x1hdeblock
  11778. Experimental horizontal deblocking filter
  11779. @item v1/x1vdeblock
  11780. Experimental vertical deblocking filter
  11781. @item dr/dering
  11782. Deringing filter
  11783. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11784. @table @option
  11785. @item threshold1
  11786. larger -> stronger filtering
  11787. @item threshold2
  11788. larger -> stronger filtering
  11789. @item threshold3
  11790. larger -> stronger filtering
  11791. @end table
  11792. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11793. @table @option
  11794. @item f/fullyrange
  11795. Stretch luminance to @code{0-255}.
  11796. @end table
  11797. @item lb/linblenddeint
  11798. Linear blend deinterlacing filter that deinterlaces the given block by
  11799. filtering all lines with a @code{(1 2 1)} filter.
  11800. @item li/linipoldeint
  11801. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11802. linearly interpolating every second line.
  11803. @item ci/cubicipoldeint
  11804. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11805. cubically interpolating every second line.
  11806. @item md/mediandeint
  11807. Median deinterlacing filter that deinterlaces the given block by applying a
  11808. median filter to every second line.
  11809. @item fd/ffmpegdeint
  11810. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11811. second line with a @code{(-1 4 2 4 -1)} filter.
  11812. @item l5/lowpass5
  11813. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11814. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11815. @item fq/forceQuant[|quantizer]
  11816. Overrides the quantizer table from the input with the constant quantizer you
  11817. specify.
  11818. @table @option
  11819. @item quantizer
  11820. Quantizer to use
  11821. @end table
  11822. @item de/default
  11823. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11824. @item fa/fast
  11825. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11826. @item ac
  11827. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11828. @end table
  11829. @subsection Examples
  11830. @itemize
  11831. @item
  11832. Apply horizontal and vertical deblocking, deringing and automatic
  11833. brightness/contrast:
  11834. @example
  11835. pp=hb/vb/dr/al
  11836. @end example
  11837. @item
  11838. Apply default filters without brightness/contrast correction:
  11839. @example
  11840. pp=de/-al
  11841. @end example
  11842. @item
  11843. Apply default filters and temporal denoiser:
  11844. @example
  11845. pp=default/tmpnoise|1|2|3
  11846. @end example
  11847. @item
  11848. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11849. automatically depending on available CPU time:
  11850. @example
  11851. pp=hb|y/vb|a
  11852. @end example
  11853. @end itemize
  11854. @section pp7
  11855. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11856. similar to spp = 6 with 7 point DCT, where only the center sample is
  11857. used after IDCT.
  11858. The filter accepts the following options:
  11859. @table @option
  11860. @item qp
  11861. Force a constant quantization parameter. It accepts an integer in range
  11862. 0 to 63. If not set, the filter will use the QP from the video stream
  11863. (if available).
  11864. @item mode
  11865. Set thresholding mode. Available modes are:
  11866. @table @samp
  11867. @item hard
  11868. Set hard thresholding.
  11869. @item soft
  11870. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11871. @item medium
  11872. Set medium thresholding (good results, default).
  11873. @end table
  11874. @end table
  11875. @section premultiply
  11876. Apply alpha premultiply effect to input video stream using first plane
  11877. of second stream as alpha.
  11878. Both streams must have same dimensions and same pixel format.
  11879. The filter accepts the following option:
  11880. @table @option
  11881. @item planes
  11882. Set which planes will be processed, unprocessed planes will be copied.
  11883. By default value 0xf, all planes will be processed.
  11884. @item inplace
  11885. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11886. @end table
  11887. @section prewitt
  11888. Apply prewitt operator to input video stream.
  11889. The filter accepts the following option:
  11890. @table @option
  11891. @item planes
  11892. Set which planes will be processed, unprocessed planes will be copied.
  11893. By default value 0xf, all planes will be processed.
  11894. @item scale
  11895. Set value which will be multiplied with filtered result.
  11896. @item delta
  11897. Set value which will be added to filtered result.
  11898. @end table
  11899. @section pseudocolor
  11900. Alter frame colors in video with pseudocolors.
  11901. This filter accepts the following options:
  11902. @table @option
  11903. @item c0
  11904. set pixel first component expression
  11905. @item c1
  11906. set pixel second component expression
  11907. @item c2
  11908. set pixel third component expression
  11909. @item c3
  11910. set pixel fourth component expression, corresponds to the alpha component
  11911. @item i
  11912. set component to use as base for altering colors
  11913. @end table
  11914. Each of them specifies the expression to use for computing the lookup table for
  11915. the corresponding pixel component values.
  11916. The expressions can contain the following constants and functions:
  11917. @table @option
  11918. @item w
  11919. @item h
  11920. The input width and height.
  11921. @item val
  11922. The input value for the pixel component.
  11923. @item ymin, umin, vmin, amin
  11924. The minimum allowed component value.
  11925. @item ymax, umax, vmax, amax
  11926. The maximum allowed component value.
  11927. @end table
  11928. All expressions default to "val".
  11929. @subsection Examples
  11930. @itemize
  11931. @item
  11932. Change too high luma values to gradient:
  11933. @example
  11934. 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'"
  11935. @end example
  11936. @end itemize
  11937. @section psnr
  11938. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11939. Ratio) between two input videos.
  11940. This filter takes in input two input videos, the first input is
  11941. considered the "main" source and is passed unchanged to the
  11942. output. The second input is used as a "reference" video for computing
  11943. the PSNR.
  11944. Both video inputs must have the same resolution and pixel format for
  11945. this filter to work correctly. Also it assumes that both inputs
  11946. have the same number of frames, which are compared one by one.
  11947. The obtained average PSNR is printed through the logging system.
  11948. The filter stores the accumulated MSE (mean squared error) of each
  11949. frame, and at the end of the processing it is averaged across all frames
  11950. equally, and the following formula is applied to obtain the PSNR:
  11951. @example
  11952. PSNR = 10*log10(MAX^2/MSE)
  11953. @end example
  11954. Where MAX is the average of the maximum values of each component of the
  11955. image.
  11956. The description of the accepted parameters follows.
  11957. @table @option
  11958. @item stats_file, f
  11959. If specified the filter will use the named file to save the PSNR of
  11960. each individual frame. When filename equals "-" the data is sent to
  11961. standard output.
  11962. @item stats_version
  11963. Specifies which version of the stats file format to use. Details of
  11964. each format are written below.
  11965. Default value is 1.
  11966. @item stats_add_max
  11967. Determines whether the max value is output to the stats log.
  11968. Default value is 0.
  11969. Requires stats_version >= 2. If this is set and stats_version < 2,
  11970. the filter will return an error.
  11971. @end table
  11972. This filter also supports the @ref{framesync} options.
  11973. The file printed if @var{stats_file} is selected, contains a sequence of
  11974. key/value pairs of the form @var{key}:@var{value} for each compared
  11975. couple of frames.
  11976. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11977. the list of per-frame-pair stats, with key value pairs following the frame
  11978. format with the following parameters:
  11979. @table @option
  11980. @item psnr_log_version
  11981. The version of the log file format. Will match @var{stats_version}.
  11982. @item fields
  11983. A comma separated list of the per-frame-pair parameters included in
  11984. the log.
  11985. @end table
  11986. A description of each shown per-frame-pair parameter follows:
  11987. @table @option
  11988. @item n
  11989. sequential number of the input frame, starting from 1
  11990. @item mse_avg
  11991. Mean Square Error pixel-by-pixel average difference of the compared
  11992. frames, averaged over all the image components.
  11993. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11994. Mean Square Error pixel-by-pixel average difference of the compared
  11995. frames for the component specified by the suffix.
  11996. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11997. Peak Signal to Noise ratio of the compared frames for the component
  11998. specified by the suffix.
  11999. @item max_avg, max_y, max_u, max_v
  12000. Maximum allowed value for each channel, and average over all
  12001. channels.
  12002. @end table
  12003. @subsection Examples
  12004. @itemize
  12005. @item
  12006. For example:
  12007. @example
  12008. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12009. [main][ref] psnr="stats_file=stats.log" [out]
  12010. @end example
  12011. On this example the input file being processed is compared with the
  12012. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  12013. is stored in @file{stats.log}.
  12014. @item
  12015. Another example with different containers:
  12016. @example
  12017. 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 -
  12018. @end example
  12019. @end itemize
  12020. @anchor{pullup}
  12021. @section pullup
  12022. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  12023. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  12024. content.
  12025. The pullup filter is designed to take advantage of future context in making
  12026. its decisions. This filter is stateless in the sense that it does not lock
  12027. onto a pattern to follow, but it instead looks forward to the following
  12028. fields in order to identify matches and rebuild progressive frames.
  12029. To produce content with an even framerate, insert the fps filter after
  12030. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  12031. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  12032. The filter accepts the following options:
  12033. @table @option
  12034. @item jl
  12035. @item jr
  12036. @item jt
  12037. @item jb
  12038. These options set the amount of "junk" to ignore at the left, right, top, and
  12039. bottom of the image, respectively. Left and right are in units of 8 pixels,
  12040. while top and bottom are in units of 2 lines.
  12041. The default is 8 pixels on each side.
  12042. @item sb
  12043. Set the strict breaks. Setting this option to 1 will reduce the chances of
  12044. filter generating an occasional mismatched frame, but it may also cause an
  12045. excessive number of frames to be dropped during high motion sequences.
  12046. Conversely, setting it to -1 will make filter match fields more easily.
  12047. This may help processing of video where there is slight blurring between
  12048. the fields, but may also cause there to be interlaced frames in the output.
  12049. Default value is @code{0}.
  12050. @item mp
  12051. Set the metric plane to use. It accepts the following values:
  12052. @table @samp
  12053. @item l
  12054. Use luma plane.
  12055. @item u
  12056. Use chroma blue plane.
  12057. @item v
  12058. Use chroma red plane.
  12059. @end table
  12060. This option may be set to use chroma plane instead of the default luma plane
  12061. for doing filter's computations. This may improve accuracy on very clean
  12062. source material, but more likely will decrease accuracy, especially if there
  12063. is chroma noise (rainbow effect) or any grayscale video.
  12064. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  12065. load and make pullup usable in realtime on slow machines.
  12066. @end table
  12067. For best results (without duplicated frames in the output file) it is
  12068. necessary to change the output frame rate. For example, to inverse
  12069. telecine NTSC input:
  12070. @example
  12071. ffmpeg -i input -vf pullup -r 24000/1001 ...
  12072. @end example
  12073. @section qp
  12074. Change video quantization parameters (QP).
  12075. The filter accepts the following option:
  12076. @table @option
  12077. @item qp
  12078. Set expression for quantization parameter.
  12079. @end table
  12080. The expression is evaluated through the eval API and can contain, among others,
  12081. the following constants:
  12082. @table @var
  12083. @item known
  12084. 1 if index is not 129, 0 otherwise.
  12085. @item qp
  12086. Sequential index starting from -129 to 128.
  12087. @end table
  12088. @subsection Examples
  12089. @itemize
  12090. @item
  12091. Some equation like:
  12092. @example
  12093. qp=2+2*sin(PI*qp)
  12094. @end example
  12095. @end itemize
  12096. @section random
  12097. Flush video frames from internal cache of frames into a random order.
  12098. No frame is discarded.
  12099. Inspired by @ref{frei0r} nervous filter.
  12100. @table @option
  12101. @item frames
  12102. Set size in number of frames of internal cache, in range from @code{2} to
  12103. @code{512}. Default is @code{30}.
  12104. @item seed
  12105. Set seed for random number generator, must be an integer included between
  12106. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12107. less than @code{0}, the filter will try to use a good random seed on a
  12108. best effort basis.
  12109. @end table
  12110. @section readeia608
  12111. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12112. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12113. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12114. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12115. @table @option
  12116. @item lavfi.readeia608.X.cc
  12117. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12118. @item lavfi.readeia608.X.line
  12119. The number of the line on which the EIA-608 data was identified and read.
  12120. @end table
  12121. This filter accepts the following options:
  12122. @table @option
  12123. @item scan_min
  12124. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12125. @item scan_max
  12126. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12127. @item spw
  12128. Set the ratio of width reserved for sync code detection.
  12129. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12130. @item chp
  12131. Enable checking the parity bit. In the event of a parity error, the filter will output
  12132. @code{0x00} for that character. Default is false.
  12133. @item lp
  12134. Lowpass lines prior to further processing. Default is enabled.
  12135. @end table
  12136. @subsection Examples
  12137. @itemize
  12138. @item
  12139. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12140. @example
  12141. 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
  12142. @end example
  12143. @end itemize
  12144. @section readvitc
  12145. Read vertical interval timecode (VITC) information from the top lines of a
  12146. video frame.
  12147. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12148. timecode value, if a valid timecode has been detected. Further metadata key
  12149. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12150. timecode data has been found or not.
  12151. This filter accepts the following options:
  12152. @table @option
  12153. @item scan_max
  12154. Set the maximum number of lines to scan for VITC data. If the value is set to
  12155. @code{-1} the full video frame is scanned. Default is @code{45}.
  12156. @item thr_b
  12157. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12158. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12159. @item thr_w
  12160. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12161. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12162. @end table
  12163. @subsection Examples
  12164. @itemize
  12165. @item
  12166. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12167. draw @code{--:--:--:--} as a placeholder:
  12168. @example
  12169. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12170. @end example
  12171. @end itemize
  12172. @section remap
  12173. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12174. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12175. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12176. value for pixel will be used for destination pixel.
  12177. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12178. will have Xmap/Ymap video stream dimensions.
  12179. Xmap and Ymap input video streams are 16bit depth, single channel.
  12180. @table @option
  12181. @item format
  12182. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12183. Default is @code{color}.
  12184. @item fill
  12185. Specify the color of the unmapped pixels. For the syntax of this option,
  12186. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12187. manual,ffmpeg-utils}. Default color is @code{black}.
  12188. @end table
  12189. @section removegrain
  12190. The removegrain filter is a spatial denoiser for progressive video.
  12191. @table @option
  12192. @item m0
  12193. Set mode for the first plane.
  12194. @item m1
  12195. Set mode for the second plane.
  12196. @item m2
  12197. Set mode for the third plane.
  12198. @item m3
  12199. Set mode for the fourth plane.
  12200. @end table
  12201. Range of mode is from 0 to 24. Description of each mode follows:
  12202. @table @var
  12203. @item 0
  12204. Leave input plane unchanged. Default.
  12205. @item 1
  12206. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12207. @item 2
  12208. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12209. @item 3
  12210. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12211. @item 4
  12212. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12213. This is equivalent to a median filter.
  12214. @item 5
  12215. Line-sensitive clipping giving the minimal change.
  12216. @item 6
  12217. Line-sensitive clipping, intermediate.
  12218. @item 7
  12219. Line-sensitive clipping, intermediate.
  12220. @item 8
  12221. Line-sensitive clipping, intermediate.
  12222. @item 9
  12223. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12224. @item 10
  12225. Replaces the target pixel with the closest neighbour.
  12226. @item 11
  12227. [1 2 1] horizontal and vertical kernel blur.
  12228. @item 12
  12229. Same as mode 11.
  12230. @item 13
  12231. Bob mode, interpolates top field from the line where the neighbours
  12232. pixels are the closest.
  12233. @item 14
  12234. Bob mode, interpolates bottom field from the line where the neighbours
  12235. pixels are the closest.
  12236. @item 15
  12237. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12238. interpolation formula.
  12239. @item 16
  12240. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12241. interpolation formula.
  12242. @item 17
  12243. Clips the pixel with the minimum and maximum of respectively the maximum and
  12244. minimum of each pair of opposite neighbour pixels.
  12245. @item 18
  12246. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12247. the current pixel is minimal.
  12248. @item 19
  12249. Replaces the pixel with the average of its 8 neighbours.
  12250. @item 20
  12251. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12252. @item 21
  12253. Clips pixels using the averages of opposite neighbour.
  12254. @item 22
  12255. Same as mode 21 but simpler and faster.
  12256. @item 23
  12257. Small edge and halo removal, but reputed useless.
  12258. @item 24
  12259. Similar as 23.
  12260. @end table
  12261. @section removelogo
  12262. Suppress a TV station logo, using an image file to determine which
  12263. pixels comprise the logo. It works by filling in the pixels that
  12264. comprise the logo with neighboring pixels.
  12265. The filter accepts the following options:
  12266. @table @option
  12267. @item filename, f
  12268. Set the filter bitmap file, which can be any image format supported by
  12269. libavformat. The width and height of the image file must match those of the
  12270. video stream being processed.
  12271. @end table
  12272. Pixels in the provided bitmap image with a value of zero are not
  12273. considered part of the logo, non-zero pixels are considered part of
  12274. the logo. If you use white (255) for the logo and black (0) for the
  12275. rest, you will be safe. For making the filter bitmap, it is
  12276. recommended to take a screen capture of a black frame with the logo
  12277. visible, and then using a threshold filter followed by the erode
  12278. filter once or twice.
  12279. If needed, little splotches can be fixed manually. Remember that if
  12280. logo pixels are not covered, the filter quality will be much
  12281. reduced. Marking too many pixels as part of the logo does not hurt as
  12282. much, but it will increase the amount of blurring needed to cover over
  12283. the image and will destroy more information than necessary, and extra
  12284. pixels will slow things down on a large logo.
  12285. @section repeatfields
  12286. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12287. fields based on its value.
  12288. @section reverse
  12289. Reverse a video clip.
  12290. Warning: This filter requires memory to buffer the entire clip, so trimming
  12291. is suggested.
  12292. @subsection Examples
  12293. @itemize
  12294. @item
  12295. Take the first 5 seconds of a clip, and reverse it.
  12296. @example
  12297. trim=end=5,reverse
  12298. @end example
  12299. @end itemize
  12300. @section rgbashift
  12301. Shift R/G/B/A pixels horizontally and/or vertically.
  12302. The filter accepts the following options:
  12303. @table @option
  12304. @item rh
  12305. Set amount to shift red horizontally.
  12306. @item rv
  12307. Set amount to shift red vertically.
  12308. @item gh
  12309. Set amount to shift green horizontally.
  12310. @item gv
  12311. Set amount to shift green vertically.
  12312. @item bh
  12313. Set amount to shift blue horizontally.
  12314. @item bv
  12315. Set amount to shift blue vertically.
  12316. @item ah
  12317. Set amount to shift alpha horizontally.
  12318. @item av
  12319. Set amount to shift alpha vertically.
  12320. @item edge
  12321. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12322. @end table
  12323. @subsection Commands
  12324. This filter supports the all above options as @ref{commands}.
  12325. @section roberts
  12326. Apply roberts cross operator to input video stream.
  12327. The filter accepts the following option:
  12328. @table @option
  12329. @item planes
  12330. Set which planes will be processed, unprocessed planes will be copied.
  12331. By default value 0xf, all planes will be processed.
  12332. @item scale
  12333. Set value which will be multiplied with filtered result.
  12334. @item delta
  12335. Set value which will be added to filtered result.
  12336. @end table
  12337. @section rotate
  12338. Rotate video by an arbitrary angle expressed in radians.
  12339. The filter accepts the following options:
  12340. A description of the optional parameters follows.
  12341. @table @option
  12342. @item angle, a
  12343. Set an expression for the angle by which to rotate the input video
  12344. clockwise, expressed as a number of radians. A negative value will
  12345. result in a counter-clockwise rotation. By default it is set to "0".
  12346. This expression is evaluated for each frame.
  12347. @item out_w, ow
  12348. Set the output width expression, default value is "iw".
  12349. This expression is evaluated just once during configuration.
  12350. @item out_h, oh
  12351. Set the output height expression, default value is "ih".
  12352. This expression is evaluated just once during configuration.
  12353. @item bilinear
  12354. Enable bilinear interpolation if set to 1, a value of 0 disables
  12355. it. Default value is 1.
  12356. @item fillcolor, c
  12357. Set the color used to fill the output area not covered by the rotated
  12358. image. For the general syntax of this option, check the
  12359. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12360. If the special value "none" is selected then no
  12361. background is printed (useful for example if the background is never shown).
  12362. Default value is "black".
  12363. @end table
  12364. The expressions for the angle and the output size can contain the
  12365. following constants and functions:
  12366. @table @option
  12367. @item n
  12368. sequential number of the input frame, starting from 0. It is always NAN
  12369. before the first frame is filtered.
  12370. @item t
  12371. time in seconds of the input frame, it is set to 0 when the filter is
  12372. configured. It is always NAN before the first frame is filtered.
  12373. @item hsub
  12374. @item vsub
  12375. horizontal and vertical chroma subsample values. For example for the
  12376. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12377. @item in_w, iw
  12378. @item in_h, ih
  12379. the input video width and height
  12380. @item out_w, ow
  12381. @item out_h, oh
  12382. the output width and height, that is the size of the padded area as
  12383. specified by the @var{width} and @var{height} expressions
  12384. @item rotw(a)
  12385. @item roth(a)
  12386. the minimal width/height required for completely containing the input
  12387. video rotated by @var{a} radians.
  12388. These are only available when computing the @option{out_w} and
  12389. @option{out_h} expressions.
  12390. @end table
  12391. @subsection Examples
  12392. @itemize
  12393. @item
  12394. Rotate the input by PI/6 radians clockwise:
  12395. @example
  12396. rotate=PI/6
  12397. @end example
  12398. @item
  12399. Rotate the input by PI/6 radians counter-clockwise:
  12400. @example
  12401. rotate=-PI/6
  12402. @end example
  12403. @item
  12404. Rotate the input by 45 degrees clockwise:
  12405. @example
  12406. rotate=45*PI/180
  12407. @end example
  12408. @item
  12409. Apply a constant rotation with period T, starting from an angle of PI/3:
  12410. @example
  12411. rotate=PI/3+2*PI*t/T
  12412. @end example
  12413. @item
  12414. Make the input video rotation oscillating with a period of T
  12415. seconds and an amplitude of A radians:
  12416. @example
  12417. rotate=A*sin(2*PI/T*t)
  12418. @end example
  12419. @item
  12420. Rotate the video, output size is chosen so that the whole rotating
  12421. input video is always completely contained in the output:
  12422. @example
  12423. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12424. @end example
  12425. @item
  12426. Rotate the video, reduce the output size so that no background is ever
  12427. shown:
  12428. @example
  12429. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12430. @end example
  12431. @end itemize
  12432. @subsection Commands
  12433. The filter supports the following commands:
  12434. @table @option
  12435. @item a, angle
  12436. Set the angle expression.
  12437. The command accepts the same syntax of the corresponding option.
  12438. If the specified expression is not valid, it is kept at its current
  12439. value.
  12440. @end table
  12441. @section sab
  12442. Apply Shape Adaptive Blur.
  12443. The filter accepts the following options:
  12444. @table @option
  12445. @item luma_radius, lr
  12446. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12447. value is 1.0. A greater value will result in a more blurred image, and
  12448. in slower processing.
  12449. @item luma_pre_filter_radius, lpfr
  12450. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12451. value is 1.0.
  12452. @item luma_strength, ls
  12453. Set luma maximum difference between pixels to still be considered, must
  12454. be a value in the 0.1-100.0 range, default value is 1.0.
  12455. @item chroma_radius, cr
  12456. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12457. greater value will result in a more blurred image, and in slower
  12458. processing.
  12459. @item chroma_pre_filter_radius, cpfr
  12460. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12461. @item chroma_strength, cs
  12462. Set chroma maximum difference between pixels to still be considered,
  12463. must be a value in the -0.9-100.0 range.
  12464. @end table
  12465. Each chroma option value, if not explicitly specified, is set to the
  12466. corresponding luma option value.
  12467. @anchor{scale}
  12468. @section scale
  12469. Scale (resize) the input video, using the libswscale library.
  12470. The scale filter forces the output display aspect ratio to be the same
  12471. of the input, by changing the output sample aspect ratio.
  12472. If the input image format is different from the format requested by
  12473. the next filter, the scale filter will convert the input to the
  12474. requested format.
  12475. @subsection Options
  12476. The filter accepts the following options, or any of the options
  12477. supported by the libswscale scaler.
  12478. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12479. the complete list of scaler options.
  12480. @table @option
  12481. @item width, w
  12482. @item height, h
  12483. Set the output video dimension expression. Default value is the input
  12484. dimension.
  12485. If the @var{width} or @var{w} value is 0, the input width is used for
  12486. the output. If the @var{height} or @var{h} value is 0, the input height
  12487. is used for the output.
  12488. If one and only one of the values is -n with n >= 1, the scale filter
  12489. will use a value that maintains the aspect ratio of the input image,
  12490. calculated from the other specified dimension. After that it will,
  12491. however, make sure that the calculated dimension is divisible by n and
  12492. adjust the value if necessary.
  12493. If both values are -n with n >= 1, the behavior will be identical to
  12494. both values being set to 0 as previously detailed.
  12495. See below for the list of accepted constants for use in the dimension
  12496. expression.
  12497. @item eval
  12498. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12499. @table @samp
  12500. @item init
  12501. Only evaluate expressions once during the filter initialization or when a command is processed.
  12502. @item frame
  12503. Evaluate expressions for each incoming frame.
  12504. @end table
  12505. Default value is @samp{init}.
  12506. @item interl
  12507. Set the interlacing mode. It accepts the following values:
  12508. @table @samp
  12509. @item 1
  12510. Force interlaced aware scaling.
  12511. @item 0
  12512. Do not apply interlaced scaling.
  12513. @item -1
  12514. Select interlaced aware scaling depending on whether the source frames
  12515. are flagged as interlaced or not.
  12516. @end table
  12517. Default value is @samp{0}.
  12518. @item flags
  12519. Set libswscale scaling flags. See
  12520. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12521. complete list of values. If not explicitly specified the filter applies
  12522. the default flags.
  12523. @item param0, param1
  12524. Set libswscale input parameters for scaling algorithms that need them. See
  12525. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12526. complete documentation. If not explicitly specified the filter applies
  12527. empty parameters.
  12528. @item size, s
  12529. Set the video size. For the syntax of this option, check the
  12530. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12531. @item in_color_matrix
  12532. @item out_color_matrix
  12533. Set in/output YCbCr color space type.
  12534. This allows the autodetected value to be overridden as well as allows forcing
  12535. a specific value used for the output and encoder.
  12536. If not specified, the color space type depends on the pixel format.
  12537. Possible values:
  12538. @table @samp
  12539. @item auto
  12540. Choose automatically.
  12541. @item bt709
  12542. Format conforming to International Telecommunication Union (ITU)
  12543. Recommendation BT.709.
  12544. @item fcc
  12545. Set color space conforming to the United States Federal Communications
  12546. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12547. @item bt601
  12548. @item bt470
  12549. @item smpte170m
  12550. Set color space conforming to:
  12551. @itemize
  12552. @item
  12553. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12554. @item
  12555. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12556. @item
  12557. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12558. @end itemize
  12559. @item smpte240m
  12560. Set color space conforming to SMPTE ST 240:1999.
  12561. @item bt2020
  12562. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12563. @end table
  12564. @item in_range
  12565. @item out_range
  12566. Set in/output YCbCr sample range.
  12567. This allows the autodetected value to be overridden as well as allows forcing
  12568. a specific value used for the output and encoder. If not specified, the
  12569. range depends on the pixel format. Possible values:
  12570. @table @samp
  12571. @item auto/unknown
  12572. Choose automatically.
  12573. @item jpeg/full/pc
  12574. Set full range (0-255 in case of 8-bit luma).
  12575. @item mpeg/limited/tv
  12576. Set "MPEG" range (16-235 in case of 8-bit luma).
  12577. @end table
  12578. @item force_original_aspect_ratio
  12579. Enable decreasing or increasing output video width or height if necessary to
  12580. keep the original aspect ratio. Possible values:
  12581. @table @samp
  12582. @item disable
  12583. Scale the video as specified and disable this feature.
  12584. @item decrease
  12585. The output video dimensions will automatically be decreased if needed.
  12586. @item increase
  12587. The output video dimensions will automatically be increased if needed.
  12588. @end table
  12589. One useful instance of this option is that when you know a specific device's
  12590. maximum allowed resolution, you can use this to limit the output video to
  12591. that, while retaining the aspect ratio. For example, device A allows
  12592. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12593. decrease) and specifying 1280x720 to the command line makes the output
  12594. 1280x533.
  12595. Please note that this is a different thing than specifying -1 for @option{w}
  12596. or @option{h}, you still need to specify the output resolution for this option
  12597. to work.
  12598. @item force_divisible_by
  12599. Ensures that both the output dimensions, width and height, are divisible by the
  12600. given integer when used together with @option{force_original_aspect_ratio}. This
  12601. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12602. This option respects the value set for @option{force_original_aspect_ratio},
  12603. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12604. may be slightly modified.
  12605. This option can be handy if you need to have a video fit within or exceed
  12606. a defined resolution using @option{force_original_aspect_ratio} but also have
  12607. encoder restrictions on width or height divisibility.
  12608. @end table
  12609. The values of the @option{w} and @option{h} options are expressions
  12610. containing the following constants:
  12611. @table @var
  12612. @item in_w
  12613. @item in_h
  12614. The input width and height
  12615. @item iw
  12616. @item ih
  12617. These are the same as @var{in_w} and @var{in_h}.
  12618. @item out_w
  12619. @item out_h
  12620. The output (scaled) width and height
  12621. @item ow
  12622. @item oh
  12623. These are the same as @var{out_w} and @var{out_h}
  12624. @item a
  12625. The same as @var{iw} / @var{ih}
  12626. @item sar
  12627. input sample aspect ratio
  12628. @item dar
  12629. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12630. @item hsub
  12631. @item vsub
  12632. horizontal and vertical input chroma subsample values. For example for the
  12633. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12634. @item ohsub
  12635. @item ovsub
  12636. horizontal and vertical output chroma subsample values. For example for the
  12637. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12638. @item n
  12639. The (sequential) number of the input frame, starting from 0.
  12640. Only available with @code{eval=frame}.
  12641. @item t
  12642. The presentation timestamp of the input frame, expressed as a number of
  12643. seconds. Only available with @code{eval=frame}.
  12644. @item pos
  12645. The position (byte offset) of the frame in the input stream, or NaN if
  12646. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12647. Only available with @code{eval=frame}.
  12648. @end table
  12649. @subsection Examples
  12650. @itemize
  12651. @item
  12652. Scale the input video to a size of 200x100
  12653. @example
  12654. scale=w=200:h=100
  12655. @end example
  12656. This is equivalent to:
  12657. @example
  12658. scale=200:100
  12659. @end example
  12660. or:
  12661. @example
  12662. scale=200x100
  12663. @end example
  12664. @item
  12665. Specify a size abbreviation for the output size:
  12666. @example
  12667. scale=qcif
  12668. @end example
  12669. which can also be written as:
  12670. @example
  12671. scale=size=qcif
  12672. @end example
  12673. @item
  12674. Scale the input to 2x:
  12675. @example
  12676. scale=w=2*iw:h=2*ih
  12677. @end example
  12678. @item
  12679. The above is the same as:
  12680. @example
  12681. scale=2*in_w:2*in_h
  12682. @end example
  12683. @item
  12684. Scale the input to 2x with forced interlaced scaling:
  12685. @example
  12686. scale=2*iw:2*ih:interl=1
  12687. @end example
  12688. @item
  12689. Scale the input to half size:
  12690. @example
  12691. scale=w=iw/2:h=ih/2
  12692. @end example
  12693. @item
  12694. Increase the width, and set the height to the same size:
  12695. @example
  12696. scale=3/2*iw:ow
  12697. @end example
  12698. @item
  12699. Seek Greek harmony:
  12700. @example
  12701. scale=iw:1/PHI*iw
  12702. scale=ih*PHI:ih
  12703. @end example
  12704. @item
  12705. Increase the height, and set the width to 3/2 of the height:
  12706. @example
  12707. scale=w=3/2*oh:h=3/5*ih
  12708. @end example
  12709. @item
  12710. Increase the size, making the size a multiple of the chroma
  12711. subsample values:
  12712. @example
  12713. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12714. @end example
  12715. @item
  12716. Increase the width to a maximum of 500 pixels,
  12717. keeping the same aspect ratio as the input:
  12718. @example
  12719. scale=w='min(500\, iw*3/2):h=-1'
  12720. @end example
  12721. @item
  12722. Make pixels square by combining scale and setsar:
  12723. @example
  12724. scale='trunc(ih*dar):ih',setsar=1/1
  12725. @end example
  12726. @item
  12727. Make pixels square by combining scale and setsar,
  12728. making sure the resulting resolution is even (required by some codecs):
  12729. @example
  12730. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12731. @end example
  12732. @end itemize
  12733. @subsection Commands
  12734. This filter supports the following commands:
  12735. @table @option
  12736. @item width, w
  12737. @item height, h
  12738. Set the output video dimension expression.
  12739. The command accepts the same syntax of the corresponding option.
  12740. If the specified expression is not valid, it is kept at its current
  12741. value.
  12742. @end table
  12743. @section scale_npp
  12744. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12745. format conversion on CUDA video frames. Setting the output width and height
  12746. works in the same way as for the @var{scale} filter.
  12747. The following additional options are accepted:
  12748. @table @option
  12749. @item format
  12750. The pixel format of the output CUDA frames. If set to the string "same" (the
  12751. default), the input format will be kept. Note that automatic format negotiation
  12752. and conversion is not yet supported for hardware frames
  12753. @item interp_algo
  12754. The interpolation algorithm used for resizing. One of the following:
  12755. @table @option
  12756. @item nn
  12757. Nearest neighbour.
  12758. @item linear
  12759. @item cubic
  12760. @item cubic2p_bspline
  12761. 2-parameter cubic (B=1, C=0)
  12762. @item cubic2p_catmullrom
  12763. 2-parameter cubic (B=0, C=1/2)
  12764. @item cubic2p_b05c03
  12765. 2-parameter cubic (B=1/2, C=3/10)
  12766. @item super
  12767. Supersampling
  12768. @item lanczos
  12769. @end table
  12770. @item force_original_aspect_ratio
  12771. Enable decreasing or increasing output video width or height if necessary to
  12772. keep the original aspect ratio. Possible values:
  12773. @table @samp
  12774. @item disable
  12775. Scale the video as specified and disable this feature.
  12776. @item decrease
  12777. The output video dimensions will automatically be decreased if needed.
  12778. @item increase
  12779. The output video dimensions will automatically be increased if needed.
  12780. @end table
  12781. One useful instance of this option is that when you know a specific device's
  12782. maximum allowed resolution, you can use this to limit the output video to
  12783. that, while retaining the aspect ratio. For example, device A allows
  12784. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12785. decrease) and specifying 1280x720 to the command line makes the output
  12786. 1280x533.
  12787. Please note that this is a different thing than specifying -1 for @option{w}
  12788. or @option{h}, you still need to specify the output resolution for this option
  12789. to work.
  12790. @item force_divisible_by
  12791. Ensures that both the output dimensions, width and height, are divisible by the
  12792. given integer when used together with @option{force_original_aspect_ratio}. This
  12793. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12794. This option respects the value set for @option{force_original_aspect_ratio},
  12795. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12796. may be slightly modified.
  12797. This option can be handy if you need to have a video fit within or exceed
  12798. a defined resolution using @option{force_original_aspect_ratio} but also have
  12799. encoder restrictions on width or height divisibility.
  12800. @end table
  12801. @section scale2ref
  12802. Scale (resize) the input video, based on a reference video.
  12803. See the scale filter for available options, scale2ref supports the same but
  12804. uses the reference video instead of the main input as basis. scale2ref also
  12805. supports the following additional constants for the @option{w} and
  12806. @option{h} options:
  12807. @table @var
  12808. @item main_w
  12809. @item main_h
  12810. The main input video's width and height
  12811. @item main_a
  12812. The same as @var{main_w} / @var{main_h}
  12813. @item main_sar
  12814. The main input video's sample aspect ratio
  12815. @item main_dar, mdar
  12816. The main input video's display aspect ratio. Calculated from
  12817. @code{(main_w / main_h) * main_sar}.
  12818. @item main_hsub
  12819. @item main_vsub
  12820. The main input video's horizontal and vertical chroma subsample values.
  12821. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12822. is 1.
  12823. @item main_n
  12824. The (sequential) number of the main input frame, starting from 0.
  12825. Only available with @code{eval=frame}.
  12826. @item main_t
  12827. The presentation timestamp of the main input frame, expressed as a number of
  12828. seconds. Only available with @code{eval=frame}.
  12829. @item main_pos
  12830. The position (byte offset) of the frame in the main input stream, or NaN if
  12831. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12832. Only available with @code{eval=frame}.
  12833. @end table
  12834. @subsection Examples
  12835. @itemize
  12836. @item
  12837. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12838. @example
  12839. 'scale2ref[b][a];[a][b]overlay'
  12840. @end example
  12841. @item
  12842. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12843. @example
  12844. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12845. @end example
  12846. @end itemize
  12847. @subsection Commands
  12848. This filter supports the following commands:
  12849. @table @option
  12850. @item width, w
  12851. @item height, h
  12852. Set the output video dimension expression.
  12853. The command accepts the same syntax of the corresponding option.
  12854. If the specified expression is not valid, it is kept at its current
  12855. value.
  12856. @end table
  12857. @section scroll
  12858. Scroll input video horizontally and/or vertically by constant speed.
  12859. The filter accepts the following options:
  12860. @table @option
  12861. @item horizontal, h
  12862. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12863. Negative values changes scrolling direction.
  12864. @item vertical, v
  12865. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12866. Negative values changes scrolling direction.
  12867. @item hpos
  12868. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12869. @item vpos
  12870. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12871. @end table
  12872. @subsection Commands
  12873. This filter supports the following @ref{commands}:
  12874. @table @option
  12875. @item horizontal, h
  12876. Set the horizontal scrolling speed.
  12877. @item vertical, v
  12878. Set the vertical scrolling speed.
  12879. @end table
  12880. @anchor{scdet}
  12881. @section scdet
  12882. Detect video scene change.
  12883. This filter sets frame metadata with mafd between frame, the scene score, and
  12884. forward the frame to the next filter, so they can use these metadata to detect
  12885. scene change or others.
  12886. In addition, this filter logs a message and sets frame metadata when it detects
  12887. a scene change by @option{threshold}.
  12888. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  12889. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  12890. to detect scene change.
  12891. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  12892. detect scene change with @option{threshold}.
  12893. The filter accepts the following options:
  12894. @table @option
  12895. @item threshold, t
  12896. Set the scene change detection threshold as a percentage of maximum change. Good
  12897. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  12898. @code{[0., 100.]}.
  12899. Default value is @code{10.}.
  12900. @item sc_pass, s
  12901. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  12902. You can enable it if you want to get snapshot of scene change frames only.
  12903. @end table
  12904. @anchor{selectivecolor}
  12905. @section selectivecolor
  12906. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12907. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12908. by the "purity" of the color (that is, how saturated it already is).
  12909. This filter is similar to the Adobe Photoshop Selective Color tool.
  12910. The filter accepts the following options:
  12911. @table @option
  12912. @item correction_method
  12913. Select color correction method.
  12914. Available values are:
  12915. @table @samp
  12916. @item absolute
  12917. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12918. component value).
  12919. @item relative
  12920. Specified adjustments are relative to the original component value.
  12921. @end table
  12922. Default is @code{absolute}.
  12923. @item reds
  12924. Adjustments for red pixels (pixels where the red component is the maximum)
  12925. @item yellows
  12926. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12927. @item greens
  12928. Adjustments for green pixels (pixels where the green component is the maximum)
  12929. @item cyans
  12930. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12931. @item blues
  12932. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12933. @item magentas
  12934. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12935. @item whites
  12936. Adjustments for white pixels (pixels where all components are greater than 128)
  12937. @item neutrals
  12938. Adjustments for all pixels except pure black and pure white
  12939. @item blacks
  12940. Adjustments for black pixels (pixels where all components are lesser than 128)
  12941. @item psfile
  12942. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12943. @end table
  12944. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12945. 4 space separated floating point adjustment values in the [-1,1] range,
  12946. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12947. pixels of its range.
  12948. @subsection Examples
  12949. @itemize
  12950. @item
  12951. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12952. increase magenta by 27% in blue areas:
  12953. @example
  12954. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12955. @end example
  12956. @item
  12957. Use a Photoshop selective color preset:
  12958. @example
  12959. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12960. @end example
  12961. @end itemize
  12962. @anchor{separatefields}
  12963. @section separatefields
  12964. The @code{separatefields} takes a frame-based video input and splits
  12965. each frame into its components fields, producing a new half height clip
  12966. with twice the frame rate and twice the frame count.
  12967. This filter use field-dominance information in frame to decide which
  12968. of each pair of fields to place first in the output.
  12969. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12970. @section setdar, setsar
  12971. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12972. output video.
  12973. This is done by changing the specified Sample (aka Pixel) Aspect
  12974. Ratio, according to the following equation:
  12975. @example
  12976. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12977. @end example
  12978. Keep in mind that the @code{setdar} filter does not modify the pixel
  12979. dimensions of the video frame. Also, the display aspect ratio set by
  12980. this filter may be changed by later filters in the filterchain,
  12981. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12982. applied.
  12983. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12984. the filter output video.
  12985. Note that as a consequence of the application of this filter, the
  12986. output display aspect ratio will change according to the equation
  12987. above.
  12988. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12989. filter may be changed by later filters in the filterchain, e.g. if
  12990. another "setsar" or a "setdar" filter is applied.
  12991. It accepts the following parameters:
  12992. @table @option
  12993. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12994. Set the aspect ratio used by the filter.
  12995. The parameter can be a floating point number string, an expression, or
  12996. a string of the form @var{num}:@var{den}, where @var{num} and
  12997. @var{den} are the numerator and denominator of the aspect ratio. If
  12998. the parameter is not specified, it is assumed the value "0".
  12999. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  13000. should be escaped.
  13001. @item max
  13002. Set the maximum integer value to use for expressing numerator and
  13003. denominator when reducing the expressed aspect ratio to a rational.
  13004. Default value is @code{100}.
  13005. @end table
  13006. The parameter @var{sar} is an expression containing
  13007. the following constants:
  13008. @table @option
  13009. @item E, PI, PHI
  13010. These are approximated values for the mathematical constants e
  13011. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  13012. @item w, h
  13013. The input width and height.
  13014. @item a
  13015. These are the same as @var{w} / @var{h}.
  13016. @item sar
  13017. The input sample aspect ratio.
  13018. @item dar
  13019. The input display aspect ratio. It is the same as
  13020. (@var{w} / @var{h}) * @var{sar}.
  13021. @item hsub, vsub
  13022. Horizontal and vertical chroma subsample values. For example, for the
  13023. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13024. @end table
  13025. @subsection Examples
  13026. @itemize
  13027. @item
  13028. To change the display aspect ratio to 16:9, specify one of the following:
  13029. @example
  13030. setdar=dar=1.77777
  13031. setdar=dar=16/9
  13032. @end example
  13033. @item
  13034. To change the sample aspect ratio to 10:11, specify:
  13035. @example
  13036. setsar=sar=10/11
  13037. @end example
  13038. @item
  13039. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  13040. 1000 in the aspect ratio reduction, use the command:
  13041. @example
  13042. setdar=ratio=16/9:max=1000
  13043. @end example
  13044. @end itemize
  13045. @anchor{setfield}
  13046. @section setfield
  13047. Force field for the output video frame.
  13048. The @code{setfield} filter marks the interlace type field for the
  13049. output frames. It does not change the input frame, but only sets the
  13050. corresponding property, which affects how the frame is treated by
  13051. following filters (e.g. @code{fieldorder} or @code{yadif}).
  13052. The filter accepts the following options:
  13053. @table @option
  13054. @item mode
  13055. Available values are:
  13056. @table @samp
  13057. @item auto
  13058. Keep the same field property.
  13059. @item bff
  13060. Mark the frame as bottom-field-first.
  13061. @item tff
  13062. Mark the frame as top-field-first.
  13063. @item prog
  13064. Mark the frame as progressive.
  13065. @end table
  13066. @end table
  13067. @anchor{setparams}
  13068. @section setparams
  13069. Force frame parameter for the output video frame.
  13070. The @code{setparams} filter marks interlace and color range for the
  13071. output frames. It does not change the input frame, but only sets the
  13072. corresponding property, which affects how the frame is treated by
  13073. filters/encoders.
  13074. @table @option
  13075. @item field_mode
  13076. Available values are:
  13077. @table @samp
  13078. @item auto
  13079. Keep the same field property (default).
  13080. @item bff
  13081. Mark the frame as bottom-field-first.
  13082. @item tff
  13083. Mark the frame as top-field-first.
  13084. @item prog
  13085. Mark the frame as progressive.
  13086. @end table
  13087. @item range
  13088. Available values are:
  13089. @table @samp
  13090. @item auto
  13091. Keep the same color range property (default).
  13092. @item unspecified, unknown
  13093. Mark the frame as unspecified color range.
  13094. @item limited, tv, mpeg
  13095. Mark the frame as limited range.
  13096. @item full, pc, jpeg
  13097. Mark the frame as full range.
  13098. @end table
  13099. @item color_primaries
  13100. Set the color primaries.
  13101. Available values are:
  13102. @table @samp
  13103. @item auto
  13104. Keep the same color primaries property (default).
  13105. @item bt709
  13106. @item unknown
  13107. @item bt470m
  13108. @item bt470bg
  13109. @item smpte170m
  13110. @item smpte240m
  13111. @item film
  13112. @item bt2020
  13113. @item smpte428
  13114. @item smpte431
  13115. @item smpte432
  13116. @item jedec-p22
  13117. @end table
  13118. @item color_trc
  13119. Set the color transfer.
  13120. Available values are:
  13121. @table @samp
  13122. @item auto
  13123. Keep the same color trc property (default).
  13124. @item bt709
  13125. @item unknown
  13126. @item bt470m
  13127. @item bt470bg
  13128. @item smpte170m
  13129. @item smpte240m
  13130. @item linear
  13131. @item log100
  13132. @item log316
  13133. @item iec61966-2-4
  13134. @item bt1361e
  13135. @item iec61966-2-1
  13136. @item bt2020-10
  13137. @item bt2020-12
  13138. @item smpte2084
  13139. @item smpte428
  13140. @item arib-std-b67
  13141. @end table
  13142. @item colorspace
  13143. Set the colorspace.
  13144. Available values are:
  13145. @table @samp
  13146. @item auto
  13147. Keep the same colorspace property (default).
  13148. @item gbr
  13149. @item bt709
  13150. @item unknown
  13151. @item fcc
  13152. @item bt470bg
  13153. @item smpte170m
  13154. @item smpte240m
  13155. @item ycgco
  13156. @item bt2020nc
  13157. @item bt2020c
  13158. @item smpte2085
  13159. @item chroma-derived-nc
  13160. @item chroma-derived-c
  13161. @item ictcp
  13162. @end table
  13163. @end table
  13164. @section showinfo
  13165. Show a line containing various information for each input video frame.
  13166. The input video is not modified.
  13167. This filter supports the following options:
  13168. @table @option
  13169. @item checksum
  13170. Calculate checksums of each plane. By default enabled.
  13171. @end table
  13172. The shown line contains a sequence of key/value pairs of the form
  13173. @var{key}:@var{value}.
  13174. The following values are shown in the output:
  13175. @table @option
  13176. @item n
  13177. The (sequential) number of the input frame, starting from 0.
  13178. @item pts
  13179. The Presentation TimeStamp of the input frame, expressed as a number of
  13180. time base units. The time base unit depends on the filter input pad.
  13181. @item pts_time
  13182. The Presentation TimeStamp of the input frame, expressed as a number of
  13183. seconds.
  13184. @item pos
  13185. The position of the frame in the input stream, or -1 if this information is
  13186. unavailable and/or meaningless (for example in case of synthetic video).
  13187. @item fmt
  13188. The pixel format name.
  13189. @item sar
  13190. The sample aspect ratio of the input frame, expressed in the form
  13191. @var{num}/@var{den}.
  13192. @item s
  13193. The size of the input frame. For the syntax of this option, check the
  13194. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13195. @item i
  13196. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13197. for bottom field first).
  13198. @item iskey
  13199. This is 1 if the frame is a key frame, 0 otherwise.
  13200. @item type
  13201. The picture type of the input frame ("I" for an I-frame, "P" for a
  13202. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13203. Also refer to the documentation of the @code{AVPictureType} enum and of
  13204. the @code{av_get_picture_type_char} function defined in
  13205. @file{libavutil/avutil.h}.
  13206. @item checksum
  13207. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13208. @item plane_checksum
  13209. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13210. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13211. @item mean
  13212. The mean value of pixels in each plane of the input frame, expressed in the form
  13213. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13214. @item stdev
  13215. The standard deviation of pixel values in each plane of the input frame, expressed
  13216. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13217. @end table
  13218. @section showpalette
  13219. Displays the 256 colors palette of each frame. This filter is only relevant for
  13220. @var{pal8} pixel format frames.
  13221. It accepts the following option:
  13222. @table @option
  13223. @item s
  13224. Set the size of the box used to represent one palette color entry. Default is
  13225. @code{30} (for a @code{30x30} pixel box).
  13226. @end table
  13227. @section shuffleframes
  13228. Reorder and/or duplicate and/or drop video frames.
  13229. It accepts the following parameters:
  13230. @table @option
  13231. @item mapping
  13232. Set the destination indexes of input frames.
  13233. This is space or '|' separated list of indexes that maps input frames to output
  13234. frames. Number of indexes also sets maximal value that each index may have.
  13235. '-1' index have special meaning and that is to drop frame.
  13236. @end table
  13237. The first frame has the index 0. The default is to keep the input unchanged.
  13238. @subsection Examples
  13239. @itemize
  13240. @item
  13241. Swap second and third frame of every three frames of the input:
  13242. @example
  13243. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13244. @end example
  13245. @item
  13246. Swap 10th and 1st frame of every ten frames of the input:
  13247. @example
  13248. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13249. @end example
  13250. @end itemize
  13251. @section shuffleplanes
  13252. Reorder and/or duplicate video planes.
  13253. It accepts the following parameters:
  13254. @table @option
  13255. @item map0
  13256. The index of the input plane to be used as the first output plane.
  13257. @item map1
  13258. The index of the input plane to be used as the second output plane.
  13259. @item map2
  13260. The index of the input plane to be used as the third output plane.
  13261. @item map3
  13262. The index of the input plane to be used as the fourth output plane.
  13263. @end table
  13264. The first plane has the index 0. The default is to keep the input unchanged.
  13265. @subsection Examples
  13266. @itemize
  13267. @item
  13268. Swap the second and third planes of the input:
  13269. @example
  13270. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13271. @end example
  13272. @end itemize
  13273. @anchor{signalstats}
  13274. @section signalstats
  13275. Evaluate various visual metrics that assist in determining issues associated
  13276. with the digitization of analog video media.
  13277. By default the filter will log these metadata values:
  13278. @table @option
  13279. @item YMIN
  13280. Display the minimal Y value contained within the input frame. Expressed in
  13281. range of [0-255].
  13282. @item YLOW
  13283. Display the Y value at the 10% percentile within the input frame. Expressed in
  13284. range of [0-255].
  13285. @item YAVG
  13286. Display the average Y value within the input frame. Expressed in range of
  13287. [0-255].
  13288. @item YHIGH
  13289. Display the Y value at the 90% percentile within the input frame. Expressed in
  13290. range of [0-255].
  13291. @item YMAX
  13292. Display the maximum Y value contained within the input frame. Expressed in
  13293. range of [0-255].
  13294. @item UMIN
  13295. Display the minimal U value contained within the input frame. Expressed in
  13296. range of [0-255].
  13297. @item ULOW
  13298. Display the U value at the 10% percentile within the input frame. Expressed in
  13299. range of [0-255].
  13300. @item UAVG
  13301. Display the average U value within the input frame. Expressed in range of
  13302. [0-255].
  13303. @item UHIGH
  13304. Display the U value at the 90% percentile within the input frame. Expressed in
  13305. range of [0-255].
  13306. @item UMAX
  13307. Display the maximum U value contained within the input frame. Expressed in
  13308. range of [0-255].
  13309. @item VMIN
  13310. Display the minimal V value contained within the input frame. Expressed in
  13311. range of [0-255].
  13312. @item VLOW
  13313. Display the V value at the 10% percentile within the input frame. Expressed in
  13314. range of [0-255].
  13315. @item VAVG
  13316. Display the average V value within the input frame. Expressed in range of
  13317. [0-255].
  13318. @item VHIGH
  13319. Display the V value at the 90% percentile within the input frame. Expressed in
  13320. range of [0-255].
  13321. @item VMAX
  13322. Display the maximum V value contained within the input frame. Expressed in
  13323. range of [0-255].
  13324. @item SATMIN
  13325. Display the minimal saturation value contained within the input frame.
  13326. Expressed in range of [0-~181.02].
  13327. @item SATLOW
  13328. Display the saturation value at the 10% percentile within the input frame.
  13329. Expressed in range of [0-~181.02].
  13330. @item SATAVG
  13331. Display the average saturation value within the input frame. Expressed in range
  13332. of [0-~181.02].
  13333. @item SATHIGH
  13334. Display the saturation value at the 90% percentile within the input frame.
  13335. Expressed in range of [0-~181.02].
  13336. @item SATMAX
  13337. Display the maximum saturation value contained within the input frame.
  13338. Expressed in range of [0-~181.02].
  13339. @item HUEMED
  13340. Display the median value for hue within the input frame. Expressed in range of
  13341. [0-360].
  13342. @item HUEAVG
  13343. Display the average value for hue within the input frame. Expressed in range of
  13344. [0-360].
  13345. @item YDIF
  13346. Display the average of sample value difference between all values of the Y
  13347. plane in the current frame and corresponding values of the previous input frame.
  13348. Expressed in range of [0-255].
  13349. @item UDIF
  13350. Display the average of sample value difference between all values of the U
  13351. plane in the current frame and corresponding values of the previous input frame.
  13352. Expressed in range of [0-255].
  13353. @item VDIF
  13354. Display the average of sample value difference between all values of the V
  13355. plane in the current frame and corresponding values of the previous input frame.
  13356. Expressed in range of [0-255].
  13357. @item YBITDEPTH
  13358. Display bit depth of Y plane in current frame.
  13359. Expressed in range of [0-16].
  13360. @item UBITDEPTH
  13361. Display bit depth of U plane in current frame.
  13362. Expressed in range of [0-16].
  13363. @item VBITDEPTH
  13364. Display bit depth of V plane in current frame.
  13365. Expressed in range of [0-16].
  13366. @end table
  13367. The filter accepts the following options:
  13368. @table @option
  13369. @item stat
  13370. @item out
  13371. @option{stat} specify an additional form of image analysis.
  13372. @option{out} output video with the specified type of pixel highlighted.
  13373. Both options accept the following values:
  13374. @table @samp
  13375. @item tout
  13376. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13377. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13378. include the results of video dropouts, head clogs, or tape tracking issues.
  13379. @item vrep
  13380. Identify @var{vertical line repetition}. Vertical line repetition includes
  13381. similar rows of pixels within a frame. In born-digital video vertical line
  13382. repetition is common, but this pattern is uncommon in video digitized from an
  13383. analog source. When it occurs in video that results from the digitization of an
  13384. analog source it can indicate concealment from a dropout compensator.
  13385. @item brng
  13386. Identify pixels that fall outside of legal broadcast range.
  13387. @end table
  13388. @item color, c
  13389. Set the highlight color for the @option{out} option. The default color is
  13390. yellow.
  13391. @end table
  13392. @subsection Examples
  13393. @itemize
  13394. @item
  13395. Output data of various video metrics:
  13396. @example
  13397. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13398. @end example
  13399. @item
  13400. Output specific data about the minimum and maximum values of the Y plane per frame:
  13401. @example
  13402. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13403. @end example
  13404. @item
  13405. Playback video while highlighting pixels that are outside of broadcast range in red.
  13406. @example
  13407. ffplay example.mov -vf signalstats="out=brng:color=red"
  13408. @end example
  13409. @item
  13410. Playback video with signalstats metadata drawn over the frame.
  13411. @example
  13412. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13413. @end example
  13414. The contents of signalstat_drawtext.txt used in the command are:
  13415. @example
  13416. time %@{pts:hms@}
  13417. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13418. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13419. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13420. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13421. @end example
  13422. @end itemize
  13423. @anchor{signature}
  13424. @section signature
  13425. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13426. input. In this case the matching between the inputs can be calculated additionally.
  13427. The filter always passes through the first input. The signature of each stream can
  13428. be written into a file.
  13429. It accepts the following options:
  13430. @table @option
  13431. @item detectmode
  13432. Enable or disable the matching process.
  13433. Available values are:
  13434. @table @samp
  13435. @item off
  13436. Disable the calculation of a matching (default).
  13437. @item full
  13438. Calculate the matching for the whole video and output whether the whole video
  13439. matches or only parts.
  13440. @item fast
  13441. Calculate only until a matching is found or the video ends. Should be faster in
  13442. some cases.
  13443. @end table
  13444. @item nb_inputs
  13445. Set the number of inputs. The option value must be a non negative integer.
  13446. Default value is 1.
  13447. @item filename
  13448. Set the path to which the output is written. If there is more than one input,
  13449. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13450. integer), that will be replaced with the input number. If no filename is
  13451. specified, no output will be written. This is the default.
  13452. @item format
  13453. Choose the output format.
  13454. Available values are:
  13455. @table @samp
  13456. @item binary
  13457. Use the specified binary representation (default).
  13458. @item xml
  13459. Use the specified xml representation.
  13460. @end table
  13461. @item th_d
  13462. Set threshold to detect one word as similar. The option value must be an integer
  13463. greater than zero. The default value is 9000.
  13464. @item th_dc
  13465. Set threshold to detect all words as similar. The option value must be an integer
  13466. greater than zero. The default value is 60000.
  13467. @item th_xh
  13468. Set threshold to detect frames as similar. The option value must be an integer
  13469. greater than zero. The default value is 116.
  13470. @item th_di
  13471. Set the minimum length of a sequence in frames to recognize it as matching
  13472. sequence. The option value must be a non negative integer value.
  13473. The default value is 0.
  13474. @item th_it
  13475. Set the minimum relation, that matching frames to all frames must have.
  13476. The option value must be a double value between 0 and 1. The default value is 0.5.
  13477. @end table
  13478. @subsection Examples
  13479. @itemize
  13480. @item
  13481. To calculate the signature of an input video and store it in signature.bin:
  13482. @example
  13483. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13484. @end example
  13485. @item
  13486. To detect whether two videos match and store the signatures in XML format in
  13487. signature0.xml and signature1.xml:
  13488. @example
  13489. 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 -
  13490. @end example
  13491. @end itemize
  13492. @anchor{smartblur}
  13493. @section smartblur
  13494. Blur the input video without impacting the outlines.
  13495. It accepts the following options:
  13496. @table @option
  13497. @item luma_radius, lr
  13498. Set the luma radius. The option value must be a float number in
  13499. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13500. used to blur the image (slower if larger). Default value is 1.0.
  13501. @item luma_strength, ls
  13502. Set the luma strength. The option value must be a float number
  13503. in the range [-1.0,1.0] that configures the blurring. A value included
  13504. in [0.0,1.0] will blur the image whereas a value included in
  13505. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13506. @item luma_threshold, lt
  13507. Set the luma threshold used as a coefficient to determine
  13508. whether a pixel should be blurred or not. The option value must be an
  13509. integer in the range [-30,30]. A value of 0 will filter all the image,
  13510. a value included in [0,30] will filter flat areas and a value included
  13511. in [-30,0] will filter edges. Default value is 0.
  13512. @item chroma_radius, cr
  13513. Set the chroma radius. The option value must be a float number in
  13514. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13515. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13516. @item chroma_strength, cs
  13517. Set the chroma strength. The option value must be a float number
  13518. in the range [-1.0,1.0] that configures the blurring. A value included
  13519. in [0.0,1.0] will blur the image whereas a value included in
  13520. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13521. @item chroma_threshold, ct
  13522. Set the chroma threshold used as a coefficient to determine
  13523. whether a pixel should be blurred or not. The option value must be an
  13524. integer in the range [-30,30]. A value of 0 will filter all the image,
  13525. a value included in [0,30] will filter flat areas and a value included
  13526. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13527. @end table
  13528. If a chroma option is not explicitly set, the corresponding luma value
  13529. is set.
  13530. @section sobel
  13531. Apply sobel operator to input video stream.
  13532. The filter accepts the following option:
  13533. @table @option
  13534. @item planes
  13535. Set which planes will be processed, unprocessed planes will be copied.
  13536. By default value 0xf, all planes will be processed.
  13537. @item scale
  13538. Set value which will be multiplied with filtered result.
  13539. @item delta
  13540. Set value which will be added to filtered result.
  13541. @end table
  13542. @anchor{spp}
  13543. @section spp
  13544. Apply a simple postprocessing filter that compresses and decompresses the image
  13545. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13546. and average the results.
  13547. The filter accepts the following options:
  13548. @table @option
  13549. @item quality
  13550. Set quality. This option defines the number of levels for averaging. It accepts
  13551. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13552. effect. A value of @code{6} means the higher quality. For each increment of
  13553. that value the speed drops by a factor of approximately 2. Default value is
  13554. @code{3}.
  13555. @item qp
  13556. Force a constant quantization parameter. If not set, the filter will use the QP
  13557. from the video stream (if available).
  13558. @item mode
  13559. Set thresholding mode. Available modes are:
  13560. @table @samp
  13561. @item hard
  13562. Set hard thresholding (default).
  13563. @item soft
  13564. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13565. @end table
  13566. @item use_bframe_qp
  13567. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13568. option may cause flicker since the B-Frames have often larger QP. Default is
  13569. @code{0} (not enabled).
  13570. @end table
  13571. @subsection Commands
  13572. This filter supports the following commands:
  13573. @table @option
  13574. @item quality, level
  13575. Set quality level. The value @code{max} can be used to set the maximum level,
  13576. currently @code{6}.
  13577. @end table
  13578. @anchor{sr}
  13579. @section sr
  13580. Scale the input by applying one of the super-resolution methods based on
  13581. convolutional neural networks. Supported models:
  13582. @itemize
  13583. @item
  13584. Super-Resolution Convolutional Neural Network model (SRCNN).
  13585. See @url{https://arxiv.org/abs/1501.00092}.
  13586. @item
  13587. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13588. See @url{https://arxiv.org/abs/1609.05158}.
  13589. @end itemize
  13590. Training scripts as well as scripts for model file (.pb) saving can be found at
  13591. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13592. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13593. Native model files (.model) can be generated from TensorFlow model
  13594. files (.pb) by using tools/python/convert.py
  13595. The filter accepts the following options:
  13596. @table @option
  13597. @item dnn_backend
  13598. Specify which DNN backend to use for model loading and execution. This option accepts
  13599. the following values:
  13600. @table @samp
  13601. @item native
  13602. Native implementation of DNN loading and execution.
  13603. @item tensorflow
  13604. TensorFlow backend. To enable this backend you
  13605. need to install the TensorFlow for C library (see
  13606. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13607. @code{--enable-libtensorflow}
  13608. @end table
  13609. Default value is @samp{native}.
  13610. @item model
  13611. Set path to model file specifying network architecture and its parameters.
  13612. Note that different backends use different file formats. TensorFlow backend
  13613. can load files for both formats, while native backend can load files for only
  13614. its format.
  13615. @item scale_factor
  13616. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13617. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13618. input upscaled using bicubic upscaling with proper scale factor.
  13619. @end table
  13620. This feature can also be finished with @ref{dnn_processing} filter.
  13621. @section ssim
  13622. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13623. This filter takes in input two input videos, the first input is
  13624. considered the "main" source and is passed unchanged to the
  13625. output. The second input is used as a "reference" video for computing
  13626. the SSIM.
  13627. Both video inputs must have the same resolution and pixel format for
  13628. this filter to work correctly. Also it assumes that both inputs
  13629. have the same number of frames, which are compared one by one.
  13630. The filter stores the calculated SSIM of each frame.
  13631. The description of the accepted parameters follows.
  13632. @table @option
  13633. @item stats_file, f
  13634. If specified the filter will use the named file to save the SSIM of
  13635. each individual frame. When filename equals "-" the data is sent to
  13636. standard output.
  13637. @end table
  13638. The file printed if @var{stats_file} is selected, contains a sequence of
  13639. key/value pairs of the form @var{key}:@var{value} for each compared
  13640. couple of frames.
  13641. A description of each shown parameter follows:
  13642. @table @option
  13643. @item n
  13644. sequential number of the input frame, starting from 1
  13645. @item Y, U, V, R, G, B
  13646. SSIM of the compared frames for the component specified by the suffix.
  13647. @item All
  13648. SSIM of the compared frames for the whole frame.
  13649. @item dB
  13650. Same as above but in dB representation.
  13651. @end table
  13652. This filter also supports the @ref{framesync} options.
  13653. @subsection Examples
  13654. @itemize
  13655. @item
  13656. For example:
  13657. @example
  13658. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13659. [main][ref] ssim="stats_file=stats.log" [out]
  13660. @end example
  13661. On this example the input file being processed is compared with the
  13662. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13663. is stored in @file{stats.log}.
  13664. @item
  13665. Another example with both psnr and ssim at same time:
  13666. @example
  13667. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13668. @end example
  13669. @item
  13670. Another example with different containers:
  13671. @example
  13672. 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 -
  13673. @end example
  13674. @end itemize
  13675. @section stereo3d
  13676. Convert between different stereoscopic image formats.
  13677. The filters accept the following options:
  13678. @table @option
  13679. @item in
  13680. Set stereoscopic image format of input.
  13681. Available values for input image formats are:
  13682. @table @samp
  13683. @item sbsl
  13684. side by side parallel (left eye left, right eye right)
  13685. @item sbsr
  13686. side by side crosseye (right eye left, left eye right)
  13687. @item sbs2l
  13688. side by side parallel with half width resolution
  13689. (left eye left, right eye right)
  13690. @item sbs2r
  13691. side by side crosseye with half width resolution
  13692. (right eye left, left eye right)
  13693. @item abl
  13694. @item tbl
  13695. above-below (left eye above, right eye below)
  13696. @item abr
  13697. @item tbr
  13698. above-below (right eye above, left eye below)
  13699. @item ab2l
  13700. @item tb2l
  13701. above-below with half height resolution
  13702. (left eye above, right eye below)
  13703. @item ab2r
  13704. @item tb2r
  13705. above-below with half height resolution
  13706. (right eye above, left eye below)
  13707. @item al
  13708. alternating frames (left eye first, right eye second)
  13709. @item ar
  13710. alternating frames (right eye first, left eye second)
  13711. @item irl
  13712. interleaved rows (left eye has top row, right eye starts on next row)
  13713. @item irr
  13714. interleaved rows (right eye has top row, left eye starts on next row)
  13715. @item icl
  13716. interleaved columns, left eye first
  13717. @item icr
  13718. interleaved columns, right eye first
  13719. Default value is @samp{sbsl}.
  13720. @end table
  13721. @item out
  13722. Set stereoscopic image format of output.
  13723. @table @samp
  13724. @item sbsl
  13725. side by side parallel (left eye left, right eye right)
  13726. @item sbsr
  13727. side by side crosseye (right eye left, left eye right)
  13728. @item sbs2l
  13729. side by side parallel with half width resolution
  13730. (left eye left, right eye right)
  13731. @item sbs2r
  13732. side by side crosseye with half width resolution
  13733. (right eye left, left eye right)
  13734. @item abl
  13735. @item tbl
  13736. above-below (left eye above, right eye below)
  13737. @item abr
  13738. @item tbr
  13739. above-below (right eye above, left eye below)
  13740. @item ab2l
  13741. @item tb2l
  13742. above-below with half height resolution
  13743. (left eye above, right eye below)
  13744. @item ab2r
  13745. @item tb2r
  13746. above-below with half height resolution
  13747. (right eye above, left eye below)
  13748. @item al
  13749. alternating frames (left eye first, right eye second)
  13750. @item ar
  13751. alternating frames (right eye first, left eye second)
  13752. @item irl
  13753. interleaved rows (left eye has top row, right eye starts on next row)
  13754. @item irr
  13755. interleaved rows (right eye has top row, left eye starts on next row)
  13756. @item arbg
  13757. anaglyph red/blue gray
  13758. (red filter on left eye, blue filter on right eye)
  13759. @item argg
  13760. anaglyph red/green gray
  13761. (red filter on left eye, green filter on right eye)
  13762. @item arcg
  13763. anaglyph red/cyan gray
  13764. (red filter on left eye, cyan filter on right eye)
  13765. @item arch
  13766. anaglyph red/cyan half colored
  13767. (red filter on left eye, cyan filter on right eye)
  13768. @item arcc
  13769. anaglyph red/cyan color
  13770. (red filter on left eye, cyan filter on right eye)
  13771. @item arcd
  13772. anaglyph red/cyan color optimized with the least squares projection of dubois
  13773. (red filter on left eye, cyan filter on right eye)
  13774. @item agmg
  13775. anaglyph green/magenta gray
  13776. (green filter on left eye, magenta filter on right eye)
  13777. @item agmh
  13778. anaglyph green/magenta half colored
  13779. (green filter on left eye, magenta filter on right eye)
  13780. @item agmc
  13781. anaglyph green/magenta colored
  13782. (green filter on left eye, magenta filter on right eye)
  13783. @item agmd
  13784. anaglyph green/magenta color optimized with the least squares projection of dubois
  13785. (green filter on left eye, magenta filter on right eye)
  13786. @item aybg
  13787. anaglyph yellow/blue gray
  13788. (yellow filter on left eye, blue filter on right eye)
  13789. @item aybh
  13790. anaglyph yellow/blue half colored
  13791. (yellow filter on left eye, blue filter on right eye)
  13792. @item aybc
  13793. anaglyph yellow/blue colored
  13794. (yellow filter on left eye, blue filter on right eye)
  13795. @item aybd
  13796. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13797. (yellow filter on left eye, blue filter on right eye)
  13798. @item ml
  13799. mono output (left eye only)
  13800. @item mr
  13801. mono output (right eye only)
  13802. @item chl
  13803. checkerboard, left eye first
  13804. @item chr
  13805. checkerboard, right eye first
  13806. @item icl
  13807. interleaved columns, left eye first
  13808. @item icr
  13809. interleaved columns, right eye first
  13810. @item hdmi
  13811. HDMI frame pack
  13812. @end table
  13813. Default value is @samp{arcd}.
  13814. @end table
  13815. @subsection Examples
  13816. @itemize
  13817. @item
  13818. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13819. @example
  13820. stereo3d=sbsl:aybd
  13821. @end example
  13822. @item
  13823. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13824. @example
  13825. stereo3d=abl:sbsr
  13826. @end example
  13827. @end itemize
  13828. @section streamselect, astreamselect
  13829. Select video or audio streams.
  13830. The filter accepts the following options:
  13831. @table @option
  13832. @item inputs
  13833. Set number of inputs. Default is 2.
  13834. @item map
  13835. Set input indexes to remap to outputs.
  13836. @end table
  13837. @subsection Commands
  13838. The @code{streamselect} and @code{astreamselect} filter supports the following
  13839. commands:
  13840. @table @option
  13841. @item map
  13842. Set input indexes to remap to outputs.
  13843. @end table
  13844. @subsection Examples
  13845. @itemize
  13846. @item
  13847. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13848. @example
  13849. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13850. @end example
  13851. @item
  13852. Same as above, but for audio:
  13853. @example
  13854. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13855. @end example
  13856. @end itemize
  13857. @anchor{subtitles}
  13858. @section subtitles
  13859. Draw subtitles on top of input video using the libass library.
  13860. To enable compilation of this filter you need to configure FFmpeg with
  13861. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13862. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13863. Alpha) subtitles format.
  13864. The filter accepts the following options:
  13865. @table @option
  13866. @item filename, f
  13867. Set the filename of the subtitle file to read. It must be specified.
  13868. @item original_size
  13869. Specify the size of the original video, the video for which the ASS file
  13870. was composed. For the syntax of this option, check the
  13871. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13872. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13873. correctly scale the fonts if the aspect ratio has been changed.
  13874. @item fontsdir
  13875. Set a directory path containing fonts that can be used by the filter.
  13876. These fonts will be used in addition to whatever the font provider uses.
  13877. @item alpha
  13878. Process alpha channel, by default alpha channel is untouched.
  13879. @item charenc
  13880. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13881. useful if not UTF-8.
  13882. @item stream_index, si
  13883. Set subtitles stream index. @code{subtitles} filter only.
  13884. @item force_style
  13885. Override default style or script info parameters of the subtitles. It accepts a
  13886. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13887. @end table
  13888. If the first key is not specified, it is assumed that the first value
  13889. specifies the @option{filename}.
  13890. For example, to render the file @file{sub.srt} on top of the input
  13891. video, use the command:
  13892. @example
  13893. subtitles=sub.srt
  13894. @end example
  13895. which is equivalent to:
  13896. @example
  13897. subtitles=filename=sub.srt
  13898. @end example
  13899. To render the default subtitles stream from file @file{video.mkv}, use:
  13900. @example
  13901. subtitles=video.mkv
  13902. @end example
  13903. To render the second subtitles stream from that file, use:
  13904. @example
  13905. subtitles=video.mkv:si=1
  13906. @end example
  13907. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13908. @code{DejaVu Serif}, use:
  13909. @example
  13910. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13911. @end example
  13912. @section super2xsai
  13913. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13914. Interpolate) pixel art scaling algorithm.
  13915. Useful for enlarging pixel art images without reducing sharpness.
  13916. @section swaprect
  13917. Swap two rectangular objects in video.
  13918. This filter accepts the following options:
  13919. @table @option
  13920. @item w
  13921. Set object width.
  13922. @item h
  13923. Set object height.
  13924. @item x1
  13925. Set 1st rect x coordinate.
  13926. @item y1
  13927. Set 1st rect y coordinate.
  13928. @item x2
  13929. Set 2nd rect x coordinate.
  13930. @item y2
  13931. Set 2nd rect y coordinate.
  13932. All expressions are evaluated once for each frame.
  13933. @end table
  13934. The all options are expressions containing the following constants:
  13935. @table @option
  13936. @item w
  13937. @item h
  13938. The input width and height.
  13939. @item a
  13940. same as @var{w} / @var{h}
  13941. @item sar
  13942. input sample aspect ratio
  13943. @item dar
  13944. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13945. @item n
  13946. The number of the input frame, starting from 0.
  13947. @item t
  13948. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13949. @item pos
  13950. the position in the file of the input frame, NAN if unknown
  13951. @end table
  13952. @section swapuv
  13953. Swap U & V plane.
  13954. @section tblend
  13955. Blend successive video frames.
  13956. See @ref{blend}
  13957. @section telecine
  13958. Apply telecine process to the video.
  13959. This filter accepts the following options:
  13960. @table @option
  13961. @item first_field
  13962. @table @samp
  13963. @item top, t
  13964. top field first
  13965. @item bottom, b
  13966. bottom field first
  13967. The default value is @code{top}.
  13968. @end table
  13969. @item pattern
  13970. A string of numbers representing the pulldown pattern you wish to apply.
  13971. The default value is @code{23}.
  13972. @end table
  13973. @example
  13974. Some typical patterns:
  13975. NTSC output (30i):
  13976. 27.5p: 32222
  13977. 24p: 23 (classic)
  13978. 24p: 2332 (preferred)
  13979. 20p: 33
  13980. 18p: 334
  13981. 16p: 3444
  13982. PAL output (25i):
  13983. 27.5p: 12222
  13984. 24p: 222222222223 ("Euro pulldown")
  13985. 16.67p: 33
  13986. 16p: 33333334
  13987. @end example
  13988. @section thistogram
  13989. Compute and draw a color distribution histogram for the input video across time.
  13990. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13991. at certain time, this filter shows also past histograms of number of frames defined
  13992. by @code{width} option.
  13993. The computed histogram is a representation of the color component
  13994. distribution in an image.
  13995. The filter accepts the following options:
  13996. @table @option
  13997. @item width, w
  13998. Set width of single color component output. Default value is @code{0}.
  13999. Value of @code{0} means width will be picked from input video.
  14000. This also set number of passed histograms to keep.
  14001. Allowed range is [0, 8192].
  14002. @item display_mode, d
  14003. Set display mode.
  14004. It accepts the following values:
  14005. @table @samp
  14006. @item stack
  14007. Per color component graphs are placed below each other.
  14008. @item parade
  14009. Per color component graphs are placed side by side.
  14010. @item overlay
  14011. Presents information identical to that in the @code{parade}, except
  14012. that the graphs representing color components are superimposed directly
  14013. over one another.
  14014. @end table
  14015. Default is @code{stack}.
  14016. @item levels_mode, m
  14017. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  14018. Default is @code{linear}.
  14019. @item components, c
  14020. Set what color components to display.
  14021. Default is @code{7}.
  14022. @item bgopacity, b
  14023. Set background opacity. Default is @code{0.9}.
  14024. @item envelope, e
  14025. Show envelope. Default is disabled.
  14026. @item ecolor, ec
  14027. Set envelope color. Default is @code{gold}.
  14028. @item slide
  14029. Set slide mode.
  14030. Available values for slide is:
  14031. @table @samp
  14032. @item frame
  14033. Draw new frame when right border is reached.
  14034. @item replace
  14035. Replace old columns with new ones.
  14036. @item scroll
  14037. Scroll from right to left.
  14038. @item rscroll
  14039. Scroll from left to right.
  14040. @item picture
  14041. Draw single picture.
  14042. @end table
  14043. Default is @code{replace}.
  14044. @end table
  14045. @section threshold
  14046. Apply threshold effect to video stream.
  14047. This filter needs four video streams to perform thresholding.
  14048. First stream is stream we are filtering.
  14049. Second stream is holding threshold values, third stream is holding min values,
  14050. and last, fourth stream is holding max values.
  14051. The filter accepts the following option:
  14052. @table @option
  14053. @item planes
  14054. Set which planes will be processed, unprocessed planes will be copied.
  14055. By default value 0xf, all planes will be processed.
  14056. @end table
  14057. For example if first stream pixel's component value is less then threshold value
  14058. of pixel component from 2nd threshold stream, third stream value will picked,
  14059. otherwise fourth stream pixel component value will be picked.
  14060. Using color source filter one can perform various types of thresholding:
  14061. @subsection Examples
  14062. @itemize
  14063. @item
  14064. Binary threshold, using gray color as threshold:
  14065. @example
  14066. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  14067. @end example
  14068. @item
  14069. Inverted binary threshold, using gray color as threshold:
  14070. @example
  14071. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  14072. @end example
  14073. @item
  14074. Truncate binary threshold, using gray color as threshold:
  14075. @example
  14076. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14077. @end example
  14078. @item
  14079. Threshold to zero, using gray color as threshold:
  14080. @example
  14081. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14082. @end example
  14083. @item
  14084. Inverted threshold to zero, using gray color as threshold:
  14085. @example
  14086. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14087. @end example
  14088. @end itemize
  14089. @section thumbnail
  14090. Select the most representative frame in a given sequence of consecutive frames.
  14091. The filter accepts the following options:
  14092. @table @option
  14093. @item n
  14094. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14095. will pick one of them, and then handle the next batch of @var{n} frames until
  14096. the end. Default is @code{100}.
  14097. @end table
  14098. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14099. value will result in a higher memory usage, so a high value is not recommended.
  14100. @subsection Examples
  14101. @itemize
  14102. @item
  14103. Extract one picture each 50 frames:
  14104. @example
  14105. thumbnail=50
  14106. @end example
  14107. @item
  14108. Complete example of a thumbnail creation with @command{ffmpeg}:
  14109. @example
  14110. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14111. @end example
  14112. @end itemize
  14113. @anchor{tile}
  14114. @section tile
  14115. Tile several successive frames together.
  14116. The @ref{untile} filter can do the reverse.
  14117. The filter accepts the following options:
  14118. @table @option
  14119. @item layout
  14120. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14121. this option, check the
  14122. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14123. @item nb_frames
  14124. Set the maximum number of frames to render in the given area. It must be less
  14125. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14126. the area will be used.
  14127. @item margin
  14128. Set the outer border margin in pixels.
  14129. @item padding
  14130. Set the inner border thickness (i.e. the number of pixels between frames). For
  14131. more advanced padding options (such as having different values for the edges),
  14132. refer to the pad video filter.
  14133. @item color
  14134. Specify the color of the unused area. For the syntax of this option, check the
  14135. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14136. The default value of @var{color} is "black".
  14137. @item overlap
  14138. Set the number of frames to overlap when tiling several successive frames together.
  14139. The value must be between @code{0} and @var{nb_frames - 1}.
  14140. @item init_padding
  14141. Set the number of frames to initially be empty before displaying first output frame.
  14142. This controls how soon will one get first output frame.
  14143. The value must be between @code{0} and @var{nb_frames - 1}.
  14144. @end table
  14145. @subsection Examples
  14146. @itemize
  14147. @item
  14148. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14149. @example
  14150. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14151. @end example
  14152. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14153. duplicating each output frame to accommodate the originally detected frame
  14154. rate.
  14155. @item
  14156. Display @code{5} pictures in an area of @code{3x2} frames,
  14157. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14158. mixed flat and named options:
  14159. @example
  14160. tile=3x2:nb_frames=5:padding=7:margin=2
  14161. @end example
  14162. @end itemize
  14163. @section tinterlace
  14164. Perform various types of temporal field interlacing.
  14165. Frames are counted starting from 1, so the first input frame is
  14166. considered odd.
  14167. The filter accepts the following options:
  14168. @table @option
  14169. @item mode
  14170. Specify the mode of the interlacing. This option can also be specified
  14171. as a value alone. See below for a list of values for this option.
  14172. Available values are:
  14173. @table @samp
  14174. @item merge, 0
  14175. Move odd frames into the upper field, even into the lower field,
  14176. generating a double height frame at half frame rate.
  14177. @example
  14178. ------> time
  14179. Input:
  14180. Frame 1 Frame 2 Frame 3 Frame 4
  14181. 11111 22222 33333 44444
  14182. 11111 22222 33333 44444
  14183. 11111 22222 33333 44444
  14184. 11111 22222 33333 44444
  14185. Output:
  14186. 11111 33333
  14187. 22222 44444
  14188. 11111 33333
  14189. 22222 44444
  14190. 11111 33333
  14191. 22222 44444
  14192. 11111 33333
  14193. 22222 44444
  14194. @end example
  14195. @item drop_even, 1
  14196. Only output odd frames, even frames are dropped, generating a frame with
  14197. unchanged height at half frame rate.
  14198. @example
  14199. ------> time
  14200. Input:
  14201. Frame 1 Frame 2 Frame 3 Frame 4
  14202. 11111 22222 33333 44444
  14203. 11111 22222 33333 44444
  14204. 11111 22222 33333 44444
  14205. 11111 22222 33333 44444
  14206. Output:
  14207. 11111 33333
  14208. 11111 33333
  14209. 11111 33333
  14210. 11111 33333
  14211. @end example
  14212. @item drop_odd, 2
  14213. Only output even frames, odd frames are dropped, generating a frame with
  14214. unchanged height at half frame rate.
  14215. @example
  14216. ------> time
  14217. Input:
  14218. Frame 1 Frame 2 Frame 3 Frame 4
  14219. 11111 22222 33333 44444
  14220. 11111 22222 33333 44444
  14221. 11111 22222 33333 44444
  14222. 11111 22222 33333 44444
  14223. Output:
  14224. 22222 44444
  14225. 22222 44444
  14226. 22222 44444
  14227. 22222 44444
  14228. @end example
  14229. @item pad, 3
  14230. Expand each frame to full height, but pad alternate lines with black,
  14231. generating a frame with double height at the same input frame rate.
  14232. @example
  14233. ------> time
  14234. Input:
  14235. Frame 1 Frame 2 Frame 3 Frame 4
  14236. 11111 22222 33333 44444
  14237. 11111 22222 33333 44444
  14238. 11111 22222 33333 44444
  14239. 11111 22222 33333 44444
  14240. Output:
  14241. 11111 ..... 33333 .....
  14242. ..... 22222 ..... 44444
  14243. 11111 ..... 33333 .....
  14244. ..... 22222 ..... 44444
  14245. 11111 ..... 33333 .....
  14246. ..... 22222 ..... 44444
  14247. 11111 ..... 33333 .....
  14248. ..... 22222 ..... 44444
  14249. @end example
  14250. @item interleave_top, 4
  14251. Interleave the upper field from odd frames with the lower field from
  14252. even frames, generating a frame with unchanged height at half frame rate.
  14253. @example
  14254. ------> time
  14255. Input:
  14256. Frame 1 Frame 2 Frame 3 Frame 4
  14257. 11111<- 22222 33333<- 44444
  14258. 11111 22222<- 33333 44444<-
  14259. 11111<- 22222 33333<- 44444
  14260. 11111 22222<- 33333 44444<-
  14261. Output:
  14262. 11111 33333
  14263. 22222 44444
  14264. 11111 33333
  14265. 22222 44444
  14266. @end example
  14267. @item interleave_bottom, 5
  14268. Interleave the lower field from odd frames with the upper field from
  14269. even frames, generating a frame with unchanged height at half frame rate.
  14270. @example
  14271. ------> time
  14272. Input:
  14273. Frame 1 Frame 2 Frame 3 Frame 4
  14274. 11111 22222<- 33333 44444<-
  14275. 11111<- 22222 33333<- 44444
  14276. 11111 22222<- 33333 44444<-
  14277. 11111<- 22222 33333<- 44444
  14278. Output:
  14279. 22222 44444
  14280. 11111 33333
  14281. 22222 44444
  14282. 11111 33333
  14283. @end example
  14284. @item interlacex2, 6
  14285. Double frame rate with unchanged height. Frames are inserted each
  14286. containing the second temporal field from the previous input frame and
  14287. the first temporal field from the next input frame. This mode relies on
  14288. the top_field_first flag. Useful for interlaced video displays with no
  14289. field synchronisation.
  14290. @example
  14291. ------> time
  14292. Input:
  14293. Frame 1 Frame 2 Frame 3 Frame 4
  14294. 11111 22222 33333 44444
  14295. 11111 22222 33333 44444
  14296. 11111 22222 33333 44444
  14297. 11111 22222 33333 44444
  14298. Output:
  14299. 11111 22222 22222 33333 33333 44444 44444
  14300. 11111 11111 22222 22222 33333 33333 44444
  14301. 11111 22222 22222 33333 33333 44444 44444
  14302. 11111 11111 22222 22222 33333 33333 44444
  14303. @end example
  14304. @item mergex2, 7
  14305. Move odd frames into the upper field, even into the lower field,
  14306. generating a double height frame at same frame rate.
  14307. @example
  14308. ------> time
  14309. Input:
  14310. Frame 1 Frame 2 Frame 3 Frame 4
  14311. 11111 22222 33333 44444
  14312. 11111 22222 33333 44444
  14313. 11111 22222 33333 44444
  14314. 11111 22222 33333 44444
  14315. Output:
  14316. 11111 33333 33333 55555
  14317. 22222 22222 44444 44444
  14318. 11111 33333 33333 55555
  14319. 22222 22222 44444 44444
  14320. 11111 33333 33333 55555
  14321. 22222 22222 44444 44444
  14322. 11111 33333 33333 55555
  14323. 22222 22222 44444 44444
  14324. @end example
  14325. @end table
  14326. Numeric values are deprecated but are accepted for backward
  14327. compatibility reasons.
  14328. Default mode is @code{merge}.
  14329. @item flags
  14330. Specify flags influencing the filter process.
  14331. Available value for @var{flags} is:
  14332. @table @option
  14333. @item low_pass_filter, vlpf
  14334. Enable linear vertical low-pass filtering in the filter.
  14335. Vertical low-pass filtering is required when creating an interlaced
  14336. destination from a progressive source which contains high-frequency
  14337. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14338. patterning.
  14339. @item complex_filter, cvlpf
  14340. Enable complex vertical low-pass filtering.
  14341. This will slightly less reduce interlace 'twitter' and Moire
  14342. patterning but better retain detail and subjective sharpness impression.
  14343. @item bypass_il
  14344. Bypass already interlaced frames, only adjust the frame rate.
  14345. @end table
  14346. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14347. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14348. @end table
  14349. @section tmedian
  14350. Pick median pixels from several successive input video frames.
  14351. The filter accepts the following options:
  14352. @table @option
  14353. @item radius
  14354. Set radius of median filter.
  14355. Default is 1. Allowed range is from 1 to 127.
  14356. @item planes
  14357. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14358. @item percentile
  14359. Set median percentile. Default value is @code{0.5}.
  14360. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14361. minimum values, and @code{1} maximum values.
  14362. @end table
  14363. @section tmix
  14364. Mix successive video frames.
  14365. A description of the accepted options follows.
  14366. @table @option
  14367. @item frames
  14368. The number of successive frames to mix. If unspecified, it defaults to 3.
  14369. @item weights
  14370. Specify weight of each input video frame.
  14371. Each weight is separated by space. If number of weights is smaller than
  14372. number of @var{frames} last specified weight will be used for all remaining
  14373. unset weights.
  14374. @item scale
  14375. Specify scale, if it is set it will be multiplied with sum
  14376. of each weight multiplied with pixel values to give final destination
  14377. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14378. @end table
  14379. @subsection Examples
  14380. @itemize
  14381. @item
  14382. Average 7 successive frames:
  14383. @example
  14384. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14385. @end example
  14386. @item
  14387. Apply simple temporal convolution:
  14388. @example
  14389. tmix=frames=3:weights="-1 3 -1"
  14390. @end example
  14391. @item
  14392. Similar as above but only showing temporal differences:
  14393. @example
  14394. tmix=frames=3:weights="-1 2 -1":scale=1
  14395. @end example
  14396. @end itemize
  14397. @anchor{tonemap}
  14398. @section tonemap
  14399. Tone map colors from different dynamic ranges.
  14400. This filter expects data in single precision floating point, as it needs to
  14401. operate on (and can output) out-of-range values. Another filter, such as
  14402. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14403. The tonemapping algorithms implemented only work on linear light, so input
  14404. data should be linearized beforehand (and possibly correctly tagged).
  14405. @example
  14406. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14407. @end example
  14408. @subsection Options
  14409. The filter accepts the following options.
  14410. @table @option
  14411. @item tonemap
  14412. Set the tone map algorithm to use.
  14413. Possible values are:
  14414. @table @var
  14415. @item none
  14416. Do not apply any tone map, only desaturate overbright pixels.
  14417. @item clip
  14418. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14419. in-range values, while distorting out-of-range values.
  14420. @item linear
  14421. Stretch the entire reference gamut to a linear multiple of the display.
  14422. @item gamma
  14423. Fit a logarithmic transfer between the tone curves.
  14424. @item reinhard
  14425. Preserve overall image brightness with a simple curve, using nonlinear
  14426. contrast, which results in flattening details and degrading color accuracy.
  14427. @item hable
  14428. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14429. of slightly darkening everything. Use it when detail preservation is more
  14430. important than color and brightness accuracy.
  14431. @item mobius
  14432. Smoothly map out-of-range values, while retaining contrast and colors for
  14433. in-range material as much as possible. Use it when color accuracy is more
  14434. important than detail preservation.
  14435. @end table
  14436. Default is none.
  14437. @item param
  14438. Tune the tone mapping algorithm.
  14439. This affects the following algorithms:
  14440. @table @var
  14441. @item none
  14442. Ignored.
  14443. @item linear
  14444. Specifies the scale factor to use while stretching.
  14445. Default to 1.0.
  14446. @item gamma
  14447. Specifies the exponent of the function.
  14448. Default to 1.8.
  14449. @item clip
  14450. Specify an extra linear coefficient to multiply into the signal before clipping.
  14451. Default to 1.0.
  14452. @item reinhard
  14453. Specify the local contrast coefficient at the display peak.
  14454. Default to 0.5, which means that in-gamut values will be about half as bright
  14455. as when clipping.
  14456. @item hable
  14457. Ignored.
  14458. @item mobius
  14459. Specify the transition point from linear to mobius transform. Every value
  14460. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14461. more accurate the result will be, at the cost of losing bright details.
  14462. Default to 0.3, which due to the steep initial slope still preserves in-range
  14463. colors fairly accurately.
  14464. @end table
  14465. @item desat
  14466. Apply desaturation for highlights that exceed this level of brightness. The
  14467. higher the parameter, the more color information will be preserved. This
  14468. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14469. (smoothly) turning into white instead. This makes images feel more natural,
  14470. at the cost of reducing information about out-of-range colors.
  14471. The default of 2.0 is somewhat conservative and will mostly just apply to
  14472. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14473. This option works only if the input frame has a supported color tag.
  14474. @item peak
  14475. Override signal/nominal/reference peak with this value. Useful when the
  14476. embedded peak information in display metadata is not reliable or when tone
  14477. mapping from a lower range to a higher range.
  14478. @end table
  14479. @section tpad
  14480. Temporarily pad video frames.
  14481. The filter accepts the following options:
  14482. @table @option
  14483. @item start
  14484. Specify number of delay frames before input video stream. Default is 0.
  14485. @item stop
  14486. Specify number of padding frames after input video stream.
  14487. Set to -1 to pad indefinitely. Default is 0.
  14488. @item start_mode
  14489. Set kind of frames added to beginning of stream.
  14490. Can be either @var{add} or @var{clone}.
  14491. With @var{add} frames of solid-color are added.
  14492. With @var{clone} frames are clones of first frame.
  14493. Default is @var{add}.
  14494. @item stop_mode
  14495. Set kind of frames added to end of stream.
  14496. Can be either @var{add} or @var{clone}.
  14497. With @var{add} frames of solid-color are added.
  14498. With @var{clone} frames are clones of last frame.
  14499. Default is @var{add}.
  14500. @item start_duration, stop_duration
  14501. Specify the duration of the start/stop delay. See
  14502. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14503. for the accepted syntax.
  14504. These options override @var{start} and @var{stop}. Default is 0.
  14505. @item color
  14506. Specify the color of the padded area. For the syntax of this option,
  14507. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14508. manual,ffmpeg-utils}.
  14509. The default value of @var{color} is "black".
  14510. @end table
  14511. @anchor{transpose}
  14512. @section transpose
  14513. Transpose rows with columns in the input video and optionally flip it.
  14514. It accepts the following parameters:
  14515. @table @option
  14516. @item dir
  14517. Specify the transposition direction.
  14518. Can assume the following values:
  14519. @table @samp
  14520. @item 0, 4, cclock_flip
  14521. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14522. @example
  14523. L.R L.l
  14524. . . -> . .
  14525. l.r R.r
  14526. @end example
  14527. @item 1, 5, clock
  14528. Rotate by 90 degrees clockwise, that is:
  14529. @example
  14530. L.R l.L
  14531. . . -> . .
  14532. l.r r.R
  14533. @end example
  14534. @item 2, 6, cclock
  14535. Rotate by 90 degrees counterclockwise, that is:
  14536. @example
  14537. L.R R.r
  14538. . . -> . .
  14539. l.r L.l
  14540. @end example
  14541. @item 3, 7, clock_flip
  14542. Rotate by 90 degrees clockwise and vertically flip, that is:
  14543. @example
  14544. L.R r.R
  14545. . . -> . .
  14546. l.r l.L
  14547. @end example
  14548. @end table
  14549. For values between 4-7, the transposition is only done if the input
  14550. video geometry is portrait and not landscape. These values are
  14551. deprecated, the @code{passthrough} option should be used instead.
  14552. Numerical values are deprecated, and should be dropped in favor of
  14553. symbolic constants.
  14554. @item passthrough
  14555. Do not apply the transposition if the input geometry matches the one
  14556. specified by the specified value. It accepts the following values:
  14557. @table @samp
  14558. @item none
  14559. Always apply transposition.
  14560. @item portrait
  14561. Preserve portrait geometry (when @var{height} >= @var{width}).
  14562. @item landscape
  14563. Preserve landscape geometry (when @var{width} >= @var{height}).
  14564. @end table
  14565. Default value is @code{none}.
  14566. @end table
  14567. For example to rotate by 90 degrees clockwise and preserve portrait
  14568. layout:
  14569. @example
  14570. transpose=dir=1:passthrough=portrait
  14571. @end example
  14572. The command above can also be specified as:
  14573. @example
  14574. transpose=1:portrait
  14575. @end example
  14576. @section transpose_npp
  14577. Transpose rows with columns in the input video and optionally flip it.
  14578. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14579. It accepts the following parameters:
  14580. @table @option
  14581. @item dir
  14582. Specify the transposition direction.
  14583. Can assume the following values:
  14584. @table @samp
  14585. @item cclock_flip
  14586. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14587. @item clock
  14588. Rotate by 90 degrees clockwise.
  14589. @item cclock
  14590. Rotate by 90 degrees counterclockwise.
  14591. @item clock_flip
  14592. Rotate by 90 degrees clockwise and vertically flip.
  14593. @end table
  14594. @item passthrough
  14595. Do not apply the transposition if the input geometry matches the one
  14596. specified by the specified value. It accepts the following values:
  14597. @table @samp
  14598. @item none
  14599. Always apply transposition. (default)
  14600. @item portrait
  14601. Preserve portrait geometry (when @var{height} >= @var{width}).
  14602. @item landscape
  14603. Preserve landscape geometry (when @var{width} >= @var{height}).
  14604. @end table
  14605. @end table
  14606. @section trim
  14607. Trim the input so that the output contains one continuous subpart of the input.
  14608. It accepts the following parameters:
  14609. @table @option
  14610. @item start
  14611. Specify the time of the start of the kept section, i.e. the frame with the
  14612. timestamp @var{start} will be the first frame in the output.
  14613. @item end
  14614. Specify the time of the first frame that will be dropped, i.e. the frame
  14615. immediately preceding the one with the timestamp @var{end} will be the last
  14616. frame in the output.
  14617. @item start_pts
  14618. This is the same as @var{start}, except this option sets the start timestamp
  14619. in timebase units instead of seconds.
  14620. @item end_pts
  14621. This is the same as @var{end}, except this option sets the end timestamp
  14622. in timebase units instead of seconds.
  14623. @item duration
  14624. The maximum duration of the output in seconds.
  14625. @item start_frame
  14626. The number of the first frame that should be passed to the output.
  14627. @item end_frame
  14628. The number of the first frame that should be dropped.
  14629. @end table
  14630. @option{start}, @option{end}, and @option{duration} are expressed as time
  14631. duration specifications; see
  14632. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14633. for the accepted syntax.
  14634. Note that the first two sets of the start/end options and the @option{duration}
  14635. option look at the frame timestamp, while the _frame variants simply count the
  14636. frames that pass through the filter. Also note that this filter does not modify
  14637. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14638. setpts filter after the trim filter.
  14639. If multiple start or end options are set, this filter tries to be greedy and
  14640. keep all the frames that match at least one of the specified constraints. To keep
  14641. only the part that matches all the constraints at once, chain multiple trim
  14642. filters.
  14643. The defaults are such that all the input is kept. So it is possible to set e.g.
  14644. just the end values to keep everything before the specified time.
  14645. Examples:
  14646. @itemize
  14647. @item
  14648. Drop everything except the second minute of input:
  14649. @example
  14650. ffmpeg -i INPUT -vf trim=60:120
  14651. @end example
  14652. @item
  14653. Keep only the first second:
  14654. @example
  14655. ffmpeg -i INPUT -vf trim=duration=1
  14656. @end example
  14657. @end itemize
  14658. @section unpremultiply
  14659. Apply alpha unpremultiply effect to input video stream using first plane
  14660. of second stream as alpha.
  14661. Both streams must have same dimensions and same pixel format.
  14662. The filter accepts the following option:
  14663. @table @option
  14664. @item planes
  14665. Set which planes will be processed, unprocessed planes will be copied.
  14666. By default value 0xf, all planes will be processed.
  14667. If the format has 1 or 2 components, then luma is bit 0.
  14668. If the format has 3 or 4 components:
  14669. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14670. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14671. If present, the alpha channel is always the last bit.
  14672. @item inplace
  14673. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14674. @end table
  14675. @anchor{unsharp}
  14676. @section unsharp
  14677. Sharpen or blur the input video.
  14678. It accepts the following parameters:
  14679. @table @option
  14680. @item luma_msize_x, lx
  14681. Set the luma matrix horizontal size. It must be an odd integer between
  14682. 3 and 23. The default value is 5.
  14683. @item luma_msize_y, ly
  14684. Set the luma matrix vertical size. It must be an odd integer between 3
  14685. and 23. The default value is 5.
  14686. @item luma_amount, la
  14687. Set the luma effect strength. It must be a floating point number, reasonable
  14688. values lay between -1.5 and 1.5.
  14689. Negative values will blur the input video, while positive values will
  14690. sharpen it, a value of zero will disable the effect.
  14691. Default value is 1.0.
  14692. @item chroma_msize_x, cx
  14693. Set the chroma matrix horizontal size. It must be an odd integer
  14694. between 3 and 23. The default value is 5.
  14695. @item chroma_msize_y, cy
  14696. Set the chroma matrix vertical size. It must be an odd integer
  14697. between 3 and 23. The default value is 5.
  14698. @item chroma_amount, ca
  14699. Set the chroma effect strength. It must be a floating point number, reasonable
  14700. values lay between -1.5 and 1.5.
  14701. Negative values will blur the input video, while positive values will
  14702. sharpen it, a value of zero will disable the effect.
  14703. Default value is 0.0.
  14704. @end table
  14705. All parameters are optional and default to the equivalent of the
  14706. string '5:5:1.0:5:5:0.0'.
  14707. @subsection Examples
  14708. @itemize
  14709. @item
  14710. Apply strong luma sharpen effect:
  14711. @example
  14712. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14713. @end example
  14714. @item
  14715. Apply a strong blur of both luma and chroma parameters:
  14716. @example
  14717. unsharp=7:7:-2:7:7:-2
  14718. @end example
  14719. @end itemize
  14720. @anchor{untile}
  14721. @section untile
  14722. Decompose a video made of tiled images into the individual images.
  14723. The frame rate of the output video is the frame rate of the input video
  14724. multiplied by the number of tiles.
  14725. This filter does the reverse of @ref{tile}.
  14726. The filter accepts the following options:
  14727. @table @option
  14728. @item layout
  14729. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14730. this option, check the
  14731. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14732. @end table
  14733. @subsection Examples
  14734. @itemize
  14735. @item
  14736. Produce a 1-second video from a still image file made of 25 frames stacked
  14737. vertically, like an analogic film reel:
  14738. @example
  14739. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  14740. @end example
  14741. @end itemize
  14742. @section uspp
  14743. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14744. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14745. shifts and average the results.
  14746. The way this differs from the behavior of spp is that uspp actually encodes &
  14747. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14748. DCT similar to MJPEG.
  14749. The filter accepts the following options:
  14750. @table @option
  14751. @item quality
  14752. Set quality. This option defines the number of levels for averaging. It accepts
  14753. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14754. effect. A value of @code{8} means the higher quality. For each increment of
  14755. that value the speed drops by a factor of approximately 2. Default value is
  14756. @code{3}.
  14757. @item qp
  14758. Force a constant quantization parameter. If not set, the filter will use the QP
  14759. from the video stream (if available).
  14760. @end table
  14761. @section v360
  14762. Convert 360 videos between various formats.
  14763. The filter accepts the following options:
  14764. @table @option
  14765. @item input
  14766. @item output
  14767. Set format of the input/output video.
  14768. Available formats:
  14769. @table @samp
  14770. @item e
  14771. @item equirect
  14772. Equirectangular projection.
  14773. @item c3x2
  14774. @item c6x1
  14775. @item c1x6
  14776. Cubemap with 3x2/6x1/1x6 layout.
  14777. Format specific options:
  14778. @table @option
  14779. @item in_pad
  14780. @item out_pad
  14781. Set padding proportion for the input/output cubemap. Values in decimals.
  14782. Example values:
  14783. @table @samp
  14784. @item 0
  14785. No padding.
  14786. @item 0.01
  14787. 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)
  14788. @end table
  14789. Default value is @b{@samp{0}}.
  14790. Maximum value is @b{@samp{0.1}}.
  14791. @item fin_pad
  14792. @item fout_pad
  14793. Set fixed padding for the input/output cubemap. Values in pixels.
  14794. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14795. @item in_forder
  14796. @item out_forder
  14797. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14798. Designation of directions:
  14799. @table @samp
  14800. @item r
  14801. right
  14802. @item l
  14803. left
  14804. @item u
  14805. up
  14806. @item d
  14807. down
  14808. @item f
  14809. forward
  14810. @item b
  14811. back
  14812. @end table
  14813. Default value is @b{@samp{rludfb}}.
  14814. @item in_frot
  14815. @item out_frot
  14816. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14817. Designation of angles:
  14818. @table @samp
  14819. @item 0
  14820. 0 degrees clockwise
  14821. @item 1
  14822. 90 degrees clockwise
  14823. @item 2
  14824. 180 degrees clockwise
  14825. @item 3
  14826. 270 degrees clockwise
  14827. @end table
  14828. Default value is @b{@samp{000000}}.
  14829. @end table
  14830. @item eac
  14831. Equi-Angular Cubemap.
  14832. @item flat
  14833. @item gnomonic
  14834. @item rectilinear
  14835. Regular video.
  14836. Format specific options:
  14837. @table @option
  14838. @item h_fov
  14839. @item v_fov
  14840. @item d_fov
  14841. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14842. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14843. @item ih_fov
  14844. @item iv_fov
  14845. @item id_fov
  14846. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14847. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14848. @end table
  14849. @item dfisheye
  14850. Dual fisheye.
  14851. Format specific options:
  14852. @table @option
  14853. @item h_fov
  14854. @item v_fov
  14855. @item d_fov
  14856. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14857. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14858. @item ih_fov
  14859. @item iv_fov
  14860. @item id_fov
  14861. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14862. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14863. @end table
  14864. @item barrel
  14865. @item fb
  14866. @item barrelsplit
  14867. Facebook's 360 formats.
  14868. @item sg
  14869. Stereographic format.
  14870. Format specific options:
  14871. @table @option
  14872. @item h_fov
  14873. @item v_fov
  14874. @item d_fov
  14875. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14876. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14877. @item ih_fov
  14878. @item iv_fov
  14879. @item id_fov
  14880. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14881. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14882. @end table
  14883. @item mercator
  14884. Mercator format.
  14885. @item ball
  14886. Ball format, gives significant distortion toward the back.
  14887. @item hammer
  14888. Hammer-Aitoff map projection format.
  14889. @item sinusoidal
  14890. Sinusoidal map projection format.
  14891. @item fisheye
  14892. Fisheye projection.
  14893. Format specific options:
  14894. @table @option
  14895. @item h_fov
  14896. @item v_fov
  14897. @item d_fov
  14898. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14899. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14900. @item ih_fov
  14901. @item iv_fov
  14902. @item id_fov
  14903. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14904. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14905. @end table
  14906. @item pannini
  14907. Pannini projection.
  14908. Format specific options:
  14909. @table @option
  14910. @item h_fov
  14911. Set output pannini parameter.
  14912. @item ih_fov
  14913. Set input pannini parameter.
  14914. @end table
  14915. @item cylindrical
  14916. Cylindrical projection.
  14917. Format specific options:
  14918. @table @option
  14919. @item h_fov
  14920. @item v_fov
  14921. @item d_fov
  14922. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14923. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14924. @item ih_fov
  14925. @item iv_fov
  14926. @item id_fov
  14927. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14928. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14929. @end table
  14930. @item perspective
  14931. Perspective projection. @i{(output only)}
  14932. Format specific options:
  14933. @table @option
  14934. @item v_fov
  14935. Set perspective parameter.
  14936. @end table
  14937. @item tetrahedron
  14938. Tetrahedron projection.
  14939. @item tsp
  14940. Truncated square pyramid projection.
  14941. @item he
  14942. @item hequirect
  14943. Half equirectangular projection.
  14944. @item equisolid
  14945. Equisolid format.
  14946. Format specific options:
  14947. @table @option
  14948. @item h_fov
  14949. @item v_fov
  14950. @item d_fov
  14951. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14952. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14953. @item ih_fov
  14954. @item iv_fov
  14955. @item id_fov
  14956. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14957. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14958. @end table
  14959. @item og
  14960. Orthographic format.
  14961. Format specific options:
  14962. @table @option
  14963. @item h_fov
  14964. @item v_fov
  14965. @item d_fov
  14966. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14967. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14968. @item ih_fov
  14969. @item iv_fov
  14970. @item id_fov
  14971. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14972. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14973. @end table
  14974. @item octahedron
  14975. Octahedron projection.
  14976. @end table
  14977. @item interp
  14978. Set interpolation method.@*
  14979. @i{Note: more complex interpolation methods require much more memory to run.}
  14980. Available methods:
  14981. @table @samp
  14982. @item near
  14983. @item nearest
  14984. Nearest neighbour.
  14985. @item line
  14986. @item linear
  14987. Bilinear interpolation.
  14988. @item lagrange9
  14989. Lagrange9 interpolation.
  14990. @item cube
  14991. @item cubic
  14992. Bicubic interpolation.
  14993. @item lanc
  14994. @item lanczos
  14995. Lanczos interpolation.
  14996. @item sp16
  14997. @item spline16
  14998. Spline16 interpolation.
  14999. @item gauss
  15000. @item gaussian
  15001. Gaussian interpolation.
  15002. @item mitchell
  15003. Mitchell interpolation.
  15004. @end table
  15005. Default value is @b{@samp{line}}.
  15006. @item w
  15007. @item h
  15008. Set the output video resolution.
  15009. Default resolution depends on formats.
  15010. @item in_stereo
  15011. @item out_stereo
  15012. Set the input/output stereo format.
  15013. @table @samp
  15014. @item 2d
  15015. 2D mono
  15016. @item sbs
  15017. Side by side
  15018. @item tb
  15019. Top bottom
  15020. @end table
  15021. Default value is @b{@samp{2d}} for input and output format.
  15022. @item yaw
  15023. @item pitch
  15024. @item roll
  15025. Set rotation for the output video. Values in degrees.
  15026. @item rorder
  15027. Set rotation order for the output video. Choose one item for each position.
  15028. @table @samp
  15029. @item y, Y
  15030. yaw
  15031. @item p, P
  15032. pitch
  15033. @item r, R
  15034. roll
  15035. @end table
  15036. Default value is @b{@samp{ypr}}.
  15037. @item h_flip
  15038. @item v_flip
  15039. @item d_flip
  15040. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  15041. @item ih_flip
  15042. @item iv_flip
  15043. Set if input video is flipped horizontally/vertically. Boolean values.
  15044. @item in_trans
  15045. Set if input video is transposed. Boolean value, by default disabled.
  15046. @item out_trans
  15047. Set if output video needs to be transposed. Boolean value, by default disabled.
  15048. @item alpha_mask
  15049. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  15050. @end table
  15051. @subsection Examples
  15052. @itemize
  15053. @item
  15054. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  15055. @example
  15056. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  15057. @end example
  15058. @item
  15059. Extract back view of Equi-Angular Cubemap:
  15060. @example
  15061. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  15062. @end example
  15063. @item
  15064. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  15065. @example
  15066. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  15067. @end example
  15068. @end itemize
  15069. @subsection Commands
  15070. This filter supports subset of above options as @ref{commands}.
  15071. @section vaguedenoiser
  15072. Apply a wavelet based denoiser.
  15073. It transforms each frame from the video input into the wavelet domain,
  15074. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15075. the obtained coefficients. It does an inverse wavelet transform after.
  15076. Due to wavelet properties, it should give a nice smoothed result, and
  15077. reduced noise, without blurring picture features.
  15078. This filter accepts the following options:
  15079. @table @option
  15080. @item threshold
  15081. The filtering strength. The higher, the more filtered the video will be.
  15082. Hard thresholding can use a higher threshold than soft thresholding
  15083. before the video looks overfiltered. Default value is 2.
  15084. @item method
  15085. The filtering method the filter will use.
  15086. It accepts the following values:
  15087. @table @samp
  15088. @item hard
  15089. All values under the threshold will be zeroed.
  15090. @item soft
  15091. All values under the threshold will be zeroed. All values above will be
  15092. reduced by the threshold.
  15093. @item garrote
  15094. Scales or nullifies coefficients - intermediary between (more) soft and
  15095. (less) hard thresholding.
  15096. @end table
  15097. Default is garrote.
  15098. @item nsteps
  15099. Number of times, the wavelet will decompose the picture. Picture can't
  15100. be decomposed beyond a particular point (typically, 8 for a 640x480
  15101. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15102. @item percent
  15103. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15104. @item planes
  15105. A list of the planes to process. By default all planes are processed.
  15106. @item type
  15107. The threshold type the filter will use.
  15108. It accepts the following values:
  15109. @table @samp
  15110. @item universal
  15111. Threshold used is same for all decompositions.
  15112. @item bayes
  15113. Threshold used depends also on each decomposition coefficients.
  15114. @end table
  15115. Default is universal.
  15116. @end table
  15117. @section vectorscope
  15118. Display 2 color component values in the two dimensional graph (which is called
  15119. a vectorscope).
  15120. This filter accepts the following options:
  15121. @table @option
  15122. @item mode, m
  15123. Set vectorscope mode.
  15124. It accepts the following values:
  15125. @table @samp
  15126. @item gray
  15127. @item tint
  15128. Gray values are displayed on graph, higher brightness means more pixels have
  15129. same component color value on location in graph. This is the default mode.
  15130. @item color
  15131. Gray values are displayed on graph. Surrounding pixels values which are not
  15132. present in video frame are drawn in gradient of 2 color components which are
  15133. set by option @code{x} and @code{y}. The 3rd color component is static.
  15134. @item color2
  15135. Actual color components values present in video frame are displayed on graph.
  15136. @item color3
  15137. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15138. on graph increases value of another color component, which is luminance by
  15139. default values of @code{x} and @code{y}.
  15140. @item color4
  15141. Actual colors present in video frame are displayed on graph. If two different
  15142. colors map to same position on graph then color with higher value of component
  15143. not present in graph is picked.
  15144. @item color5
  15145. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15146. component picked from radial gradient.
  15147. @end table
  15148. @item x
  15149. Set which color component will be represented on X-axis. Default is @code{1}.
  15150. @item y
  15151. Set which color component will be represented on Y-axis. Default is @code{2}.
  15152. @item intensity, i
  15153. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15154. of color component which represents frequency of (X, Y) location in graph.
  15155. @item envelope, e
  15156. @table @samp
  15157. @item none
  15158. No envelope, this is default.
  15159. @item instant
  15160. Instant envelope, even darkest single pixel will be clearly highlighted.
  15161. @item peak
  15162. Hold maximum and minimum values presented in graph over time. This way you
  15163. can still spot out of range values without constantly looking at vectorscope.
  15164. @item peak+instant
  15165. Peak and instant envelope combined together.
  15166. @end table
  15167. @item graticule, g
  15168. Set what kind of graticule to draw.
  15169. @table @samp
  15170. @item none
  15171. @item green
  15172. @item color
  15173. @item invert
  15174. @end table
  15175. @item opacity, o
  15176. Set graticule opacity.
  15177. @item flags, f
  15178. Set graticule flags.
  15179. @table @samp
  15180. @item white
  15181. Draw graticule for white point.
  15182. @item black
  15183. Draw graticule for black point.
  15184. @item name
  15185. Draw color points short names.
  15186. @end table
  15187. @item bgopacity, b
  15188. Set background opacity.
  15189. @item lthreshold, l
  15190. Set low threshold for color component not represented on X or Y axis.
  15191. Values lower than this value will be ignored. Default is 0.
  15192. Note this value is multiplied with actual max possible value one pixel component
  15193. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15194. is 0.1 * 255 = 25.
  15195. @item hthreshold, h
  15196. Set high threshold for color component not represented on X or Y axis.
  15197. Values higher than this value will be ignored. Default is 1.
  15198. Note this value is multiplied with actual max possible value one pixel component
  15199. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15200. is 0.9 * 255 = 230.
  15201. @item colorspace, c
  15202. Set what kind of colorspace to use when drawing graticule.
  15203. @table @samp
  15204. @item auto
  15205. @item 601
  15206. @item 709
  15207. @end table
  15208. Default is auto.
  15209. @item tint0, t0
  15210. @item tint1, t1
  15211. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15212. This means no tint, and output will remain gray.
  15213. @end table
  15214. @anchor{vidstabdetect}
  15215. @section vidstabdetect
  15216. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15217. @ref{vidstabtransform} for pass 2.
  15218. This filter generates a file with relative translation and rotation
  15219. transform information about subsequent frames, which is then used by
  15220. the @ref{vidstabtransform} filter.
  15221. To enable compilation of this filter you need to configure FFmpeg with
  15222. @code{--enable-libvidstab}.
  15223. This filter accepts the following options:
  15224. @table @option
  15225. @item result
  15226. Set the path to the file used to write the transforms information.
  15227. Default value is @file{transforms.trf}.
  15228. @item shakiness
  15229. Set how shaky the video is and how quick the camera is. It accepts an
  15230. integer in the range 1-10, a value of 1 means little shakiness, a
  15231. value of 10 means strong shakiness. Default value is 5.
  15232. @item accuracy
  15233. Set the accuracy of the detection process. It must be a value in the
  15234. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15235. accuracy. Default value is 15.
  15236. @item stepsize
  15237. Set stepsize of the search process. The region around minimum is
  15238. scanned with 1 pixel resolution. Default value is 6.
  15239. @item mincontrast
  15240. Set minimum contrast. Below this value a local measurement field is
  15241. discarded. Must be a floating point value in the range 0-1. Default
  15242. value is 0.3.
  15243. @item tripod
  15244. Set reference frame number for tripod mode.
  15245. If enabled, the motion of the frames is compared to a reference frame
  15246. in the filtered stream, identified by the specified number. The idea
  15247. is to compensate all movements in a more-or-less static scene and keep
  15248. the camera view absolutely still.
  15249. If set to 0, it is disabled. The frames are counted starting from 1.
  15250. @item show
  15251. Show fields and transforms in the resulting frames. It accepts an
  15252. integer in the range 0-2. Default value is 0, which disables any
  15253. visualization.
  15254. @end table
  15255. @subsection Examples
  15256. @itemize
  15257. @item
  15258. Use default values:
  15259. @example
  15260. vidstabdetect
  15261. @end example
  15262. @item
  15263. Analyze strongly shaky movie and put the results in file
  15264. @file{mytransforms.trf}:
  15265. @example
  15266. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15267. @end example
  15268. @item
  15269. Visualize the result of internal transformations in the resulting
  15270. video:
  15271. @example
  15272. vidstabdetect=show=1
  15273. @end example
  15274. @item
  15275. Analyze a video with medium shakiness using @command{ffmpeg}:
  15276. @example
  15277. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15278. @end example
  15279. @end itemize
  15280. @anchor{vidstabtransform}
  15281. @section vidstabtransform
  15282. Video stabilization/deshaking: pass 2 of 2,
  15283. see @ref{vidstabdetect} for pass 1.
  15284. Read a file with transform information for each frame and
  15285. apply/compensate them. Together with the @ref{vidstabdetect}
  15286. filter this can be used to deshake videos. See also
  15287. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15288. the @ref{unsharp} filter, see below.
  15289. To enable compilation of this filter you need to configure FFmpeg with
  15290. @code{--enable-libvidstab}.
  15291. @subsection Options
  15292. @table @option
  15293. @item input
  15294. Set path to the file used to read the transforms. Default value is
  15295. @file{transforms.trf}.
  15296. @item smoothing
  15297. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15298. camera movements. Default value is 10.
  15299. For example a number of 10 means that 21 frames are used (10 in the
  15300. past and 10 in the future) to smoothen the motion in the video. A
  15301. larger value leads to a smoother video, but limits the acceleration of
  15302. the camera (pan/tilt movements). 0 is a special case where a static
  15303. camera is simulated.
  15304. @item optalgo
  15305. Set the camera path optimization algorithm.
  15306. Accepted values are:
  15307. @table @samp
  15308. @item gauss
  15309. gaussian kernel low-pass filter on camera motion (default)
  15310. @item avg
  15311. averaging on transformations
  15312. @end table
  15313. @item maxshift
  15314. Set maximal number of pixels to translate frames. Default value is -1,
  15315. meaning no limit.
  15316. @item maxangle
  15317. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15318. value is -1, meaning no limit.
  15319. @item crop
  15320. Specify how to deal with borders that may be visible due to movement
  15321. compensation.
  15322. Available values are:
  15323. @table @samp
  15324. @item keep
  15325. keep image information from previous frame (default)
  15326. @item black
  15327. fill the border black
  15328. @end table
  15329. @item invert
  15330. Invert transforms if set to 1. Default value is 0.
  15331. @item relative
  15332. Consider transforms as relative to previous frame if set to 1,
  15333. absolute if set to 0. Default value is 0.
  15334. @item zoom
  15335. Set percentage to zoom. A positive value will result in a zoom-in
  15336. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15337. zoom).
  15338. @item optzoom
  15339. Set optimal zooming to avoid borders.
  15340. Accepted values are:
  15341. @table @samp
  15342. @item 0
  15343. disabled
  15344. @item 1
  15345. optimal static zoom value is determined (only very strong movements
  15346. will lead to visible borders) (default)
  15347. @item 2
  15348. optimal adaptive zoom value is determined (no borders will be
  15349. visible), see @option{zoomspeed}
  15350. @end table
  15351. Note that the value given at zoom is added to the one calculated here.
  15352. @item zoomspeed
  15353. Set percent to zoom maximally each frame (enabled when
  15354. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15355. 0.25.
  15356. @item interpol
  15357. Specify type of interpolation.
  15358. Available values are:
  15359. @table @samp
  15360. @item no
  15361. no interpolation
  15362. @item linear
  15363. linear only horizontal
  15364. @item bilinear
  15365. linear in both directions (default)
  15366. @item bicubic
  15367. cubic in both directions (slow)
  15368. @end table
  15369. @item tripod
  15370. Enable virtual tripod mode if set to 1, which is equivalent to
  15371. @code{relative=0:smoothing=0}. Default value is 0.
  15372. Use also @code{tripod} option of @ref{vidstabdetect}.
  15373. @item debug
  15374. Increase log verbosity if set to 1. Also the detected global motions
  15375. are written to the temporary file @file{global_motions.trf}. Default
  15376. value is 0.
  15377. @end table
  15378. @subsection Examples
  15379. @itemize
  15380. @item
  15381. Use @command{ffmpeg} for a typical stabilization with default values:
  15382. @example
  15383. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15384. @end example
  15385. Note the use of the @ref{unsharp} filter which is always recommended.
  15386. @item
  15387. Zoom in a bit more and load transform data from a given file:
  15388. @example
  15389. vidstabtransform=zoom=5:input="mytransforms.trf"
  15390. @end example
  15391. @item
  15392. Smoothen the video even more:
  15393. @example
  15394. vidstabtransform=smoothing=30
  15395. @end example
  15396. @end itemize
  15397. @section vflip
  15398. Flip the input video vertically.
  15399. For example, to vertically flip a video with @command{ffmpeg}:
  15400. @example
  15401. ffmpeg -i in.avi -vf "vflip" out.avi
  15402. @end example
  15403. @section vfrdet
  15404. Detect variable frame rate video.
  15405. This filter tries to detect if the input is variable or constant frame rate.
  15406. At end it will output number of frames detected as having variable delta pts,
  15407. and ones with constant delta pts.
  15408. If there was frames with variable delta, than it will also show min, max and
  15409. average delta encountered.
  15410. @section vibrance
  15411. Boost or alter saturation.
  15412. The filter accepts the following options:
  15413. @table @option
  15414. @item intensity
  15415. Set strength of boost if positive value or strength of alter if negative value.
  15416. Default is 0. Allowed range is from -2 to 2.
  15417. @item rbal
  15418. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15419. @item gbal
  15420. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15421. @item bbal
  15422. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15423. @item rlum
  15424. Set the red luma coefficient.
  15425. @item glum
  15426. Set the green luma coefficient.
  15427. @item blum
  15428. Set the blue luma coefficient.
  15429. @item alternate
  15430. If @code{intensity} is negative and this is set to 1, colors will change,
  15431. otherwise colors will be less saturated, more towards gray.
  15432. @end table
  15433. @subsection Commands
  15434. This filter supports the all above options as @ref{commands}.
  15435. @anchor{vignette}
  15436. @section vignette
  15437. Make or reverse a natural vignetting effect.
  15438. The filter accepts the following options:
  15439. @table @option
  15440. @item angle, a
  15441. Set lens angle expression as a number of radians.
  15442. The value is clipped in the @code{[0,PI/2]} range.
  15443. Default value: @code{"PI/5"}
  15444. @item x0
  15445. @item y0
  15446. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15447. by default.
  15448. @item mode
  15449. Set forward/backward mode.
  15450. Available modes are:
  15451. @table @samp
  15452. @item forward
  15453. The larger the distance from the central point, the darker the image becomes.
  15454. @item backward
  15455. The larger the distance from the central point, the brighter the image becomes.
  15456. This can be used to reverse a vignette effect, though there is no automatic
  15457. detection to extract the lens @option{angle} and other settings (yet). It can
  15458. also be used to create a burning effect.
  15459. @end table
  15460. Default value is @samp{forward}.
  15461. @item eval
  15462. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15463. It accepts the following values:
  15464. @table @samp
  15465. @item init
  15466. Evaluate expressions only once during the filter initialization.
  15467. @item frame
  15468. Evaluate expressions for each incoming frame. This is way slower than the
  15469. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15470. allows advanced dynamic expressions.
  15471. @end table
  15472. Default value is @samp{init}.
  15473. @item dither
  15474. Set dithering to reduce the circular banding effects. Default is @code{1}
  15475. (enabled).
  15476. @item aspect
  15477. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15478. Setting this value to the SAR of the input will make a rectangular vignetting
  15479. following the dimensions of the video.
  15480. Default is @code{1/1}.
  15481. @end table
  15482. @subsection Expressions
  15483. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15484. following parameters.
  15485. @table @option
  15486. @item w
  15487. @item h
  15488. input width and height
  15489. @item n
  15490. the number of input frame, starting from 0
  15491. @item pts
  15492. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15493. @var{TB} units, NAN if undefined
  15494. @item r
  15495. frame rate of the input video, NAN if the input frame rate is unknown
  15496. @item t
  15497. the PTS (Presentation TimeStamp) of the filtered video frame,
  15498. expressed in seconds, NAN if undefined
  15499. @item tb
  15500. time base of the input video
  15501. @end table
  15502. @subsection Examples
  15503. @itemize
  15504. @item
  15505. Apply simple strong vignetting effect:
  15506. @example
  15507. vignette=PI/4
  15508. @end example
  15509. @item
  15510. Make a flickering vignetting:
  15511. @example
  15512. vignette='PI/4+random(1)*PI/50':eval=frame
  15513. @end example
  15514. @end itemize
  15515. @section vmafmotion
  15516. Obtain the average VMAF motion score of a video.
  15517. It is one of the component metrics of VMAF.
  15518. The obtained average motion score is printed through the logging system.
  15519. The filter accepts the following options:
  15520. @table @option
  15521. @item stats_file
  15522. If specified, the filter will use the named file to save the motion score of
  15523. each frame with respect to the previous frame.
  15524. When filename equals "-" the data is sent to standard output.
  15525. @end table
  15526. Example:
  15527. @example
  15528. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15529. @end example
  15530. @section vstack
  15531. Stack input videos vertically.
  15532. All streams must be of same pixel format and of same width.
  15533. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15534. to create same output.
  15535. The filter accepts the following options:
  15536. @table @option
  15537. @item inputs
  15538. Set number of input streams. Default is 2.
  15539. @item shortest
  15540. If set to 1, force the output to terminate when the shortest input
  15541. terminates. Default value is 0.
  15542. @end table
  15543. @section w3fdif
  15544. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15545. Deinterlacing Filter").
  15546. Based on the process described by Martin Weston for BBC R&D, and
  15547. implemented based on the de-interlace algorithm written by Jim
  15548. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15549. uses filter coefficients calculated by BBC R&D.
  15550. This filter uses field-dominance information in frame to decide which
  15551. of each pair of fields to place first in the output.
  15552. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15553. There are two sets of filter coefficients, so called "simple"
  15554. and "complex". Which set of filter coefficients is used can
  15555. be set by passing an optional parameter:
  15556. @table @option
  15557. @item filter
  15558. Set the interlacing filter coefficients. Accepts one of the following values:
  15559. @table @samp
  15560. @item simple
  15561. Simple filter coefficient set.
  15562. @item complex
  15563. More-complex filter coefficient set.
  15564. @end table
  15565. Default value is @samp{complex}.
  15566. @item deint
  15567. Specify which frames to deinterlace. Accepts one of the following values:
  15568. @table @samp
  15569. @item all
  15570. Deinterlace all frames,
  15571. @item interlaced
  15572. Only deinterlace frames marked as interlaced.
  15573. @end table
  15574. Default value is @samp{all}.
  15575. @end table
  15576. @section waveform
  15577. Video waveform monitor.
  15578. The waveform monitor plots color component intensity. By default luminance
  15579. only. Each column of the waveform corresponds to a column of pixels in the
  15580. source video.
  15581. It accepts the following options:
  15582. @table @option
  15583. @item mode, m
  15584. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15585. In row mode, the graph on the left side represents color component value 0 and
  15586. the right side represents value = 255. In column mode, the top side represents
  15587. color component value = 0 and bottom side represents value = 255.
  15588. @item intensity, i
  15589. Set intensity. Smaller values are useful to find out how many values of the same
  15590. luminance are distributed across input rows/columns.
  15591. Default value is @code{0.04}. Allowed range is [0, 1].
  15592. @item mirror, r
  15593. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15594. In mirrored mode, higher values will be represented on the left
  15595. side for @code{row} mode and at the top for @code{column} mode. Default is
  15596. @code{1} (mirrored).
  15597. @item display, d
  15598. Set display mode.
  15599. It accepts the following values:
  15600. @table @samp
  15601. @item overlay
  15602. Presents information identical to that in the @code{parade}, except
  15603. that the graphs representing color components are superimposed directly
  15604. over one another.
  15605. This display mode makes it easier to spot relative differences or similarities
  15606. in overlapping areas of the color components that are supposed to be identical,
  15607. such as neutral whites, grays, or blacks.
  15608. @item stack
  15609. Display separate graph for the color components side by side in
  15610. @code{row} mode or one below the other in @code{column} mode.
  15611. @item parade
  15612. Display separate graph for the color components side by side in
  15613. @code{column} mode or one below the other in @code{row} mode.
  15614. Using this display mode makes it easy to spot color casts in the highlights
  15615. and shadows of an image, by comparing the contours of the top and the bottom
  15616. graphs of each waveform. Since whites, grays, and blacks are characterized
  15617. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15618. should display three waveforms of roughly equal width/height. If not, the
  15619. correction is easy to perform by making level adjustments the three waveforms.
  15620. @end table
  15621. Default is @code{stack}.
  15622. @item components, c
  15623. Set which color components to display. Default is 1, which means only luminance
  15624. or red color component if input is in RGB colorspace. If is set for example to
  15625. 7 it will display all 3 (if) available color components.
  15626. @item envelope, e
  15627. @table @samp
  15628. @item none
  15629. No envelope, this is default.
  15630. @item instant
  15631. Instant envelope, minimum and maximum values presented in graph will be easily
  15632. visible even with small @code{step} value.
  15633. @item peak
  15634. Hold minimum and maximum values presented in graph across time. This way you
  15635. can still spot out of range values without constantly looking at waveforms.
  15636. @item peak+instant
  15637. Peak and instant envelope combined together.
  15638. @end table
  15639. @item filter, f
  15640. @table @samp
  15641. @item lowpass
  15642. No filtering, this is default.
  15643. @item flat
  15644. Luma and chroma combined together.
  15645. @item aflat
  15646. Similar as above, but shows difference between blue and red chroma.
  15647. @item xflat
  15648. Similar as above, but use different colors.
  15649. @item yflat
  15650. Similar as above, but again with different colors.
  15651. @item chroma
  15652. Displays only chroma.
  15653. @item color
  15654. Displays actual color value on waveform.
  15655. @item acolor
  15656. Similar as above, but with luma showing frequency of chroma values.
  15657. @end table
  15658. @item graticule, g
  15659. Set which graticule to display.
  15660. @table @samp
  15661. @item none
  15662. Do not display graticule.
  15663. @item green
  15664. Display green graticule showing legal broadcast ranges.
  15665. @item orange
  15666. Display orange graticule showing legal broadcast ranges.
  15667. @item invert
  15668. Display invert graticule showing legal broadcast ranges.
  15669. @end table
  15670. @item opacity, o
  15671. Set graticule opacity.
  15672. @item flags, fl
  15673. Set graticule flags.
  15674. @table @samp
  15675. @item numbers
  15676. Draw numbers above lines. By default enabled.
  15677. @item dots
  15678. Draw dots instead of lines.
  15679. @end table
  15680. @item scale, s
  15681. Set scale used for displaying graticule.
  15682. @table @samp
  15683. @item digital
  15684. @item millivolts
  15685. @item ire
  15686. @end table
  15687. Default is digital.
  15688. @item bgopacity, b
  15689. Set background opacity.
  15690. @item tint0, t0
  15691. @item tint1, t1
  15692. Set tint for output.
  15693. Only used with lowpass filter and when display is not overlay and input
  15694. pixel formats are not RGB.
  15695. @end table
  15696. @section weave, doubleweave
  15697. The @code{weave} takes a field-based video input and join
  15698. each two sequential fields into single frame, producing a new double
  15699. height clip with half the frame rate and half the frame count.
  15700. The @code{doubleweave} works same as @code{weave} but without
  15701. halving frame rate and frame count.
  15702. It accepts the following option:
  15703. @table @option
  15704. @item first_field
  15705. Set first field. Available values are:
  15706. @table @samp
  15707. @item top, t
  15708. Set the frame as top-field-first.
  15709. @item bottom, b
  15710. Set the frame as bottom-field-first.
  15711. @end table
  15712. @end table
  15713. @subsection Examples
  15714. @itemize
  15715. @item
  15716. Interlace video using @ref{select} and @ref{separatefields} filter:
  15717. @example
  15718. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15719. @end example
  15720. @end itemize
  15721. @section xbr
  15722. Apply the xBR high-quality magnification filter which is designed for pixel
  15723. art. It follows a set of edge-detection rules, see
  15724. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15725. It accepts the following option:
  15726. @table @option
  15727. @item n
  15728. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15729. @code{3xBR} and @code{4} for @code{4xBR}.
  15730. Default is @code{3}.
  15731. @end table
  15732. @section xfade
  15733. Apply cross fade from one input video stream to another input video stream.
  15734. The cross fade is applied for specified duration.
  15735. The filter accepts the following options:
  15736. @table @option
  15737. @item transition
  15738. Set one of available transition effects:
  15739. @table @samp
  15740. @item custom
  15741. @item fade
  15742. @item wipeleft
  15743. @item wiperight
  15744. @item wipeup
  15745. @item wipedown
  15746. @item slideleft
  15747. @item slideright
  15748. @item slideup
  15749. @item slidedown
  15750. @item circlecrop
  15751. @item rectcrop
  15752. @item distance
  15753. @item fadeblack
  15754. @item fadewhite
  15755. @item radial
  15756. @item smoothleft
  15757. @item smoothright
  15758. @item smoothup
  15759. @item smoothdown
  15760. @item circleopen
  15761. @item circleclose
  15762. @item vertopen
  15763. @item vertclose
  15764. @item horzopen
  15765. @item horzclose
  15766. @item dissolve
  15767. @item pixelize
  15768. @item diagtl
  15769. @item diagtr
  15770. @item diagbl
  15771. @item diagbr
  15772. @item hlslice
  15773. @item hrslice
  15774. @item vuslice
  15775. @item vdslice
  15776. @item hblur
  15777. @item fadegrays
  15778. @item wipetl
  15779. @item wipetr
  15780. @item wipebl
  15781. @item wipebr
  15782. @item squeezeh
  15783. @item squeezev
  15784. @end table
  15785. Default transition effect is fade.
  15786. @item duration
  15787. Set cross fade duration in seconds.
  15788. Default duration is 1 second.
  15789. @item offset
  15790. Set cross fade start relative to first input stream in seconds.
  15791. Default offset is 0.
  15792. @item expr
  15793. Set expression for custom transition effect.
  15794. The expressions can use the following variables and functions:
  15795. @table @option
  15796. @item X
  15797. @item Y
  15798. The coordinates of the current sample.
  15799. @item W
  15800. @item H
  15801. The width and height of the image.
  15802. @item P
  15803. Progress of transition effect.
  15804. @item PLANE
  15805. Currently processed plane.
  15806. @item A
  15807. Return value of first input at current location and plane.
  15808. @item B
  15809. Return value of second input at current location and plane.
  15810. @item a0(x, y)
  15811. @item a1(x, y)
  15812. @item a2(x, y)
  15813. @item a3(x, y)
  15814. Return the value of the pixel at location (@var{x},@var{y}) of the
  15815. first/second/third/fourth component of first input.
  15816. @item b0(x, y)
  15817. @item b1(x, y)
  15818. @item b2(x, y)
  15819. @item b3(x, y)
  15820. Return the value of the pixel at location (@var{x},@var{y}) of the
  15821. first/second/third/fourth component of second input.
  15822. @end table
  15823. @end table
  15824. @subsection Examples
  15825. @itemize
  15826. @item
  15827. Cross fade from one input video to another input video, with fade transition and duration of transition
  15828. of 2 seconds starting at offset of 5 seconds:
  15829. @example
  15830. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15831. @end example
  15832. @end itemize
  15833. @section xmedian
  15834. Pick median pixels from several input videos.
  15835. The filter accepts the following options:
  15836. @table @option
  15837. @item inputs
  15838. Set number of inputs.
  15839. Default is 3. Allowed range is from 3 to 255.
  15840. If number of inputs is even number, than result will be mean value between two median values.
  15841. @item planes
  15842. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15843. @item percentile
  15844. Set median percentile. Default value is @code{0.5}.
  15845. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15846. minimum values, and @code{1} maximum values.
  15847. @end table
  15848. @section xstack
  15849. Stack video inputs into custom layout.
  15850. All streams must be of same pixel format.
  15851. The filter accepts the following options:
  15852. @table @option
  15853. @item inputs
  15854. Set number of input streams. Default is 2.
  15855. @item layout
  15856. Specify layout of inputs.
  15857. This option requires the desired layout configuration to be explicitly set by the user.
  15858. This sets position of each video input in output. Each input
  15859. is separated by '|'.
  15860. The first number represents the column, and the second number represents the row.
  15861. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15862. where X is video input from which to take width or height.
  15863. Multiple values can be used when separated by '+'. In such
  15864. case values are summed together.
  15865. Note that if inputs are of different sizes gaps may appear, as not all of
  15866. the output video frame will be filled. Similarly, videos can overlap each
  15867. other if their position doesn't leave enough space for the full frame of
  15868. adjoining videos.
  15869. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15870. a layout must be set by the user.
  15871. @item shortest
  15872. If set to 1, force the output to terminate when the shortest input
  15873. terminates. Default value is 0.
  15874. @item fill
  15875. If set to valid color, all unused pixels will be filled with that color.
  15876. By default fill is set to none, so it is disabled.
  15877. @end table
  15878. @subsection Examples
  15879. @itemize
  15880. @item
  15881. Display 4 inputs into 2x2 grid.
  15882. Layout:
  15883. @example
  15884. input1(0, 0) | input3(w0, 0)
  15885. input2(0, h0) | input4(w0, h0)
  15886. @end example
  15887. @example
  15888. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15889. @end example
  15890. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15891. @item
  15892. Display 4 inputs into 1x4 grid.
  15893. Layout:
  15894. @example
  15895. input1(0, 0)
  15896. input2(0, h0)
  15897. input3(0, h0+h1)
  15898. input4(0, h0+h1+h2)
  15899. @end example
  15900. @example
  15901. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15902. @end example
  15903. Note that if inputs are of different widths, unused space will appear.
  15904. @item
  15905. Display 9 inputs into 3x3 grid.
  15906. Layout:
  15907. @example
  15908. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15909. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15910. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15911. @end example
  15912. @example
  15913. 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
  15914. @end example
  15915. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15916. @item
  15917. Display 16 inputs into 4x4 grid.
  15918. Layout:
  15919. @example
  15920. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15921. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15922. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15923. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15924. @end example
  15925. @example
  15926. 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|
  15927. 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
  15928. @end example
  15929. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15930. @end itemize
  15931. @anchor{yadif}
  15932. @section yadif
  15933. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15934. filter").
  15935. It accepts the following parameters:
  15936. @table @option
  15937. @item mode
  15938. The interlacing mode to adopt. It accepts one of the following values:
  15939. @table @option
  15940. @item 0, send_frame
  15941. Output one frame for each frame.
  15942. @item 1, send_field
  15943. Output one frame for each field.
  15944. @item 2, send_frame_nospatial
  15945. Like @code{send_frame}, but it skips the spatial interlacing check.
  15946. @item 3, send_field_nospatial
  15947. Like @code{send_field}, but it skips the spatial interlacing check.
  15948. @end table
  15949. The default value is @code{send_frame}.
  15950. @item parity
  15951. The picture field parity assumed for the input interlaced video. It accepts one
  15952. of the following values:
  15953. @table @option
  15954. @item 0, tff
  15955. Assume the top field is first.
  15956. @item 1, bff
  15957. Assume the bottom field is first.
  15958. @item -1, auto
  15959. Enable automatic detection of field parity.
  15960. @end table
  15961. The default value is @code{auto}.
  15962. If the interlacing is unknown or the decoder does not export this information,
  15963. top field first will be assumed.
  15964. @item deint
  15965. Specify which frames to deinterlace. Accepts one of the following
  15966. values:
  15967. @table @option
  15968. @item 0, all
  15969. Deinterlace all frames.
  15970. @item 1, interlaced
  15971. Only deinterlace frames marked as interlaced.
  15972. @end table
  15973. The default value is @code{all}.
  15974. @end table
  15975. @section yadif_cuda
  15976. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15977. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15978. and/or nvenc.
  15979. It accepts the following parameters:
  15980. @table @option
  15981. @item mode
  15982. The interlacing mode to adopt. It accepts one of the following values:
  15983. @table @option
  15984. @item 0, send_frame
  15985. Output one frame for each frame.
  15986. @item 1, send_field
  15987. Output one frame for each field.
  15988. @item 2, send_frame_nospatial
  15989. Like @code{send_frame}, but it skips the spatial interlacing check.
  15990. @item 3, send_field_nospatial
  15991. Like @code{send_field}, but it skips the spatial interlacing check.
  15992. @end table
  15993. The default value is @code{send_frame}.
  15994. @item parity
  15995. The picture field parity assumed for the input interlaced video. It accepts one
  15996. of the following values:
  15997. @table @option
  15998. @item 0, tff
  15999. Assume the top field is first.
  16000. @item 1, bff
  16001. Assume the bottom field is first.
  16002. @item -1, auto
  16003. Enable automatic detection of field parity.
  16004. @end table
  16005. The default value is @code{auto}.
  16006. If the interlacing is unknown or the decoder does not export this information,
  16007. top field first will be assumed.
  16008. @item deint
  16009. Specify which frames to deinterlace. Accepts one of the following
  16010. values:
  16011. @table @option
  16012. @item 0, all
  16013. Deinterlace all frames.
  16014. @item 1, interlaced
  16015. Only deinterlace frames marked as interlaced.
  16016. @end table
  16017. The default value is @code{all}.
  16018. @end table
  16019. @section yaepblur
  16020. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  16021. The algorithm is described in
  16022. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  16023. It accepts the following parameters:
  16024. @table @option
  16025. @item radius, r
  16026. Set the window radius. Default value is 3.
  16027. @item planes, p
  16028. Set which planes to filter. Default is only the first plane.
  16029. @item sigma, s
  16030. Set blur strength. Default value is 128.
  16031. @end table
  16032. @subsection Commands
  16033. This filter supports same @ref{commands} as options.
  16034. @section zoompan
  16035. Apply Zoom & Pan effect.
  16036. This filter accepts the following options:
  16037. @table @option
  16038. @item zoom, z
  16039. Set the zoom expression. Range is 1-10. Default is 1.
  16040. @item x
  16041. @item y
  16042. Set the x and y expression. Default is 0.
  16043. @item d
  16044. Set the duration expression in number of frames.
  16045. This sets for how many number of frames effect will last for
  16046. single input image.
  16047. @item s
  16048. Set the output image size, default is 'hd720'.
  16049. @item fps
  16050. Set the output frame rate, default is '25'.
  16051. @end table
  16052. Each expression can contain the following constants:
  16053. @table @option
  16054. @item in_w, iw
  16055. Input width.
  16056. @item in_h, ih
  16057. Input height.
  16058. @item out_w, ow
  16059. Output width.
  16060. @item out_h, oh
  16061. Output height.
  16062. @item in
  16063. Input frame count.
  16064. @item on
  16065. Output frame count.
  16066. @item in_time, it
  16067. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16068. @item out_time, time, ot
  16069. The output timestamp expressed in seconds.
  16070. @item x
  16071. @item y
  16072. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  16073. for current input frame.
  16074. @item px
  16075. @item py
  16076. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16077. not yet such frame (first input frame).
  16078. @item zoom
  16079. Last calculated zoom from 'z' expression for current input frame.
  16080. @item pzoom
  16081. Last calculated zoom of last output frame of previous input frame.
  16082. @item duration
  16083. Number of output frames for current input frame. Calculated from 'd' expression
  16084. for each input frame.
  16085. @item pduration
  16086. number of output frames created for previous input frame
  16087. @item a
  16088. Rational number: input width / input height
  16089. @item sar
  16090. sample aspect ratio
  16091. @item dar
  16092. display aspect ratio
  16093. @end table
  16094. @subsection Examples
  16095. @itemize
  16096. @item
  16097. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16098. @example
  16099. 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
  16100. @end example
  16101. @item
  16102. Zoom in up to 1.5x and pan always at center of picture:
  16103. @example
  16104. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16105. @end example
  16106. @item
  16107. Same as above but without pausing:
  16108. @example
  16109. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16110. @end example
  16111. @item
  16112. Zoom in 2x into center of picture only for the first second of the input video:
  16113. @example
  16114. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16115. @end example
  16116. @end itemize
  16117. @anchor{zscale}
  16118. @section zscale
  16119. Scale (resize) the input video, using the z.lib library:
  16120. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16121. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16122. The zscale filter forces the output display aspect ratio to be the same
  16123. as the input, by changing the output sample aspect ratio.
  16124. If the input image format is different from the format requested by
  16125. the next filter, the zscale filter will convert the input to the
  16126. requested format.
  16127. @subsection Options
  16128. The filter accepts the following options.
  16129. @table @option
  16130. @item width, w
  16131. @item height, h
  16132. Set the output video dimension expression. Default value is the input
  16133. dimension.
  16134. If the @var{width} or @var{w} value is 0, the input width is used for
  16135. the output. If the @var{height} or @var{h} value is 0, the input height
  16136. is used for the output.
  16137. If one and only one of the values is -n with n >= 1, the zscale filter
  16138. will use a value that maintains the aspect ratio of the input image,
  16139. calculated from the other specified dimension. After that it will,
  16140. however, make sure that the calculated dimension is divisible by n and
  16141. adjust the value if necessary.
  16142. If both values are -n with n >= 1, the behavior will be identical to
  16143. both values being set to 0 as previously detailed.
  16144. See below for the list of accepted constants for use in the dimension
  16145. expression.
  16146. @item size, s
  16147. Set the video size. For the syntax of this option, check the
  16148. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16149. @item dither, d
  16150. Set the dither type.
  16151. Possible values are:
  16152. @table @var
  16153. @item none
  16154. @item ordered
  16155. @item random
  16156. @item error_diffusion
  16157. @end table
  16158. Default is none.
  16159. @item filter, f
  16160. Set the resize filter type.
  16161. Possible values are:
  16162. @table @var
  16163. @item point
  16164. @item bilinear
  16165. @item bicubic
  16166. @item spline16
  16167. @item spline36
  16168. @item lanczos
  16169. @end table
  16170. Default is bilinear.
  16171. @item range, r
  16172. Set the color range.
  16173. Possible values are:
  16174. @table @var
  16175. @item input
  16176. @item limited
  16177. @item full
  16178. @end table
  16179. Default is same as input.
  16180. @item primaries, p
  16181. Set the color primaries.
  16182. Possible values are:
  16183. @table @var
  16184. @item input
  16185. @item 709
  16186. @item unspecified
  16187. @item 170m
  16188. @item 240m
  16189. @item 2020
  16190. @end table
  16191. Default is same as input.
  16192. @item transfer, t
  16193. Set the transfer characteristics.
  16194. Possible values are:
  16195. @table @var
  16196. @item input
  16197. @item 709
  16198. @item unspecified
  16199. @item 601
  16200. @item linear
  16201. @item 2020_10
  16202. @item 2020_12
  16203. @item smpte2084
  16204. @item iec61966-2-1
  16205. @item arib-std-b67
  16206. @end table
  16207. Default is same as input.
  16208. @item matrix, m
  16209. Set the colorspace matrix.
  16210. Possible value are:
  16211. @table @var
  16212. @item input
  16213. @item 709
  16214. @item unspecified
  16215. @item 470bg
  16216. @item 170m
  16217. @item 2020_ncl
  16218. @item 2020_cl
  16219. @end table
  16220. Default is same as input.
  16221. @item rangein, rin
  16222. Set the input color range.
  16223. Possible values are:
  16224. @table @var
  16225. @item input
  16226. @item limited
  16227. @item full
  16228. @end table
  16229. Default is same as input.
  16230. @item primariesin, pin
  16231. Set the input color primaries.
  16232. Possible values are:
  16233. @table @var
  16234. @item input
  16235. @item 709
  16236. @item unspecified
  16237. @item 170m
  16238. @item 240m
  16239. @item 2020
  16240. @end table
  16241. Default is same as input.
  16242. @item transferin, tin
  16243. Set the input transfer characteristics.
  16244. Possible values are:
  16245. @table @var
  16246. @item input
  16247. @item 709
  16248. @item unspecified
  16249. @item 601
  16250. @item linear
  16251. @item 2020_10
  16252. @item 2020_12
  16253. @end table
  16254. Default is same as input.
  16255. @item matrixin, min
  16256. Set the input colorspace matrix.
  16257. Possible value are:
  16258. @table @var
  16259. @item input
  16260. @item 709
  16261. @item unspecified
  16262. @item 470bg
  16263. @item 170m
  16264. @item 2020_ncl
  16265. @item 2020_cl
  16266. @end table
  16267. @item chromal, c
  16268. Set the output chroma location.
  16269. Possible values are:
  16270. @table @var
  16271. @item input
  16272. @item left
  16273. @item center
  16274. @item topleft
  16275. @item top
  16276. @item bottomleft
  16277. @item bottom
  16278. @end table
  16279. @item chromalin, cin
  16280. Set the input chroma location.
  16281. Possible values are:
  16282. @table @var
  16283. @item input
  16284. @item left
  16285. @item center
  16286. @item topleft
  16287. @item top
  16288. @item bottomleft
  16289. @item bottom
  16290. @end table
  16291. @item npl
  16292. Set the nominal peak luminance.
  16293. @end table
  16294. The values of the @option{w} and @option{h} options are expressions
  16295. containing the following constants:
  16296. @table @var
  16297. @item in_w
  16298. @item in_h
  16299. The input width and height
  16300. @item iw
  16301. @item ih
  16302. These are the same as @var{in_w} and @var{in_h}.
  16303. @item out_w
  16304. @item out_h
  16305. The output (scaled) width and height
  16306. @item ow
  16307. @item oh
  16308. These are the same as @var{out_w} and @var{out_h}
  16309. @item a
  16310. The same as @var{iw} / @var{ih}
  16311. @item sar
  16312. input sample aspect ratio
  16313. @item dar
  16314. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16315. @item hsub
  16316. @item vsub
  16317. horizontal and vertical input chroma subsample values. For example for the
  16318. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16319. @item ohsub
  16320. @item ovsub
  16321. horizontal and vertical output chroma subsample values. For example for the
  16322. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16323. @end table
  16324. @subsection Commands
  16325. This filter supports the following commands:
  16326. @table @option
  16327. @item width, w
  16328. @item height, h
  16329. Set the output video dimension expression.
  16330. The command accepts the same syntax of the corresponding option.
  16331. If the specified expression is not valid, it is kept at its current
  16332. value.
  16333. @end table
  16334. @c man end VIDEO FILTERS
  16335. @chapter OpenCL Video Filters
  16336. @c man begin OPENCL VIDEO FILTERS
  16337. Below is a description of the currently available OpenCL video filters.
  16338. To enable compilation of these filters you need to configure FFmpeg with
  16339. @code{--enable-opencl}.
  16340. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16341. @table @option
  16342. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16343. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16344. given device parameters.
  16345. @item -filter_hw_device @var{name}
  16346. Pass the hardware device called @var{name} to all filters in any filter graph.
  16347. @end table
  16348. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16349. @itemize
  16350. @item
  16351. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16352. @example
  16353. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16354. @end example
  16355. @end itemize
  16356. 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.
  16357. @section avgblur_opencl
  16358. Apply average blur filter.
  16359. The filter accepts the following options:
  16360. @table @option
  16361. @item sizeX
  16362. Set horizontal radius size.
  16363. Range is @code{[1, 1024]} and default value is @code{1}.
  16364. @item planes
  16365. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16366. @item sizeY
  16367. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16368. @end table
  16369. @subsection Example
  16370. @itemize
  16371. @item
  16372. 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.
  16373. @example
  16374. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16375. @end example
  16376. @end itemize
  16377. @section boxblur_opencl
  16378. Apply a boxblur algorithm to the input video.
  16379. It accepts the following parameters:
  16380. @table @option
  16381. @item luma_radius, lr
  16382. @item luma_power, lp
  16383. @item chroma_radius, cr
  16384. @item chroma_power, cp
  16385. @item alpha_radius, ar
  16386. @item alpha_power, ap
  16387. @end table
  16388. A description of the accepted options follows.
  16389. @table @option
  16390. @item luma_radius, lr
  16391. @item chroma_radius, cr
  16392. @item alpha_radius, ar
  16393. Set an expression for the box radius in pixels used for blurring the
  16394. corresponding input plane.
  16395. The radius value must be a non-negative number, and must not be
  16396. greater than the value of the expression @code{min(w,h)/2} for the
  16397. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16398. planes.
  16399. Default value for @option{luma_radius} is "2". If not specified,
  16400. @option{chroma_radius} and @option{alpha_radius} default to the
  16401. corresponding value set for @option{luma_radius}.
  16402. The expressions can contain the following constants:
  16403. @table @option
  16404. @item w
  16405. @item h
  16406. The input width and height in pixels.
  16407. @item cw
  16408. @item ch
  16409. The input chroma image width and height in pixels.
  16410. @item hsub
  16411. @item vsub
  16412. The horizontal and vertical chroma subsample values. For example, for the
  16413. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16414. @end table
  16415. @item luma_power, lp
  16416. @item chroma_power, cp
  16417. @item alpha_power, ap
  16418. Specify how many times the boxblur filter is applied to the
  16419. corresponding plane.
  16420. Default value for @option{luma_power} is 2. If not specified,
  16421. @option{chroma_power} and @option{alpha_power} default to the
  16422. corresponding value set for @option{luma_power}.
  16423. A value of 0 will disable the effect.
  16424. @end table
  16425. @subsection Examples
  16426. 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.
  16427. @itemize
  16428. @item
  16429. Apply a boxblur filter with the luma, chroma, and alpha radius
  16430. 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.
  16431. @example
  16432. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16433. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16434. @end example
  16435. @item
  16436. 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.
  16437. For the luma plane, a 2x2 box radius will be run once.
  16438. For the chroma plane, a 4x4 box radius will be run 5 times.
  16439. For the alpha plane, a 3x3 box radius will be run 7 times.
  16440. @example
  16441. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16442. @end example
  16443. @end itemize
  16444. @section colorkey_opencl
  16445. RGB colorspace color keying.
  16446. The filter accepts the following options:
  16447. @table @option
  16448. @item color
  16449. The color which will be replaced with transparency.
  16450. @item similarity
  16451. Similarity percentage with the key color.
  16452. 0.01 matches only the exact key color, while 1.0 matches everything.
  16453. @item blend
  16454. Blend percentage.
  16455. 0.0 makes pixels either fully transparent, or not transparent at all.
  16456. Higher values result in semi-transparent pixels, with a higher transparency
  16457. the more similar the pixels color is to the key color.
  16458. @end table
  16459. @subsection Examples
  16460. @itemize
  16461. @item
  16462. Make every semi-green pixel in the input transparent with some slight blending:
  16463. @example
  16464. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16465. @end example
  16466. @end itemize
  16467. @section convolution_opencl
  16468. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16469. The filter accepts the following options:
  16470. @table @option
  16471. @item 0m
  16472. @item 1m
  16473. @item 2m
  16474. @item 3m
  16475. Set matrix for each plane.
  16476. Matrix is sequence of 9, 25 or 49 signed numbers.
  16477. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16478. @item 0rdiv
  16479. @item 1rdiv
  16480. @item 2rdiv
  16481. @item 3rdiv
  16482. Set multiplier for calculated value for each plane.
  16483. If unset or 0, it will be sum of all matrix elements.
  16484. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16485. @item 0bias
  16486. @item 1bias
  16487. @item 2bias
  16488. @item 3bias
  16489. Set bias for each plane. This value is added to the result of the multiplication.
  16490. Useful for making the overall image brighter or darker.
  16491. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16492. @end table
  16493. @subsection Examples
  16494. @itemize
  16495. @item
  16496. Apply sharpen:
  16497. @example
  16498. -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
  16499. @end example
  16500. @item
  16501. Apply blur:
  16502. @example
  16503. -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
  16504. @end example
  16505. @item
  16506. Apply edge enhance:
  16507. @example
  16508. -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
  16509. @end example
  16510. @item
  16511. Apply edge detect:
  16512. @example
  16513. -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
  16514. @end example
  16515. @item
  16516. Apply laplacian edge detector which includes diagonals:
  16517. @example
  16518. -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
  16519. @end example
  16520. @item
  16521. Apply emboss:
  16522. @example
  16523. -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
  16524. @end example
  16525. @end itemize
  16526. @section erosion_opencl
  16527. Apply erosion effect to the video.
  16528. This filter replaces the pixel by the local(3x3) minimum.
  16529. It accepts the following options:
  16530. @table @option
  16531. @item threshold0
  16532. @item threshold1
  16533. @item threshold2
  16534. @item threshold3
  16535. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16536. If @code{0}, plane will remain unchanged.
  16537. @item coordinates
  16538. Flag which specifies the pixel to refer to.
  16539. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16540. Flags to local 3x3 coordinates region centered on @code{x}:
  16541. 1 2 3
  16542. 4 x 5
  16543. 6 7 8
  16544. @end table
  16545. @subsection Example
  16546. @itemize
  16547. @item
  16548. 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.
  16549. @example
  16550. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16551. @end example
  16552. @end itemize
  16553. @section deshake_opencl
  16554. Feature-point based video stabilization filter.
  16555. The filter accepts the following options:
  16556. @table @option
  16557. @item tripod
  16558. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16559. @item debug
  16560. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16561. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16562. Viewing point matches in the output video is only supported for RGB input.
  16563. Defaults to @code{0}.
  16564. @item adaptive_crop
  16565. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16566. Defaults to @code{1}.
  16567. @item refine_features
  16568. Whether or not feature points should be refined at a sub-pixel level.
  16569. This can be turned off for a slight performance gain at the cost of precision.
  16570. Defaults to @code{1}.
  16571. @item smooth_strength
  16572. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16573. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16574. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16575. Defaults to @code{0.0}.
  16576. @item smooth_window_multiplier
  16577. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16578. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16579. Acceptable values range from @code{0.1} to @code{10.0}.
  16580. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16581. potentially improving smoothness, but also increase latency and memory usage.
  16582. Defaults to @code{2.0}.
  16583. @end table
  16584. @subsection Examples
  16585. @itemize
  16586. @item
  16587. Stabilize a video with a fixed, medium smoothing strength:
  16588. @example
  16589. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16590. @end example
  16591. @item
  16592. Stabilize a video with debugging (both in console and in rendered video):
  16593. @example
  16594. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16595. @end example
  16596. @end itemize
  16597. @section dilation_opencl
  16598. Apply dilation effect to the video.
  16599. This filter replaces the pixel by the local(3x3) maximum.
  16600. It accepts the following options:
  16601. @table @option
  16602. @item threshold0
  16603. @item threshold1
  16604. @item threshold2
  16605. @item threshold3
  16606. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16607. If @code{0}, plane will remain unchanged.
  16608. @item coordinates
  16609. Flag which specifies the pixel to refer to.
  16610. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16611. Flags to local 3x3 coordinates region centered on @code{x}:
  16612. 1 2 3
  16613. 4 x 5
  16614. 6 7 8
  16615. @end table
  16616. @subsection Example
  16617. @itemize
  16618. @item
  16619. 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.
  16620. @example
  16621. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16622. @end example
  16623. @end itemize
  16624. @section nlmeans_opencl
  16625. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16626. @section overlay_opencl
  16627. Overlay one video on top of another.
  16628. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16629. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16630. The filter accepts the following options:
  16631. @table @option
  16632. @item x
  16633. Set the x coordinate of the overlaid video on the main video.
  16634. Default value is @code{0}.
  16635. @item y
  16636. Set the y coordinate of the overlaid video on the main video.
  16637. Default value is @code{0}.
  16638. @end table
  16639. @subsection Examples
  16640. @itemize
  16641. @item
  16642. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16643. @example
  16644. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16645. @end example
  16646. @item
  16647. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16648. @example
  16649. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16650. @end example
  16651. @end itemize
  16652. @section pad_opencl
  16653. Add paddings to the input image, and place the original input at the
  16654. provided @var{x}, @var{y} coordinates.
  16655. It accepts the following options:
  16656. @table @option
  16657. @item width, w
  16658. @item height, h
  16659. Specify an expression for the size of the output image with the
  16660. paddings added. If the value for @var{width} or @var{height} is 0, the
  16661. corresponding input size is used for the output.
  16662. The @var{width} expression can reference the value set by the
  16663. @var{height} expression, and vice versa.
  16664. The default value of @var{width} and @var{height} is 0.
  16665. @item x
  16666. @item y
  16667. Specify the offsets to place the input image at within the padded area,
  16668. with respect to the top/left border of the output image.
  16669. The @var{x} expression can reference the value set by the @var{y}
  16670. expression, and vice versa.
  16671. The default value of @var{x} and @var{y} is 0.
  16672. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16673. so the input image is centered on the padded area.
  16674. @item color
  16675. Specify the color of the padded area. For the syntax of this option,
  16676. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16677. manual,ffmpeg-utils}.
  16678. @item aspect
  16679. Pad to an aspect instead to a resolution.
  16680. @end table
  16681. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16682. options are expressions containing the following constants:
  16683. @table @option
  16684. @item in_w
  16685. @item in_h
  16686. The input video width and height.
  16687. @item iw
  16688. @item ih
  16689. These are the same as @var{in_w} and @var{in_h}.
  16690. @item out_w
  16691. @item out_h
  16692. The output width and height (the size of the padded area), as
  16693. specified by the @var{width} and @var{height} expressions.
  16694. @item ow
  16695. @item oh
  16696. These are the same as @var{out_w} and @var{out_h}.
  16697. @item x
  16698. @item y
  16699. The x and y offsets as specified by the @var{x} and @var{y}
  16700. expressions, or NAN if not yet specified.
  16701. @item a
  16702. same as @var{iw} / @var{ih}
  16703. @item sar
  16704. input sample aspect ratio
  16705. @item dar
  16706. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16707. @end table
  16708. @section prewitt_opencl
  16709. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16710. The filter accepts the following option:
  16711. @table @option
  16712. @item planes
  16713. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16714. @item scale
  16715. Set value which will be multiplied with filtered result.
  16716. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16717. @item delta
  16718. Set value which will be added to filtered result.
  16719. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16720. @end table
  16721. @subsection Example
  16722. @itemize
  16723. @item
  16724. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16725. @example
  16726. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16727. @end example
  16728. @end itemize
  16729. @anchor{program_opencl}
  16730. @section program_opencl
  16731. Filter video using an OpenCL program.
  16732. @table @option
  16733. @item source
  16734. OpenCL program source file.
  16735. @item kernel
  16736. Kernel name in program.
  16737. @item inputs
  16738. Number of inputs to the filter. Defaults to 1.
  16739. @item size, s
  16740. Size of output frames. Defaults to the same as the first input.
  16741. @end table
  16742. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16743. The program source file must contain a kernel function with the given name,
  16744. which will be run once for each plane of the output. Each run on a plane
  16745. gets enqueued as a separate 2D global NDRange with one work-item for each
  16746. pixel to be generated. The global ID offset for each work-item is therefore
  16747. the coordinates of a pixel in the destination image.
  16748. The kernel function needs to take the following arguments:
  16749. @itemize
  16750. @item
  16751. Destination image, @var{__write_only image2d_t}.
  16752. This image will become the output; the kernel should write all of it.
  16753. @item
  16754. Frame index, @var{unsigned int}.
  16755. This is a counter starting from zero and increasing by one for each frame.
  16756. @item
  16757. Source images, @var{__read_only image2d_t}.
  16758. These are the most recent images on each input. The kernel may read from
  16759. them to generate the output, but they can't be written to.
  16760. @end itemize
  16761. Example programs:
  16762. @itemize
  16763. @item
  16764. Copy the input to the output (output must be the same size as the input).
  16765. @verbatim
  16766. __kernel void copy(__write_only image2d_t destination,
  16767. unsigned int index,
  16768. __read_only image2d_t source)
  16769. {
  16770. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16771. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16772. float4 value = read_imagef(source, sampler, location);
  16773. write_imagef(destination, location, value);
  16774. }
  16775. @end verbatim
  16776. @item
  16777. Apply a simple transformation, rotating the input by an amount increasing
  16778. with the index counter. Pixel values are linearly interpolated by the
  16779. sampler, and the output need not have the same dimensions as the input.
  16780. @verbatim
  16781. __kernel void rotate_image(__write_only image2d_t dst,
  16782. unsigned int index,
  16783. __read_only image2d_t src)
  16784. {
  16785. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16786. CLK_FILTER_LINEAR);
  16787. float angle = (float)index / 100.0f;
  16788. float2 dst_dim = convert_float2(get_image_dim(dst));
  16789. float2 src_dim = convert_float2(get_image_dim(src));
  16790. float2 dst_cen = dst_dim / 2.0f;
  16791. float2 src_cen = src_dim / 2.0f;
  16792. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16793. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16794. float2 src_pos = {
  16795. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16796. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16797. };
  16798. src_pos = src_pos * src_dim / dst_dim;
  16799. float2 src_loc = src_pos + src_cen;
  16800. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16801. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16802. write_imagef(dst, dst_loc, 0.5f);
  16803. else
  16804. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16805. }
  16806. @end verbatim
  16807. @item
  16808. Blend two inputs together, with the amount of each input used varying
  16809. with the index counter.
  16810. @verbatim
  16811. __kernel void blend_images(__write_only image2d_t dst,
  16812. unsigned int index,
  16813. __read_only image2d_t src1,
  16814. __read_only image2d_t src2)
  16815. {
  16816. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16817. CLK_FILTER_LINEAR);
  16818. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16819. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16820. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16821. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16822. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16823. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16824. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16825. }
  16826. @end verbatim
  16827. @end itemize
  16828. @section roberts_opencl
  16829. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16830. The filter accepts the following option:
  16831. @table @option
  16832. @item planes
  16833. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16834. @item scale
  16835. Set value which will be multiplied with filtered result.
  16836. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16837. @item delta
  16838. Set value which will be added to filtered result.
  16839. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16840. @end table
  16841. @subsection Example
  16842. @itemize
  16843. @item
  16844. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16845. @example
  16846. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16847. @end example
  16848. @end itemize
  16849. @section sobel_opencl
  16850. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16851. The filter accepts the following option:
  16852. @table @option
  16853. @item planes
  16854. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16855. @item scale
  16856. Set value which will be multiplied with filtered result.
  16857. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16858. @item delta
  16859. Set value which will be added to filtered result.
  16860. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16861. @end table
  16862. @subsection Example
  16863. @itemize
  16864. @item
  16865. Apply sobel operator with scale set to 2 and delta set to 10
  16866. @example
  16867. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16868. @end example
  16869. @end itemize
  16870. @section tonemap_opencl
  16871. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16872. It accepts the following parameters:
  16873. @table @option
  16874. @item tonemap
  16875. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16876. @item param
  16877. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16878. @item desat
  16879. Apply desaturation for highlights that exceed this level of brightness. The
  16880. higher the parameter, the more color information will be preserved. This
  16881. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16882. (smoothly) turning into white instead. This makes images feel more natural,
  16883. at the cost of reducing information about out-of-range colors.
  16884. The default value is 0.5, and the algorithm here is a little different from
  16885. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16886. @item threshold
  16887. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16888. is used to detect whether the scene has changed or not. If the distance between
  16889. the current frame average brightness and the current running average exceeds
  16890. a threshold value, we would re-calculate scene average and peak brightness.
  16891. The default value is 0.2.
  16892. @item format
  16893. Specify the output pixel format.
  16894. Currently supported formats are:
  16895. @table @var
  16896. @item p010
  16897. @item nv12
  16898. @end table
  16899. @item range, r
  16900. Set the output color range.
  16901. Possible values are:
  16902. @table @var
  16903. @item tv/mpeg
  16904. @item pc/jpeg
  16905. @end table
  16906. Default is same as input.
  16907. @item primaries, p
  16908. Set the output color primaries.
  16909. Possible values are:
  16910. @table @var
  16911. @item bt709
  16912. @item bt2020
  16913. @end table
  16914. Default is same as input.
  16915. @item transfer, t
  16916. Set the output transfer characteristics.
  16917. Possible values are:
  16918. @table @var
  16919. @item bt709
  16920. @item bt2020
  16921. @end table
  16922. Default is bt709.
  16923. @item matrix, m
  16924. Set the output colorspace matrix.
  16925. Possible value are:
  16926. @table @var
  16927. @item bt709
  16928. @item bt2020
  16929. @end table
  16930. Default is same as input.
  16931. @end table
  16932. @subsection Example
  16933. @itemize
  16934. @item
  16935. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16936. @example
  16937. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16938. @end example
  16939. @end itemize
  16940. @section unsharp_opencl
  16941. Sharpen or blur the input video.
  16942. It accepts the following parameters:
  16943. @table @option
  16944. @item luma_msize_x, lx
  16945. Set the luma matrix horizontal size.
  16946. Range is @code{[1, 23]} and default value is @code{5}.
  16947. @item luma_msize_y, ly
  16948. Set the luma matrix vertical size.
  16949. Range is @code{[1, 23]} and default value is @code{5}.
  16950. @item luma_amount, la
  16951. Set the luma effect strength.
  16952. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16953. Negative values will blur the input video, while positive values will
  16954. sharpen it, a value of zero will disable the effect.
  16955. @item chroma_msize_x, cx
  16956. Set the chroma matrix horizontal size.
  16957. Range is @code{[1, 23]} and default value is @code{5}.
  16958. @item chroma_msize_y, cy
  16959. Set the chroma matrix vertical size.
  16960. Range is @code{[1, 23]} and default value is @code{5}.
  16961. @item chroma_amount, ca
  16962. Set the chroma effect strength.
  16963. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16964. Negative values will blur the input video, while positive values will
  16965. sharpen it, a value of zero will disable the effect.
  16966. @end table
  16967. All parameters are optional and default to the equivalent of the
  16968. string '5:5:1.0:5:5:0.0'.
  16969. @subsection Examples
  16970. @itemize
  16971. @item
  16972. Apply strong luma sharpen effect:
  16973. @example
  16974. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16975. @end example
  16976. @item
  16977. Apply a strong blur of both luma and chroma parameters:
  16978. @example
  16979. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16980. @end example
  16981. @end itemize
  16982. @section xfade_opencl
  16983. Cross fade two videos with custom transition effect by using OpenCL.
  16984. It accepts the following options:
  16985. @table @option
  16986. @item transition
  16987. Set one of possible transition effects.
  16988. @table @option
  16989. @item custom
  16990. Select custom transition effect, the actual transition description
  16991. will be picked from source and kernel options.
  16992. @item fade
  16993. @item wipeleft
  16994. @item wiperight
  16995. @item wipeup
  16996. @item wipedown
  16997. @item slideleft
  16998. @item slideright
  16999. @item slideup
  17000. @item slidedown
  17001. Default transition is fade.
  17002. @end table
  17003. @item source
  17004. OpenCL program source file for custom transition.
  17005. @item kernel
  17006. Set name of kernel to use for custom transition from program source file.
  17007. @item duration
  17008. Set duration of video transition.
  17009. @item offset
  17010. Set time of start of transition relative to first video.
  17011. @end table
  17012. The program source file must contain a kernel function with the given name,
  17013. which will be run once for each plane of the output. Each run on a plane
  17014. gets enqueued as a separate 2D global NDRange with one work-item for each
  17015. pixel to be generated. The global ID offset for each work-item is therefore
  17016. the coordinates of a pixel in the destination image.
  17017. The kernel function needs to take the following arguments:
  17018. @itemize
  17019. @item
  17020. Destination image, @var{__write_only image2d_t}.
  17021. This image will become the output; the kernel should write all of it.
  17022. @item
  17023. First Source image, @var{__read_only image2d_t}.
  17024. Second Source image, @var{__read_only image2d_t}.
  17025. These are the most recent images on each input. The kernel may read from
  17026. them to generate the output, but they can't be written to.
  17027. @item
  17028. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  17029. @end itemize
  17030. Example programs:
  17031. @itemize
  17032. @item
  17033. Apply dots curtain transition effect:
  17034. @verbatim
  17035. __kernel void blend_images(__write_only image2d_t dst,
  17036. __read_only image2d_t src1,
  17037. __read_only image2d_t src2,
  17038. float progress)
  17039. {
  17040. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17041. CLK_FILTER_LINEAR);
  17042. int2 p = (int2)(get_global_id(0), get_global_id(1));
  17043. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  17044. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  17045. rp = rp / dim;
  17046. float2 dots = (float2)(20.0, 20.0);
  17047. float2 center = (float2)(0,0);
  17048. float2 unused;
  17049. float4 val1 = read_imagef(src1, sampler, p);
  17050. float4 val2 = read_imagef(src2, sampler, p);
  17051. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  17052. write_imagef(dst, p, next ? val1 : val2);
  17053. }
  17054. @end verbatim
  17055. @end itemize
  17056. @c man end OPENCL VIDEO FILTERS
  17057. @chapter VAAPI Video Filters
  17058. @c man begin VAAPI VIDEO FILTERS
  17059. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  17060. To enable compilation of these filters you need to configure FFmpeg with
  17061. @code{--enable-vaapi}.
  17062. 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}
  17063. @section tonemap_vaapi
  17064. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  17065. It maps the dynamic range of HDR10 content to the SDR content.
  17066. It currently only accepts HDR10 as input.
  17067. It accepts the following parameters:
  17068. @table @option
  17069. @item format
  17070. Specify the output pixel format.
  17071. Currently supported formats are:
  17072. @table @var
  17073. @item p010
  17074. @item nv12
  17075. @end table
  17076. Default is nv12.
  17077. @item primaries, p
  17078. Set the output color primaries.
  17079. Default is same as input.
  17080. @item transfer, t
  17081. Set the output transfer characteristics.
  17082. Default is bt709.
  17083. @item matrix, m
  17084. Set the output colorspace matrix.
  17085. Default is same as input.
  17086. @end table
  17087. @subsection Example
  17088. @itemize
  17089. @item
  17090. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17091. @example
  17092. tonemap_vaapi=format=p010:t=bt2020-10
  17093. @end example
  17094. @end itemize
  17095. @c man end VAAPI VIDEO FILTERS
  17096. @chapter Video Sources
  17097. @c man begin VIDEO SOURCES
  17098. Below is a description of the currently available video sources.
  17099. @section buffer
  17100. Buffer video frames, and make them available to the filter chain.
  17101. This source is mainly intended for a programmatic use, in particular
  17102. through the interface defined in @file{libavfilter/buffersrc.h}.
  17103. It accepts the following parameters:
  17104. @table @option
  17105. @item video_size
  17106. Specify the size (width and height) of the buffered video frames. For the
  17107. syntax of this option, check the
  17108. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17109. @item width
  17110. The input video width.
  17111. @item height
  17112. The input video height.
  17113. @item pix_fmt
  17114. A string representing the pixel format of the buffered video frames.
  17115. It may be a number corresponding to a pixel format, or a pixel format
  17116. name.
  17117. @item time_base
  17118. Specify the timebase assumed by the timestamps of the buffered frames.
  17119. @item frame_rate
  17120. Specify the frame rate expected for the video stream.
  17121. @item pixel_aspect, sar
  17122. The sample (pixel) aspect ratio of the input video.
  17123. @item sws_param
  17124. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17125. to the filtergraph description to specify swscale flags for automatically
  17126. inserted scalers. See @ref{Filtergraph syntax}.
  17127. @item hw_frames_ctx
  17128. When using a hardware pixel format, this should be a reference to an
  17129. AVHWFramesContext describing input frames.
  17130. @end table
  17131. For example:
  17132. @example
  17133. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17134. @end example
  17135. will instruct the source to accept video frames with size 320x240 and
  17136. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17137. square pixels (1:1 sample aspect ratio).
  17138. Since the pixel format with name "yuv410p" corresponds to the number 6
  17139. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17140. this example corresponds to:
  17141. @example
  17142. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17143. @end example
  17144. Alternatively, the options can be specified as a flat string, but this
  17145. syntax is deprecated:
  17146. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17147. @section cellauto
  17148. Create a pattern generated by an elementary cellular automaton.
  17149. The initial state of the cellular automaton can be defined through the
  17150. @option{filename} and @option{pattern} options. If such options are
  17151. not specified an initial state is created randomly.
  17152. At each new frame a new row in the video is filled with the result of
  17153. the cellular automaton next generation. The behavior when the whole
  17154. frame is filled is defined by the @option{scroll} option.
  17155. This source accepts the following options:
  17156. @table @option
  17157. @item filename, f
  17158. Read the initial cellular automaton state, i.e. the starting row, from
  17159. the specified file.
  17160. In the file, each non-whitespace character is considered an alive
  17161. cell, a newline will terminate the row, and further characters in the
  17162. file will be ignored.
  17163. @item pattern, p
  17164. Read the initial cellular automaton state, i.e. the starting row, from
  17165. the specified string.
  17166. Each non-whitespace character in the string is considered an alive
  17167. cell, a newline will terminate the row, and further characters in the
  17168. string will be ignored.
  17169. @item rate, r
  17170. Set the video rate, that is the number of frames generated per second.
  17171. Default is 25.
  17172. @item random_fill_ratio, ratio
  17173. Set the random fill ratio for the initial cellular automaton row. It
  17174. is a floating point number value ranging from 0 to 1, defaults to
  17175. 1/PHI.
  17176. This option is ignored when a file or a pattern is specified.
  17177. @item random_seed, seed
  17178. Set the seed for filling randomly the initial row, must be an integer
  17179. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17180. set to -1, the filter will try to use a good random seed on a best
  17181. effort basis.
  17182. @item rule
  17183. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17184. Default value is 110.
  17185. @item size, s
  17186. Set the size of the output video. For the syntax of this option, check the
  17187. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17188. If @option{filename} or @option{pattern} is specified, the size is set
  17189. by default to the width of the specified initial state row, and the
  17190. height is set to @var{width} * PHI.
  17191. If @option{size} is set, it must contain the width of the specified
  17192. pattern string, and the specified pattern will be centered in the
  17193. larger row.
  17194. If a filename or a pattern string is not specified, the size value
  17195. defaults to "320x518" (used for a randomly generated initial state).
  17196. @item scroll
  17197. If set to 1, scroll the output upward when all the rows in the output
  17198. have been already filled. If set to 0, the new generated row will be
  17199. written over the top row just after the bottom row is filled.
  17200. Defaults to 1.
  17201. @item start_full, full
  17202. If set to 1, completely fill the output with generated rows before
  17203. outputting the first frame.
  17204. This is the default behavior, for disabling set the value to 0.
  17205. @item stitch
  17206. If set to 1, stitch the left and right row edges together.
  17207. This is the default behavior, for disabling set the value to 0.
  17208. @end table
  17209. @subsection Examples
  17210. @itemize
  17211. @item
  17212. Read the initial state from @file{pattern}, and specify an output of
  17213. size 200x400.
  17214. @example
  17215. cellauto=f=pattern:s=200x400
  17216. @end example
  17217. @item
  17218. Generate a random initial row with a width of 200 cells, with a fill
  17219. ratio of 2/3:
  17220. @example
  17221. cellauto=ratio=2/3:s=200x200
  17222. @end example
  17223. @item
  17224. Create a pattern generated by rule 18 starting by a single alive cell
  17225. centered on an initial row with width 100:
  17226. @example
  17227. cellauto=p=@@:s=100x400:full=0:rule=18
  17228. @end example
  17229. @item
  17230. Specify a more elaborated initial pattern:
  17231. @example
  17232. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17233. @end example
  17234. @end itemize
  17235. @anchor{coreimagesrc}
  17236. @section coreimagesrc
  17237. Video source generated on GPU using Apple's CoreImage API on OSX.
  17238. This video source is a specialized version of the @ref{coreimage} video filter.
  17239. Use a core image generator at the beginning of the applied filterchain to
  17240. generate the content.
  17241. The coreimagesrc video source accepts the following options:
  17242. @table @option
  17243. @item list_generators
  17244. List all available generators along with all their respective options as well as
  17245. possible minimum and maximum values along with the default values.
  17246. @example
  17247. list_generators=true
  17248. @end example
  17249. @item size, s
  17250. Specify the size of the sourced video. For the syntax of this option, check the
  17251. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17252. The default value is @code{320x240}.
  17253. @item rate, r
  17254. Specify the frame rate of the sourced video, as the number of frames
  17255. generated per second. It has to be a string in the format
  17256. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17257. number or a valid video frame rate abbreviation. The default value is
  17258. "25".
  17259. @item sar
  17260. Set the sample aspect ratio of the sourced video.
  17261. @item duration, d
  17262. Set the duration of the sourced video. See
  17263. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17264. for the accepted syntax.
  17265. If not specified, or the expressed duration is negative, the video is
  17266. supposed to be generated forever.
  17267. @end table
  17268. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17269. A complete filterchain can be used for further processing of the
  17270. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17271. and examples for details.
  17272. @subsection Examples
  17273. @itemize
  17274. @item
  17275. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17276. given as complete and escaped command-line for Apple's standard bash shell:
  17277. @example
  17278. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17279. @end example
  17280. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17281. need for a nullsrc video source.
  17282. @end itemize
  17283. @section gradients
  17284. Generate several gradients.
  17285. @table @option
  17286. @item size, s
  17287. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17288. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17289. @item rate, r
  17290. Set frame rate, expressed as number of frames per second. Default
  17291. value is "25".
  17292. @item c0, c1, c2, c3, c4, c5, c6, c7
  17293. Set 8 colors. Default values for colors is to pick random one.
  17294. @item x0, y0, y0, y1
  17295. Set gradient line source and destination points. If negative or out of range, random ones
  17296. are picked.
  17297. @item nb_colors, n
  17298. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17299. @item seed
  17300. Set seed for picking gradient line points.
  17301. @item duration, d
  17302. Set the duration of the sourced video. See
  17303. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17304. for the accepted syntax.
  17305. If not specified, or the expressed duration is negative, the video is
  17306. supposed to be generated forever.
  17307. @item speed
  17308. Set speed of gradients rotation.
  17309. @end table
  17310. @section mandelbrot
  17311. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17312. point specified with @var{start_x} and @var{start_y}.
  17313. This source accepts the following options:
  17314. @table @option
  17315. @item end_pts
  17316. Set the terminal pts value. Default value is 400.
  17317. @item end_scale
  17318. Set the terminal scale value.
  17319. Must be a floating point value. Default value is 0.3.
  17320. @item inner
  17321. Set the inner coloring mode, that is the algorithm used to draw the
  17322. Mandelbrot fractal internal region.
  17323. It shall assume one of the following values:
  17324. @table @option
  17325. @item black
  17326. Set black mode.
  17327. @item convergence
  17328. Show time until convergence.
  17329. @item mincol
  17330. Set color based on point closest to the origin of the iterations.
  17331. @item period
  17332. Set period mode.
  17333. @end table
  17334. Default value is @var{mincol}.
  17335. @item bailout
  17336. Set the bailout value. Default value is 10.0.
  17337. @item maxiter
  17338. Set the maximum of iterations performed by the rendering
  17339. algorithm. Default value is 7189.
  17340. @item outer
  17341. Set outer coloring mode.
  17342. It shall assume one of following values:
  17343. @table @option
  17344. @item iteration_count
  17345. Set iteration count mode.
  17346. @item normalized_iteration_count
  17347. set normalized iteration count mode.
  17348. @end table
  17349. Default value is @var{normalized_iteration_count}.
  17350. @item rate, r
  17351. Set frame rate, expressed as number of frames per second. Default
  17352. value is "25".
  17353. @item size, s
  17354. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17355. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17356. @item start_scale
  17357. Set the initial scale value. Default value is 3.0.
  17358. @item start_x
  17359. Set the initial x position. Must be a floating point value between
  17360. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17361. @item start_y
  17362. Set the initial y position. Must be a floating point value between
  17363. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17364. @end table
  17365. @section mptestsrc
  17366. Generate various test patterns, as generated by the MPlayer test filter.
  17367. The size of the generated video is fixed, and is 256x256.
  17368. This source is useful in particular for testing encoding features.
  17369. This source accepts the following options:
  17370. @table @option
  17371. @item rate, r
  17372. Specify the frame rate of the sourced video, as the number of frames
  17373. generated per second. It has to be a string in the format
  17374. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17375. number or a valid video frame rate abbreviation. The default value is
  17376. "25".
  17377. @item duration, d
  17378. Set the duration of the sourced video. See
  17379. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17380. for the accepted syntax.
  17381. If not specified, or the expressed duration is negative, the video is
  17382. supposed to be generated forever.
  17383. @item test, t
  17384. Set the number or the name of the test to perform. Supported tests are:
  17385. @table @option
  17386. @item dc_luma
  17387. @item dc_chroma
  17388. @item freq_luma
  17389. @item freq_chroma
  17390. @item amp_luma
  17391. @item amp_chroma
  17392. @item cbp
  17393. @item mv
  17394. @item ring1
  17395. @item ring2
  17396. @item all
  17397. @item max_frames, m
  17398. Set the maximum number of frames generated for each test, default value is 30.
  17399. @end table
  17400. Default value is "all", which will cycle through the list of all tests.
  17401. @end table
  17402. Some examples:
  17403. @example
  17404. mptestsrc=t=dc_luma
  17405. @end example
  17406. will generate a "dc_luma" test pattern.
  17407. @section frei0r_src
  17408. Provide a frei0r source.
  17409. To enable compilation of this filter you need to install the frei0r
  17410. header and configure FFmpeg with @code{--enable-frei0r}.
  17411. This source accepts the following parameters:
  17412. @table @option
  17413. @item size
  17414. The size of the video to generate. For the syntax of this option, check the
  17415. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17416. @item framerate
  17417. The framerate of the generated video. It may be a string of the form
  17418. @var{num}/@var{den} or a frame rate abbreviation.
  17419. @item filter_name
  17420. The name to the frei0r source to load. For more information regarding frei0r and
  17421. how to set the parameters, read the @ref{frei0r} section in the video filters
  17422. documentation.
  17423. @item filter_params
  17424. A '|'-separated list of parameters to pass to the frei0r source.
  17425. @end table
  17426. For example, to generate a frei0r partik0l source with size 200x200
  17427. and frame rate 10 which is overlaid on the overlay filter main input:
  17428. @example
  17429. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17430. @end example
  17431. @section life
  17432. Generate a life pattern.
  17433. This source is based on a generalization of John Conway's life game.
  17434. The sourced input represents a life grid, each pixel represents a cell
  17435. which can be in one of two possible states, alive or dead. Every cell
  17436. interacts with its eight neighbours, which are the cells that are
  17437. horizontally, vertically, or diagonally adjacent.
  17438. At each interaction the grid evolves according to the adopted rule,
  17439. which specifies the number of neighbor alive cells which will make a
  17440. cell stay alive or born. The @option{rule} option allows one to specify
  17441. the rule to adopt.
  17442. This source accepts the following options:
  17443. @table @option
  17444. @item filename, f
  17445. Set the file from which to read the initial grid state. In the file,
  17446. each non-whitespace character is considered an alive cell, and newline
  17447. is used to delimit the end of each row.
  17448. If this option is not specified, the initial grid is generated
  17449. randomly.
  17450. @item rate, r
  17451. Set the video rate, that is the number of frames generated per second.
  17452. Default is 25.
  17453. @item random_fill_ratio, ratio
  17454. Set the random fill ratio for the initial random grid. It is a
  17455. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17456. It is ignored when a file is specified.
  17457. @item random_seed, seed
  17458. Set the seed for filling the initial random grid, must be an integer
  17459. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17460. set to -1, the filter will try to use a good random seed on a best
  17461. effort basis.
  17462. @item rule
  17463. Set the life rule.
  17464. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17465. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17466. @var{NS} specifies the number of alive neighbor cells which make a
  17467. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17468. which make a dead cell to become alive (i.e. to "born").
  17469. "s" and "b" can be used in place of "S" and "B", respectively.
  17470. Alternatively a rule can be specified by an 18-bits integer. The 9
  17471. high order bits are used to encode the next cell state if it is alive
  17472. for each number of neighbor alive cells, the low order bits specify
  17473. the rule for "borning" new cells. Higher order bits encode for an
  17474. higher number of neighbor cells.
  17475. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17476. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17477. Default value is "S23/B3", which is the original Conway's game of life
  17478. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17479. cells, and will born a new cell if there are three alive cells around
  17480. a dead cell.
  17481. @item size, s
  17482. Set the size of the output video. For the syntax of this option, check the
  17483. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17484. If @option{filename} is specified, the size is set by default to the
  17485. same size of the input file. If @option{size} is set, it must contain
  17486. the size specified in the input file, and the initial grid defined in
  17487. that file is centered in the larger resulting area.
  17488. If a filename is not specified, the size value defaults to "320x240"
  17489. (used for a randomly generated initial grid).
  17490. @item stitch
  17491. If set to 1, stitch the left and right grid edges together, and the
  17492. top and bottom edges also. Defaults to 1.
  17493. @item mold
  17494. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17495. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17496. value from 0 to 255.
  17497. @item life_color
  17498. Set the color of living (or new born) cells.
  17499. @item death_color
  17500. Set the color of dead cells. If @option{mold} is set, this is the first color
  17501. used to represent a dead cell.
  17502. @item mold_color
  17503. Set mold color, for definitely dead and moldy cells.
  17504. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17505. ffmpeg-utils manual,ffmpeg-utils}.
  17506. @end table
  17507. @subsection Examples
  17508. @itemize
  17509. @item
  17510. Read a grid from @file{pattern}, and center it on a grid of size
  17511. 300x300 pixels:
  17512. @example
  17513. life=f=pattern:s=300x300
  17514. @end example
  17515. @item
  17516. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17517. @example
  17518. life=ratio=2/3:s=200x200
  17519. @end example
  17520. @item
  17521. Specify a custom rule for evolving a randomly generated grid:
  17522. @example
  17523. life=rule=S14/B34
  17524. @end example
  17525. @item
  17526. Full example with slow death effect (mold) using @command{ffplay}:
  17527. @example
  17528. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17529. @end example
  17530. @end itemize
  17531. @anchor{allrgb}
  17532. @anchor{allyuv}
  17533. @anchor{color}
  17534. @anchor{haldclutsrc}
  17535. @anchor{nullsrc}
  17536. @anchor{pal75bars}
  17537. @anchor{pal100bars}
  17538. @anchor{rgbtestsrc}
  17539. @anchor{smptebars}
  17540. @anchor{smptehdbars}
  17541. @anchor{testsrc}
  17542. @anchor{testsrc2}
  17543. @anchor{yuvtestsrc}
  17544. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17545. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17546. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17547. The @code{color} source provides an uniformly colored input.
  17548. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17549. @ref{haldclut} filter.
  17550. The @code{nullsrc} source returns unprocessed video frames. It is
  17551. mainly useful to be employed in analysis / debugging tools, or as the
  17552. source for filters which ignore the input data.
  17553. The @code{pal75bars} source generates a color bars pattern, based on
  17554. EBU PAL recommendations with 75% color levels.
  17555. The @code{pal100bars} source generates a color bars pattern, based on
  17556. EBU PAL recommendations with 100% color levels.
  17557. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17558. detecting RGB vs BGR issues. You should see a red, green and blue
  17559. stripe from top to bottom.
  17560. The @code{smptebars} source generates a color bars pattern, based on
  17561. the SMPTE Engineering Guideline EG 1-1990.
  17562. The @code{smptehdbars} source generates a color bars pattern, based on
  17563. the SMPTE RP 219-2002.
  17564. The @code{testsrc} source generates a test video pattern, showing a
  17565. color pattern, a scrolling gradient and a timestamp. This is mainly
  17566. intended for testing purposes.
  17567. The @code{testsrc2} source is similar to testsrc, but supports more
  17568. pixel formats instead of just @code{rgb24}. This allows using it as an
  17569. input for other tests without requiring a format conversion.
  17570. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17571. see a y, cb and cr stripe from top to bottom.
  17572. The sources accept the following parameters:
  17573. @table @option
  17574. @item level
  17575. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17576. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17577. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17578. coded on a @code{1/(N*N)} scale.
  17579. @item color, c
  17580. Specify the color of the source, only available in the @code{color}
  17581. source. For the syntax of this option, check the
  17582. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17583. @item size, s
  17584. Specify the size of the sourced video. For the syntax of this option, check the
  17585. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17586. The default value is @code{320x240}.
  17587. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17588. @code{haldclutsrc} filters.
  17589. @item rate, r
  17590. Specify the frame rate of the sourced video, as the number of frames
  17591. generated per second. It has to be a string in the format
  17592. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17593. number or a valid video frame rate abbreviation. The default value is
  17594. "25".
  17595. @item duration, d
  17596. Set the duration of the sourced video. See
  17597. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17598. for the accepted syntax.
  17599. If not specified, or the expressed duration is negative, the video is
  17600. supposed to be generated forever.
  17601. Since the frame rate is used as time base, all frames including the last one
  17602. will have their full duration. If the specified duration is not a multiple
  17603. of the frame duration, it will be rounded up.
  17604. @item sar
  17605. Set the sample aspect ratio of the sourced video.
  17606. @item alpha
  17607. Specify the alpha (opacity) of the background, only available in the
  17608. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17609. 255 (fully opaque, the default).
  17610. @item decimals, n
  17611. Set the number of decimals to show in the timestamp, only available in the
  17612. @code{testsrc} source.
  17613. The displayed timestamp value will correspond to the original
  17614. timestamp value multiplied by the power of 10 of the specified
  17615. value. Default value is 0.
  17616. @end table
  17617. @subsection Examples
  17618. @itemize
  17619. @item
  17620. Generate a video with a duration of 5.3 seconds, with size
  17621. 176x144 and a frame rate of 10 frames per second:
  17622. @example
  17623. testsrc=duration=5.3:size=qcif:rate=10
  17624. @end example
  17625. @item
  17626. The following graph description will generate a red source
  17627. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17628. frames per second:
  17629. @example
  17630. color=c=red@@0.2:s=qcif:r=10
  17631. @end example
  17632. @item
  17633. If the input content is to be ignored, @code{nullsrc} can be used. The
  17634. following command generates noise in the luminance plane by employing
  17635. the @code{geq} filter:
  17636. @example
  17637. nullsrc=s=256x256, geq=random(1)*255:128:128
  17638. @end example
  17639. @end itemize
  17640. @subsection Commands
  17641. The @code{color} source supports the following commands:
  17642. @table @option
  17643. @item c, color
  17644. Set the color of the created image. Accepts the same syntax of the
  17645. corresponding @option{color} option.
  17646. @end table
  17647. @section openclsrc
  17648. Generate video using an OpenCL program.
  17649. @table @option
  17650. @item source
  17651. OpenCL program source file.
  17652. @item kernel
  17653. Kernel name in program.
  17654. @item size, s
  17655. Size of frames to generate. This must be set.
  17656. @item format
  17657. Pixel format to use for the generated frames. This must be set.
  17658. @item rate, r
  17659. Number of frames generated every second. Default value is '25'.
  17660. @end table
  17661. For details of how the program loading works, see the @ref{program_opencl}
  17662. filter.
  17663. Example programs:
  17664. @itemize
  17665. @item
  17666. Generate a colour ramp by setting pixel values from the position of the pixel
  17667. in the output image. (Note that this will work with all pixel formats, but
  17668. the generated output will not be the same.)
  17669. @verbatim
  17670. __kernel void ramp(__write_only image2d_t dst,
  17671. unsigned int index)
  17672. {
  17673. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17674. float4 val;
  17675. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17676. write_imagef(dst, loc, val);
  17677. }
  17678. @end verbatim
  17679. @item
  17680. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17681. @verbatim
  17682. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17683. unsigned int index)
  17684. {
  17685. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17686. float4 value = 0.0f;
  17687. int x = loc.x + index;
  17688. int y = loc.y + index;
  17689. while (x > 0 || y > 0) {
  17690. if (x % 3 == 1 && y % 3 == 1) {
  17691. value = 1.0f;
  17692. break;
  17693. }
  17694. x /= 3;
  17695. y /= 3;
  17696. }
  17697. write_imagef(dst, loc, value);
  17698. }
  17699. @end verbatim
  17700. @end itemize
  17701. @section sierpinski
  17702. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17703. This source accepts the following options:
  17704. @table @option
  17705. @item size, s
  17706. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17707. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17708. @item rate, r
  17709. Set frame rate, expressed as number of frames per second. Default
  17710. value is "25".
  17711. @item seed
  17712. Set seed which is used for random panning.
  17713. @item jump
  17714. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17715. @item type
  17716. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17717. @end table
  17718. @c man end VIDEO SOURCES
  17719. @chapter Video Sinks
  17720. @c man begin VIDEO SINKS
  17721. Below is a description of the currently available video sinks.
  17722. @section buffersink
  17723. Buffer video frames, and make them available to the end of the filter
  17724. graph.
  17725. This sink is mainly intended for programmatic use, in particular
  17726. through the interface defined in @file{libavfilter/buffersink.h}
  17727. or the options system.
  17728. It accepts a pointer to an AVBufferSinkContext structure, which
  17729. defines the incoming buffers' formats, to be passed as the opaque
  17730. parameter to @code{avfilter_init_filter} for initialization.
  17731. @section nullsink
  17732. Null video sink: do absolutely nothing with the input video. It is
  17733. mainly useful as a template and for use in analysis / debugging
  17734. tools.
  17735. @c man end VIDEO SINKS
  17736. @chapter Multimedia Filters
  17737. @c man begin MULTIMEDIA FILTERS
  17738. Below is a description of the currently available multimedia filters.
  17739. @section abitscope
  17740. Convert input audio to a video output, displaying the audio bit scope.
  17741. The filter accepts the following options:
  17742. @table @option
  17743. @item rate, r
  17744. Set frame rate, expressed as number of frames per second. Default
  17745. value is "25".
  17746. @item size, s
  17747. Specify the video size for the output. For the syntax of this option, check the
  17748. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17749. Default value is @code{1024x256}.
  17750. @item colors
  17751. Specify list of colors separated by space or by '|' which will be used to
  17752. draw channels. Unrecognized or missing colors will be replaced
  17753. by white color.
  17754. @end table
  17755. @section adrawgraph
  17756. Draw a graph using input audio metadata.
  17757. See @ref{drawgraph}
  17758. @section agraphmonitor
  17759. See @ref{graphmonitor}.
  17760. @section ahistogram
  17761. Convert input audio to a video output, displaying the volume histogram.
  17762. The filter accepts the following options:
  17763. @table @option
  17764. @item dmode
  17765. Specify how histogram is calculated.
  17766. It accepts the following values:
  17767. @table @samp
  17768. @item single
  17769. Use single histogram for all channels.
  17770. @item separate
  17771. Use separate histogram for each channel.
  17772. @end table
  17773. Default is @code{single}.
  17774. @item rate, r
  17775. Set frame rate, expressed as number of frames per second. Default
  17776. value is "25".
  17777. @item size, s
  17778. Specify the video size for the output. For the syntax of this option, check the
  17779. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17780. Default value is @code{hd720}.
  17781. @item scale
  17782. Set display scale.
  17783. It accepts the following values:
  17784. @table @samp
  17785. @item log
  17786. logarithmic
  17787. @item sqrt
  17788. square root
  17789. @item cbrt
  17790. cubic root
  17791. @item lin
  17792. linear
  17793. @item rlog
  17794. reverse logarithmic
  17795. @end table
  17796. Default is @code{log}.
  17797. @item ascale
  17798. Set amplitude scale.
  17799. It accepts the following values:
  17800. @table @samp
  17801. @item log
  17802. logarithmic
  17803. @item lin
  17804. linear
  17805. @end table
  17806. Default is @code{log}.
  17807. @item acount
  17808. Set how much frames to accumulate in histogram.
  17809. Default is 1. Setting this to -1 accumulates all frames.
  17810. @item rheight
  17811. Set histogram ratio of window height.
  17812. @item slide
  17813. Set sonogram sliding.
  17814. It accepts the following values:
  17815. @table @samp
  17816. @item replace
  17817. replace old rows with new ones.
  17818. @item scroll
  17819. scroll from top to bottom.
  17820. @end table
  17821. Default is @code{replace}.
  17822. @end table
  17823. @section aphasemeter
  17824. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17825. representing mean phase of current audio frame. A video output can also be produced and is
  17826. enabled by default. The audio is passed through as first output.
  17827. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17828. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17829. and @code{1} means channels are in phase.
  17830. The filter accepts the following options, all related to its video output:
  17831. @table @option
  17832. @item rate, r
  17833. Set the output frame rate. Default value is @code{25}.
  17834. @item size, s
  17835. Set the video size for the output. For the syntax of this option, check the
  17836. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17837. Default value is @code{800x400}.
  17838. @item rc
  17839. @item gc
  17840. @item bc
  17841. Specify the red, green, blue contrast. Default values are @code{2},
  17842. @code{7} and @code{1}.
  17843. Allowed range is @code{[0, 255]}.
  17844. @item mpc
  17845. Set color which will be used for drawing median phase. If color is
  17846. @code{none} which is default, no median phase value will be drawn.
  17847. @item video
  17848. Enable video output. Default is enabled.
  17849. @end table
  17850. @subsection phasing detection
  17851. The filter also detects out of phase and mono sequences in stereo streams.
  17852. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  17853. The filter accepts the following options for this detection:
  17854. @table @option
  17855. @item phasing
  17856. Enable mono and out of phase detection. Default is disabled.
  17857. @item tolerance, t
  17858. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  17859. Allowed range is @code{[0, 1]}.
  17860. @item angle, a
  17861. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  17862. Allowed range is @code{[90, 180]}.
  17863. @item duration, d
  17864. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  17865. @end table
  17866. @subsection Examples
  17867. @itemize
  17868. @item
  17869. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  17870. @example
  17871. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  17872. @end example
  17873. @end itemize
  17874. @section avectorscope
  17875. Convert input audio to a video output, representing the audio vector
  17876. scope.
  17877. The filter is used to measure the difference between channels of stereo
  17878. audio stream. A monaural signal, consisting of identical left and right
  17879. signal, results in straight vertical line. Any stereo separation is visible
  17880. as a deviation from this line, creating a Lissajous figure.
  17881. If the straight (or deviation from it) but horizontal line appears this
  17882. indicates that the left and right channels are out of phase.
  17883. The filter accepts the following options:
  17884. @table @option
  17885. @item mode, m
  17886. Set the vectorscope mode.
  17887. Available values are:
  17888. @table @samp
  17889. @item lissajous
  17890. Lissajous rotated by 45 degrees.
  17891. @item lissajous_xy
  17892. Same as above but not rotated.
  17893. @item polar
  17894. Shape resembling half of circle.
  17895. @end table
  17896. Default value is @samp{lissajous}.
  17897. @item size, s
  17898. Set the video size for the output. For the syntax of this option, check the
  17899. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17900. Default value is @code{400x400}.
  17901. @item rate, r
  17902. Set the output frame rate. Default value is @code{25}.
  17903. @item rc
  17904. @item gc
  17905. @item bc
  17906. @item ac
  17907. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17908. @code{160}, @code{80} and @code{255}.
  17909. Allowed range is @code{[0, 255]}.
  17910. @item rf
  17911. @item gf
  17912. @item bf
  17913. @item af
  17914. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17915. @code{10}, @code{5} and @code{5}.
  17916. Allowed range is @code{[0, 255]}.
  17917. @item zoom
  17918. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17919. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17920. @item draw
  17921. Set the vectorscope drawing mode.
  17922. Available values are:
  17923. @table @samp
  17924. @item dot
  17925. Draw dot for each sample.
  17926. @item line
  17927. Draw line between previous and current sample.
  17928. @end table
  17929. Default value is @samp{dot}.
  17930. @item scale
  17931. Specify amplitude scale of audio samples.
  17932. Available values are:
  17933. @table @samp
  17934. @item lin
  17935. Linear.
  17936. @item sqrt
  17937. Square root.
  17938. @item cbrt
  17939. Cubic root.
  17940. @item log
  17941. Logarithmic.
  17942. @end table
  17943. @item swap
  17944. Swap left channel axis with right channel axis.
  17945. @item mirror
  17946. Mirror axis.
  17947. @table @samp
  17948. @item none
  17949. No mirror.
  17950. @item x
  17951. Mirror only x axis.
  17952. @item y
  17953. Mirror only y axis.
  17954. @item xy
  17955. Mirror both axis.
  17956. @end table
  17957. @end table
  17958. @subsection Examples
  17959. @itemize
  17960. @item
  17961. Complete example using @command{ffplay}:
  17962. @example
  17963. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17964. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  17965. @end example
  17966. @end itemize
  17967. @section bench, abench
  17968. Benchmark part of a filtergraph.
  17969. The filter accepts the following options:
  17970. @table @option
  17971. @item action
  17972. Start or stop a timer.
  17973. Available values are:
  17974. @table @samp
  17975. @item start
  17976. Get the current time, set it as frame metadata (using the key
  17977. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  17978. @item stop
  17979. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  17980. the input frame metadata to get the time difference. Time difference, average,
  17981. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  17982. @code{min}) are then printed. The timestamps are expressed in seconds.
  17983. @end table
  17984. @end table
  17985. @subsection Examples
  17986. @itemize
  17987. @item
  17988. Benchmark @ref{selectivecolor} filter:
  17989. @example
  17990. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17991. @end example
  17992. @end itemize
  17993. @section concat
  17994. Concatenate audio and video streams, joining them together one after the
  17995. other.
  17996. The filter works on segments of synchronized video and audio streams. All
  17997. segments must have the same number of streams of each type, and that will
  17998. also be the number of streams at output.
  17999. The filter accepts the following options:
  18000. @table @option
  18001. @item n
  18002. Set the number of segments. Default is 2.
  18003. @item v
  18004. Set the number of output video streams, that is also the number of video
  18005. streams in each segment. Default is 1.
  18006. @item a
  18007. Set the number of output audio streams, that is also the number of audio
  18008. streams in each segment. Default is 0.
  18009. @item unsafe
  18010. Activate unsafe mode: do not fail if segments have a different format.
  18011. @end table
  18012. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  18013. @var{a} audio outputs.
  18014. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  18015. segment, in the same order as the outputs, then the inputs for the second
  18016. segment, etc.
  18017. Related streams do not always have exactly the same duration, for various
  18018. reasons including codec frame size or sloppy authoring. For that reason,
  18019. related synchronized streams (e.g. a video and its audio track) should be
  18020. concatenated at once. The concat filter will use the duration of the longest
  18021. stream in each segment (except the last one), and if necessary pad shorter
  18022. audio streams with silence.
  18023. For this filter to work correctly, all segments must start at timestamp 0.
  18024. All corresponding streams must have the same parameters in all segments; the
  18025. filtering system will automatically select a common pixel format for video
  18026. streams, and a common sample format, sample rate and channel layout for
  18027. audio streams, but other settings, such as resolution, must be converted
  18028. explicitly by the user.
  18029. Different frame rates are acceptable but will result in variable frame rate
  18030. at output; be sure to configure the output file to handle it.
  18031. @subsection Examples
  18032. @itemize
  18033. @item
  18034. Concatenate an opening, an episode and an ending, all in bilingual version
  18035. (video in stream 0, audio in streams 1 and 2):
  18036. @example
  18037. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  18038. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  18039. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  18040. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  18041. @end example
  18042. @item
  18043. Concatenate two parts, handling audio and video separately, using the
  18044. (a)movie sources, and adjusting the resolution:
  18045. @example
  18046. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  18047. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  18048. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  18049. @end example
  18050. Note that a desync will happen at the stitch if the audio and video streams
  18051. do not have exactly the same duration in the first file.
  18052. @end itemize
  18053. @subsection Commands
  18054. This filter supports the following commands:
  18055. @table @option
  18056. @item next
  18057. Close the current segment and step to the next one
  18058. @end table
  18059. @anchor{ebur128}
  18060. @section ebur128
  18061. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  18062. level. By default, it logs a message at a frequency of 10Hz with the
  18063. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  18064. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  18065. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  18066. sample format is double-precision floating point. The input stream will be converted to
  18067. this specification, if needed. Users may need to insert aformat and/or aresample filters
  18068. after this filter to obtain the original parameters.
  18069. The filter also has a video output (see the @var{video} option) with a real
  18070. time graph to observe the loudness evolution. The graphic contains the logged
  18071. message mentioned above, so it is not printed anymore when this option is set,
  18072. unless the verbose logging is set. The main graphing area contains the
  18073. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  18074. the momentary loudness (400 milliseconds), but can optionally be configured
  18075. to instead display short-term loudness (see @var{gauge}).
  18076. The green area marks a +/- 1LU target range around the target loudness
  18077. (-23LUFS by default, unless modified through @var{target}).
  18078. More information about the Loudness Recommendation EBU R128 on
  18079. @url{http://tech.ebu.ch/loudness}.
  18080. The filter accepts the following options:
  18081. @table @option
  18082. @item video
  18083. Activate the video output. The audio stream is passed unchanged whether this
  18084. option is set or no. The video stream will be the first output stream if
  18085. activated. Default is @code{0}.
  18086. @item size
  18087. Set the video size. This option is for video only. For the syntax of this
  18088. option, check the
  18089. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18090. Default and minimum resolution is @code{640x480}.
  18091. @item meter
  18092. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18093. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18094. other integer value between this range is allowed.
  18095. @item metadata
  18096. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18097. into 100ms output frames, each of them containing various loudness information
  18098. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18099. Default is @code{0}.
  18100. @item framelog
  18101. Force the frame logging level.
  18102. Available values are:
  18103. @table @samp
  18104. @item info
  18105. information logging level
  18106. @item verbose
  18107. verbose logging level
  18108. @end table
  18109. By default, the logging level is set to @var{info}. If the @option{video} or
  18110. the @option{metadata} options are set, it switches to @var{verbose}.
  18111. @item peak
  18112. Set peak mode(s).
  18113. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18114. values are:
  18115. @table @samp
  18116. @item none
  18117. Disable any peak mode (default).
  18118. @item sample
  18119. Enable sample-peak mode.
  18120. Simple peak mode looking for the higher sample value. It logs a message
  18121. for sample-peak (identified by @code{SPK}).
  18122. @item true
  18123. Enable true-peak mode.
  18124. If enabled, the peak lookup is done on an over-sampled version of the input
  18125. stream for better peak accuracy. It logs a message for true-peak.
  18126. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18127. This mode requires a build with @code{libswresample}.
  18128. @end table
  18129. @item dualmono
  18130. Treat mono input files as "dual mono". If a mono file is intended for playback
  18131. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18132. If set to @code{true}, this option will compensate for this effect.
  18133. Multi-channel input files are not affected by this option.
  18134. @item panlaw
  18135. Set a specific pan law to be used for the measurement of dual mono files.
  18136. This parameter is optional, and has a default value of -3.01dB.
  18137. @item target
  18138. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18139. This parameter is optional and has a default value of -23LUFS as specified
  18140. by EBU R128. However, material published online may prefer a level of -16LUFS
  18141. (e.g. for use with podcasts or video platforms).
  18142. @item gauge
  18143. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18144. @code{shortterm}. By default the momentary value will be used, but in certain
  18145. scenarios it may be more useful to observe the short term value instead (e.g.
  18146. live mixing).
  18147. @item scale
  18148. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18149. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18150. video output, not the summary or continuous log output.
  18151. @end table
  18152. @subsection Examples
  18153. @itemize
  18154. @item
  18155. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18156. @example
  18157. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18158. @end example
  18159. @item
  18160. Run an analysis with @command{ffmpeg}:
  18161. @example
  18162. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18163. @end example
  18164. @end itemize
  18165. @section interleave, ainterleave
  18166. Temporally interleave frames from several inputs.
  18167. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18168. These filters read frames from several inputs and send the oldest
  18169. queued frame to the output.
  18170. Input streams must have well defined, monotonically increasing frame
  18171. timestamp values.
  18172. In order to submit one frame to output, these filters need to enqueue
  18173. at least one frame for each input, so they cannot work in case one
  18174. input is not yet terminated and will not receive incoming frames.
  18175. For example consider the case when one input is a @code{select} filter
  18176. which always drops input frames. The @code{interleave} filter will keep
  18177. reading from that input, but it will never be able to send new frames
  18178. to output until the input sends an end-of-stream signal.
  18179. Also, depending on inputs synchronization, the filters will drop
  18180. frames in case one input receives more frames than the other ones, and
  18181. the queue is already filled.
  18182. These filters accept the following options:
  18183. @table @option
  18184. @item nb_inputs, n
  18185. Set the number of different inputs, it is 2 by default.
  18186. @item duration
  18187. How to determine the end-of-stream.
  18188. @table @option
  18189. @item longest
  18190. The duration of the longest input. (default)
  18191. @item shortest
  18192. The duration of the shortest input.
  18193. @item first
  18194. The duration of the first input.
  18195. @end table
  18196. @end table
  18197. @subsection Examples
  18198. @itemize
  18199. @item
  18200. Interleave frames belonging to different streams using @command{ffmpeg}:
  18201. @example
  18202. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18203. @end example
  18204. @item
  18205. Add flickering blur effect:
  18206. @example
  18207. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18208. @end example
  18209. @end itemize
  18210. @section metadata, ametadata
  18211. Manipulate frame metadata.
  18212. This filter accepts the following options:
  18213. @table @option
  18214. @item mode
  18215. Set mode of operation of the filter.
  18216. Can be one of the following:
  18217. @table @samp
  18218. @item select
  18219. If both @code{value} and @code{key} is set, select frames
  18220. which have such metadata. If only @code{key} is set, select
  18221. every frame that has such key in metadata.
  18222. @item add
  18223. Add new metadata @code{key} and @code{value}. If key is already available
  18224. do nothing.
  18225. @item modify
  18226. Modify value of already present key.
  18227. @item delete
  18228. If @code{value} is set, delete only keys that have such value.
  18229. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18230. the frame.
  18231. @item print
  18232. Print key and its value if metadata was found. If @code{key} is not set print all
  18233. metadata values available in frame.
  18234. @end table
  18235. @item key
  18236. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18237. @item value
  18238. Set metadata value which will be used. This option is mandatory for
  18239. @code{modify} and @code{add} mode.
  18240. @item function
  18241. Which function to use when comparing metadata value and @code{value}.
  18242. Can be one of following:
  18243. @table @samp
  18244. @item same_str
  18245. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18246. @item starts_with
  18247. Values are interpreted as strings, returns true if metadata value starts with
  18248. the @code{value} option string.
  18249. @item less
  18250. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18251. @item equal
  18252. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18253. @item greater
  18254. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18255. @item expr
  18256. Values are interpreted as floats, returns true if expression from option @code{expr}
  18257. evaluates to true.
  18258. @item ends_with
  18259. Values are interpreted as strings, returns true if metadata value ends with
  18260. the @code{value} option string.
  18261. @end table
  18262. @item expr
  18263. Set expression which is used when @code{function} is set to @code{expr}.
  18264. The expression is evaluated through the eval API and can contain the following
  18265. constants:
  18266. @table @option
  18267. @item VALUE1
  18268. Float representation of @code{value} from metadata key.
  18269. @item VALUE2
  18270. Float representation of @code{value} as supplied by user in @code{value} option.
  18271. @end table
  18272. @item file
  18273. If specified in @code{print} mode, output is written to the named file. Instead of
  18274. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18275. for standard output. If @code{file} option is not set, output is written to the log
  18276. with AV_LOG_INFO loglevel.
  18277. @item direct
  18278. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18279. @end table
  18280. @subsection Examples
  18281. @itemize
  18282. @item
  18283. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18284. between 0 and 1.
  18285. @example
  18286. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18287. @end example
  18288. @item
  18289. Print silencedetect output to file @file{metadata.txt}.
  18290. @example
  18291. silencedetect,ametadata=mode=print:file=metadata.txt
  18292. @end example
  18293. @item
  18294. Direct all metadata to a pipe with file descriptor 4.
  18295. @example
  18296. metadata=mode=print:file='pipe\:4'
  18297. @end example
  18298. @end itemize
  18299. @section perms, aperms
  18300. Set read/write permissions for the output frames.
  18301. These filters are mainly aimed at developers to test direct path in the
  18302. following filter in the filtergraph.
  18303. The filters accept the following options:
  18304. @table @option
  18305. @item mode
  18306. Select the permissions mode.
  18307. It accepts the following values:
  18308. @table @samp
  18309. @item none
  18310. Do nothing. This is the default.
  18311. @item ro
  18312. Set all the output frames read-only.
  18313. @item rw
  18314. Set all the output frames directly writable.
  18315. @item toggle
  18316. Make the frame read-only if writable, and writable if read-only.
  18317. @item random
  18318. Set each output frame read-only or writable randomly.
  18319. @end table
  18320. @item seed
  18321. Set the seed for the @var{random} mode, must be an integer included between
  18322. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18323. @code{-1}, the filter will try to use a good random seed on a best effort
  18324. basis.
  18325. @end table
  18326. Note: in case of auto-inserted filter between the permission filter and the
  18327. following one, the permission might not be received as expected in that
  18328. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18329. perms/aperms filter can avoid this problem.
  18330. @section realtime, arealtime
  18331. Slow down filtering to match real time approximately.
  18332. These filters will pause the filtering for a variable amount of time to
  18333. match the output rate with the input timestamps.
  18334. They are similar to the @option{re} option to @code{ffmpeg}.
  18335. They accept the following options:
  18336. @table @option
  18337. @item limit
  18338. Time limit for the pauses. Any pause longer than that will be considered
  18339. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18340. @item speed
  18341. Speed factor for processing. The value must be a float larger than zero.
  18342. Values larger than 1.0 will result in faster than realtime processing,
  18343. smaller will slow processing down. The @var{limit} is automatically adapted
  18344. accordingly. Default is 1.0.
  18345. A processing speed faster than what is possible without these filters cannot
  18346. be achieved.
  18347. @end table
  18348. @anchor{select}
  18349. @section select, aselect
  18350. Select frames to pass in output.
  18351. This filter accepts the following options:
  18352. @table @option
  18353. @item expr, e
  18354. Set expression, which is evaluated for each input frame.
  18355. If the expression is evaluated to zero, the frame is discarded.
  18356. If the evaluation result is negative or NaN, the frame is sent to the
  18357. first output; otherwise it is sent to the output with index
  18358. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18359. For example a value of @code{1.2} corresponds to the output with index
  18360. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18361. @item outputs, n
  18362. Set the number of outputs. The output to which to send the selected
  18363. frame is based on the result of the evaluation. Default value is 1.
  18364. @end table
  18365. The expression can contain the following constants:
  18366. @table @option
  18367. @item n
  18368. The (sequential) number of the filtered frame, starting from 0.
  18369. @item selected_n
  18370. The (sequential) number of the selected frame, starting from 0.
  18371. @item prev_selected_n
  18372. The sequential number of the last selected frame. It's NAN if undefined.
  18373. @item TB
  18374. The timebase of the input timestamps.
  18375. @item pts
  18376. The PTS (Presentation TimeStamp) of the filtered video frame,
  18377. expressed in @var{TB} units. It's NAN if undefined.
  18378. @item t
  18379. The PTS of the filtered video frame,
  18380. expressed in seconds. It's NAN if undefined.
  18381. @item prev_pts
  18382. The PTS of the previously filtered video frame. It's NAN if undefined.
  18383. @item prev_selected_pts
  18384. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18385. @item prev_selected_t
  18386. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18387. @item start_pts
  18388. The PTS of the first video frame in the video. It's NAN if undefined.
  18389. @item start_t
  18390. The time of the first video frame in the video. It's NAN if undefined.
  18391. @item pict_type @emph{(video only)}
  18392. The type of the filtered frame. It can assume one of the following
  18393. values:
  18394. @table @option
  18395. @item I
  18396. @item P
  18397. @item B
  18398. @item S
  18399. @item SI
  18400. @item SP
  18401. @item BI
  18402. @end table
  18403. @item interlace_type @emph{(video only)}
  18404. The frame interlace type. It can assume one of the following values:
  18405. @table @option
  18406. @item PROGRESSIVE
  18407. The frame is progressive (not interlaced).
  18408. @item TOPFIRST
  18409. The frame is top-field-first.
  18410. @item BOTTOMFIRST
  18411. The frame is bottom-field-first.
  18412. @end table
  18413. @item consumed_sample_n @emph{(audio only)}
  18414. the number of selected samples before the current frame
  18415. @item samples_n @emph{(audio only)}
  18416. the number of samples in the current frame
  18417. @item sample_rate @emph{(audio only)}
  18418. the input sample rate
  18419. @item key
  18420. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18421. @item pos
  18422. the position in the file of the filtered frame, -1 if the information
  18423. is not available (e.g. for synthetic video)
  18424. @item scene @emph{(video only)}
  18425. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18426. probability for the current frame to introduce a new scene, while a higher
  18427. value means the current frame is more likely to be one (see the example below)
  18428. @item concatdec_select
  18429. The concat demuxer can select only part of a concat input file by setting an
  18430. inpoint and an outpoint, but the output packets may not be entirely contained
  18431. in the selected interval. By using this variable, it is possible to skip frames
  18432. generated by the concat demuxer which are not exactly contained in the selected
  18433. interval.
  18434. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18435. and the @var{lavf.concat.duration} packet metadata values which are also
  18436. present in the decoded frames.
  18437. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18438. start_time and either the duration metadata is missing or the frame pts is less
  18439. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18440. missing.
  18441. That basically means that an input frame is selected if its pts is within the
  18442. interval set by the concat demuxer.
  18443. @end table
  18444. The default value of the select expression is "1".
  18445. @subsection Examples
  18446. @itemize
  18447. @item
  18448. Select all frames in input:
  18449. @example
  18450. select
  18451. @end example
  18452. The example above is the same as:
  18453. @example
  18454. select=1
  18455. @end example
  18456. @item
  18457. Skip all frames:
  18458. @example
  18459. select=0
  18460. @end example
  18461. @item
  18462. Select only I-frames:
  18463. @example
  18464. select='eq(pict_type\,I)'
  18465. @end example
  18466. @item
  18467. Select one frame every 100:
  18468. @example
  18469. select='not(mod(n\,100))'
  18470. @end example
  18471. @item
  18472. Select only frames contained in the 10-20 time interval:
  18473. @example
  18474. select=between(t\,10\,20)
  18475. @end example
  18476. @item
  18477. Select only I-frames contained in the 10-20 time interval:
  18478. @example
  18479. select=between(t\,10\,20)*eq(pict_type\,I)
  18480. @end example
  18481. @item
  18482. Select frames with a minimum distance of 10 seconds:
  18483. @example
  18484. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18485. @end example
  18486. @item
  18487. Use aselect to select only audio frames with samples number > 100:
  18488. @example
  18489. aselect='gt(samples_n\,100)'
  18490. @end example
  18491. @item
  18492. Create a mosaic of the first scenes:
  18493. @example
  18494. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18495. @end example
  18496. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18497. choice.
  18498. @item
  18499. Send even and odd frames to separate outputs, and compose them:
  18500. @example
  18501. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18502. @end example
  18503. @item
  18504. Select useful frames from an ffconcat file which is using inpoints and
  18505. outpoints but where the source files are not intra frame only.
  18506. @example
  18507. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18508. @end example
  18509. @end itemize
  18510. @section sendcmd, asendcmd
  18511. Send commands to filters in the filtergraph.
  18512. These filters read commands to be sent to other filters in the
  18513. filtergraph.
  18514. @code{sendcmd} must be inserted between two video filters,
  18515. @code{asendcmd} must be inserted between two audio filters, but apart
  18516. from that they act the same way.
  18517. The specification of commands can be provided in the filter arguments
  18518. with the @var{commands} option, or in a file specified by the
  18519. @var{filename} option.
  18520. These filters accept the following options:
  18521. @table @option
  18522. @item commands, c
  18523. Set the commands to be read and sent to the other filters.
  18524. @item filename, f
  18525. Set the filename of the commands to be read and sent to the other
  18526. filters.
  18527. @end table
  18528. @subsection Commands syntax
  18529. A commands description consists of a sequence of interval
  18530. specifications, comprising a list of commands to be executed when a
  18531. particular event related to that interval occurs. The occurring event
  18532. is typically the current frame time entering or leaving a given time
  18533. interval.
  18534. An interval is specified by the following syntax:
  18535. @example
  18536. @var{START}[-@var{END}] @var{COMMANDS};
  18537. @end example
  18538. The time interval is specified by the @var{START} and @var{END} times.
  18539. @var{END} is optional and defaults to the maximum time.
  18540. The current frame time is considered within the specified interval if
  18541. it is included in the interval [@var{START}, @var{END}), that is when
  18542. the time is greater or equal to @var{START} and is lesser than
  18543. @var{END}.
  18544. @var{COMMANDS} consists of a sequence of one or more command
  18545. specifications, separated by ",", relating to that interval. The
  18546. syntax of a command specification is given by:
  18547. @example
  18548. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18549. @end example
  18550. @var{FLAGS} is optional and specifies the type of events relating to
  18551. the time interval which enable sending the specified command, and must
  18552. be a non-null sequence of identifier flags separated by "+" or "|" and
  18553. enclosed between "[" and "]".
  18554. The following flags are recognized:
  18555. @table @option
  18556. @item enter
  18557. The command is sent when the current frame timestamp enters the
  18558. specified interval. In other words, the command is sent when the
  18559. previous frame timestamp was not in the given interval, and the
  18560. current is.
  18561. @item leave
  18562. The command is sent when the current frame timestamp leaves the
  18563. specified interval. In other words, the command is sent when the
  18564. previous frame timestamp was in the given interval, and the
  18565. current is not.
  18566. @item expr
  18567. The command @var{ARG} is interpreted as expression and result of
  18568. expression is passed as @var{ARG}.
  18569. The expression is evaluated through the eval API and can contain the following
  18570. constants:
  18571. @table @option
  18572. @item POS
  18573. Original position in the file of the frame, or undefined if undefined
  18574. for the current frame.
  18575. @item PTS
  18576. The presentation timestamp in input.
  18577. @item N
  18578. The count of the input frame for video or audio, starting from 0.
  18579. @item T
  18580. The time in seconds of the current frame.
  18581. @item TS
  18582. The start time in seconds of the current command interval.
  18583. @item TE
  18584. The end time in seconds of the current command interval.
  18585. @item TI
  18586. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18587. @end table
  18588. @end table
  18589. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18590. assumed.
  18591. @var{TARGET} specifies the target of the command, usually the name of
  18592. the filter class or a specific filter instance name.
  18593. @var{COMMAND} specifies the name of the command for the target filter.
  18594. @var{ARG} is optional and specifies the optional list of argument for
  18595. the given @var{COMMAND}.
  18596. Between one interval specification and another, whitespaces, or
  18597. sequences of characters starting with @code{#} until the end of line,
  18598. are ignored and can be used to annotate comments.
  18599. A simplified BNF description of the commands specification syntax
  18600. follows:
  18601. @example
  18602. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18603. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18604. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18605. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18606. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18607. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18608. @end example
  18609. @subsection Examples
  18610. @itemize
  18611. @item
  18612. Specify audio tempo change at second 4:
  18613. @example
  18614. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18615. @end example
  18616. @item
  18617. Target a specific filter instance:
  18618. @example
  18619. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18620. @end example
  18621. @item
  18622. Specify a list of drawtext and hue commands in a file.
  18623. @example
  18624. # show text in the interval 5-10
  18625. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18626. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18627. # desaturate the image in the interval 15-20
  18628. 15.0-20.0 [enter] hue s 0,
  18629. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18630. [leave] hue s 1,
  18631. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18632. # apply an exponential saturation fade-out effect, starting from time 25
  18633. 25 [enter] hue s exp(25-t)
  18634. @end example
  18635. A filtergraph allowing to read and process the above command list
  18636. stored in a file @file{test.cmd}, can be specified with:
  18637. @example
  18638. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18639. @end example
  18640. @end itemize
  18641. @anchor{setpts}
  18642. @section setpts, asetpts
  18643. Change the PTS (presentation timestamp) of the input frames.
  18644. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18645. This filter accepts the following options:
  18646. @table @option
  18647. @item expr
  18648. The expression which is evaluated for each frame to construct its timestamp.
  18649. @end table
  18650. The expression is evaluated through the eval API and can contain the following
  18651. constants:
  18652. @table @option
  18653. @item FRAME_RATE, FR
  18654. frame rate, only defined for constant frame-rate video
  18655. @item PTS
  18656. The presentation timestamp in input
  18657. @item N
  18658. The count of the input frame for video or the number of consumed samples,
  18659. not including the current frame for audio, starting from 0.
  18660. @item NB_CONSUMED_SAMPLES
  18661. The number of consumed samples, not including the current frame (only
  18662. audio)
  18663. @item NB_SAMPLES, S
  18664. The number of samples in the current frame (only audio)
  18665. @item SAMPLE_RATE, SR
  18666. The audio sample rate.
  18667. @item STARTPTS
  18668. The PTS of the first frame.
  18669. @item STARTT
  18670. the time in seconds of the first frame
  18671. @item INTERLACED
  18672. State whether the current frame is interlaced.
  18673. @item T
  18674. the time in seconds of the current frame
  18675. @item POS
  18676. original position in the file of the frame, or undefined if undefined
  18677. for the current frame
  18678. @item PREV_INPTS
  18679. The previous input PTS.
  18680. @item PREV_INT
  18681. previous input time in seconds
  18682. @item PREV_OUTPTS
  18683. The previous output PTS.
  18684. @item PREV_OUTT
  18685. previous output time in seconds
  18686. @item RTCTIME
  18687. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18688. instead.
  18689. @item RTCSTART
  18690. The wallclock (RTC) time at the start of the movie in microseconds.
  18691. @item TB
  18692. The timebase of the input timestamps.
  18693. @end table
  18694. @subsection Examples
  18695. @itemize
  18696. @item
  18697. Start counting PTS from zero
  18698. @example
  18699. setpts=PTS-STARTPTS
  18700. @end example
  18701. @item
  18702. Apply fast motion effect:
  18703. @example
  18704. setpts=0.5*PTS
  18705. @end example
  18706. @item
  18707. Apply slow motion effect:
  18708. @example
  18709. setpts=2.0*PTS
  18710. @end example
  18711. @item
  18712. Set fixed rate of 25 frames per second:
  18713. @example
  18714. setpts=N/(25*TB)
  18715. @end example
  18716. @item
  18717. Set fixed rate 25 fps with some jitter:
  18718. @example
  18719. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18720. @end example
  18721. @item
  18722. Apply an offset of 10 seconds to the input PTS:
  18723. @example
  18724. setpts=PTS+10/TB
  18725. @end example
  18726. @item
  18727. Generate timestamps from a "live source" and rebase onto the current timebase:
  18728. @example
  18729. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18730. @end example
  18731. @item
  18732. Generate timestamps by counting samples:
  18733. @example
  18734. asetpts=N/SR/TB
  18735. @end example
  18736. @end itemize
  18737. @section setrange
  18738. Force color range for the output video frame.
  18739. The @code{setrange} filter marks the color range property for the
  18740. output frames. It does not change the input frame, but only sets the
  18741. corresponding property, which affects how the frame is treated by
  18742. following filters.
  18743. The filter accepts the following options:
  18744. @table @option
  18745. @item range
  18746. Available values are:
  18747. @table @samp
  18748. @item auto
  18749. Keep the same color range property.
  18750. @item unspecified, unknown
  18751. Set the color range as unspecified.
  18752. @item limited, tv, mpeg
  18753. Set the color range as limited.
  18754. @item full, pc, jpeg
  18755. Set the color range as full.
  18756. @end table
  18757. @end table
  18758. @section settb, asettb
  18759. Set the timebase to use for the output frames timestamps.
  18760. It is mainly useful for testing timebase configuration.
  18761. It accepts the following parameters:
  18762. @table @option
  18763. @item expr, tb
  18764. The expression which is evaluated into the output timebase.
  18765. @end table
  18766. The value for @option{tb} is an arithmetic expression representing a
  18767. rational. The expression can contain the constants "AVTB" (the default
  18768. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18769. audio only). Default value is "intb".
  18770. @subsection Examples
  18771. @itemize
  18772. @item
  18773. Set the timebase to 1/25:
  18774. @example
  18775. settb=expr=1/25
  18776. @end example
  18777. @item
  18778. Set the timebase to 1/10:
  18779. @example
  18780. settb=expr=0.1
  18781. @end example
  18782. @item
  18783. Set the timebase to 1001/1000:
  18784. @example
  18785. settb=1+0.001
  18786. @end example
  18787. @item
  18788. Set the timebase to 2*intb:
  18789. @example
  18790. settb=2*intb
  18791. @end example
  18792. @item
  18793. Set the default timebase value:
  18794. @example
  18795. settb=AVTB
  18796. @end example
  18797. @end itemize
  18798. @section showcqt
  18799. Convert input audio to a video output representing frequency spectrum
  18800. logarithmically using Brown-Puckette constant Q transform algorithm with
  18801. direct frequency domain coefficient calculation (but the transform itself
  18802. is not really constant Q, instead the Q factor is actually variable/clamped),
  18803. with musical tone scale, from E0 to D#10.
  18804. The filter accepts the following options:
  18805. @table @option
  18806. @item size, s
  18807. Specify the video size for the output. It must be even. For the syntax of this option,
  18808. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18809. Default value is @code{1920x1080}.
  18810. @item fps, rate, r
  18811. Set the output frame rate. Default value is @code{25}.
  18812. @item bar_h
  18813. Set the bargraph height. It must be even. Default value is @code{-1} which
  18814. computes the bargraph height automatically.
  18815. @item axis_h
  18816. Set the axis height. It must be even. Default value is @code{-1} which computes
  18817. the axis height automatically.
  18818. @item sono_h
  18819. Set the sonogram height. It must be even. Default value is @code{-1} which
  18820. computes the sonogram height automatically.
  18821. @item fullhd
  18822. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18823. instead. Default value is @code{1}.
  18824. @item sono_v, volume
  18825. Specify the sonogram volume expression. It can contain variables:
  18826. @table @option
  18827. @item bar_v
  18828. the @var{bar_v} evaluated expression
  18829. @item frequency, freq, f
  18830. the frequency where it is evaluated
  18831. @item timeclamp, tc
  18832. the value of @var{timeclamp} option
  18833. @end table
  18834. and functions:
  18835. @table @option
  18836. @item a_weighting(f)
  18837. A-weighting of equal loudness
  18838. @item b_weighting(f)
  18839. B-weighting of equal loudness
  18840. @item c_weighting(f)
  18841. C-weighting of equal loudness.
  18842. @end table
  18843. Default value is @code{16}.
  18844. @item bar_v, volume2
  18845. Specify the bargraph volume expression. It can contain variables:
  18846. @table @option
  18847. @item sono_v
  18848. the @var{sono_v} evaluated expression
  18849. @item frequency, freq, f
  18850. the frequency where it is evaluated
  18851. @item timeclamp, tc
  18852. the value of @var{timeclamp} option
  18853. @end table
  18854. and functions:
  18855. @table @option
  18856. @item a_weighting(f)
  18857. A-weighting of equal loudness
  18858. @item b_weighting(f)
  18859. B-weighting of equal loudness
  18860. @item c_weighting(f)
  18861. C-weighting of equal loudness.
  18862. @end table
  18863. Default value is @code{sono_v}.
  18864. @item sono_g, gamma
  18865. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18866. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18867. Acceptable range is @code{[1, 7]}.
  18868. @item bar_g, gamma2
  18869. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18870. @code{[1, 7]}.
  18871. @item bar_t
  18872. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18873. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18874. @item timeclamp, tc
  18875. Specify the transform timeclamp. At low frequency, there is trade-off between
  18876. accuracy in time domain and frequency domain. If timeclamp is lower,
  18877. event in time domain is represented more accurately (such as fast bass drum),
  18878. otherwise event in frequency domain is represented more accurately
  18879. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18880. @item attack
  18881. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18882. limits future samples by applying asymmetric windowing in time domain, useful
  18883. when low latency is required. Accepted range is @code{[0, 1]}.
  18884. @item basefreq
  18885. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18886. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18887. @item endfreq
  18888. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18889. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18890. @item coeffclamp
  18891. This option is deprecated and ignored.
  18892. @item tlength
  18893. Specify the transform length in time domain. Use this option to control accuracy
  18894. trade-off between time domain and frequency domain at every frequency sample.
  18895. It can contain variables:
  18896. @table @option
  18897. @item frequency, freq, f
  18898. the frequency where it is evaluated
  18899. @item timeclamp, tc
  18900. the value of @var{timeclamp} option.
  18901. @end table
  18902. Default value is @code{384*tc/(384+tc*f)}.
  18903. @item count
  18904. Specify the transform count for every video frame. Default value is @code{6}.
  18905. Acceptable range is @code{[1, 30]}.
  18906. @item fcount
  18907. Specify the transform count for every single pixel. Default value is @code{0},
  18908. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18909. @item fontfile
  18910. Specify font file for use with freetype to draw the axis. If not specified,
  18911. use embedded font. Note that drawing with font file or embedded font is not
  18912. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18913. option instead.
  18914. @item font
  18915. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18916. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18917. escaping.
  18918. @item fontcolor
  18919. Specify font color expression. This is arithmetic expression that should return
  18920. integer value 0xRRGGBB. It can contain variables:
  18921. @table @option
  18922. @item frequency, freq, f
  18923. the frequency where it is evaluated
  18924. @item timeclamp, tc
  18925. the value of @var{timeclamp} option
  18926. @end table
  18927. and functions:
  18928. @table @option
  18929. @item midi(f)
  18930. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  18931. @item r(x), g(x), b(x)
  18932. red, green, and blue value of intensity x.
  18933. @end table
  18934. Default value is @code{st(0, (midi(f)-59.5)/12);
  18935. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  18936. r(1-ld(1)) + b(ld(1))}.
  18937. @item axisfile
  18938. Specify image file to draw the axis. This option override @var{fontfile} and
  18939. @var{fontcolor} option.
  18940. @item axis, text
  18941. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  18942. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  18943. Default value is @code{1}.
  18944. @item csp
  18945. Set colorspace. The accepted values are:
  18946. @table @samp
  18947. @item unspecified
  18948. Unspecified (default)
  18949. @item bt709
  18950. BT.709
  18951. @item fcc
  18952. FCC
  18953. @item bt470bg
  18954. BT.470BG or BT.601-6 625
  18955. @item smpte170m
  18956. SMPTE-170M or BT.601-6 525
  18957. @item smpte240m
  18958. SMPTE-240M
  18959. @item bt2020ncl
  18960. BT.2020 with non-constant luminance
  18961. @end table
  18962. @item cscheme
  18963. Set spectrogram color scheme. This is list of floating point values with format
  18964. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  18965. The default is @code{1|0.5|0|0|0.5|1}.
  18966. @end table
  18967. @subsection Examples
  18968. @itemize
  18969. @item
  18970. Playing audio while showing the spectrum:
  18971. @example
  18972. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  18973. @end example
  18974. @item
  18975. Same as above, but with frame rate 30 fps:
  18976. @example
  18977. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  18978. @end example
  18979. @item
  18980. Playing at 1280x720:
  18981. @example
  18982. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  18983. @end example
  18984. @item
  18985. Disable sonogram display:
  18986. @example
  18987. sono_h=0
  18988. @end example
  18989. @item
  18990. A1 and its harmonics: A1, A2, (near)E3, A3:
  18991. @example
  18992. 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),
  18993. asplit[a][out1]; [a] showcqt [out0]'
  18994. @end example
  18995. @item
  18996. Same as above, but with more accuracy in frequency domain:
  18997. @example
  18998. 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),
  18999. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  19000. @end example
  19001. @item
  19002. Custom volume:
  19003. @example
  19004. bar_v=10:sono_v=bar_v*a_weighting(f)
  19005. @end example
  19006. @item
  19007. Custom gamma, now spectrum is linear to the amplitude.
  19008. @example
  19009. bar_g=2:sono_g=2
  19010. @end example
  19011. @item
  19012. Custom tlength equation:
  19013. @example
  19014. 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)))'
  19015. @end example
  19016. @item
  19017. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  19018. @example
  19019. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  19020. @end example
  19021. @item
  19022. Custom font using fontconfig:
  19023. @example
  19024. font='Courier New,Monospace,mono|bold'
  19025. @end example
  19026. @item
  19027. Custom frequency range with custom axis using image file:
  19028. @example
  19029. axisfile=myaxis.png:basefreq=40:endfreq=10000
  19030. @end example
  19031. @end itemize
  19032. @section showfreqs
  19033. Convert input audio to video output representing the audio power spectrum.
  19034. Audio amplitude is on Y-axis while frequency is on X-axis.
  19035. The filter accepts the following options:
  19036. @table @option
  19037. @item size, s
  19038. Specify size of video. For the syntax of this option, check the
  19039. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19040. Default is @code{1024x512}.
  19041. @item mode
  19042. Set display mode.
  19043. This set how each frequency bin will be represented.
  19044. It accepts the following values:
  19045. @table @samp
  19046. @item line
  19047. @item bar
  19048. @item dot
  19049. @end table
  19050. Default is @code{bar}.
  19051. @item ascale
  19052. Set amplitude scale.
  19053. It accepts the following values:
  19054. @table @samp
  19055. @item lin
  19056. Linear scale.
  19057. @item sqrt
  19058. Square root scale.
  19059. @item cbrt
  19060. Cubic root scale.
  19061. @item log
  19062. Logarithmic scale.
  19063. @end table
  19064. Default is @code{log}.
  19065. @item fscale
  19066. Set frequency scale.
  19067. It accepts the following values:
  19068. @table @samp
  19069. @item lin
  19070. Linear scale.
  19071. @item log
  19072. Logarithmic scale.
  19073. @item rlog
  19074. Reverse logarithmic scale.
  19075. @end table
  19076. Default is @code{lin}.
  19077. @item win_size
  19078. Set window size. Allowed range is from 16 to 65536.
  19079. Default is @code{2048}
  19080. @item win_func
  19081. Set windowing function.
  19082. It accepts the following values:
  19083. @table @samp
  19084. @item rect
  19085. @item bartlett
  19086. @item hanning
  19087. @item hamming
  19088. @item blackman
  19089. @item welch
  19090. @item flattop
  19091. @item bharris
  19092. @item bnuttall
  19093. @item bhann
  19094. @item sine
  19095. @item nuttall
  19096. @item lanczos
  19097. @item gauss
  19098. @item tukey
  19099. @item dolph
  19100. @item cauchy
  19101. @item parzen
  19102. @item poisson
  19103. @item bohman
  19104. @end table
  19105. Default is @code{hanning}.
  19106. @item overlap
  19107. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19108. which means optimal overlap for selected window function will be picked.
  19109. @item averaging
  19110. Set time averaging. Setting this to 0 will display current maximal peaks.
  19111. Default is @code{1}, which means time averaging is disabled.
  19112. @item colors
  19113. Specify list of colors separated by space or by '|' which will be used to
  19114. draw channel frequencies. Unrecognized or missing colors will be replaced
  19115. by white color.
  19116. @item cmode
  19117. Set channel display mode.
  19118. It accepts the following values:
  19119. @table @samp
  19120. @item combined
  19121. @item separate
  19122. @end table
  19123. Default is @code{combined}.
  19124. @item minamp
  19125. Set minimum amplitude used in @code{log} amplitude scaler.
  19126. @end table
  19127. @section showspatial
  19128. Convert stereo input audio to a video output, representing the spatial relationship
  19129. between two channels.
  19130. The filter accepts the following options:
  19131. @table @option
  19132. @item size, s
  19133. Specify the video size for the output. For the syntax of this option, check the
  19134. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19135. Default value is @code{512x512}.
  19136. @item win_size
  19137. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19138. @item win_func
  19139. Set window function.
  19140. It accepts the following values:
  19141. @table @samp
  19142. @item rect
  19143. @item bartlett
  19144. @item hann
  19145. @item hanning
  19146. @item hamming
  19147. @item blackman
  19148. @item welch
  19149. @item flattop
  19150. @item bharris
  19151. @item bnuttall
  19152. @item bhann
  19153. @item sine
  19154. @item nuttall
  19155. @item lanczos
  19156. @item gauss
  19157. @item tukey
  19158. @item dolph
  19159. @item cauchy
  19160. @item parzen
  19161. @item poisson
  19162. @item bohman
  19163. @end table
  19164. Default value is @code{hann}.
  19165. @item overlap
  19166. Set ratio of overlap window. Default value is @code{0.5}.
  19167. When value is @code{1} overlap is set to recommended size for specific
  19168. window function currently used.
  19169. @end table
  19170. @anchor{showspectrum}
  19171. @section showspectrum
  19172. Convert input audio to a video output, representing the audio frequency
  19173. spectrum.
  19174. The filter accepts the following options:
  19175. @table @option
  19176. @item size, s
  19177. Specify the video size for the output. For the syntax of this option, check the
  19178. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19179. Default value is @code{640x512}.
  19180. @item slide
  19181. Specify how the spectrum should slide along the window.
  19182. It accepts the following values:
  19183. @table @samp
  19184. @item replace
  19185. the samples start again on the left when they reach the right
  19186. @item scroll
  19187. the samples scroll from right to left
  19188. @item fullframe
  19189. frames are only produced when the samples reach the right
  19190. @item rscroll
  19191. the samples scroll from left to right
  19192. @end table
  19193. Default value is @code{replace}.
  19194. @item mode
  19195. Specify display mode.
  19196. It accepts the following values:
  19197. @table @samp
  19198. @item combined
  19199. all channels are displayed in the same row
  19200. @item separate
  19201. all channels are displayed in separate rows
  19202. @end table
  19203. Default value is @samp{combined}.
  19204. @item color
  19205. Specify display color mode.
  19206. It accepts the following values:
  19207. @table @samp
  19208. @item channel
  19209. each channel is displayed in a separate color
  19210. @item intensity
  19211. each channel is displayed using the same color scheme
  19212. @item rainbow
  19213. each channel is displayed using the rainbow color scheme
  19214. @item moreland
  19215. each channel is displayed using the moreland color scheme
  19216. @item nebulae
  19217. each channel is displayed using the nebulae color scheme
  19218. @item fire
  19219. each channel is displayed using the fire color scheme
  19220. @item fiery
  19221. each channel is displayed using the fiery color scheme
  19222. @item fruit
  19223. each channel is displayed using the fruit color scheme
  19224. @item cool
  19225. each channel is displayed using the cool color scheme
  19226. @item magma
  19227. each channel is displayed using the magma color scheme
  19228. @item green
  19229. each channel is displayed using the green color scheme
  19230. @item viridis
  19231. each channel is displayed using the viridis color scheme
  19232. @item plasma
  19233. each channel is displayed using the plasma color scheme
  19234. @item cividis
  19235. each channel is displayed using the cividis color scheme
  19236. @item terrain
  19237. each channel is displayed using the terrain color scheme
  19238. @end table
  19239. Default value is @samp{channel}.
  19240. @item scale
  19241. Specify scale used for calculating intensity color values.
  19242. It accepts the following values:
  19243. @table @samp
  19244. @item lin
  19245. linear
  19246. @item sqrt
  19247. square root, default
  19248. @item cbrt
  19249. cubic root
  19250. @item log
  19251. logarithmic
  19252. @item 4thrt
  19253. 4th root
  19254. @item 5thrt
  19255. 5th root
  19256. @end table
  19257. Default value is @samp{sqrt}.
  19258. @item fscale
  19259. Specify frequency scale.
  19260. It accepts the following values:
  19261. @table @samp
  19262. @item lin
  19263. linear
  19264. @item log
  19265. logarithmic
  19266. @end table
  19267. Default value is @samp{lin}.
  19268. @item saturation
  19269. Set saturation modifier for displayed colors. Negative values provide
  19270. alternative color scheme. @code{0} is no saturation at all.
  19271. Saturation must be in [-10.0, 10.0] range.
  19272. Default value is @code{1}.
  19273. @item win_func
  19274. Set window function.
  19275. It accepts the following values:
  19276. @table @samp
  19277. @item rect
  19278. @item bartlett
  19279. @item hann
  19280. @item hanning
  19281. @item hamming
  19282. @item blackman
  19283. @item welch
  19284. @item flattop
  19285. @item bharris
  19286. @item bnuttall
  19287. @item bhann
  19288. @item sine
  19289. @item nuttall
  19290. @item lanczos
  19291. @item gauss
  19292. @item tukey
  19293. @item dolph
  19294. @item cauchy
  19295. @item parzen
  19296. @item poisson
  19297. @item bohman
  19298. @end table
  19299. Default value is @code{hann}.
  19300. @item orientation
  19301. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19302. @code{horizontal}. Default is @code{vertical}.
  19303. @item overlap
  19304. Set ratio of overlap window. Default value is @code{0}.
  19305. When value is @code{1} overlap is set to recommended size for specific
  19306. window function currently used.
  19307. @item gain
  19308. Set scale gain for calculating intensity color values.
  19309. Default value is @code{1}.
  19310. @item data
  19311. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19312. @item rotation
  19313. Set color rotation, must be in [-1.0, 1.0] range.
  19314. Default value is @code{0}.
  19315. @item start
  19316. Set start frequency from which to display spectrogram. Default is @code{0}.
  19317. @item stop
  19318. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19319. @item fps
  19320. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19321. @item legend
  19322. Draw time and frequency axes and legends. Default is disabled.
  19323. @end table
  19324. The usage is very similar to the showwaves filter; see the examples in that
  19325. section.
  19326. @subsection Examples
  19327. @itemize
  19328. @item
  19329. Large window with logarithmic color scaling:
  19330. @example
  19331. showspectrum=s=1280x480:scale=log
  19332. @end example
  19333. @item
  19334. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19335. @example
  19336. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19337. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19338. @end example
  19339. @end itemize
  19340. @section showspectrumpic
  19341. Convert input audio to a single video frame, representing the audio frequency
  19342. spectrum.
  19343. The filter accepts the following options:
  19344. @table @option
  19345. @item size, s
  19346. Specify the video size for the output. For the syntax of this option, check the
  19347. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19348. Default value is @code{4096x2048}.
  19349. @item mode
  19350. Specify display mode.
  19351. It accepts the following values:
  19352. @table @samp
  19353. @item combined
  19354. all channels are displayed in the same row
  19355. @item separate
  19356. all channels are displayed in separate rows
  19357. @end table
  19358. Default value is @samp{combined}.
  19359. @item color
  19360. Specify display color mode.
  19361. It accepts the following values:
  19362. @table @samp
  19363. @item channel
  19364. each channel is displayed in a separate color
  19365. @item intensity
  19366. each channel is displayed using the same color scheme
  19367. @item rainbow
  19368. each channel is displayed using the rainbow color scheme
  19369. @item moreland
  19370. each channel is displayed using the moreland color scheme
  19371. @item nebulae
  19372. each channel is displayed using the nebulae color scheme
  19373. @item fire
  19374. each channel is displayed using the fire color scheme
  19375. @item fiery
  19376. each channel is displayed using the fiery color scheme
  19377. @item fruit
  19378. each channel is displayed using the fruit color scheme
  19379. @item cool
  19380. each channel is displayed using the cool color scheme
  19381. @item magma
  19382. each channel is displayed using the magma color scheme
  19383. @item green
  19384. each channel is displayed using the green color scheme
  19385. @item viridis
  19386. each channel is displayed using the viridis color scheme
  19387. @item plasma
  19388. each channel is displayed using the plasma color scheme
  19389. @item cividis
  19390. each channel is displayed using the cividis color scheme
  19391. @item terrain
  19392. each channel is displayed using the terrain color scheme
  19393. @end table
  19394. Default value is @samp{intensity}.
  19395. @item scale
  19396. Specify scale used for calculating intensity color values.
  19397. It accepts the following values:
  19398. @table @samp
  19399. @item lin
  19400. linear
  19401. @item sqrt
  19402. square root, default
  19403. @item cbrt
  19404. cubic root
  19405. @item log
  19406. logarithmic
  19407. @item 4thrt
  19408. 4th root
  19409. @item 5thrt
  19410. 5th root
  19411. @end table
  19412. Default value is @samp{log}.
  19413. @item fscale
  19414. Specify frequency scale.
  19415. It accepts the following values:
  19416. @table @samp
  19417. @item lin
  19418. linear
  19419. @item log
  19420. logarithmic
  19421. @end table
  19422. Default value is @samp{lin}.
  19423. @item saturation
  19424. Set saturation modifier for displayed colors. Negative values provide
  19425. alternative color scheme. @code{0} is no saturation at all.
  19426. Saturation must be in [-10.0, 10.0] range.
  19427. Default value is @code{1}.
  19428. @item win_func
  19429. Set window function.
  19430. It accepts the following values:
  19431. @table @samp
  19432. @item rect
  19433. @item bartlett
  19434. @item hann
  19435. @item hanning
  19436. @item hamming
  19437. @item blackman
  19438. @item welch
  19439. @item flattop
  19440. @item bharris
  19441. @item bnuttall
  19442. @item bhann
  19443. @item sine
  19444. @item nuttall
  19445. @item lanczos
  19446. @item gauss
  19447. @item tukey
  19448. @item dolph
  19449. @item cauchy
  19450. @item parzen
  19451. @item poisson
  19452. @item bohman
  19453. @end table
  19454. Default value is @code{hann}.
  19455. @item orientation
  19456. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19457. @code{horizontal}. Default is @code{vertical}.
  19458. @item gain
  19459. Set scale gain for calculating intensity color values.
  19460. Default value is @code{1}.
  19461. @item legend
  19462. Draw time and frequency axes and legends. Default is enabled.
  19463. @item rotation
  19464. Set color rotation, must be in [-1.0, 1.0] range.
  19465. Default value is @code{0}.
  19466. @item start
  19467. Set start frequency from which to display spectrogram. Default is @code{0}.
  19468. @item stop
  19469. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19470. @end table
  19471. @subsection Examples
  19472. @itemize
  19473. @item
  19474. Extract an audio spectrogram of a whole audio track
  19475. in a 1024x1024 picture using @command{ffmpeg}:
  19476. @example
  19477. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19478. @end example
  19479. @end itemize
  19480. @section showvolume
  19481. Convert input audio volume to a video output.
  19482. The filter accepts the following options:
  19483. @table @option
  19484. @item rate, r
  19485. Set video rate.
  19486. @item b
  19487. Set border width, allowed range is [0, 5]. Default is 1.
  19488. @item w
  19489. Set channel width, allowed range is [80, 8192]. Default is 400.
  19490. @item h
  19491. Set channel height, allowed range is [1, 900]. Default is 20.
  19492. @item f
  19493. Set fade, allowed range is [0, 1]. Default is 0.95.
  19494. @item c
  19495. Set volume color expression.
  19496. The expression can use the following variables:
  19497. @table @option
  19498. @item VOLUME
  19499. Current max volume of channel in dB.
  19500. @item PEAK
  19501. Current peak.
  19502. @item CHANNEL
  19503. Current channel number, starting from 0.
  19504. @end table
  19505. @item t
  19506. If set, displays channel names. Default is enabled.
  19507. @item v
  19508. If set, displays volume values. Default is enabled.
  19509. @item o
  19510. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19511. default is @code{h}.
  19512. @item s
  19513. Set step size, allowed range is [0, 5]. Default is 0, which means
  19514. step is disabled.
  19515. @item p
  19516. Set background opacity, allowed range is [0, 1]. Default is 0.
  19517. @item m
  19518. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19519. default is @code{p}.
  19520. @item ds
  19521. Set display scale, can be linear: @code{lin} or log: @code{log},
  19522. default is @code{lin}.
  19523. @item dm
  19524. In second.
  19525. If set to > 0., display a line for the max level
  19526. in the previous seconds.
  19527. default is disabled: @code{0.}
  19528. @item dmc
  19529. The color of the max line. Use when @code{dm} option is set to > 0.
  19530. default is: @code{orange}
  19531. @end table
  19532. @section showwaves
  19533. Convert input audio to a video output, representing the samples waves.
  19534. The filter accepts the following options:
  19535. @table @option
  19536. @item size, s
  19537. Specify the video size for the output. For the syntax of this option, check the
  19538. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19539. Default value is @code{600x240}.
  19540. @item mode
  19541. Set display mode.
  19542. Available values are:
  19543. @table @samp
  19544. @item point
  19545. Draw a point for each sample.
  19546. @item line
  19547. Draw a vertical line for each sample.
  19548. @item p2p
  19549. Draw a point for each sample and a line between them.
  19550. @item cline
  19551. Draw a centered vertical line for each sample.
  19552. @end table
  19553. Default value is @code{point}.
  19554. @item n
  19555. Set the number of samples which are printed on the same column. A
  19556. larger value will decrease the frame rate. Must be a positive
  19557. integer. This option can be set only if the value for @var{rate}
  19558. is not explicitly specified.
  19559. @item rate, r
  19560. Set the (approximate) output frame rate. This is done by setting the
  19561. option @var{n}. Default value is "25".
  19562. @item split_channels
  19563. Set if channels should be drawn separately or overlap. Default value is 0.
  19564. @item colors
  19565. Set colors separated by '|' which are going to be used for drawing of each channel.
  19566. @item scale
  19567. Set amplitude scale.
  19568. Available values are:
  19569. @table @samp
  19570. @item lin
  19571. Linear.
  19572. @item log
  19573. Logarithmic.
  19574. @item sqrt
  19575. Square root.
  19576. @item cbrt
  19577. Cubic root.
  19578. @end table
  19579. Default is linear.
  19580. @item draw
  19581. Set the draw mode. This is mostly useful to set for high @var{n}.
  19582. Available values are:
  19583. @table @samp
  19584. @item scale
  19585. Scale pixel values for each drawn sample.
  19586. @item full
  19587. Draw every sample directly.
  19588. @end table
  19589. Default value is @code{scale}.
  19590. @end table
  19591. @subsection Examples
  19592. @itemize
  19593. @item
  19594. Output the input file audio and the corresponding video representation
  19595. at the same time:
  19596. @example
  19597. amovie=a.mp3,asplit[out0],showwaves[out1]
  19598. @end example
  19599. @item
  19600. Create a synthetic signal and show it with showwaves, forcing a
  19601. frame rate of 30 frames per second:
  19602. @example
  19603. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19604. @end example
  19605. @end itemize
  19606. @section showwavespic
  19607. Convert input audio to a single video frame, representing the samples waves.
  19608. The filter accepts the following options:
  19609. @table @option
  19610. @item size, s
  19611. Specify the video size for the output. For the syntax of this option, check the
  19612. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19613. Default value is @code{600x240}.
  19614. @item split_channels
  19615. Set if channels should be drawn separately or overlap. Default value is 0.
  19616. @item colors
  19617. Set colors separated by '|' which are going to be used for drawing of each channel.
  19618. @item scale
  19619. Set amplitude scale.
  19620. Available values are:
  19621. @table @samp
  19622. @item lin
  19623. Linear.
  19624. @item log
  19625. Logarithmic.
  19626. @item sqrt
  19627. Square root.
  19628. @item cbrt
  19629. Cubic root.
  19630. @end table
  19631. Default is linear.
  19632. @item draw
  19633. Set the draw mode.
  19634. Available values are:
  19635. @table @samp
  19636. @item scale
  19637. Scale pixel values for each drawn sample.
  19638. @item full
  19639. Draw every sample directly.
  19640. @end table
  19641. Default value is @code{scale}.
  19642. @item filter
  19643. Set the filter mode.
  19644. Available values are:
  19645. @table @samp
  19646. @item average
  19647. Use average samples values for each drawn sample.
  19648. @item peak
  19649. Use peak samples values for each drawn sample.
  19650. @end table
  19651. Default value is @code{average}.
  19652. @end table
  19653. @subsection Examples
  19654. @itemize
  19655. @item
  19656. Extract a channel split representation of the wave form of a whole audio track
  19657. in a 1024x800 picture using @command{ffmpeg}:
  19658. @example
  19659. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19660. @end example
  19661. @end itemize
  19662. @section sidedata, asidedata
  19663. Delete frame side data, or select frames based on it.
  19664. This filter accepts the following options:
  19665. @table @option
  19666. @item mode
  19667. Set mode of operation of the filter.
  19668. Can be one of the following:
  19669. @table @samp
  19670. @item select
  19671. Select every frame with side data of @code{type}.
  19672. @item delete
  19673. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19674. data in the frame.
  19675. @end table
  19676. @item type
  19677. Set side data type used with all modes. Must be set for @code{select} mode. For
  19678. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19679. in @file{libavutil/frame.h}. For example, to choose
  19680. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19681. @end table
  19682. @section spectrumsynth
  19683. Synthesize audio from 2 input video spectrums, first input stream represents
  19684. magnitude across time and second represents phase across time.
  19685. The filter will transform from frequency domain as displayed in videos back
  19686. to time domain as presented in audio output.
  19687. This filter is primarily created for reversing processed @ref{showspectrum}
  19688. filter outputs, but can synthesize sound from other spectrograms too.
  19689. But in such case results are going to be poor if the phase data is not
  19690. available, because in such cases phase data need to be recreated, usually
  19691. it's just recreated from random noise.
  19692. For best results use gray only output (@code{channel} color mode in
  19693. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19694. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19695. @code{data} option. Inputs videos should generally use @code{fullframe}
  19696. slide mode as that saves resources needed for decoding video.
  19697. The filter accepts the following options:
  19698. @table @option
  19699. @item sample_rate
  19700. Specify sample rate of output audio, the sample rate of audio from which
  19701. spectrum was generated may differ.
  19702. @item channels
  19703. Set number of channels represented in input video spectrums.
  19704. @item scale
  19705. Set scale which was used when generating magnitude input spectrum.
  19706. Can be @code{lin} or @code{log}. Default is @code{log}.
  19707. @item slide
  19708. Set slide which was used when generating inputs spectrums.
  19709. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19710. Default is @code{fullframe}.
  19711. @item win_func
  19712. Set window function used for resynthesis.
  19713. @item overlap
  19714. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19715. which means optimal overlap for selected window function will be picked.
  19716. @item orientation
  19717. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19718. Default is @code{vertical}.
  19719. @end table
  19720. @subsection Examples
  19721. @itemize
  19722. @item
  19723. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19724. then resynthesize videos back to audio with spectrumsynth:
  19725. @example
  19726. 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
  19727. 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
  19728. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19729. @end example
  19730. @end itemize
  19731. @section split, asplit
  19732. Split input into several identical outputs.
  19733. @code{asplit} works with audio input, @code{split} with video.
  19734. The filter accepts a single parameter which specifies the number of outputs. If
  19735. unspecified, it defaults to 2.
  19736. @subsection Examples
  19737. @itemize
  19738. @item
  19739. Create two separate outputs from the same input:
  19740. @example
  19741. [in] split [out0][out1]
  19742. @end example
  19743. @item
  19744. To create 3 or more outputs, you need to specify the number of
  19745. outputs, like in:
  19746. @example
  19747. [in] asplit=3 [out0][out1][out2]
  19748. @end example
  19749. @item
  19750. Create two separate outputs from the same input, one cropped and
  19751. one padded:
  19752. @example
  19753. [in] split [splitout1][splitout2];
  19754. [splitout1] crop=100:100:0:0 [cropout];
  19755. [splitout2] pad=200:200:100:100 [padout];
  19756. @end example
  19757. @item
  19758. Create 5 copies of the input audio with @command{ffmpeg}:
  19759. @example
  19760. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19761. @end example
  19762. @end itemize
  19763. @section zmq, azmq
  19764. Receive commands sent through a libzmq client, and forward them to
  19765. filters in the filtergraph.
  19766. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19767. must be inserted between two video filters, @code{azmq} between two
  19768. audio filters. Both are capable to send messages to any filter type.
  19769. To enable these filters you need to install the libzmq library and
  19770. headers and configure FFmpeg with @code{--enable-libzmq}.
  19771. For more information about libzmq see:
  19772. @url{http://www.zeromq.org/}
  19773. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19774. receives messages sent through a network interface defined by the
  19775. @option{bind_address} (or the abbreviation "@option{b}") option.
  19776. Default value of this option is @file{tcp://localhost:5555}. You may
  19777. want to alter this value to your needs, but do not forget to escape any
  19778. ':' signs (see @ref{filtergraph escaping}).
  19779. The received message must be in the form:
  19780. @example
  19781. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19782. @end example
  19783. @var{TARGET} specifies the target of the command, usually the name of
  19784. the filter class or a specific filter instance name. The default
  19785. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19786. but you can override this by using the @samp{filter_name@@id} syntax
  19787. (see @ref{Filtergraph syntax}).
  19788. @var{COMMAND} specifies the name of the command for the target filter.
  19789. @var{ARG} is optional and specifies the optional argument list for the
  19790. given @var{COMMAND}.
  19791. Upon reception, the message is processed and the corresponding command
  19792. is injected into the filtergraph. Depending on the result, the filter
  19793. will send a reply to the client, adopting the format:
  19794. @example
  19795. @var{ERROR_CODE} @var{ERROR_REASON}
  19796. @var{MESSAGE}
  19797. @end example
  19798. @var{MESSAGE} is optional.
  19799. @subsection Examples
  19800. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19801. be used to send commands processed by these filters.
  19802. Consider the following filtergraph generated by @command{ffplay}.
  19803. In this example the last overlay filter has an instance name. All other
  19804. filters will have default instance names.
  19805. @example
  19806. ffplay -dumpgraph 1 -f lavfi "
  19807. color=s=100x100:c=red [l];
  19808. color=s=100x100:c=blue [r];
  19809. nullsrc=s=200x100, zmq [bg];
  19810. [bg][l] overlay [bg+l];
  19811. [bg+l][r] overlay@@my=x=100 "
  19812. @end example
  19813. To change the color of the left side of the video, the following
  19814. command can be used:
  19815. @example
  19816. echo Parsed_color_0 c yellow | tools/zmqsend
  19817. @end example
  19818. To change the right side:
  19819. @example
  19820. echo Parsed_color_1 c pink | tools/zmqsend
  19821. @end example
  19822. To change the position of the right side:
  19823. @example
  19824. echo overlay@@my x 150 | tools/zmqsend
  19825. @end example
  19826. @c man end MULTIMEDIA FILTERS
  19827. @chapter Multimedia Sources
  19828. @c man begin MULTIMEDIA SOURCES
  19829. Below is a description of the currently available multimedia sources.
  19830. @section amovie
  19831. This is the same as @ref{movie} source, except it selects an audio
  19832. stream by default.
  19833. @anchor{movie}
  19834. @section movie
  19835. Read audio and/or video stream(s) from a movie container.
  19836. It accepts the following parameters:
  19837. @table @option
  19838. @item filename
  19839. The name of the resource to read (not necessarily a file; it can also be a
  19840. device or a stream accessed through some protocol).
  19841. @item format_name, f
  19842. Specifies the format assumed for the movie to read, and can be either
  19843. the name of a container or an input device. If not specified, the
  19844. format is guessed from @var{movie_name} or by probing.
  19845. @item seek_point, sp
  19846. Specifies the seek point in seconds. The frames will be output
  19847. starting from this seek point. The parameter is evaluated with
  19848. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19849. postfix. The default value is "0".
  19850. @item streams, s
  19851. Specifies the streams to read. Several streams can be specified,
  19852. separated by "+". The source will then have as many outputs, in the
  19853. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19854. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19855. respectively the default (best suited) video and audio stream. Default
  19856. is "dv", or "da" if the filter is called as "amovie".
  19857. @item stream_index, si
  19858. Specifies the index of the video stream to read. If the value is -1,
  19859. the most suitable video stream will be automatically selected. The default
  19860. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19861. audio instead of video.
  19862. @item loop
  19863. Specifies how many times to read the stream in sequence.
  19864. If the value is 0, the stream will be looped infinitely.
  19865. Default value is "1".
  19866. Note that when the movie is looped the source timestamps are not
  19867. changed, so it will generate non monotonically increasing timestamps.
  19868. @item discontinuity
  19869. Specifies the time difference between frames above which the point is
  19870. considered a timestamp discontinuity which is removed by adjusting the later
  19871. timestamps.
  19872. @end table
  19873. It allows overlaying a second video on top of the main input of
  19874. a filtergraph, as shown in this graph:
  19875. @example
  19876. input -----------> deltapts0 --> overlay --> output
  19877. ^
  19878. |
  19879. movie --> scale--> deltapts1 -------+
  19880. @end example
  19881. @subsection Examples
  19882. @itemize
  19883. @item
  19884. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19885. on top of the input labelled "in":
  19886. @example
  19887. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19888. [in] setpts=PTS-STARTPTS [main];
  19889. [main][over] overlay=16:16 [out]
  19890. @end example
  19891. @item
  19892. Read from a video4linux2 device, and overlay it on top of the input
  19893. labelled "in":
  19894. @example
  19895. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19896. [in] setpts=PTS-STARTPTS [main];
  19897. [main][over] overlay=16:16 [out]
  19898. @end example
  19899. @item
  19900. Read the first video stream and the audio stream with id 0x81 from
  19901. dvd.vob; the video is connected to the pad named "video" and the audio is
  19902. connected to the pad named "audio":
  19903. @example
  19904. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19905. @end example
  19906. @end itemize
  19907. @subsection Commands
  19908. Both movie and amovie support the following commands:
  19909. @table @option
  19910. @item seek
  19911. Perform seek using "av_seek_frame".
  19912. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19913. @itemize
  19914. @item
  19915. @var{stream_index}: If stream_index is -1, a default
  19916. stream is selected, and @var{timestamp} is automatically converted
  19917. from AV_TIME_BASE units to the stream specific time_base.
  19918. @item
  19919. @var{timestamp}: Timestamp in AVStream.time_base units
  19920. or, if no stream is specified, in AV_TIME_BASE units.
  19921. @item
  19922. @var{flags}: Flags which select direction and seeking mode.
  19923. @end itemize
  19924. @item get_duration
  19925. Get movie duration in AV_TIME_BASE units.
  19926. @end table
  19927. @c man end MULTIMEDIA SOURCES