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.

26168 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 numerator/zeros coefficients.
  1111. @item poles, p
  1112. Set denominator/poles 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 sf
  1123. analog transfer function
  1124. @item tf
  1125. digital transfer function
  1126. @item zp
  1127. Z-plane zeros/poles, cartesian (default)
  1128. @item pr
  1129. Z-plane zeros/poles, polar radians
  1130. @item pd
  1131. Z-plane zeros/poles, polar degrees
  1132. @item sp
  1133. S-plane zeros/poles
  1134. @end table
  1135. @item process, r
  1136. Set type of processing.
  1137. @table @samp
  1138. @item d
  1139. direct processing
  1140. @item s
  1141. serial processing
  1142. @item p
  1143. parallel processing
  1144. @end table
  1145. @item precision, e
  1146. Set filtering precision.
  1147. @table @samp
  1148. @item dbl
  1149. double-precision floating-point (default)
  1150. @item flt
  1151. single-precision floating-point
  1152. @item i32
  1153. 32-bit integers
  1154. @item i16
  1155. 16-bit integers
  1156. @end table
  1157. @item normalize, n
  1158. Normalize filter coefficients, by default is enabled.
  1159. Enabling it will normalize magnitude response at DC to 0dB.
  1160. @item mix
  1161. How much to use filtered signal in output. Default is 1.
  1162. Range is between 0 and 1.
  1163. @item response
  1164. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1165. By default it is disabled.
  1166. @item channel
  1167. Set for which IR channel to display frequency response. By default is first channel
  1168. displayed. This option is used only when @var{response} is enabled.
  1169. @item size
  1170. Set video stream size. This option is used only when @var{response} is enabled.
  1171. @end table
  1172. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1173. order.
  1174. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1175. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1176. imaginary unit.
  1177. Different coefficients and gains can be provided for every channel, in such case
  1178. use '|' to separate coefficients or gains. Last provided coefficients will be
  1179. used for all remaining channels.
  1180. @subsection Examples
  1181. @itemize
  1182. @item
  1183. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1184. @example
  1185. 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
  1186. @end example
  1187. @item
  1188. Same as above but in @code{zp} format:
  1189. @example
  1190. 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
  1191. @end example
  1192. @item
  1193. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1194. @example
  1195. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1196. @end example
  1197. @end itemize
  1198. @section alimiter
  1199. The limiter prevents an input signal from rising over a desired threshold.
  1200. This limiter uses lookahead technology to prevent your signal from distorting.
  1201. It means that there is a small delay after the signal is processed. Keep in mind
  1202. that the delay it produces is the attack time you set.
  1203. The filter accepts the following options:
  1204. @table @option
  1205. @item level_in
  1206. Set input gain. Default is 1.
  1207. @item level_out
  1208. Set output gain. Default is 1.
  1209. @item limit
  1210. Don't let signals above this level pass the limiter. Default is 1.
  1211. @item attack
  1212. The limiter will reach its attenuation level in this amount of time in
  1213. milliseconds. Default is 5 milliseconds.
  1214. @item release
  1215. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1216. Default is 50 milliseconds.
  1217. @item asc
  1218. When gain reduction is always needed ASC takes care of releasing to an
  1219. average reduction level rather than reaching a reduction of 0 in the release
  1220. time.
  1221. @item asc_level
  1222. Select how much the release time is affected by ASC, 0 means nearly no changes
  1223. in release time while 1 produces higher release times.
  1224. @item level
  1225. Auto level output signal. Default is enabled.
  1226. This normalizes audio back to 0dB if enabled.
  1227. @end table
  1228. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1229. with @ref{aresample} before applying this filter.
  1230. @section allpass
  1231. Apply a two-pole all-pass filter with central frequency (in Hz)
  1232. @var{frequency}, and filter-width @var{width}.
  1233. An all-pass filter changes the audio's frequency to phase relationship
  1234. without changing its frequency to amplitude relationship.
  1235. The filter accepts the following options:
  1236. @table @option
  1237. @item frequency, f
  1238. Set frequency in Hz.
  1239. @item width_type, t
  1240. Set method to specify band-width of filter.
  1241. @table @option
  1242. @item h
  1243. Hz
  1244. @item q
  1245. Q-Factor
  1246. @item o
  1247. octave
  1248. @item s
  1249. slope
  1250. @item k
  1251. kHz
  1252. @end table
  1253. @item width, w
  1254. Specify the band-width of a filter in width_type units.
  1255. @item mix, m
  1256. How much to use filtered signal in output. Default is 1.
  1257. Range is between 0 and 1.
  1258. @item channels, c
  1259. Specify which channels to filter, by default all available are filtered.
  1260. @item normalize, n
  1261. Normalize biquad coefficients, by default is disabled.
  1262. Enabling it will normalize magnitude response at DC to 0dB.
  1263. @item order, o
  1264. Set the filter order, can be 1 or 2. Default is 2.
  1265. @item transform, a
  1266. Set transform type of IIR filter.
  1267. @table @option
  1268. @item di
  1269. @item dii
  1270. @item tdii
  1271. @item latt
  1272. @end table
  1273. @end table
  1274. @subsection Commands
  1275. This filter supports the following commands:
  1276. @table @option
  1277. @item frequency, f
  1278. Change allpass frequency.
  1279. Syntax for the command is : "@var{frequency}"
  1280. @item width_type, t
  1281. Change allpass width_type.
  1282. Syntax for the command is : "@var{width_type}"
  1283. @item width, w
  1284. Change allpass width.
  1285. Syntax for the command is : "@var{width}"
  1286. @item mix, m
  1287. Change allpass mix.
  1288. Syntax for the command is : "@var{mix}"
  1289. @end table
  1290. @section aloop
  1291. Loop audio samples.
  1292. The filter accepts the following options:
  1293. @table @option
  1294. @item loop
  1295. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1296. Default is 0.
  1297. @item size
  1298. Set maximal number of samples. Default is 0.
  1299. @item start
  1300. Set first sample of loop. Default is 0.
  1301. @end table
  1302. @anchor{amerge}
  1303. @section amerge
  1304. Merge two or more audio streams into a single multi-channel stream.
  1305. The filter accepts the following options:
  1306. @table @option
  1307. @item inputs
  1308. Set the number of inputs. Default is 2.
  1309. @end table
  1310. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1311. the channel layout of the output will be set accordingly and the channels
  1312. will be reordered as necessary. If the channel layouts of the inputs are not
  1313. disjoint, the output will have all the channels of the first input then all
  1314. the channels of the second input, in that order, and the channel layout of
  1315. the output will be the default value corresponding to the total number of
  1316. channels.
  1317. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1318. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1319. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1320. first input, b1 is the first channel of the second input).
  1321. On the other hand, if both input are in stereo, the output channels will be
  1322. in the default order: a1, a2, b1, b2, and the channel layout will be
  1323. arbitrarily set to 4.0, which may or may not be the expected value.
  1324. All inputs must have the same sample rate, and format.
  1325. If inputs do not have the same duration, the output will stop with the
  1326. shortest.
  1327. @subsection Examples
  1328. @itemize
  1329. @item
  1330. Merge two mono files into a stereo stream:
  1331. @example
  1332. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1333. @end example
  1334. @item
  1335. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1336. @example
  1337. 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
  1338. @end example
  1339. @end itemize
  1340. @section amix
  1341. Mixes multiple audio inputs into a single output.
  1342. Note that this filter only supports float samples (the @var{amerge}
  1343. and @var{pan} audio filters support many formats). If the @var{amix}
  1344. input has integer samples then @ref{aresample} will be automatically
  1345. inserted to perform the conversion to float samples.
  1346. For example
  1347. @example
  1348. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1349. @end example
  1350. will mix 3 input audio streams to a single output with the same duration as the
  1351. first input and a dropout transition time of 3 seconds.
  1352. It accepts the following parameters:
  1353. @table @option
  1354. @item inputs
  1355. The number of inputs. If unspecified, it defaults to 2.
  1356. @item duration
  1357. How to determine the end-of-stream.
  1358. @table @option
  1359. @item longest
  1360. The duration of the longest input. (default)
  1361. @item shortest
  1362. The duration of the shortest input.
  1363. @item first
  1364. The duration of the first input.
  1365. @end table
  1366. @item dropout_transition
  1367. The transition time, in seconds, for volume renormalization when an input
  1368. stream ends. The default value is 2 seconds.
  1369. @item weights
  1370. Specify weight of each input audio stream as sequence.
  1371. Each weight is separated by space. By default all inputs have same weight.
  1372. @end table
  1373. @subsection Commands
  1374. This filter supports the following commands:
  1375. @table @option
  1376. @item weights
  1377. Syntax is same as option with same name.
  1378. @end table
  1379. @section amultiply
  1380. Multiply first audio stream with second audio stream and store result
  1381. in output audio stream. Multiplication is done by multiplying each
  1382. sample from first stream with sample at same position from second stream.
  1383. With this element-wise multiplication one can create amplitude fades and
  1384. amplitude modulations.
  1385. @section anequalizer
  1386. High-order parametric multiband equalizer for each channel.
  1387. It accepts the following parameters:
  1388. @table @option
  1389. @item params
  1390. This option string is in format:
  1391. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1392. Each equalizer band is separated by '|'.
  1393. @table @option
  1394. @item chn
  1395. Set channel number to which equalization will be applied.
  1396. If input doesn't have that channel the entry is ignored.
  1397. @item f
  1398. Set central frequency for band.
  1399. If input doesn't have that frequency the entry is ignored.
  1400. @item w
  1401. Set band width in hertz.
  1402. @item g
  1403. Set band gain in dB.
  1404. @item t
  1405. Set filter type for band, optional, can be:
  1406. @table @samp
  1407. @item 0
  1408. Butterworth, this is default.
  1409. @item 1
  1410. Chebyshev type 1.
  1411. @item 2
  1412. Chebyshev type 2.
  1413. @end table
  1414. @end table
  1415. @item curves
  1416. With this option activated frequency response of anequalizer is displayed
  1417. in video stream.
  1418. @item size
  1419. Set video stream size. Only useful if curves option is activated.
  1420. @item mgain
  1421. Set max gain that will be displayed. Only useful if curves option is activated.
  1422. Setting this to a reasonable value makes it possible to display gain which is derived from
  1423. neighbour bands which are too close to each other and thus produce higher gain
  1424. when both are activated.
  1425. @item fscale
  1426. Set frequency scale used to draw frequency response in video output.
  1427. Can be linear or logarithmic. Default is logarithmic.
  1428. @item colors
  1429. Set color for each channel curve which is going to be displayed in video stream.
  1430. This is list of color names separated by space or by '|'.
  1431. Unrecognised or missing colors will be replaced by white color.
  1432. @end table
  1433. @subsection Examples
  1434. @itemize
  1435. @item
  1436. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1437. for first 2 channels using Chebyshev type 1 filter:
  1438. @example
  1439. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1440. @end example
  1441. @end itemize
  1442. @subsection Commands
  1443. This filter supports the following commands:
  1444. @table @option
  1445. @item change
  1446. Alter existing filter parameters.
  1447. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1448. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1449. error is returned.
  1450. @var{freq} set new frequency parameter.
  1451. @var{width} set new width parameter in herz.
  1452. @var{gain} set new gain parameter in dB.
  1453. Full filter invocation with asendcmd may look like this:
  1454. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1455. @end table
  1456. @section anlmdn
  1457. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1458. Each sample is adjusted by looking for other samples with similar contexts. This
  1459. context similarity is defined by comparing their surrounding patches of size
  1460. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1461. The filter accepts the following options:
  1462. @table @option
  1463. @item s
  1464. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1465. @item p
  1466. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1467. Default value is 2 milliseconds.
  1468. @item r
  1469. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1470. Default value is 6 milliseconds.
  1471. @item o
  1472. Set the output mode.
  1473. It accepts the following values:
  1474. @table @option
  1475. @item i
  1476. Pass input unchanged.
  1477. @item o
  1478. Pass noise filtered out.
  1479. @item n
  1480. Pass only noise.
  1481. Default value is @var{o}.
  1482. @end table
  1483. @item m
  1484. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1485. @end table
  1486. @subsection Commands
  1487. This filter supports the all above options as @ref{commands}.
  1488. @section anlms
  1489. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1490. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1491. relate to producing the least mean square of the error signal (difference between the desired,
  1492. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1493. A description of the accepted options follows.
  1494. @table @option
  1495. @item order
  1496. Set filter order.
  1497. @item mu
  1498. Set filter mu.
  1499. @item eps
  1500. Set the filter eps.
  1501. @item leakage
  1502. Set the filter leakage.
  1503. @item out_mode
  1504. It accepts the following values:
  1505. @table @option
  1506. @item i
  1507. Pass the 1st input.
  1508. @item d
  1509. Pass the 2nd input.
  1510. @item o
  1511. Pass filtered samples.
  1512. @item n
  1513. Pass difference between desired and filtered samples.
  1514. Default value is @var{o}.
  1515. @end table
  1516. @end table
  1517. @subsection Examples
  1518. @itemize
  1519. @item
  1520. One of many usages of this filter is noise reduction, input audio is filtered
  1521. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1522. @example
  1523. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1524. @end example
  1525. @end itemize
  1526. @subsection Commands
  1527. This filter supports the same commands as options, excluding option @code{order}.
  1528. @section anull
  1529. Pass the audio source unchanged to the output.
  1530. @section apad
  1531. Pad the end of an audio stream with silence.
  1532. This can be used together with @command{ffmpeg} @option{-shortest} to
  1533. extend audio streams to the same length as the video stream.
  1534. A description of the accepted options follows.
  1535. @table @option
  1536. @item packet_size
  1537. Set silence packet size. Default value is 4096.
  1538. @item pad_len
  1539. Set the number of samples of silence to add to the end. After the
  1540. value is reached, the stream is terminated. This option is mutually
  1541. exclusive with @option{whole_len}.
  1542. @item whole_len
  1543. Set the minimum total number of samples in the output audio stream. If
  1544. the value is longer than the input audio length, silence is added to
  1545. the end, until the value is reached. This option is mutually exclusive
  1546. with @option{pad_len}.
  1547. @item pad_dur
  1548. Specify the duration of samples of silence to add. See
  1549. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1550. for the accepted syntax. Used only if set to non-zero value.
  1551. @item whole_dur
  1552. Specify the minimum total duration in the output audio stream. See
  1553. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1554. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1555. the input audio length, silence is added to the end, until the value is reached.
  1556. This option is mutually exclusive with @option{pad_dur}
  1557. @end table
  1558. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1559. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1560. the input stream indefinitely.
  1561. @subsection Examples
  1562. @itemize
  1563. @item
  1564. Add 1024 samples of silence to the end of the input:
  1565. @example
  1566. apad=pad_len=1024
  1567. @end example
  1568. @item
  1569. Make sure the audio output will contain at least 10000 samples, pad
  1570. the input with silence if required:
  1571. @example
  1572. apad=whole_len=10000
  1573. @end example
  1574. @item
  1575. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1576. video stream will always result the shortest and will be converted
  1577. until the end in the output file when using the @option{shortest}
  1578. option:
  1579. @example
  1580. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1581. @end example
  1582. @end itemize
  1583. @section aphaser
  1584. Add a phasing effect to the input audio.
  1585. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1586. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1587. A description of the accepted parameters follows.
  1588. @table @option
  1589. @item in_gain
  1590. Set input gain. Default is 0.4.
  1591. @item out_gain
  1592. Set output gain. Default is 0.74
  1593. @item delay
  1594. Set delay in milliseconds. Default is 3.0.
  1595. @item decay
  1596. Set decay. Default is 0.4.
  1597. @item speed
  1598. Set modulation speed in Hz. Default is 0.5.
  1599. @item type
  1600. Set modulation type. Default is triangular.
  1601. It accepts the following values:
  1602. @table @samp
  1603. @item triangular, t
  1604. @item sinusoidal, s
  1605. @end table
  1606. @end table
  1607. @section aphaseshift
  1608. Apply phase shift to input audio samples.
  1609. The filter accepts the following options:
  1610. @table @option
  1611. @item shift
  1612. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1613. Default value is 0.0.
  1614. @end table
  1615. @subsection Commands
  1616. This filter supports the above option as @ref{commands}.
  1617. @section apulsator
  1618. Audio pulsator is something between an autopanner and a tremolo.
  1619. But it can produce funny stereo effects as well. Pulsator changes the volume
  1620. of the left and right channel based on a LFO (low frequency oscillator) with
  1621. different waveforms and shifted phases.
  1622. This filter have the ability to define an offset between left and right
  1623. channel. An offset of 0 means that both LFO shapes match each other.
  1624. The left and right channel are altered equally - a conventional tremolo.
  1625. An offset of 50% means that the shape of the right channel is exactly shifted
  1626. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1627. an autopanner. At 1 both curves match again. Every setting in between moves the
  1628. phase shift gapless between all stages and produces some "bypassing" sounds with
  1629. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1630. the 0.5) the faster the signal passes from the left to the right speaker.
  1631. The filter accepts the following options:
  1632. @table @option
  1633. @item level_in
  1634. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1635. @item level_out
  1636. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1637. @item mode
  1638. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1639. sawup or sawdown. Default is sine.
  1640. @item amount
  1641. Set modulation. Define how much of original signal is affected by the LFO.
  1642. @item offset_l
  1643. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1644. @item offset_r
  1645. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1646. @item width
  1647. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1648. @item timing
  1649. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1650. @item bpm
  1651. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1652. is set to bpm.
  1653. @item ms
  1654. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1655. is set to ms.
  1656. @item hz
  1657. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1658. if timing is set to hz.
  1659. @end table
  1660. @anchor{aresample}
  1661. @section aresample
  1662. Resample the input audio to the specified parameters, using the
  1663. libswresample library. If none are specified then the filter will
  1664. automatically convert between its input and output.
  1665. This filter is also able to stretch/squeeze the audio data to make it match
  1666. the timestamps or to inject silence / cut out audio to make it match the
  1667. timestamps, do a combination of both or do neither.
  1668. The filter accepts the syntax
  1669. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1670. expresses a sample rate and @var{resampler_options} is a list of
  1671. @var{key}=@var{value} pairs, separated by ":". See the
  1672. @ref{Resampler Options,,"Resampler Options" section in the
  1673. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1674. for the complete list of supported options.
  1675. @subsection Examples
  1676. @itemize
  1677. @item
  1678. Resample the input audio to 44100Hz:
  1679. @example
  1680. aresample=44100
  1681. @end example
  1682. @item
  1683. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1684. samples per second compensation:
  1685. @example
  1686. aresample=async=1000
  1687. @end example
  1688. @end itemize
  1689. @section areverse
  1690. Reverse an audio clip.
  1691. Warning: This filter requires memory to buffer the entire clip, so trimming
  1692. is suggested.
  1693. @subsection Examples
  1694. @itemize
  1695. @item
  1696. Take the first 5 seconds of a clip, and reverse it.
  1697. @example
  1698. atrim=end=5,areverse
  1699. @end example
  1700. @end itemize
  1701. @section arnndn
  1702. Reduce noise from speech using Recurrent Neural Networks.
  1703. This filter accepts the following options:
  1704. @table @option
  1705. @item model, m
  1706. Set train model file to load. This option is always required.
  1707. @end table
  1708. @section asetnsamples
  1709. Set the number of samples per each output audio frame.
  1710. The last output packet may contain a different number of samples, as
  1711. the filter will flush all the remaining samples when the input audio
  1712. signals its end.
  1713. The filter accepts the following options:
  1714. @table @option
  1715. @item nb_out_samples, n
  1716. Set the number of frames per each output audio frame. The number is
  1717. intended as the number of samples @emph{per each channel}.
  1718. Default value is 1024.
  1719. @item pad, p
  1720. If set to 1, the filter will pad the last audio frame with zeroes, so
  1721. that the last frame will contain the same number of samples as the
  1722. previous ones. Default value is 1.
  1723. @end table
  1724. For example, to set the number of per-frame samples to 1234 and
  1725. disable padding for the last frame, use:
  1726. @example
  1727. asetnsamples=n=1234:p=0
  1728. @end example
  1729. @section asetrate
  1730. Set the sample rate without altering the PCM data.
  1731. This will result in a change of speed and pitch.
  1732. The filter accepts the following options:
  1733. @table @option
  1734. @item sample_rate, r
  1735. Set the output sample rate. Default is 44100 Hz.
  1736. @end table
  1737. @section ashowinfo
  1738. Show a line containing various information for each input audio frame.
  1739. The input audio is not modified.
  1740. The shown line contains a sequence of key/value pairs of the form
  1741. @var{key}:@var{value}.
  1742. The following values are shown in the output:
  1743. @table @option
  1744. @item n
  1745. The (sequential) number of the input frame, starting from 0.
  1746. @item pts
  1747. The presentation timestamp of the input frame, in time base units; the time base
  1748. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1749. @item pts_time
  1750. The presentation timestamp of the input frame in seconds.
  1751. @item pos
  1752. position of the frame in the input stream, -1 if this information in
  1753. unavailable and/or meaningless (for example in case of synthetic audio)
  1754. @item fmt
  1755. The sample format.
  1756. @item chlayout
  1757. The channel layout.
  1758. @item rate
  1759. The sample rate for the audio frame.
  1760. @item nb_samples
  1761. The number of samples (per channel) in the frame.
  1762. @item checksum
  1763. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1764. audio, the data is treated as if all the planes were concatenated.
  1765. @item plane_checksums
  1766. A list of Adler-32 checksums for each data plane.
  1767. @end table
  1768. @section asoftclip
  1769. Apply audio soft clipping.
  1770. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1771. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1772. This filter accepts the following options:
  1773. @table @option
  1774. @item type
  1775. Set type of soft-clipping.
  1776. It accepts the following values:
  1777. @table @option
  1778. @item hard
  1779. @item tanh
  1780. @item atan
  1781. @item cubic
  1782. @item exp
  1783. @item alg
  1784. @item quintic
  1785. @item sin
  1786. @item erf
  1787. @end table
  1788. @item param
  1789. Set additional parameter which controls sigmoid function.
  1790. @item oversample
  1791. Set oversampling factor.
  1792. @end table
  1793. @subsection Commands
  1794. This filter supports the all above options as @ref{commands}.
  1795. @section asr
  1796. Automatic Speech Recognition
  1797. This filter uses PocketSphinx for speech recognition. To enable
  1798. compilation of this filter, you need to configure FFmpeg with
  1799. @code{--enable-pocketsphinx}.
  1800. It accepts the following options:
  1801. @table @option
  1802. @item rate
  1803. Set sampling rate of input audio. Defaults is @code{16000}.
  1804. This need to match speech models, otherwise one will get poor results.
  1805. @item hmm
  1806. Set dictionary containing acoustic model files.
  1807. @item dict
  1808. Set pronunciation dictionary.
  1809. @item lm
  1810. Set language model file.
  1811. @item lmctl
  1812. Set language model set.
  1813. @item lmname
  1814. Set which language model to use.
  1815. @item logfn
  1816. Set output for log messages.
  1817. @end table
  1818. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1819. @anchor{astats}
  1820. @section astats
  1821. Display time domain statistical information about the audio channels.
  1822. Statistics are calculated and displayed for each audio channel and,
  1823. where applicable, an overall figure is also given.
  1824. It accepts the following option:
  1825. @table @option
  1826. @item length
  1827. Short window length in seconds, used for peak and trough RMS measurement.
  1828. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1829. @item metadata
  1830. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1831. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1832. disabled.
  1833. Available keys for each channel are:
  1834. DC_offset
  1835. Min_level
  1836. Max_level
  1837. Min_difference
  1838. Max_difference
  1839. Mean_difference
  1840. RMS_difference
  1841. Peak_level
  1842. RMS_peak
  1843. RMS_trough
  1844. Crest_factor
  1845. Flat_factor
  1846. Peak_count
  1847. Noise_floor
  1848. Noise_floor_count
  1849. Bit_depth
  1850. Dynamic_range
  1851. Zero_crossings
  1852. Zero_crossings_rate
  1853. Number_of_NaNs
  1854. Number_of_Infs
  1855. Number_of_denormals
  1856. and for Overall:
  1857. DC_offset
  1858. Min_level
  1859. Max_level
  1860. Min_difference
  1861. Max_difference
  1862. Mean_difference
  1863. RMS_difference
  1864. Peak_level
  1865. RMS_level
  1866. RMS_peak
  1867. RMS_trough
  1868. Flat_factor
  1869. Peak_count
  1870. Noise_floor
  1871. Noise_floor_count
  1872. Bit_depth
  1873. Number_of_samples
  1874. Number_of_NaNs
  1875. Number_of_Infs
  1876. Number_of_denormals
  1877. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1878. this @code{lavfi.astats.Overall.Peak_count}.
  1879. For description what each key means read below.
  1880. @item reset
  1881. Set number of frame after which stats are going to be recalculated.
  1882. Default is disabled.
  1883. @item measure_perchannel
  1884. Select the entries which need to be measured per channel. The metadata keys can
  1885. be used as flags, default is @option{all} which measures everything.
  1886. @option{none} disables all per channel measurement.
  1887. @item measure_overall
  1888. Select the entries which need to be measured overall. The metadata keys can
  1889. be used as flags, default is @option{all} which measures everything.
  1890. @option{none} disables all overall measurement.
  1891. @end table
  1892. A description of each shown parameter follows:
  1893. @table @option
  1894. @item DC offset
  1895. Mean amplitude displacement from zero.
  1896. @item Min level
  1897. Minimal sample level.
  1898. @item Max level
  1899. Maximal sample level.
  1900. @item Min difference
  1901. Minimal difference between two consecutive samples.
  1902. @item Max difference
  1903. Maximal difference between two consecutive samples.
  1904. @item Mean difference
  1905. Mean difference between two consecutive samples.
  1906. The average of each difference between two consecutive samples.
  1907. @item RMS difference
  1908. Root Mean Square difference between two consecutive samples.
  1909. @item Peak level dB
  1910. @item RMS level dB
  1911. Standard peak and RMS level measured in dBFS.
  1912. @item RMS peak dB
  1913. @item RMS trough dB
  1914. Peak and trough values for RMS level measured over a short window.
  1915. @item Crest factor
  1916. Standard ratio of peak to RMS level (note: not in dB).
  1917. @item Flat factor
  1918. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1919. (i.e. either @var{Min level} or @var{Max level}).
  1920. @item Peak count
  1921. Number of occasions (not the number of samples) that the signal attained either
  1922. @var{Min level} or @var{Max level}.
  1923. @item Noise floor dB
  1924. Minimum local peak measured in dBFS over a short window.
  1925. @item Noise floor count
  1926. Number of occasions (not the number of samples) that the signal attained
  1927. @var{Noise floor}.
  1928. @item Bit depth
  1929. Overall bit depth of audio. Number of bits used for each sample.
  1930. @item Dynamic range
  1931. Measured dynamic range of audio in dB.
  1932. @item Zero crossings
  1933. Number of points where the waveform crosses the zero level axis.
  1934. @item Zero crossings rate
  1935. Rate of Zero crossings and number of audio samples.
  1936. @end table
  1937. @section asubboost
  1938. Boost subwoofer frequencies.
  1939. The filter accepts the following options:
  1940. @table @option
  1941. @item dry
  1942. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  1943. Default value is 0.5.
  1944. @item wet
  1945. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  1946. Default value is 0.8.
  1947. @item decay
  1948. Set delay line decay gain value. Allowed range is from 0 to 1.
  1949. Default value is 0.7.
  1950. @item feedback
  1951. Set delay line feedback gain value. Allowed range is from 0 to 1.
  1952. Default value is 0.5.
  1953. @item cutoff
  1954. Set cutoff frequency in herz. Allowed range is 50 to 900.
  1955. Default value is 100.
  1956. @item slope
  1957. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  1958. Default value is 0.5.
  1959. @item delay
  1960. Set delay. Allowed range is from 1 to 100.
  1961. Default value is 20.
  1962. @end table
  1963. @subsection Commands
  1964. This filter supports the all above options as @ref{commands}.
  1965. @section atempo
  1966. Adjust audio tempo.
  1967. The filter accepts exactly one parameter, the audio tempo. If not
  1968. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1969. be in the [0.5, 100.0] range.
  1970. Note that tempo greater than 2 will skip some samples rather than
  1971. blend them in. If for any reason this is a concern it is always
  1972. possible to daisy-chain several instances of atempo to achieve the
  1973. desired product tempo.
  1974. @subsection Examples
  1975. @itemize
  1976. @item
  1977. Slow down audio to 80% tempo:
  1978. @example
  1979. atempo=0.8
  1980. @end example
  1981. @item
  1982. To speed up audio to 300% tempo:
  1983. @example
  1984. atempo=3
  1985. @end example
  1986. @item
  1987. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1988. @example
  1989. atempo=sqrt(3),atempo=sqrt(3)
  1990. @end example
  1991. @end itemize
  1992. @subsection Commands
  1993. This filter supports the following commands:
  1994. @table @option
  1995. @item tempo
  1996. Change filter tempo scale factor.
  1997. Syntax for the command is : "@var{tempo}"
  1998. @end table
  1999. @section atrim
  2000. Trim the input so that the output contains one continuous subpart of the input.
  2001. It accepts the following parameters:
  2002. @table @option
  2003. @item start
  2004. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2005. sample with the timestamp @var{start} will be the first sample in the output.
  2006. @item end
  2007. Specify time of the first audio sample that will be dropped, i.e. the
  2008. audio sample immediately preceding the one with the timestamp @var{end} will be
  2009. the last sample in the output.
  2010. @item start_pts
  2011. Same as @var{start}, except this option sets the start timestamp in samples
  2012. instead of seconds.
  2013. @item end_pts
  2014. Same as @var{end}, except this option sets the end timestamp in samples instead
  2015. of seconds.
  2016. @item duration
  2017. The maximum duration of the output in seconds.
  2018. @item start_sample
  2019. The number of the first sample that should be output.
  2020. @item end_sample
  2021. The number of the first sample that should be dropped.
  2022. @end table
  2023. @option{start}, @option{end}, and @option{duration} are expressed as time
  2024. duration specifications; see
  2025. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2026. Note that the first two sets of the start/end options and the @option{duration}
  2027. option look at the frame timestamp, while the _sample options simply count the
  2028. samples that pass through the filter. So start/end_pts and start/end_sample will
  2029. give different results when the timestamps are wrong, inexact or do not start at
  2030. zero. Also note that this filter does not modify the timestamps. If you wish
  2031. to have the output timestamps start at zero, insert the asetpts filter after the
  2032. atrim filter.
  2033. If multiple start or end options are set, this filter tries to be greedy and
  2034. keep all samples that match at least one of the specified constraints. To keep
  2035. only the part that matches all the constraints at once, chain multiple atrim
  2036. filters.
  2037. The defaults are such that all the input is kept. So it is possible to set e.g.
  2038. just the end values to keep everything before the specified time.
  2039. Examples:
  2040. @itemize
  2041. @item
  2042. Drop everything except the second minute of input:
  2043. @example
  2044. ffmpeg -i INPUT -af atrim=60:120
  2045. @end example
  2046. @item
  2047. Keep only the first 1000 samples:
  2048. @example
  2049. ffmpeg -i INPUT -af atrim=end_sample=1000
  2050. @end example
  2051. @end itemize
  2052. @section axcorrelate
  2053. Calculate normalized cross-correlation between two input audio streams.
  2054. Resulted samples are always between -1 and 1 inclusive.
  2055. If result is 1 it means two input samples are highly correlated in that selected segment.
  2056. Result 0 means they are not correlated at all.
  2057. If result is -1 it means two input samples are out of phase, which means they cancel each
  2058. other.
  2059. The filter accepts the following options:
  2060. @table @option
  2061. @item size
  2062. Set size of segment over which cross-correlation is calculated.
  2063. Default is 256. Allowed range is from 2 to 131072.
  2064. @item algo
  2065. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2066. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2067. are always zero and thus need much less calculations to make.
  2068. This is generally not true, but is valid for typical audio streams.
  2069. @end table
  2070. @subsection Examples
  2071. @itemize
  2072. @item
  2073. Calculate correlation between channels in stereo audio stream:
  2074. @example
  2075. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2076. @end example
  2077. @end itemize
  2078. @section bandpass
  2079. Apply a two-pole Butterworth band-pass filter with central
  2080. frequency @var{frequency}, and (3dB-point) band-width width.
  2081. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2082. instead of the default: constant 0dB peak gain.
  2083. The filter roll off at 6dB per octave (20dB per decade).
  2084. The filter accepts the following options:
  2085. @table @option
  2086. @item frequency, f
  2087. Set the filter's central frequency. Default is @code{3000}.
  2088. @item csg
  2089. Constant skirt gain if set to 1. Defaults to 0.
  2090. @item width_type, t
  2091. Set method to specify band-width of filter.
  2092. @table @option
  2093. @item h
  2094. Hz
  2095. @item q
  2096. Q-Factor
  2097. @item o
  2098. octave
  2099. @item s
  2100. slope
  2101. @item k
  2102. kHz
  2103. @end table
  2104. @item width, w
  2105. Specify the band-width of a filter in width_type units.
  2106. @item mix, m
  2107. How much to use filtered signal in output. Default is 1.
  2108. Range is between 0 and 1.
  2109. @item channels, c
  2110. Specify which channels to filter, by default all available are filtered.
  2111. @item normalize, n
  2112. Normalize biquad coefficients, by default is disabled.
  2113. Enabling it will normalize magnitude response at DC to 0dB.
  2114. @item transform, a
  2115. Set transform type of IIR filter.
  2116. @table @option
  2117. @item di
  2118. @item dii
  2119. @item tdii
  2120. @item latt
  2121. @end table
  2122. @end table
  2123. @subsection Commands
  2124. This filter supports the following commands:
  2125. @table @option
  2126. @item frequency, f
  2127. Change bandpass frequency.
  2128. Syntax for the command is : "@var{frequency}"
  2129. @item width_type, t
  2130. Change bandpass width_type.
  2131. Syntax for the command is : "@var{width_type}"
  2132. @item width, w
  2133. Change bandpass width.
  2134. Syntax for the command is : "@var{width}"
  2135. @item mix, m
  2136. Change bandpass mix.
  2137. Syntax for the command is : "@var{mix}"
  2138. @end table
  2139. @section bandreject
  2140. Apply a two-pole Butterworth band-reject filter with central
  2141. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2142. The filter roll off at 6dB per octave (20dB per decade).
  2143. The filter accepts the following options:
  2144. @table @option
  2145. @item frequency, f
  2146. Set the filter's central frequency. Default is @code{3000}.
  2147. @item width_type, t
  2148. Set method to specify band-width of filter.
  2149. @table @option
  2150. @item h
  2151. Hz
  2152. @item q
  2153. Q-Factor
  2154. @item o
  2155. octave
  2156. @item s
  2157. slope
  2158. @item k
  2159. kHz
  2160. @end table
  2161. @item width, w
  2162. Specify the band-width of a filter in width_type units.
  2163. @item mix, m
  2164. How much to use filtered signal in output. Default is 1.
  2165. Range is between 0 and 1.
  2166. @item channels, c
  2167. Specify which channels to filter, by default all available are filtered.
  2168. @item normalize, n
  2169. Normalize biquad coefficients, by default is disabled.
  2170. Enabling it will normalize magnitude response at DC to 0dB.
  2171. @item transform, a
  2172. Set transform type of IIR filter.
  2173. @table @option
  2174. @item di
  2175. @item dii
  2176. @item tdii
  2177. @item latt
  2178. @end table
  2179. @end table
  2180. @subsection Commands
  2181. This filter supports the following commands:
  2182. @table @option
  2183. @item frequency, f
  2184. Change bandreject frequency.
  2185. Syntax for the command is : "@var{frequency}"
  2186. @item width_type, t
  2187. Change bandreject width_type.
  2188. Syntax for the command is : "@var{width_type}"
  2189. @item width, w
  2190. Change bandreject width.
  2191. Syntax for the command is : "@var{width}"
  2192. @item mix, m
  2193. Change bandreject mix.
  2194. Syntax for the command is : "@var{mix}"
  2195. @end table
  2196. @section bass, lowshelf
  2197. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2198. shelving filter with a response similar to that of a standard
  2199. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2200. The filter accepts the following options:
  2201. @table @option
  2202. @item gain, g
  2203. Give the gain at 0 Hz. Its useful range is about -20
  2204. (for a large cut) to +20 (for a large boost).
  2205. Beware of clipping when using a positive gain.
  2206. @item frequency, f
  2207. Set the filter's central frequency and so can be used
  2208. to extend or reduce the frequency range to be boosted or cut.
  2209. The default value is @code{100} Hz.
  2210. @item width_type, t
  2211. Set method to specify band-width of filter.
  2212. @table @option
  2213. @item h
  2214. Hz
  2215. @item q
  2216. Q-Factor
  2217. @item o
  2218. octave
  2219. @item s
  2220. slope
  2221. @item k
  2222. kHz
  2223. @end table
  2224. @item width, w
  2225. Determine how steep is the filter's shelf transition.
  2226. @item mix, m
  2227. How much to use filtered signal in output. Default is 1.
  2228. Range is between 0 and 1.
  2229. @item channels, c
  2230. Specify which channels to filter, by default all available are filtered.
  2231. @item normalize, n
  2232. Normalize biquad coefficients, by default is disabled.
  2233. Enabling it will normalize magnitude response at DC to 0dB.
  2234. @item transform, a
  2235. Set transform type of IIR filter.
  2236. @table @option
  2237. @item di
  2238. @item dii
  2239. @item tdii
  2240. @item latt
  2241. @end table
  2242. @end table
  2243. @subsection Commands
  2244. This filter supports the following commands:
  2245. @table @option
  2246. @item frequency, f
  2247. Change bass frequency.
  2248. Syntax for the command is : "@var{frequency}"
  2249. @item width_type, t
  2250. Change bass width_type.
  2251. Syntax for the command is : "@var{width_type}"
  2252. @item width, w
  2253. Change bass width.
  2254. Syntax for the command is : "@var{width}"
  2255. @item gain, g
  2256. Change bass gain.
  2257. Syntax for the command is : "@var{gain}"
  2258. @item mix, m
  2259. Change bass mix.
  2260. Syntax for the command is : "@var{mix}"
  2261. @end table
  2262. @section biquad
  2263. Apply a biquad IIR filter with the given coefficients.
  2264. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2265. are the numerator and denominator coefficients respectively.
  2266. and @var{channels}, @var{c} specify which channels to filter, by default all
  2267. available are filtered.
  2268. @subsection Commands
  2269. This filter supports the following commands:
  2270. @table @option
  2271. @item a0
  2272. @item a1
  2273. @item a2
  2274. @item b0
  2275. @item b1
  2276. @item b2
  2277. Change biquad parameter.
  2278. Syntax for the command is : "@var{value}"
  2279. @item mix, m
  2280. How much to use filtered signal in output. Default is 1.
  2281. Range is between 0 and 1.
  2282. @item channels, c
  2283. Specify which channels to filter, by default all available are filtered.
  2284. @item normalize, n
  2285. Normalize biquad coefficients, by default is disabled.
  2286. Enabling it will normalize magnitude response at DC to 0dB.
  2287. @item transform, a
  2288. Set transform type of IIR filter.
  2289. @table @option
  2290. @item di
  2291. @item dii
  2292. @item tdii
  2293. @item latt
  2294. @end table
  2295. @end table
  2296. @section bs2b
  2297. Bauer stereo to binaural transformation, which improves headphone listening of
  2298. stereo audio records.
  2299. To enable compilation of this filter you need to configure FFmpeg with
  2300. @code{--enable-libbs2b}.
  2301. It accepts the following parameters:
  2302. @table @option
  2303. @item profile
  2304. Pre-defined crossfeed level.
  2305. @table @option
  2306. @item default
  2307. Default level (fcut=700, feed=50).
  2308. @item cmoy
  2309. Chu Moy circuit (fcut=700, feed=60).
  2310. @item jmeier
  2311. Jan Meier circuit (fcut=650, feed=95).
  2312. @end table
  2313. @item fcut
  2314. Cut frequency (in Hz).
  2315. @item feed
  2316. Feed level (in Hz).
  2317. @end table
  2318. @section channelmap
  2319. Remap input channels to new locations.
  2320. It accepts the following parameters:
  2321. @table @option
  2322. @item map
  2323. Map channels from input to output. The argument is a '|'-separated list of
  2324. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2325. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2326. channel (e.g. FL for front left) or its index in the input channel layout.
  2327. @var{out_channel} is the name of the output channel or its index in the output
  2328. channel layout. If @var{out_channel} is not given then it is implicitly an
  2329. index, starting with zero and increasing by one for each mapping.
  2330. @item channel_layout
  2331. The channel layout of the output stream.
  2332. @end table
  2333. If no mapping is present, the filter will implicitly map input channels to
  2334. output channels, preserving indices.
  2335. @subsection Examples
  2336. @itemize
  2337. @item
  2338. For example, assuming a 5.1+downmix input MOV file,
  2339. @example
  2340. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2341. @end example
  2342. will create an output WAV file tagged as stereo from the downmix channels of
  2343. the input.
  2344. @item
  2345. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2346. @example
  2347. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2348. @end example
  2349. @end itemize
  2350. @section channelsplit
  2351. Split each channel from an input audio stream into a separate output stream.
  2352. It accepts the following parameters:
  2353. @table @option
  2354. @item channel_layout
  2355. The channel layout of the input stream. The default is "stereo".
  2356. @item channels
  2357. A channel layout describing the channels to be extracted as separate output streams
  2358. or "all" to extract each input channel as a separate stream. The default is "all".
  2359. Choosing channels not present in channel layout in the input will result in an error.
  2360. @end table
  2361. @subsection Examples
  2362. @itemize
  2363. @item
  2364. For example, assuming a stereo input MP3 file,
  2365. @example
  2366. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2367. @end example
  2368. will create an output Matroska file with two audio streams, one containing only
  2369. the left channel and the other the right channel.
  2370. @item
  2371. Split a 5.1 WAV file into per-channel files:
  2372. @example
  2373. ffmpeg -i in.wav -filter_complex
  2374. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2375. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2376. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2377. side_right.wav
  2378. @end example
  2379. @item
  2380. Extract only LFE from a 5.1 WAV file:
  2381. @example
  2382. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2383. -map '[LFE]' lfe.wav
  2384. @end example
  2385. @end itemize
  2386. @section chorus
  2387. Add a chorus effect to the audio.
  2388. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2389. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2390. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2391. The modulation depth defines the range the modulated delay is played before or after
  2392. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2393. sound tuned around the original one, like in a chorus where some vocals are slightly
  2394. off key.
  2395. It accepts the following parameters:
  2396. @table @option
  2397. @item in_gain
  2398. Set input gain. Default is 0.4.
  2399. @item out_gain
  2400. Set output gain. Default is 0.4.
  2401. @item delays
  2402. Set delays. A typical delay is around 40ms to 60ms.
  2403. @item decays
  2404. Set decays.
  2405. @item speeds
  2406. Set speeds.
  2407. @item depths
  2408. Set depths.
  2409. @end table
  2410. @subsection Examples
  2411. @itemize
  2412. @item
  2413. A single delay:
  2414. @example
  2415. chorus=0.7:0.9:55:0.4:0.25:2
  2416. @end example
  2417. @item
  2418. Two delays:
  2419. @example
  2420. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2421. @end example
  2422. @item
  2423. Fuller sounding chorus with three delays:
  2424. @example
  2425. 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
  2426. @end example
  2427. @end itemize
  2428. @section compand
  2429. Compress or expand the audio's dynamic range.
  2430. It accepts the following parameters:
  2431. @table @option
  2432. @item attacks
  2433. @item decays
  2434. A list of times in seconds for each channel over which the instantaneous level
  2435. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2436. increase of volume and @var{decays} refers to decrease of volume. For most
  2437. situations, the attack time (response to the audio getting louder) should be
  2438. shorter than the decay time, because the human ear is more sensitive to sudden
  2439. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2440. a typical value for decay is 0.8 seconds.
  2441. If specified number of attacks & decays is lower than number of channels, the last
  2442. set attack/decay will be used for all remaining channels.
  2443. @item points
  2444. A list of points for the transfer function, specified in dB relative to the
  2445. maximum possible signal amplitude. Each key points list must be defined using
  2446. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2447. @code{x0/y0 x1/y1 x2/y2 ....}
  2448. The input values must be in strictly increasing order but the transfer function
  2449. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2450. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2451. function are @code{-70/-70|-60/-20|1/0}.
  2452. @item soft-knee
  2453. Set the curve radius in dB for all joints. It defaults to 0.01.
  2454. @item gain
  2455. Set the additional gain in dB to be applied at all points on the transfer
  2456. function. This allows for easy adjustment of the overall gain.
  2457. It defaults to 0.
  2458. @item volume
  2459. Set an initial volume, in dB, to be assumed for each channel when filtering
  2460. starts. This permits the user to supply a nominal level initially, so that, for
  2461. example, a very large gain is not applied to initial signal levels before the
  2462. companding has begun to operate. A typical value for audio which is initially
  2463. quiet is -90 dB. It defaults to 0.
  2464. @item delay
  2465. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2466. delayed before being fed to the volume adjuster. Specifying a delay
  2467. approximately equal to the attack/decay times allows the filter to effectively
  2468. operate in predictive rather than reactive mode. It defaults to 0.
  2469. @end table
  2470. @subsection Examples
  2471. @itemize
  2472. @item
  2473. Make music with both quiet and loud passages suitable for listening to in a
  2474. noisy environment:
  2475. @example
  2476. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2477. @end example
  2478. Another example for audio with whisper and explosion parts:
  2479. @example
  2480. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2481. @end example
  2482. @item
  2483. A noise gate for when the noise is at a lower level than the signal:
  2484. @example
  2485. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2486. @end example
  2487. @item
  2488. Here is another noise gate, this time for when the noise is at a higher level
  2489. than the signal (making it, in some ways, similar to squelch):
  2490. @example
  2491. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2492. @end example
  2493. @item
  2494. 2:1 compression starting at -6dB:
  2495. @example
  2496. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2497. @end example
  2498. @item
  2499. 2:1 compression starting at -9dB:
  2500. @example
  2501. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2502. @end example
  2503. @item
  2504. 2:1 compression starting at -12dB:
  2505. @example
  2506. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2507. @end example
  2508. @item
  2509. 2:1 compression starting at -18dB:
  2510. @example
  2511. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2512. @end example
  2513. @item
  2514. 3:1 compression starting at -15dB:
  2515. @example
  2516. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2517. @end example
  2518. @item
  2519. Compressor/Gate:
  2520. @example
  2521. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2522. @end example
  2523. @item
  2524. Expander:
  2525. @example
  2526. 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
  2527. @end example
  2528. @item
  2529. Hard limiter at -6dB:
  2530. @example
  2531. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2532. @end example
  2533. @item
  2534. Hard limiter at -12dB:
  2535. @example
  2536. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2537. @end example
  2538. @item
  2539. Hard noise gate at -35 dB:
  2540. @example
  2541. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2542. @end example
  2543. @item
  2544. Soft limiter:
  2545. @example
  2546. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2547. @end example
  2548. @end itemize
  2549. @section compensationdelay
  2550. Compensation Delay Line is a metric based delay to compensate differing
  2551. positions of microphones or speakers.
  2552. For example, you have recorded guitar with two microphones placed in
  2553. different locations. Because the front of sound wave has fixed speed in
  2554. normal conditions, the phasing of microphones can vary and depends on
  2555. their location and interposition. The best sound mix can be achieved when
  2556. these microphones are in phase (synchronized). Note that a distance of
  2557. ~30 cm between microphones makes one microphone capture the signal in
  2558. antiphase to the other microphone. That makes the final mix sound moody.
  2559. This filter helps to solve phasing problems by adding different delays
  2560. to each microphone track and make them synchronized.
  2561. The best result can be reached when you take one track as base and
  2562. synchronize other tracks one by one with it.
  2563. Remember that synchronization/delay tolerance depends on sample rate, too.
  2564. Higher sample rates will give more tolerance.
  2565. The filter accepts the following parameters:
  2566. @table @option
  2567. @item mm
  2568. Set millimeters distance. This is compensation distance for fine tuning.
  2569. Default is 0.
  2570. @item cm
  2571. Set cm distance. This is compensation distance for tightening distance setup.
  2572. Default is 0.
  2573. @item m
  2574. Set meters distance. This is compensation distance for hard distance setup.
  2575. Default is 0.
  2576. @item dry
  2577. Set dry amount. Amount of unprocessed (dry) signal.
  2578. Default is 0.
  2579. @item wet
  2580. Set wet amount. Amount of processed (wet) signal.
  2581. Default is 1.
  2582. @item temp
  2583. Set temperature in degrees Celsius. This is the temperature of the environment.
  2584. Default is 20.
  2585. @end table
  2586. @section crossfeed
  2587. Apply headphone crossfeed filter.
  2588. Crossfeed is the process of blending the left and right channels of stereo
  2589. audio recording.
  2590. It is mainly used to reduce extreme stereo separation of low frequencies.
  2591. The intent is to produce more speaker like sound to the listener.
  2592. The filter accepts the following options:
  2593. @table @option
  2594. @item strength
  2595. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2596. This sets gain of low shelf filter for side part of stereo image.
  2597. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2598. @item range
  2599. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2600. This sets cut off frequency of low shelf filter. Default is cut off near
  2601. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2602. @item slope
  2603. Set curve slope of low shelf filter. Default is 0.5.
  2604. Allowed range is from 0.01 to 1.
  2605. @item level_in
  2606. Set input gain. Default is 0.9.
  2607. @item level_out
  2608. Set output gain. Default is 1.
  2609. @end table
  2610. @subsection Commands
  2611. This filter supports the all above options as @ref{commands}.
  2612. @section crystalizer
  2613. Simple algorithm to expand audio dynamic range.
  2614. The filter accepts the following options:
  2615. @table @option
  2616. @item i
  2617. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2618. (unchanged sound) to 10.0 (maximum effect).
  2619. @item c
  2620. Enable clipping. By default is enabled.
  2621. @end table
  2622. @subsection Commands
  2623. This filter supports the all above options as @ref{commands}.
  2624. @section dcshift
  2625. Apply a DC shift to the audio.
  2626. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2627. in the recording chain) from the audio. The effect of a DC offset is reduced
  2628. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2629. a signal has a DC offset.
  2630. @table @option
  2631. @item shift
  2632. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2633. the audio.
  2634. @item limitergain
  2635. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2636. used to prevent clipping.
  2637. @end table
  2638. @section deesser
  2639. Apply de-essing to the audio samples.
  2640. @table @option
  2641. @item i
  2642. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2643. Default is 0.
  2644. @item m
  2645. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2646. Default is 0.5.
  2647. @item f
  2648. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2649. Default is 0.5.
  2650. @item s
  2651. Set the output mode.
  2652. It accepts the following values:
  2653. @table @option
  2654. @item i
  2655. Pass input unchanged.
  2656. @item o
  2657. Pass ess filtered out.
  2658. @item e
  2659. Pass only ess.
  2660. Default value is @var{o}.
  2661. @end table
  2662. @end table
  2663. @section drmeter
  2664. Measure audio dynamic range.
  2665. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2666. is found in transition material. And anything less that 8 have very poor dynamics
  2667. and is very compressed.
  2668. The filter accepts the following options:
  2669. @table @option
  2670. @item length
  2671. Set window length in seconds used to split audio into segments of equal length.
  2672. Default is 3 seconds.
  2673. @end table
  2674. @section dynaudnorm
  2675. Dynamic Audio Normalizer.
  2676. This filter applies a certain amount of gain to the input audio in order
  2677. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2678. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2679. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2680. This allows for applying extra gain to the "quiet" sections of the audio
  2681. while avoiding distortions or clipping the "loud" sections. In other words:
  2682. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2683. sections, in the sense that the volume of each section is brought to the
  2684. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2685. this goal *without* applying "dynamic range compressing". It will retain 100%
  2686. of the dynamic range *within* each section of the audio file.
  2687. @table @option
  2688. @item framelen, f
  2689. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2690. Default is 500 milliseconds.
  2691. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2692. referred to as frames. This is required, because a peak magnitude has no
  2693. meaning for just a single sample value. Instead, we need to determine the
  2694. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2695. normalizer would simply use the peak magnitude of the complete file, the
  2696. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2697. frame. The length of a frame is specified in milliseconds. By default, the
  2698. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2699. been found to give good results with most files.
  2700. Note that the exact frame length, in number of samples, will be determined
  2701. automatically, based on the sampling rate of the individual input audio file.
  2702. @item gausssize, g
  2703. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2704. number. Default is 31.
  2705. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2706. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2707. is specified in frames, centered around the current frame. For the sake of
  2708. simplicity, this must be an odd number. Consequently, the default value of 31
  2709. takes into account the current frame, as well as the 15 preceding frames and
  2710. the 15 subsequent frames. Using a larger window results in a stronger
  2711. smoothing effect and thus in less gain variation, i.e. slower gain
  2712. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2713. effect and thus in more gain variation, i.e. faster gain adaptation.
  2714. In other words, the more you increase this value, the more the Dynamic Audio
  2715. Normalizer will behave like a "traditional" normalization filter. On the
  2716. contrary, the more you decrease this value, the more the Dynamic Audio
  2717. Normalizer will behave like a dynamic range compressor.
  2718. @item peak, p
  2719. Set the target peak value. This specifies the highest permissible magnitude
  2720. level for the normalized audio input. This filter will try to approach the
  2721. target peak magnitude as closely as possible, but at the same time it also
  2722. makes sure that the normalized signal will never exceed the peak magnitude.
  2723. A frame's maximum local gain factor is imposed directly by the target peak
  2724. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2725. It is not recommended to go above this value.
  2726. @item maxgain, m
  2727. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2728. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2729. factor for each input frame, i.e. the maximum gain factor that does not
  2730. result in clipping or distortion. The maximum gain factor is determined by
  2731. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2732. additionally bounds the frame's maximum gain factor by a predetermined
  2733. (global) maximum gain factor. This is done in order to avoid excessive gain
  2734. factors in "silent" or almost silent frames. By default, the maximum gain
  2735. factor is 10.0, For most inputs the default value should be sufficient and
  2736. it usually is not recommended to increase this value. Though, for input
  2737. with an extremely low overall volume level, it may be necessary to allow even
  2738. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2739. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2740. Instead, a "sigmoid" threshold function will be applied. This way, the
  2741. gain factors will smoothly approach the threshold value, but never exceed that
  2742. value.
  2743. @item targetrms, r
  2744. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2745. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2746. This means that the maximum local gain factor for each frame is defined
  2747. (only) by the frame's highest magnitude sample. This way, the samples can
  2748. be amplified as much as possible without exceeding the maximum signal
  2749. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2750. Normalizer can also take into account the frame's root mean square,
  2751. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2752. determine the power of a time-varying signal. It is therefore considered
  2753. that the RMS is a better approximation of the "perceived loudness" than
  2754. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2755. frames to a constant RMS value, a uniform "perceived loudness" can be
  2756. established. If a target RMS value has been specified, a frame's local gain
  2757. factor is defined as the factor that would result in exactly that RMS value.
  2758. Note, however, that the maximum local gain factor is still restricted by the
  2759. frame's highest magnitude sample, in order to prevent clipping.
  2760. @item coupling, n
  2761. Enable channels coupling. By default is enabled.
  2762. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2763. amount. This means the same gain factor will be applied to all channels, i.e.
  2764. the maximum possible gain factor is determined by the "loudest" channel.
  2765. However, in some recordings, it may happen that the volume of the different
  2766. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2767. In this case, this option can be used to disable the channel coupling. This way,
  2768. the gain factor will be determined independently for each channel, depending
  2769. only on the individual channel's highest magnitude sample. This allows for
  2770. harmonizing the volume of the different channels.
  2771. @item correctdc, c
  2772. Enable DC bias correction. By default is disabled.
  2773. An audio signal (in the time domain) is a sequence of sample values.
  2774. In the Dynamic Audio Normalizer these sample values are represented in the
  2775. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2776. audio signal, or "waveform", should be centered around the zero point.
  2777. That means if we calculate the mean value of all samples in a file, or in a
  2778. single frame, then the result should be 0.0 or at least very close to that
  2779. value. If, however, there is a significant deviation of the mean value from
  2780. 0.0, in either positive or negative direction, this is referred to as a
  2781. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2782. Audio Normalizer provides optional DC bias correction.
  2783. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2784. the mean value, or "DC correction" offset, of each input frame and subtract
  2785. that value from all of the frame's sample values which ensures those samples
  2786. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2787. boundaries, the DC correction offset values will be interpolated smoothly
  2788. between neighbouring frames.
  2789. @item altboundary, b
  2790. Enable alternative boundary mode. By default is disabled.
  2791. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2792. around each frame. This includes the preceding frames as well as the
  2793. subsequent frames. However, for the "boundary" frames, located at the very
  2794. beginning and at the very end of the audio file, not all neighbouring
  2795. frames are available. In particular, for the first few frames in the audio
  2796. file, the preceding frames are not known. And, similarly, for the last few
  2797. frames in the audio file, the subsequent frames are not known. Thus, the
  2798. question arises which gain factors should be assumed for the missing frames
  2799. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2800. to deal with this situation. The default boundary mode assumes a gain factor
  2801. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2802. "fade out" at the beginning and at the end of the input, respectively.
  2803. @item compress, s
  2804. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2805. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2806. compression. This means that signal peaks will not be pruned and thus the
  2807. full dynamic range will be retained within each local neighbourhood. However,
  2808. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2809. normalization algorithm with a more "traditional" compression.
  2810. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2811. (thresholding) function. If (and only if) the compression feature is enabled,
  2812. all input frames will be processed by a soft knee thresholding function prior
  2813. to the actual normalization process. Put simply, the thresholding function is
  2814. going to prune all samples whose magnitude exceeds a certain threshold value.
  2815. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2816. value. Instead, the threshold value will be adjusted for each individual
  2817. frame.
  2818. In general, smaller parameters result in stronger compression, and vice versa.
  2819. Values below 3.0 are not recommended, because audible distortion may appear.
  2820. @item threshold, t
  2821. Set the target threshold value. This specifies the lowest permissible
  2822. magnitude level for the audio input which will be normalized.
  2823. If input frame volume is above this value frame will be normalized.
  2824. Otherwise frame may not be normalized at all. The default value is set
  2825. to 0, which means all input frames will be normalized.
  2826. This option is mostly useful if digital noise is not wanted to be amplified.
  2827. @end table
  2828. @subsection Commands
  2829. This filter supports the all above options as @ref{commands}.
  2830. @section earwax
  2831. Make audio easier to listen to on headphones.
  2832. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2833. so that when listened to on headphones the stereo image is moved from
  2834. inside your head (standard for headphones) to outside and in front of
  2835. the listener (standard for speakers).
  2836. Ported from SoX.
  2837. @section equalizer
  2838. Apply a two-pole peaking equalisation (EQ) filter. With this
  2839. filter, the signal-level at and around a selected frequency can
  2840. be increased or decreased, whilst (unlike bandpass and bandreject
  2841. filters) that at all other frequencies is unchanged.
  2842. In order to produce complex equalisation curves, this filter can
  2843. be given several times, each with a different central frequency.
  2844. The filter accepts the following options:
  2845. @table @option
  2846. @item frequency, f
  2847. Set the filter's central frequency in Hz.
  2848. @item width_type, t
  2849. Set method to specify band-width of filter.
  2850. @table @option
  2851. @item h
  2852. Hz
  2853. @item q
  2854. Q-Factor
  2855. @item o
  2856. octave
  2857. @item s
  2858. slope
  2859. @item k
  2860. kHz
  2861. @end table
  2862. @item width, w
  2863. Specify the band-width of a filter in width_type units.
  2864. @item gain, g
  2865. Set the required gain or attenuation in dB.
  2866. Beware of clipping when using a positive gain.
  2867. @item mix, m
  2868. How much to use filtered signal in output. Default is 1.
  2869. Range is between 0 and 1.
  2870. @item channels, c
  2871. Specify which channels to filter, by default all available are filtered.
  2872. @item normalize, n
  2873. Normalize biquad coefficients, by default is disabled.
  2874. Enabling it will normalize magnitude response at DC to 0dB.
  2875. @item transform, a
  2876. Set transform type of IIR filter.
  2877. @table @option
  2878. @item di
  2879. @item dii
  2880. @item tdii
  2881. @item latt
  2882. @end table
  2883. @end table
  2884. @subsection Examples
  2885. @itemize
  2886. @item
  2887. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2888. @example
  2889. equalizer=f=1000:t=h:width=200:g=-10
  2890. @end example
  2891. @item
  2892. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2893. @example
  2894. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2895. @end example
  2896. @end itemize
  2897. @subsection Commands
  2898. This filter supports the following commands:
  2899. @table @option
  2900. @item frequency, f
  2901. Change equalizer frequency.
  2902. Syntax for the command is : "@var{frequency}"
  2903. @item width_type, t
  2904. Change equalizer width_type.
  2905. Syntax for the command is : "@var{width_type}"
  2906. @item width, w
  2907. Change equalizer width.
  2908. Syntax for the command is : "@var{width}"
  2909. @item gain, g
  2910. Change equalizer gain.
  2911. Syntax for the command is : "@var{gain}"
  2912. @item mix, m
  2913. Change equalizer mix.
  2914. Syntax for the command is : "@var{mix}"
  2915. @end table
  2916. @section extrastereo
  2917. Linearly increases the difference between left and right channels which
  2918. adds some sort of "live" effect to playback.
  2919. The filter accepts the following options:
  2920. @table @option
  2921. @item m
  2922. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2923. (average of both channels), with 1.0 sound will be unchanged, with
  2924. -1.0 left and right channels will be swapped.
  2925. @item c
  2926. Enable clipping. By default is enabled.
  2927. @end table
  2928. @subsection Commands
  2929. This filter supports the all above options as @ref{commands}.
  2930. @section firequalizer
  2931. Apply FIR Equalization using arbitrary frequency response.
  2932. The filter accepts the following option:
  2933. @table @option
  2934. @item gain
  2935. Set gain curve equation (in dB). The expression can contain variables:
  2936. @table @option
  2937. @item f
  2938. the evaluated frequency
  2939. @item sr
  2940. sample rate
  2941. @item ch
  2942. channel number, set to 0 when multichannels evaluation is disabled
  2943. @item chid
  2944. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2945. multichannels evaluation is disabled
  2946. @item chs
  2947. number of channels
  2948. @item chlayout
  2949. channel_layout, see libavutil/channel_layout.h
  2950. @end table
  2951. and functions:
  2952. @table @option
  2953. @item gain_interpolate(f)
  2954. interpolate gain on frequency f based on gain_entry
  2955. @item cubic_interpolate(f)
  2956. same as gain_interpolate, but smoother
  2957. @end table
  2958. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2959. @item gain_entry
  2960. Set gain entry for gain_interpolate function. The expression can
  2961. contain functions:
  2962. @table @option
  2963. @item entry(f, g)
  2964. store gain entry at frequency f with value g
  2965. @end table
  2966. This option is also available as command.
  2967. @item delay
  2968. Set filter delay in seconds. Higher value means more accurate.
  2969. Default is @code{0.01}.
  2970. @item accuracy
  2971. Set filter accuracy in Hz. Lower value means more accurate.
  2972. Default is @code{5}.
  2973. @item wfunc
  2974. Set window function. Acceptable values are:
  2975. @table @option
  2976. @item rectangular
  2977. rectangular window, useful when gain curve is already smooth
  2978. @item hann
  2979. hann window (default)
  2980. @item hamming
  2981. hamming window
  2982. @item blackman
  2983. blackman window
  2984. @item nuttall3
  2985. 3-terms continuous 1st derivative nuttall window
  2986. @item mnuttall3
  2987. minimum 3-terms discontinuous nuttall window
  2988. @item nuttall
  2989. 4-terms continuous 1st derivative nuttall window
  2990. @item bnuttall
  2991. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2992. @item bharris
  2993. blackman-harris window
  2994. @item tukey
  2995. tukey window
  2996. @end table
  2997. @item fixed
  2998. If enabled, use fixed number of audio samples. This improves speed when
  2999. filtering with large delay. Default is disabled.
  3000. @item multi
  3001. Enable multichannels evaluation on gain. Default is disabled.
  3002. @item zero_phase
  3003. Enable zero phase mode by subtracting timestamp to compensate delay.
  3004. Default is disabled.
  3005. @item scale
  3006. Set scale used by gain. Acceptable values are:
  3007. @table @option
  3008. @item linlin
  3009. linear frequency, linear gain
  3010. @item linlog
  3011. linear frequency, logarithmic (in dB) gain (default)
  3012. @item loglin
  3013. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3014. @item loglog
  3015. logarithmic frequency, logarithmic gain
  3016. @end table
  3017. @item dumpfile
  3018. Set file for dumping, suitable for gnuplot.
  3019. @item dumpscale
  3020. Set scale for dumpfile. Acceptable values are same with scale option.
  3021. Default is linlog.
  3022. @item fft2
  3023. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3024. Default is disabled.
  3025. @item min_phase
  3026. Enable minimum phase impulse response. Default is disabled.
  3027. @end table
  3028. @subsection Examples
  3029. @itemize
  3030. @item
  3031. lowpass at 1000 Hz:
  3032. @example
  3033. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3034. @end example
  3035. @item
  3036. lowpass at 1000 Hz with gain_entry:
  3037. @example
  3038. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3039. @end example
  3040. @item
  3041. custom equalization:
  3042. @example
  3043. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3044. @end example
  3045. @item
  3046. higher delay with zero phase to compensate delay:
  3047. @example
  3048. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3049. @end example
  3050. @item
  3051. lowpass on left channel, highpass on right channel:
  3052. @example
  3053. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3054. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3055. @end example
  3056. @end itemize
  3057. @section flanger
  3058. Apply a flanging effect to the audio.
  3059. The filter accepts the following options:
  3060. @table @option
  3061. @item delay
  3062. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3063. @item depth
  3064. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3065. @item regen
  3066. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3067. Default value is 0.
  3068. @item width
  3069. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3070. Default value is 71.
  3071. @item speed
  3072. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3073. @item shape
  3074. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3075. Default value is @var{sinusoidal}.
  3076. @item phase
  3077. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3078. Default value is 25.
  3079. @item interp
  3080. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3081. Default is @var{linear}.
  3082. @end table
  3083. @section haas
  3084. Apply Haas effect to audio.
  3085. Note that this makes most sense to apply on mono signals.
  3086. With this filter applied to mono signals it give some directionality and
  3087. stretches its stereo image.
  3088. The filter accepts the following options:
  3089. @table @option
  3090. @item level_in
  3091. Set input level. By default is @var{1}, or 0dB
  3092. @item level_out
  3093. Set output level. By default is @var{1}, or 0dB.
  3094. @item side_gain
  3095. Set gain applied to side part of signal. By default is @var{1}.
  3096. @item middle_source
  3097. Set kind of middle source. Can be one of the following:
  3098. @table @samp
  3099. @item left
  3100. Pick left channel.
  3101. @item right
  3102. Pick right channel.
  3103. @item mid
  3104. Pick middle part signal of stereo image.
  3105. @item side
  3106. Pick side part signal of stereo image.
  3107. @end table
  3108. @item middle_phase
  3109. Change middle phase. By default is disabled.
  3110. @item left_delay
  3111. Set left channel delay. By default is @var{2.05} milliseconds.
  3112. @item left_balance
  3113. Set left channel balance. By default is @var{-1}.
  3114. @item left_gain
  3115. Set left channel gain. By default is @var{1}.
  3116. @item left_phase
  3117. Change left phase. By default is disabled.
  3118. @item right_delay
  3119. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3120. @item right_balance
  3121. Set right channel balance. By default is @var{1}.
  3122. @item right_gain
  3123. Set right channel gain. By default is @var{1}.
  3124. @item right_phase
  3125. Change right phase. By default is enabled.
  3126. @end table
  3127. @section hdcd
  3128. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3129. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3130. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3131. of HDCD, and detects the Transient Filter flag.
  3132. @example
  3133. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3134. @end example
  3135. When using the filter with wav, note the default encoding for wav is 16-bit,
  3136. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3137. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3138. @example
  3139. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3140. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3141. @end example
  3142. The filter accepts the following options:
  3143. @table @option
  3144. @item disable_autoconvert
  3145. Disable any automatic format conversion or resampling in the filter graph.
  3146. @item process_stereo
  3147. Process the stereo channels together. If target_gain does not match between
  3148. channels, consider it invalid and use the last valid target_gain.
  3149. @item cdt_ms
  3150. Set the code detect timer period in ms.
  3151. @item force_pe
  3152. Always extend peaks above -3dBFS even if PE isn't signaled.
  3153. @item analyze_mode
  3154. Replace audio with a solid tone and adjust the amplitude to signal some
  3155. specific aspect of the decoding process. The output file can be loaded in
  3156. an audio editor alongside the original to aid analysis.
  3157. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3158. Modes are:
  3159. @table @samp
  3160. @item 0, off
  3161. Disabled
  3162. @item 1, lle
  3163. Gain adjustment level at each sample
  3164. @item 2, pe
  3165. Samples where peak extend occurs
  3166. @item 3, cdt
  3167. Samples where the code detect timer is active
  3168. @item 4, tgm
  3169. Samples where the target gain does not match between channels
  3170. @end table
  3171. @end table
  3172. @section headphone
  3173. Apply head-related transfer functions (HRTFs) to create virtual
  3174. loudspeakers around the user for binaural listening via headphones.
  3175. The HRIRs are provided via additional streams, for each channel
  3176. one stereo input stream is needed.
  3177. The filter accepts the following options:
  3178. @table @option
  3179. @item map
  3180. Set mapping of input streams for convolution.
  3181. The argument is a '|'-separated list of channel names in order as they
  3182. are given as additional stream inputs for filter.
  3183. This also specify number of input streams. Number of input streams
  3184. must be not less than number of channels in first stream plus one.
  3185. @item gain
  3186. Set gain applied to audio. Value is in dB. Default is 0.
  3187. @item type
  3188. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3189. processing audio in time domain which is slow.
  3190. @var{freq} is processing audio in frequency domain which is fast.
  3191. Default is @var{freq}.
  3192. @item lfe
  3193. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3194. @item size
  3195. Set size of frame in number of samples which will be processed at once.
  3196. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3197. @item hrir
  3198. Set format of hrir stream.
  3199. Default value is @var{stereo}. Alternative value is @var{multich}.
  3200. If value is set to @var{stereo}, number of additional streams should
  3201. be greater or equal to number of input channels in first input stream.
  3202. Also each additional stream should have stereo number of channels.
  3203. If value is set to @var{multich}, number of additional streams should
  3204. be exactly one. Also number of input channels of additional stream
  3205. should be equal or greater than twice number of channels of first input
  3206. stream.
  3207. @end table
  3208. @subsection Examples
  3209. @itemize
  3210. @item
  3211. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3212. each amovie filter use stereo file with IR coefficients as input.
  3213. The files give coefficients for each position of virtual loudspeaker:
  3214. @example
  3215. ffmpeg -i input.wav
  3216. -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"
  3217. output.wav
  3218. @end example
  3219. @item
  3220. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3221. but now in @var{multich} @var{hrir} format.
  3222. @example
  3223. 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"
  3224. output.wav
  3225. @end example
  3226. @end itemize
  3227. @section highpass
  3228. Apply a high-pass filter with 3dB point frequency.
  3229. The filter can be either single-pole, or double-pole (the default).
  3230. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3231. The filter accepts the following options:
  3232. @table @option
  3233. @item frequency, f
  3234. Set frequency in Hz. Default is 3000.
  3235. @item poles, p
  3236. Set number of poles. Default is 2.
  3237. @item width_type, t
  3238. Set method to specify band-width of filter.
  3239. @table @option
  3240. @item h
  3241. Hz
  3242. @item q
  3243. Q-Factor
  3244. @item o
  3245. octave
  3246. @item s
  3247. slope
  3248. @item k
  3249. kHz
  3250. @end table
  3251. @item width, w
  3252. Specify the band-width of a filter in width_type units.
  3253. Applies only to double-pole filter.
  3254. The default is 0.707q and gives a Butterworth response.
  3255. @item mix, m
  3256. How much to use filtered signal in output. Default is 1.
  3257. Range is between 0 and 1.
  3258. @item channels, c
  3259. Specify which channels to filter, by default all available are filtered.
  3260. @item normalize, n
  3261. Normalize biquad coefficients, by default is disabled.
  3262. Enabling it will normalize magnitude response at DC to 0dB.
  3263. @item transform, a
  3264. Set transform type of IIR filter.
  3265. @table @option
  3266. @item di
  3267. @item dii
  3268. @item tdii
  3269. @item latt
  3270. @end table
  3271. @end table
  3272. @subsection Commands
  3273. This filter supports the following commands:
  3274. @table @option
  3275. @item frequency, f
  3276. Change highpass frequency.
  3277. Syntax for the command is : "@var{frequency}"
  3278. @item width_type, t
  3279. Change highpass width_type.
  3280. Syntax for the command is : "@var{width_type}"
  3281. @item width, w
  3282. Change highpass width.
  3283. Syntax for the command is : "@var{width}"
  3284. @item mix, m
  3285. Change highpass mix.
  3286. Syntax for the command is : "@var{mix}"
  3287. @end table
  3288. @section join
  3289. Join multiple input streams into one multi-channel stream.
  3290. It accepts the following parameters:
  3291. @table @option
  3292. @item inputs
  3293. The number of input streams. It defaults to 2.
  3294. @item channel_layout
  3295. The desired output channel layout. It defaults to stereo.
  3296. @item map
  3297. Map channels from inputs to output. The argument is a '|'-separated list of
  3298. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3299. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3300. can be either the name of the input channel (e.g. FL for front left) or its
  3301. index in the specified input stream. @var{out_channel} is the name of the output
  3302. channel.
  3303. @end table
  3304. The filter will attempt to guess the mappings when they are not specified
  3305. explicitly. It does so by first trying to find an unused matching input channel
  3306. and if that fails it picks the first unused input channel.
  3307. Join 3 inputs (with properly set channel layouts):
  3308. @example
  3309. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3310. @end example
  3311. Build a 5.1 output from 6 single-channel streams:
  3312. @example
  3313. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3314. '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'
  3315. out
  3316. @end example
  3317. @section ladspa
  3318. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3319. To enable compilation of this filter you need to configure FFmpeg with
  3320. @code{--enable-ladspa}.
  3321. @table @option
  3322. @item file, f
  3323. Specifies the name of LADSPA plugin library to load. If the environment
  3324. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3325. each one of the directories specified by the colon separated list in
  3326. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3327. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3328. @file{/usr/lib/ladspa/}.
  3329. @item plugin, p
  3330. Specifies the plugin within the library. Some libraries contain only
  3331. one plugin, but others contain many of them. If this is not set filter
  3332. will list all available plugins within the specified library.
  3333. @item controls, c
  3334. Set the '|' separated list of controls which are zero or more floating point
  3335. values that determine the behavior of the loaded plugin (for example delay,
  3336. threshold or gain).
  3337. Controls need to be defined using the following syntax:
  3338. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3339. @var{valuei} is the value set on the @var{i}-th control.
  3340. Alternatively they can be also defined using the following syntax:
  3341. @var{value0}|@var{value1}|@var{value2}|..., where
  3342. @var{valuei} is the value set on the @var{i}-th control.
  3343. If @option{controls} is set to @code{help}, all available controls and
  3344. their valid ranges are printed.
  3345. @item sample_rate, s
  3346. Specify the sample rate, default to 44100. Only used if plugin have
  3347. zero inputs.
  3348. @item nb_samples, n
  3349. Set the number of samples per channel per each output frame, default
  3350. is 1024. Only used if plugin have zero inputs.
  3351. @item duration, d
  3352. Set the minimum duration of the sourced audio. See
  3353. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3354. for the accepted syntax.
  3355. Note that the resulting duration may be greater than the specified duration,
  3356. as the generated audio is always cut at the end of a complete frame.
  3357. If not specified, or the expressed duration is negative, the audio is
  3358. supposed to be generated forever.
  3359. Only used if plugin have zero inputs.
  3360. @item latency, l
  3361. Enable latency compensation, by default is disabled.
  3362. Only used if plugin have inputs.
  3363. @end table
  3364. @subsection Examples
  3365. @itemize
  3366. @item
  3367. List all available plugins within amp (LADSPA example plugin) library:
  3368. @example
  3369. ladspa=file=amp
  3370. @end example
  3371. @item
  3372. List all available controls and their valid ranges for @code{vcf_notch}
  3373. plugin from @code{VCF} library:
  3374. @example
  3375. ladspa=f=vcf:p=vcf_notch:c=help
  3376. @end example
  3377. @item
  3378. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3379. plugin library:
  3380. @example
  3381. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3382. @end example
  3383. @item
  3384. Add reverberation to the audio using TAP-plugins
  3385. (Tom's Audio Processing plugins):
  3386. @example
  3387. ladspa=file=tap_reverb:tap_reverb
  3388. @end example
  3389. @item
  3390. Generate white noise, with 0.2 amplitude:
  3391. @example
  3392. ladspa=file=cmt:noise_source_white:c=c0=.2
  3393. @end example
  3394. @item
  3395. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3396. @code{C* Audio Plugin Suite} (CAPS) library:
  3397. @example
  3398. ladspa=file=caps:Click:c=c1=20'
  3399. @end example
  3400. @item
  3401. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3402. @example
  3403. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3404. @end example
  3405. @item
  3406. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3407. @code{SWH Plugins} collection:
  3408. @example
  3409. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3410. @end example
  3411. @item
  3412. Attenuate low frequencies using Multiband EQ from Steve Harris
  3413. @code{SWH Plugins} collection:
  3414. @example
  3415. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3416. @end example
  3417. @item
  3418. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3419. (CAPS) library:
  3420. @example
  3421. ladspa=caps:Narrower
  3422. @end example
  3423. @item
  3424. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3425. @example
  3426. ladspa=caps:White:.2
  3427. @end example
  3428. @item
  3429. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3430. @example
  3431. ladspa=caps:Fractal:c=c1=1
  3432. @end example
  3433. @item
  3434. Dynamic volume normalization using @code{VLevel} plugin:
  3435. @example
  3436. ladspa=vlevel-ladspa:vlevel_mono
  3437. @end example
  3438. @end itemize
  3439. @subsection Commands
  3440. This filter supports the following commands:
  3441. @table @option
  3442. @item cN
  3443. Modify the @var{N}-th control value.
  3444. If the specified value is not valid, it is ignored and prior one is kept.
  3445. @end table
  3446. @section loudnorm
  3447. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3448. Support for both single pass (livestreams, files) and double pass (files) modes.
  3449. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3450. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3451. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3452. The filter accepts the following options:
  3453. @table @option
  3454. @item I, i
  3455. Set integrated loudness target.
  3456. Range is -70.0 - -5.0. Default value is -24.0.
  3457. @item LRA, lra
  3458. Set loudness range target.
  3459. Range is 1.0 - 20.0. Default value is 7.0.
  3460. @item TP, tp
  3461. Set maximum true peak.
  3462. Range is -9.0 - +0.0. Default value is -2.0.
  3463. @item measured_I, measured_i
  3464. Measured IL of input file.
  3465. Range is -99.0 - +0.0.
  3466. @item measured_LRA, measured_lra
  3467. Measured LRA of input file.
  3468. Range is 0.0 - 99.0.
  3469. @item measured_TP, measured_tp
  3470. Measured true peak of input file.
  3471. Range is -99.0 - +99.0.
  3472. @item measured_thresh
  3473. Measured threshold of input file.
  3474. Range is -99.0 - +0.0.
  3475. @item offset
  3476. Set offset gain. Gain is applied before the true-peak limiter.
  3477. Range is -99.0 - +99.0. Default is +0.0.
  3478. @item linear
  3479. Normalize by linearly scaling the source audio.
  3480. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3481. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3482. be lower than source LRA and the change in integrated loudness shouldn't
  3483. result in a true peak which exceeds the target TP. If any of these
  3484. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3485. Options are @code{true} or @code{false}. Default is @code{true}.
  3486. @item dual_mono
  3487. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3488. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3489. If set to @code{true}, this option will compensate for this effect.
  3490. Multi-channel input files are not affected by this option.
  3491. Options are true or false. Default is false.
  3492. @item print_format
  3493. Set print format for stats. Options are summary, json, or none.
  3494. Default value is none.
  3495. @end table
  3496. @section lowpass
  3497. Apply a low-pass filter with 3dB point frequency.
  3498. The filter can be either single-pole or double-pole (the default).
  3499. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3500. The filter accepts the following options:
  3501. @table @option
  3502. @item frequency, f
  3503. Set frequency in Hz. Default is 500.
  3504. @item poles, p
  3505. Set number of poles. Default is 2.
  3506. @item width_type, t
  3507. Set method to specify band-width of filter.
  3508. @table @option
  3509. @item h
  3510. Hz
  3511. @item q
  3512. Q-Factor
  3513. @item o
  3514. octave
  3515. @item s
  3516. slope
  3517. @item k
  3518. kHz
  3519. @end table
  3520. @item width, w
  3521. Specify the band-width of a filter in width_type units.
  3522. Applies only to double-pole filter.
  3523. The default is 0.707q and gives a Butterworth response.
  3524. @item mix, m
  3525. How much to use filtered signal in output. Default is 1.
  3526. Range is between 0 and 1.
  3527. @item channels, c
  3528. Specify which channels to filter, by default all available are filtered.
  3529. @item normalize, n
  3530. Normalize biquad coefficients, by default is disabled.
  3531. Enabling it will normalize magnitude response at DC to 0dB.
  3532. @item transform, a
  3533. Set transform type of IIR filter.
  3534. @table @option
  3535. @item di
  3536. @item dii
  3537. @item tdii
  3538. @item latt
  3539. @end table
  3540. @end table
  3541. @subsection Examples
  3542. @itemize
  3543. @item
  3544. Lowpass only LFE channel, it LFE is not present it does nothing:
  3545. @example
  3546. lowpass=c=LFE
  3547. @end example
  3548. @end itemize
  3549. @subsection Commands
  3550. This filter supports the following commands:
  3551. @table @option
  3552. @item frequency, f
  3553. Change lowpass frequency.
  3554. Syntax for the command is : "@var{frequency}"
  3555. @item width_type, t
  3556. Change lowpass width_type.
  3557. Syntax for the command is : "@var{width_type}"
  3558. @item width, w
  3559. Change lowpass width.
  3560. Syntax for the command is : "@var{width}"
  3561. @item mix, m
  3562. Change lowpass mix.
  3563. Syntax for the command is : "@var{mix}"
  3564. @end table
  3565. @section lv2
  3566. Load a LV2 (LADSPA Version 2) plugin.
  3567. To enable compilation of this filter you need to configure FFmpeg with
  3568. @code{--enable-lv2}.
  3569. @table @option
  3570. @item plugin, p
  3571. Specifies the plugin URI. You may need to escape ':'.
  3572. @item controls, c
  3573. Set the '|' separated list of controls which are zero or more floating point
  3574. values that determine the behavior of the loaded plugin (for example delay,
  3575. threshold or gain).
  3576. If @option{controls} is set to @code{help}, all available controls and
  3577. their valid ranges are printed.
  3578. @item sample_rate, s
  3579. Specify the sample rate, default to 44100. Only used if plugin have
  3580. zero inputs.
  3581. @item nb_samples, n
  3582. Set the number of samples per channel per each output frame, default
  3583. is 1024. Only used if plugin have zero inputs.
  3584. @item duration, d
  3585. Set the minimum duration of the sourced audio. See
  3586. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3587. for the accepted syntax.
  3588. Note that the resulting duration may be greater than the specified duration,
  3589. as the generated audio is always cut at the end of a complete frame.
  3590. If not specified, or the expressed duration is negative, the audio is
  3591. supposed to be generated forever.
  3592. Only used if plugin have zero inputs.
  3593. @end table
  3594. @subsection Examples
  3595. @itemize
  3596. @item
  3597. Apply bass enhancer plugin from Calf:
  3598. @example
  3599. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3600. @end example
  3601. @item
  3602. Apply vinyl plugin from Calf:
  3603. @example
  3604. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3605. @end example
  3606. @item
  3607. Apply bit crusher plugin from ArtyFX:
  3608. @example
  3609. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3610. @end example
  3611. @end itemize
  3612. @section mcompand
  3613. Multiband Compress or expand the audio's dynamic range.
  3614. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3615. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3616. response when absent compander action.
  3617. It accepts the following parameters:
  3618. @table @option
  3619. @item args
  3620. This option syntax is:
  3621. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3622. For explanation of each item refer to compand filter documentation.
  3623. @end table
  3624. @anchor{pan}
  3625. @section pan
  3626. Mix channels with specific gain levels. The filter accepts the output
  3627. channel layout followed by a set of channels definitions.
  3628. This filter is also designed to efficiently remap the channels of an audio
  3629. stream.
  3630. The filter accepts parameters of the form:
  3631. "@var{l}|@var{outdef}|@var{outdef}|..."
  3632. @table @option
  3633. @item l
  3634. output channel layout or number of channels
  3635. @item outdef
  3636. output channel specification, of the form:
  3637. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3638. @item out_name
  3639. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3640. number (c0, c1, etc.)
  3641. @item gain
  3642. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3643. @item in_name
  3644. input channel to use, see out_name for details; it is not possible to mix
  3645. named and numbered input channels
  3646. @end table
  3647. If the `=' in a channel specification is replaced by `<', then the gains for
  3648. that specification will be renormalized so that the total is 1, thus
  3649. avoiding clipping noise.
  3650. @subsection Mixing examples
  3651. For example, if you want to down-mix from stereo to mono, but with a bigger
  3652. factor for the left channel:
  3653. @example
  3654. pan=1c|c0=0.9*c0+0.1*c1
  3655. @end example
  3656. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3657. 7-channels surround:
  3658. @example
  3659. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3660. @end example
  3661. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3662. that should be preferred (see "-ac" option) unless you have very specific
  3663. needs.
  3664. @subsection Remapping examples
  3665. The channel remapping will be effective if, and only if:
  3666. @itemize
  3667. @item gain coefficients are zeroes or ones,
  3668. @item only one input per channel output,
  3669. @end itemize
  3670. If all these conditions are satisfied, the filter will notify the user ("Pure
  3671. channel mapping detected"), and use an optimized and lossless method to do the
  3672. remapping.
  3673. For example, if you have a 5.1 source and want a stereo audio stream by
  3674. dropping the extra channels:
  3675. @example
  3676. pan="stereo| c0=FL | c1=FR"
  3677. @end example
  3678. Given the same source, you can also switch front left and front right channels
  3679. and keep the input channel layout:
  3680. @example
  3681. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3682. @end example
  3683. If the input is a stereo audio stream, you can mute the front left channel (and
  3684. still keep the stereo channel layout) with:
  3685. @example
  3686. pan="stereo|c1=c1"
  3687. @end example
  3688. Still with a stereo audio stream input, you can copy the right channel in both
  3689. front left and right:
  3690. @example
  3691. pan="stereo| c0=FR | c1=FR"
  3692. @end example
  3693. @section replaygain
  3694. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3695. outputs it unchanged.
  3696. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3697. @section resample
  3698. Convert the audio sample format, sample rate and channel layout. It is
  3699. not meant to be used directly.
  3700. @section rubberband
  3701. Apply time-stretching and pitch-shifting with librubberband.
  3702. To enable compilation of this filter, you need to configure FFmpeg with
  3703. @code{--enable-librubberband}.
  3704. The filter accepts the following options:
  3705. @table @option
  3706. @item tempo
  3707. Set tempo scale factor.
  3708. @item pitch
  3709. Set pitch scale factor.
  3710. @item transients
  3711. Set transients detector.
  3712. Possible values are:
  3713. @table @var
  3714. @item crisp
  3715. @item mixed
  3716. @item smooth
  3717. @end table
  3718. @item detector
  3719. Set detector.
  3720. Possible values are:
  3721. @table @var
  3722. @item compound
  3723. @item percussive
  3724. @item soft
  3725. @end table
  3726. @item phase
  3727. Set phase.
  3728. Possible values are:
  3729. @table @var
  3730. @item laminar
  3731. @item independent
  3732. @end table
  3733. @item window
  3734. Set processing window size.
  3735. Possible values are:
  3736. @table @var
  3737. @item standard
  3738. @item short
  3739. @item long
  3740. @end table
  3741. @item smoothing
  3742. Set smoothing.
  3743. Possible values are:
  3744. @table @var
  3745. @item off
  3746. @item on
  3747. @end table
  3748. @item formant
  3749. Enable formant preservation when shift pitching.
  3750. Possible values are:
  3751. @table @var
  3752. @item shifted
  3753. @item preserved
  3754. @end table
  3755. @item pitchq
  3756. Set pitch quality.
  3757. Possible values are:
  3758. @table @var
  3759. @item quality
  3760. @item speed
  3761. @item consistency
  3762. @end table
  3763. @item channels
  3764. Set channels.
  3765. Possible values are:
  3766. @table @var
  3767. @item apart
  3768. @item together
  3769. @end table
  3770. @end table
  3771. @subsection Commands
  3772. This filter supports the following commands:
  3773. @table @option
  3774. @item tempo
  3775. Change filter tempo scale factor.
  3776. Syntax for the command is : "@var{tempo}"
  3777. @item pitch
  3778. Change filter pitch scale factor.
  3779. Syntax for the command is : "@var{pitch}"
  3780. @end table
  3781. @section sidechaincompress
  3782. This filter acts like normal compressor but has the ability to compress
  3783. detected signal using second input signal.
  3784. It needs two input streams and returns one output stream.
  3785. First input stream will be processed depending on second stream signal.
  3786. The filtered signal then can be filtered with other filters in later stages of
  3787. processing. See @ref{pan} and @ref{amerge} filter.
  3788. The filter accepts the following options:
  3789. @table @option
  3790. @item level_in
  3791. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3792. @item mode
  3793. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3794. Default is @code{downward}.
  3795. @item threshold
  3796. If a signal of second stream raises above this level it will affect the gain
  3797. reduction of first stream.
  3798. By default is 0.125. Range is between 0.00097563 and 1.
  3799. @item ratio
  3800. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3801. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3802. Default is 2. Range is between 1 and 20.
  3803. @item attack
  3804. Amount of milliseconds the signal has to rise above the threshold before gain
  3805. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3806. @item release
  3807. Amount of milliseconds the signal has to fall below the threshold before
  3808. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3809. @item makeup
  3810. Set the amount by how much signal will be amplified after processing.
  3811. Default is 1. Range is from 1 to 64.
  3812. @item knee
  3813. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3814. Default is 2.82843. Range is between 1 and 8.
  3815. @item link
  3816. Choose if the @code{average} level between all channels of side-chain stream
  3817. or the louder(@code{maximum}) channel of side-chain stream affects the
  3818. reduction. Default is @code{average}.
  3819. @item detection
  3820. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3821. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3822. @item level_sc
  3823. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3824. @item mix
  3825. How much to use compressed signal in output. Default is 1.
  3826. Range is between 0 and 1.
  3827. @end table
  3828. @subsection Commands
  3829. This filter supports the all above options as @ref{commands}.
  3830. @subsection Examples
  3831. @itemize
  3832. @item
  3833. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3834. depending on the signal of 2nd input and later compressed signal to be
  3835. merged with 2nd input:
  3836. @example
  3837. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3838. @end example
  3839. @end itemize
  3840. @section sidechaingate
  3841. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3842. filter the detected signal before sending it to the gain reduction stage.
  3843. Normally a gate uses the full range signal to detect a level above the
  3844. threshold.
  3845. For example: If you cut all lower frequencies from your sidechain signal
  3846. the gate will decrease the volume of your track only if not enough highs
  3847. appear. With this technique you are able to reduce the resonation of a
  3848. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3849. guitar.
  3850. It needs two input streams and returns one output stream.
  3851. First input stream will be processed depending on second stream signal.
  3852. The filter accepts the following options:
  3853. @table @option
  3854. @item level_in
  3855. Set input level before filtering.
  3856. Default is 1. Allowed range is from 0.015625 to 64.
  3857. @item mode
  3858. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3859. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3860. will be amplified, expanding dynamic range in upward direction.
  3861. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3862. @item range
  3863. Set the level of gain reduction when the signal is below the threshold.
  3864. Default is 0.06125. Allowed range is from 0 to 1.
  3865. Setting this to 0 disables reduction and then filter behaves like expander.
  3866. @item threshold
  3867. If a signal rises above this level the gain reduction is released.
  3868. Default is 0.125. Allowed range is from 0 to 1.
  3869. @item ratio
  3870. Set a ratio about which the signal is reduced.
  3871. Default is 2. Allowed range is from 1 to 9000.
  3872. @item attack
  3873. Amount of milliseconds the signal has to rise above the threshold before gain
  3874. reduction stops.
  3875. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3876. @item release
  3877. Amount of milliseconds the signal has to fall below the threshold before the
  3878. reduction is increased again. Default is 250 milliseconds.
  3879. Allowed range is from 0.01 to 9000.
  3880. @item makeup
  3881. Set amount of amplification of signal after processing.
  3882. Default is 1. Allowed range is from 1 to 64.
  3883. @item knee
  3884. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3885. Default is 2.828427125. Allowed range is from 1 to 8.
  3886. @item detection
  3887. Choose if exact signal should be taken for detection or an RMS like one.
  3888. Default is rms. Can be peak or rms.
  3889. @item link
  3890. Choose if the average level between all channels or the louder channel affects
  3891. the reduction.
  3892. Default is average. Can be average or maximum.
  3893. @item level_sc
  3894. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3895. @end table
  3896. @section silencedetect
  3897. Detect silence in an audio stream.
  3898. This filter logs a message when it detects that the input audio volume is less
  3899. or equal to a noise tolerance value for a duration greater or equal to the
  3900. minimum detected noise duration.
  3901. The printed times and duration are expressed in seconds. The
  3902. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3903. is set on the first frame whose timestamp equals or exceeds the detection
  3904. duration and it contains the timestamp of the first frame of the silence.
  3905. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3906. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3907. keys are set on the first frame after the silence. If @option{mono} is
  3908. enabled, and each channel is evaluated separately, the @code{.X}
  3909. suffixed keys are used, and @code{X} corresponds to the channel number.
  3910. The filter accepts the following options:
  3911. @table @option
  3912. @item noise, n
  3913. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3914. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3915. @item duration, d
  3916. Set silence duration until notification (default is 2 seconds). See
  3917. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3918. for the accepted syntax.
  3919. @item mono, m
  3920. Process each channel separately, instead of combined. By default is disabled.
  3921. @end table
  3922. @subsection Examples
  3923. @itemize
  3924. @item
  3925. Detect 5 seconds of silence with -50dB noise tolerance:
  3926. @example
  3927. silencedetect=n=-50dB:d=5
  3928. @end example
  3929. @item
  3930. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3931. tolerance in @file{silence.mp3}:
  3932. @example
  3933. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3934. @end example
  3935. @end itemize
  3936. @section silenceremove
  3937. Remove silence from the beginning, middle or end of the audio.
  3938. The filter accepts the following options:
  3939. @table @option
  3940. @item start_periods
  3941. This value is used to indicate if audio should be trimmed at beginning of
  3942. the audio. A value of zero indicates no silence should be trimmed from the
  3943. beginning. When specifying a non-zero value, it trims audio up until it
  3944. finds non-silence. Normally, when trimming silence from beginning of audio
  3945. the @var{start_periods} will be @code{1} but it can be increased to higher
  3946. values to trim all audio up to specific count of non-silence periods.
  3947. Default value is @code{0}.
  3948. @item start_duration
  3949. Specify the amount of time that non-silence must be detected before it stops
  3950. trimming audio. By increasing the duration, bursts of noises can be treated
  3951. as silence and trimmed off. Default value is @code{0}.
  3952. @item start_threshold
  3953. This indicates what sample value should be treated as silence. For digital
  3954. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3955. you may wish to increase the value to account for background noise.
  3956. Can be specified in dB (in case "dB" is appended to the specified value)
  3957. or amplitude ratio. Default value is @code{0}.
  3958. @item start_silence
  3959. Specify max duration of silence at beginning that will be kept after
  3960. trimming. Default is 0, which is equal to trimming all samples detected
  3961. as silence.
  3962. @item start_mode
  3963. Specify mode of detection of silence end in start of multi-channel audio.
  3964. Can be @var{any} or @var{all}. Default is @var{any}.
  3965. With @var{any}, any sample that is detected as non-silence will cause
  3966. stopped trimming of silence.
  3967. With @var{all}, only if all channels are detected as non-silence will cause
  3968. stopped trimming of silence.
  3969. @item stop_periods
  3970. Set the count for trimming silence from the end of audio.
  3971. To remove silence from the middle of a file, specify a @var{stop_periods}
  3972. that is negative. This value is then treated as a positive value and is
  3973. used to indicate the effect should restart processing as specified by
  3974. @var{start_periods}, making it suitable for removing periods of silence
  3975. in the middle of the audio.
  3976. Default value is @code{0}.
  3977. @item stop_duration
  3978. Specify a duration of silence that must exist before audio is not copied any
  3979. more. By specifying a higher duration, silence that is wanted can be left in
  3980. the audio.
  3981. Default value is @code{0}.
  3982. @item stop_threshold
  3983. This is the same as @option{start_threshold} but for trimming silence from
  3984. the end of audio.
  3985. Can be specified in dB (in case "dB" is appended to the specified value)
  3986. or amplitude ratio. Default value is @code{0}.
  3987. @item stop_silence
  3988. Specify max duration of silence at end that will be kept after
  3989. trimming. Default is 0, which is equal to trimming all samples detected
  3990. as silence.
  3991. @item stop_mode
  3992. Specify mode of detection of silence start in end of multi-channel audio.
  3993. Can be @var{any} or @var{all}. Default is @var{any}.
  3994. With @var{any}, any sample that is detected as non-silence will cause
  3995. stopped trimming of silence.
  3996. With @var{all}, only if all channels are detected as non-silence will cause
  3997. stopped trimming of silence.
  3998. @item detection
  3999. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4000. and works better with digital silence which is exactly 0.
  4001. Default value is @code{rms}.
  4002. @item window
  4003. Set duration in number of seconds used to calculate size of window in number
  4004. of samples for detecting silence.
  4005. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4006. @end table
  4007. @subsection Examples
  4008. @itemize
  4009. @item
  4010. The following example shows how this filter can be used to start a recording
  4011. that does not contain the delay at the start which usually occurs between
  4012. pressing the record button and the start of the performance:
  4013. @example
  4014. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4015. @end example
  4016. @item
  4017. Trim all silence encountered from beginning to end where there is more than 1
  4018. second of silence in audio:
  4019. @example
  4020. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4021. @end example
  4022. @item
  4023. Trim all digital silence samples, using peak detection, from beginning to end
  4024. where there is more than 0 samples of digital silence in audio and digital
  4025. silence is detected in all channels at same positions in stream:
  4026. @example
  4027. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4028. @end example
  4029. @end itemize
  4030. @section sofalizer
  4031. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4032. loudspeakers around the user for binaural listening via headphones (audio
  4033. formats up to 9 channels supported).
  4034. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4035. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4036. Austrian Academy of Sciences.
  4037. To enable compilation of this filter you need to configure FFmpeg with
  4038. @code{--enable-libmysofa}.
  4039. The filter accepts the following options:
  4040. @table @option
  4041. @item sofa
  4042. Set the SOFA file used for rendering.
  4043. @item gain
  4044. Set gain applied to audio. Value is in dB. Default is 0.
  4045. @item rotation
  4046. Set rotation of virtual loudspeakers in deg. Default is 0.
  4047. @item elevation
  4048. Set elevation of virtual speakers in deg. Default is 0.
  4049. @item radius
  4050. Set distance in meters between loudspeakers and the listener with near-field
  4051. HRTFs. Default is 1.
  4052. @item type
  4053. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4054. processing audio in time domain which is slow.
  4055. @var{freq} is processing audio in frequency domain which is fast.
  4056. Default is @var{freq}.
  4057. @item speakers
  4058. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4059. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4060. Each virtual loudspeaker is described with short channel name following with
  4061. azimuth and elevation in degrees.
  4062. Each virtual loudspeaker description is separated by '|'.
  4063. For example to override front left and front right channel positions use:
  4064. 'speakers=FL 45 15|FR 345 15'.
  4065. Descriptions with unrecognised channel names are ignored.
  4066. @item lfegain
  4067. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4068. @item framesize
  4069. Set custom frame size in number of samples. Default is 1024.
  4070. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4071. is set to @var{freq}.
  4072. @item normalize
  4073. Should all IRs be normalized upon importing SOFA file.
  4074. By default is enabled.
  4075. @item interpolate
  4076. Should nearest IRs be interpolated with neighbor IRs if exact position
  4077. does not match. By default is disabled.
  4078. @item minphase
  4079. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4080. @item anglestep
  4081. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4082. @item radstep
  4083. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4084. @end table
  4085. @subsection Examples
  4086. @itemize
  4087. @item
  4088. Using ClubFritz6 sofa file:
  4089. @example
  4090. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4091. @end example
  4092. @item
  4093. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4094. @example
  4095. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4096. @end example
  4097. @item
  4098. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4099. and also with custom gain:
  4100. @example
  4101. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4102. @end example
  4103. @end itemize
  4104. @section speechnorm
  4105. Speech Normalizer.
  4106. This filter expands or compresses each half-cycle of audio samples
  4107. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4108. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4109. The filter accepts the following options:
  4110. @table @option
  4111. @item peak, p
  4112. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4113. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4114. @item expansion, e
  4115. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4116. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4117. would be such that local peak value reaches target peak value but never to surpass it and that
  4118. ratio between new and previous peak value does not surpass this option value.
  4119. @item compression, c
  4120. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4121. This option controls maximum local half-cycle of samples compression. This option is used
  4122. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4123. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4124. that peak's half-cycle will be compressed by current compression factor.
  4125. @item threshold, t
  4126. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4127. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4128. Any half-cycle samples with their local peak value below or same as this option value will be
  4129. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4130. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4131. @item raise, r
  4132. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4133. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4134. each new half-cycle until it reaches @option{expansion} value.
  4135. Setting this options too high may lead to distortions.
  4136. @item fall, f
  4137. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4138. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4139. each new half-cycle until it reaches @option{compression} value.
  4140. @item channels, h
  4141. Specify which channels to filter, by default all available channels are filtered.
  4142. @item invert, i
  4143. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4144. option. When enabled any half-cycle of samples with their local peak value below or same as
  4145. @option{threshold} option will be expanded otherwise it will be compressed.
  4146. @item link, l
  4147. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4148. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4149. is enabled the minimum of all possible gains for each filtered channel is used.
  4150. @end table
  4151. @subsection Commands
  4152. This filter supports the all above options as @ref{commands}.
  4153. @section stereotools
  4154. This filter has some handy utilities to manage stereo signals, for converting
  4155. M/S stereo recordings to L/R signal while having control over the parameters
  4156. or spreading the stereo image of master track.
  4157. The filter accepts the following options:
  4158. @table @option
  4159. @item level_in
  4160. Set input level before filtering for both channels. Defaults is 1.
  4161. Allowed range is from 0.015625 to 64.
  4162. @item level_out
  4163. Set output level after filtering for both channels. Defaults is 1.
  4164. Allowed range is from 0.015625 to 64.
  4165. @item balance_in
  4166. Set input balance between both channels. Default is 0.
  4167. Allowed range is from -1 to 1.
  4168. @item balance_out
  4169. Set output balance between both channels. Default is 0.
  4170. Allowed range is from -1 to 1.
  4171. @item softclip
  4172. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4173. clipping. Disabled by default.
  4174. @item mutel
  4175. Mute the left channel. Disabled by default.
  4176. @item muter
  4177. Mute the right channel. Disabled by default.
  4178. @item phasel
  4179. Change the phase of the left channel. Disabled by default.
  4180. @item phaser
  4181. Change the phase of the right channel. Disabled by default.
  4182. @item mode
  4183. Set stereo mode. Available values are:
  4184. @table @samp
  4185. @item lr>lr
  4186. Left/Right to Left/Right, this is default.
  4187. @item lr>ms
  4188. Left/Right to Mid/Side.
  4189. @item ms>lr
  4190. Mid/Side to Left/Right.
  4191. @item lr>ll
  4192. Left/Right to Left/Left.
  4193. @item lr>rr
  4194. Left/Right to Right/Right.
  4195. @item lr>l+r
  4196. Left/Right to Left + Right.
  4197. @item lr>rl
  4198. Left/Right to Right/Left.
  4199. @item ms>ll
  4200. Mid/Side to Left/Left.
  4201. @item ms>rr
  4202. Mid/Side to Right/Right.
  4203. @end table
  4204. @item slev
  4205. Set level of side signal. Default is 1.
  4206. Allowed range is from 0.015625 to 64.
  4207. @item sbal
  4208. Set balance of side signal. Default is 0.
  4209. Allowed range is from -1 to 1.
  4210. @item mlev
  4211. Set level of the middle signal. Default is 1.
  4212. Allowed range is from 0.015625 to 64.
  4213. @item mpan
  4214. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4215. @item base
  4216. Set stereo base between mono and inversed channels. Default is 0.
  4217. Allowed range is from -1 to 1.
  4218. @item delay
  4219. Set delay in milliseconds how much to delay left from right channel and
  4220. vice versa. Default is 0. Allowed range is from -20 to 20.
  4221. @item sclevel
  4222. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4223. @item phase
  4224. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4225. @item bmode_in, bmode_out
  4226. Set balance mode for balance_in/balance_out option.
  4227. Can be one of the following:
  4228. @table @samp
  4229. @item balance
  4230. Classic balance mode. Attenuate one channel at time.
  4231. Gain is raised up to 1.
  4232. @item amplitude
  4233. Similar as classic mode above but gain is raised up to 2.
  4234. @item power
  4235. Equal power distribution, from -6dB to +6dB range.
  4236. @end table
  4237. @end table
  4238. @subsection Examples
  4239. @itemize
  4240. @item
  4241. Apply karaoke like effect:
  4242. @example
  4243. stereotools=mlev=0.015625
  4244. @end example
  4245. @item
  4246. Convert M/S signal to L/R:
  4247. @example
  4248. "stereotools=mode=ms>lr"
  4249. @end example
  4250. @end itemize
  4251. @section stereowiden
  4252. This filter enhance the stereo effect by suppressing signal common to both
  4253. channels and by delaying the signal of left into right and vice versa,
  4254. thereby widening the stereo effect.
  4255. The filter accepts the following options:
  4256. @table @option
  4257. @item delay
  4258. Time in milliseconds of the delay of left signal into right and vice versa.
  4259. Default is 20 milliseconds.
  4260. @item feedback
  4261. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4262. effect of left signal in right output and vice versa which gives widening
  4263. effect. Default is 0.3.
  4264. @item crossfeed
  4265. Cross feed of left into right with inverted phase. This helps in suppressing
  4266. the mono. If the value is 1 it will cancel all the signal common to both
  4267. channels. Default is 0.3.
  4268. @item drymix
  4269. Set level of input signal of original channel. Default is 0.8.
  4270. @end table
  4271. @subsection Commands
  4272. This filter supports the all above options except @code{delay} as @ref{commands}.
  4273. @section superequalizer
  4274. Apply 18 band equalizer.
  4275. The filter accepts the following options:
  4276. @table @option
  4277. @item 1b
  4278. Set 65Hz band gain.
  4279. @item 2b
  4280. Set 92Hz band gain.
  4281. @item 3b
  4282. Set 131Hz band gain.
  4283. @item 4b
  4284. Set 185Hz band gain.
  4285. @item 5b
  4286. Set 262Hz band gain.
  4287. @item 6b
  4288. Set 370Hz band gain.
  4289. @item 7b
  4290. Set 523Hz band gain.
  4291. @item 8b
  4292. Set 740Hz band gain.
  4293. @item 9b
  4294. Set 1047Hz band gain.
  4295. @item 10b
  4296. Set 1480Hz band gain.
  4297. @item 11b
  4298. Set 2093Hz band gain.
  4299. @item 12b
  4300. Set 2960Hz band gain.
  4301. @item 13b
  4302. Set 4186Hz band gain.
  4303. @item 14b
  4304. Set 5920Hz band gain.
  4305. @item 15b
  4306. Set 8372Hz band gain.
  4307. @item 16b
  4308. Set 11840Hz band gain.
  4309. @item 17b
  4310. Set 16744Hz band gain.
  4311. @item 18b
  4312. Set 20000Hz band gain.
  4313. @end table
  4314. @section surround
  4315. Apply audio surround upmix filter.
  4316. This filter allows to produce multichannel output from audio stream.
  4317. The filter accepts the following options:
  4318. @table @option
  4319. @item chl_out
  4320. Set output channel layout. By default, this is @var{5.1}.
  4321. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4322. for the required syntax.
  4323. @item chl_in
  4324. Set input channel layout. By default, this is @var{stereo}.
  4325. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4326. for the required syntax.
  4327. @item level_in
  4328. Set input volume level. By default, this is @var{1}.
  4329. @item level_out
  4330. Set output volume level. By default, this is @var{1}.
  4331. @item lfe
  4332. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4333. @item lfe_low
  4334. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4335. @item lfe_high
  4336. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4337. @item lfe_mode
  4338. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4339. In @var{add} mode, LFE channel is created from input audio and added to output.
  4340. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4341. also all non-LFE output channels are subtracted with output LFE channel.
  4342. @item angle
  4343. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4344. Default is @var{90}.
  4345. @item fc_in
  4346. Set front center input volume. By default, this is @var{1}.
  4347. @item fc_out
  4348. Set front center output volume. By default, this is @var{1}.
  4349. @item fl_in
  4350. Set front left input volume. By default, this is @var{1}.
  4351. @item fl_out
  4352. Set front left output volume. By default, this is @var{1}.
  4353. @item fr_in
  4354. Set front right input volume. By default, this is @var{1}.
  4355. @item fr_out
  4356. Set front right output volume. By default, this is @var{1}.
  4357. @item sl_in
  4358. Set side left input volume. By default, this is @var{1}.
  4359. @item sl_out
  4360. Set side left output volume. By default, this is @var{1}.
  4361. @item sr_in
  4362. Set side right input volume. By default, this is @var{1}.
  4363. @item sr_out
  4364. Set side right output volume. By default, this is @var{1}.
  4365. @item bl_in
  4366. Set back left input volume. By default, this is @var{1}.
  4367. @item bl_out
  4368. Set back left output volume. By default, this is @var{1}.
  4369. @item br_in
  4370. Set back right input volume. By default, this is @var{1}.
  4371. @item br_out
  4372. Set back right output volume. By default, this is @var{1}.
  4373. @item bc_in
  4374. Set back center input volume. By default, this is @var{1}.
  4375. @item bc_out
  4376. Set back center output volume. By default, this is @var{1}.
  4377. @item lfe_in
  4378. Set LFE input volume. By default, this is @var{1}.
  4379. @item lfe_out
  4380. Set LFE output volume. By default, this is @var{1}.
  4381. @item allx
  4382. Set spread usage of stereo image across X axis for all channels.
  4383. @item ally
  4384. Set spread usage of stereo image across Y axis for all channels.
  4385. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4386. Set spread usage of stereo image across X axis for each channel.
  4387. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4388. Set spread usage of stereo image across Y axis for each channel.
  4389. @item win_size
  4390. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4391. @item win_func
  4392. Set window function.
  4393. It accepts the following values:
  4394. @table @samp
  4395. @item rect
  4396. @item bartlett
  4397. @item hann, hanning
  4398. @item hamming
  4399. @item blackman
  4400. @item welch
  4401. @item flattop
  4402. @item bharris
  4403. @item bnuttall
  4404. @item bhann
  4405. @item sine
  4406. @item nuttall
  4407. @item lanczos
  4408. @item gauss
  4409. @item tukey
  4410. @item dolph
  4411. @item cauchy
  4412. @item parzen
  4413. @item poisson
  4414. @item bohman
  4415. @end table
  4416. Default is @code{hann}.
  4417. @item overlap
  4418. Set window overlap. If set to 1, the recommended overlap for selected
  4419. window function will be picked. Default is @code{0.5}.
  4420. @end table
  4421. @section treble, highshelf
  4422. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4423. shelving filter with a response similar to that of a standard
  4424. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4425. The filter accepts the following options:
  4426. @table @option
  4427. @item gain, g
  4428. Give the gain at whichever is the lower of ~22 kHz and the
  4429. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4430. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4431. @item frequency, f
  4432. Set the filter's central frequency and so can be used
  4433. to extend or reduce the frequency range to be boosted or cut.
  4434. The default value is @code{3000} Hz.
  4435. @item width_type, t
  4436. Set method to specify band-width of filter.
  4437. @table @option
  4438. @item h
  4439. Hz
  4440. @item q
  4441. Q-Factor
  4442. @item o
  4443. octave
  4444. @item s
  4445. slope
  4446. @item k
  4447. kHz
  4448. @end table
  4449. @item width, w
  4450. Determine how steep is the filter's shelf transition.
  4451. @item mix, m
  4452. How much to use filtered signal in output. Default is 1.
  4453. Range is between 0 and 1.
  4454. @item channels, c
  4455. Specify which channels to filter, by default all available are filtered.
  4456. @item normalize, n
  4457. Normalize biquad coefficients, by default is disabled.
  4458. Enabling it will normalize magnitude response at DC to 0dB.
  4459. @item transform, a
  4460. Set transform type of IIR filter.
  4461. @table @option
  4462. @item di
  4463. @item dii
  4464. @item tdii
  4465. @item latt
  4466. @end table
  4467. @end table
  4468. @subsection Commands
  4469. This filter supports the following commands:
  4470. @table @option
  4471. @item frequency, f
  4472. Change treble frequency.
  4473. Syntax for the command is : "@var{frequency}"
  4474. @item width_type, t
  4475. Change treble width_type.
  4476. Syntax for the command is : "@var{width_type}"
  4477. @item width, w
  4478. Change treble width.
  4479. Syntax for the command is : "@var{width}"
  4480. @item gain, g
  4481. Change treble gain.
  4482. Syntax for the command is : "@var{gain}"
  4483. @item mix, m
  4484. Change treble mix.
  4485. Syntax for the command is : "@var{mix}"
  4486. @end table
  4487. @section tremolo
  4488. Sinusoidal amplitude modulation.
  4489. The filter accepts the following options:
  4490. @table @option
  4491. @item f
  4492. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4493. (20 Hz or lower) will result in a tremolo effect.
  4494. This filter may also be used as a ring modulator by specifying
  4495. a modulation frequency higher than 20 Hz.
  4496. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4497. @item d
  4498. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4499. Default value is 0.5.
  4500. @end table
  4501. @section vibrato
  4502. Sinusoidal phase modulation.
  4503. The filter accepts the following options:
  4504. @table @option
  4505. @item f
  4506. Modulation frequency in Hertz.
  4507. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4508. @item d
  4509. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4510. Default value is 0.5.
  4511. @end table
  4512. @section volume
  4513. Adjust the input audio volume.
  4514. It accepts the following parameters:
  4515. @table @option
  4516. @item volume
  4517. Set audio volume expression.
  4518. Output values are clipped to the maximum value.
  4519. The output audio volume is given by the relation:
  4520. @example
  4521. @var{output_volume} = @var{volume} * @var{input_volume}
  4522. @end example
  4523. The default value for @var{volume} is "1.0".
  4524. @item precision
  4525. This parameter represents the mathematical precision.
  4526. It determines which input sample formats will be allowed, which affects the
  4527. precision of the volume scaling.
  4528. @table @option
  4529. @item fixed
  4530. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4531. @item float
  4532. 32-bit floating-point; this limits input sample format to FLT. (default)
  4533. @item double
  4534. 64-bit floating-point; this limits input sample format to DBL.
  4535. @end table
  4536. @item replaygain
  4537. Choose the behaviour on encountering ReplayGain side data in input frames.
  4538. @table @option
  4539. @item drop
  4540. Remove ReplayGain side data, ignoring its contents (the default).
  4541. @item ignore
  4542. Ignore ReplayGain side data, but leave it in the frame.
  4543. @item track
  4544. Prefer the track gain, if present.
  4545. @item album
  4546. Prefer the album gain, if present.
  4547. @end table
  4548. @item replaygain_preamp
  4549. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4550. Default value for @var{replaygain_preamp} is 0.0.
  4551. @item replaygain_noclip
  4552. Prevent clipping by limiting the gain applied.
  4553. Default value for @var{replaygain_noclip} is 1.
  4554. @item eval
  4555. Set when the volume expression is evaluated.
  4556. It accepts the following values:
  4557. @table @samp
  4558. @item once
  4559. only evaluate expression once during the filter initialization, or
  4560. when the @samp{volume} command is sent
  4561. @item frame
  4562. evaluate expression for each incoming frame
  4563. @end table
  4564. Default value is @samp{once}.
  4565. @end table
  4566. The volume expression can contain the following parameters.
  4567. @table @option
  4568. @item n
  4569. frame number (starting at zero)
  4570. @item nb_channels
  4571. number of channels
  4572. @item nb_consumed_samples
  4573. number of samples consumed by the filter
  4574. @item nb_samples
  4575. number of samples in the current frame
  4576. @item pos
  4577. original frame position in the file
  4578. @item pts
  4579. frame PTS
  4580. @item sample_rate
  4581. sample rate
  4582. @item startpts
  4583. PTS at start of stream
  4584. @item startt
  4585. time at start of stream
  4586. @item t
  4587. frame time
  4588. @item tb
  4589. timestamp timebase
  4590. @item volume
  4591. last set volume value
  4592. @end table
  4593. Note that when @option{eval} is set to @samp{once} only the
  4594. @var{sample_rate} and @var{tb} variables are available, all other
  4595. variables will evaluate to NAN.
  4596. @subsection Commands
  4597. This filter supports the following commands:
  4598. @table @option
  4599. @item volume
  4600. Modify the volume expression.
  4601. The command accepts the same syntax of the corresponding option.
  4602. If the specified expression is not valid, it is kept at its current
  4603. value.
  4604. @end table
  4605. @subsection Examples
  4606. @itemize
  4607. @item
  4608. Halve the input audio volume:
  4609. @example
  4610. volume=volume=0.5
  4611. volume=volume=1/2
  4612. volume=volume=-6.0206dB
  4613. @end example
  4614. In all the above example the named key for @option{volume} can be
  4615. omitted, for example like in:
  4616. @example
  4617. volume=0.5
  4618. @end example
  4619. @item
  4620. Increase input audio power by 6 decibels using fixed-point precision:
  4621. @example
  4622. volume=volume=6dB:precision=fixed
  4623. @end example
  4624. @item
  4625. Fade volume after time 10 with an annihilation period of 5 seconds:
  4626. @example
  4627. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4628. @end example
  4629. @end itemize
  4630. @section volumedetect
  4631. Detect the volume of the input video.
  4632. The filter has no parameters. The input is not modified. Statistics about
  4633. the volume will be printed in the log when the input stream end is reached.
  4634. In particular it will show the mean volume (root mean square), maximum
  4635. volume (on a per-sample basis), and the beginning of a histogram of the
  4636. registered volume values (from the maximum value to a cumulated 1/1000 of
  4637. the samples).
  4638. All volumes are in decibels relative to the maximum PCM value.
  4639. @subsection Examples
  4640. Here is an excerpt of the output:
  4641. @example
  4642. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4643. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4644. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4645. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4646. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4647. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4648. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4649. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4650. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4651. @end example
  4652. It means that:
  4653. @itemize
  4654. @item
  4655. The mean square energy is approximately -27 dB, or 10^-2.7.
  4656. @item
  4657. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4658. @item
  4659. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4660. @end itemize
  4661. In other words, raising the volume by +4 dB does not cause any clipping,
  4662. raising it by +5 dB causes clipping for 6 samples, etc.
  4663. @c man end AUDIO FILTERS
  4664. @chapter Audio Sources
  4665. @c man begin AUDIO SOURCES
  4666. Below is a description of the currently available audio sources.
  4667. @section abuffer
  4668. Buffer audio frames, and make them available to the filter chain.
  4669. This source is mainly intended for a programmatic use, in particular
  4670. through the interface defined in @file{libavfilter/buffersrc.h}.
  4671. It accepts the following parameters:
  4672. @table @option
  4673. @item time_base
  4674. The timebase which will be used for timestamps of submitted frames. It must be
  4675. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4676. @item sample_rate
  4677. The sample rate of the incoming audio buffers.
  4678. @item sample_fmt
  4679. The sample format of the incoming audio buffers.
  4680. Either a sample format name or its corresponding integer representation from
  4681. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4682. @item channel_layout
  4683. The channel layout of the incoming audio buffers.
  4684. Either a channel layout name from channel_layout_map in
  4685. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4686. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4687. @item channels
  4688. The number of channels of the incoming audio buffers.
  4689. If both @var{channels} and @var{channel_layout} are specified, then they
  4690. must be consistent.
  4691. @end table
  4692. @subsection Examples
  4693. @example
  4694. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4695. @end example
  4696. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4697. Since the sample format with name "s16p" corresponds to the number
  4698. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4699. equivalent to:
  4700. @example
  4701. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4702. @end example
  4703. @section aevalsrc
  4704. Generate an audio signal specified by an expression.
  4705. This source accepts in input one or more expressions (one for each
  4706. channel), which are evaluated and used to generate a corresponding
  4707. audio signal.
  4708. This source accepts the following options:
  4709. @table @option
  4710. @item exprs
  4711. Set the '|'-separated expressions list for each separate channel. In case the
  4712. @option{channel_layout} option is not specified, the selected channel layout
  4713. depends on the number of provided expressions. Otherwise the last
  4714. specified expression is applied to the remaining output channels.
  4715. @item channel_layout, c
  4716. Set the channel layout. The number of channels in the specified layout
  4717. must be equal to the number of specified expressions.
  4718. @item duration, d
  4719. Set the minimum duration of the sourced audio. See
  4720. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4721. for the accepted syntax.
  4722. Note that the resulting duration may be greater than the specified
  4723. duration, as the generated audio is always cut at the end of a
  4724. complete frame.
  4725. If not specified, or the expressed duration is negative, the audio is
  4726. supposed to be generated forever.
  4727. @item nb_samples, n
  4728. Set the number of samples per channel per each output frame,
  4729. default to 1024.
  4730. @item sample_rate, s
  4731. Specify the sample rate, default to 44100.
  4732. @end table
  4733. Each expression in @var{exprs} can contain the following constants:
  4734. @table @option
  4735. @item n
  4736. number of the evaluated sample, starting from 0
  4737. @item t
  4738. time of the evaluated sample expressed in seconds, starting from 0
  4739. @item s
  4740. sample rate
  4741. @end table
  4742. @subsection Examples
  4743. @itemize
  4744. @item
  4745. Generate silence:
  4746. @example
  4747. aevalsrc=0
  4748. @end example
  4749. @item
  4750. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4751. 8000 Hz:
  4752. @example
  4753. aevalsrc="sin(440*2*PI*t):s=8000"
  4754. @end example
  4755. @item
  4756. Generate a two channels signal, specify the channel layout (Front
  4757. Center + Back Center) explicitly:
  4758. @example
  4759. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4760. @end example
  4761. @item
  4762. Generate white noise:
  4763. @example
  4764. aevalsrc="-2+random(0)"
  4765. @end example
  4766. @item
  4767. Generate an amplitude modulated signal:
  4768. @example
  4769. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4770. @end example
  4771. @item
  4772. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4773. @example
  4774. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4775. @end example
  4776. @end itemize
  4777. @section afirsrc
  4778. Generate a FIR coefficients using frequency sampling method.
  4779. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4780. The filter accepts the following options:
  4781. @table @option
  4782. @item taps, t
  4783. Set number of filter coefficents in output audio stream.
  4784. Default value is 1025.
  4785. @item frequency, f
  4786. Set frequency points from where magnitude and phase are set.
  4787. This must be in non decreasing order, and first element must be 0, while last element
  4788. must be 1. Elements are separated by white spaces.
  4789. @item magnitude, m
  4790. Set magnitude value for every frequency point set by @option{frequency}.
  4791. Number of values must be same as number of frequency points.
  4792. Values are separated by white spaces.
  4793. @item phase, p
  4794. Set phase value for every frequency point set by @option{frequency}.
  4795. Number of values must be same as number of frequency points.
  4796. Values are separated by white spaces.
  4797. @item sample_rate, r
  4798. Set sample rate, default is 44100.
  4799. @item nb_samples, n
  4800. Set number of samples per each frame. Default is 1024.
  4801. @item win_func, w
  4802. Set window function. Default is blackman.
  4803. @end table
  4804. @section anullsrc
  4805. The null audio source, return unprocessed audio frames. It is mainly useful
  4806. as a template and to be employed in analysis / debugging tools, or as
  4807. the source for filters which ignore the input data (for example the sox
  4808. synth filter).
  4809. This source accepts the following options:
  4810. @table @option
  4811. @item channel_layout, cl
  4812. Specifies the channel layout, and can be either an integer or a string
  4813. representing a channel layout. The default value of @var{channel_layout}
  4814. is "stereo".
  4815. Check the channel_layout_map definition in
  4816. @file{libavutil/channel_layout.c} for the mapping between strings and
  4817. channel layout values.
  4818. @item sample_rate, r
  4819. Specifies the sample rate, and defaults to 44100.
  4820. @item nb_samples, n
  4821. Set the number of samples per requested frames.
  4822. @item duration, d
  4823. Set the duration of the sourced audio. See
  4824. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4825. for the accepted syntax.
  4826. If not specified, or the expressed duration is negative, the audio is
  4827. supposed to be generated forever.
  4828. @end table
  4829. @subsection Examples
  4830. @itemize
  4831. @item
  4832. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4833. @example
  4834. anullsrc=r=48000:cl=4
  4835. @end example
  4836. @item
  4837. Do the same operation with a more obvious syntax:
  4838. @example
  4839. anullsrc=r=48000:cl=mono
  4840. @end example
  4841. @end itemize
  4842. All the parameters need to be explicitly defined.
  4843. @section flite
  4844. Synthesize a voice utterance using the libflite library.
  4845. To enable compilation of this filter you need to configure FFmpeg with
  4846. @code{--enable-libflite}.
  4847. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4848. The filter accepts the following options:
  4849. @table @option
  4850. @item list_voices
  4851. If set to 1, list the names of the available voices and exit
  4852. immediately. Default value is 0.
  4853. @item nb_samples, n
  4854. Set the maximum number of samples per frame. Default value is 512.
  4855. @item textfile
  4856. Set the filename containing the text to speak.
  4857. @item text
  4858. Set the text to speak.
  4859. @item voice, v
  4860. Set the voice to use for the speech synthesis. Default value is
  4861. @code{kal}. See also the @var{list_voices} option.
  4862. @end table
  4863. @subsection Examples
  4864. @itemize
  4865. @item
  4866. Read from file @file{speech.txt}, and synthesize the text using the
  4867. standard flite voice:
  4868. @example
  4869. flite=textfile=speech.txt
  4870. @end example
  4871. @item
  4872. Read the specified text selecting the @code{slt} voice:
  4873. @example
  4874. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4875. @end example
  4876. @item
  4877. Input text to ffmpeg:
  4878. @example
  4879. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4880. @end example
  4881. @item
  4882. Make @file{ffplay} speak the specified text, using @code{flite} and
  4883. the @code{lavfi} device:
  4884. @example
  4885. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4886. @end example
  4887. @end itemize
  4888. For more information about libflite, check:
  4889. @url{http://www.festvox.org/flite/}
  4890. @section anoisesrc
  4891. Generate a noise audio signal.
  4892. The filter accepts the following options:
  4893. @table @option
  4894. @item sample_rate, r
  4895. Specify the sample rate. Default value is 48000 Hz.
  4896. @item amplitude, a
  4897. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4898. is 1.0.
  4899. @item duration, d
  4900. Specify the duration of the generated audio stream. Not specifying this option
  4901. results in noise with an infinite length.
  4902. @item color, colour, c
  4903. Specify the color of noise. Available noise colors are white, pink, brown,
  4904. blue, violet and velvet. Default color is white.
  4905. @item seed, s
  4906. Specify a value used to seed the PRNG.
  4907. @item nb_samples, n
  4908. Set the number of samples per each output frame, default is 1024.
  4909. @end table
  4910. @subsection Examples
  4911. @itemize
  4912. @item
  4913. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4914. @example
  4915. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4916. @end example
  4917. @end itemize
  4918. @section hilbert
  4919. Generate odd-tap Hilbert transform FIR coefficients.
  4920. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4921. the signal by 90 degrees.
  4922. This is used in many matrix coding schemes and for analytic signal generation.
  4923. The process is often written as a multiplication by i (or j), the imaginary unit.
  4924. The filter accepts the following options:
  4925. @table @option
  4926. @item sample_rate, s
  4927. Set sample rate, default is 44100.
  4928. @item taps, t
  4929. Set length of FIR filter, default is 22051.
  4930. @item nb_samples, n
  4931. Set number of samples per each frame.
  4932. @item win_func, w
  4933. Set window function to be used when generating FIR coefficients.
  4934. @end table
  4935. @section sinc
  4936. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4937. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4938. The filter accepts the following options:
  4939. @table @option
  4940. @item sample_rate, r
  4941. Set sample rate, default is 44100.
  4942. @item nb_samples, n
  4943. Set number of samples per each frame. Default is 1024.
  4944. @item hp
  4945. Set high-pass frequency. Default is 0.
  4946. @item lp
  4947. Set low-pass frequency. Default is 0.
  4948. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4949. is higher than 0 then filter will create band-pass filter coefficients,
  4950. otherwise band-reject filter coefficients.
  4951. @item phase
  4952. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4953. @item beta
  4954. Set Kaiser window beta.
  4955. @item att
  4956. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4957. @item round
  4958. Enable rounding, by default is disabled.
  4959. @item hptaps
  4960. Set number of taps for high-pass filter.
  4961. @item lptaps
  4962. Set number of taps for low-pass filter.
  4963. @end table
  4964. @section sine
  4965. Generate an audio signal made of a sine wave with amplitude 1/8.
  4966. The audio signal is bit-exact.
  4967. The filter accepts the following options:
  4968. @table @option
  4969. @item frequency, f
  4970. Set the carrier frequency. Default is 440 Hz.
  4971. @item beep_factor, b
  4972. Enable a periodic beep every second with frequency @var{beep_factor} times
  4973. the carrier frequency. Default is 0, meaning the beep is disabled.
  4974. @item sample_rate, r
  4975. Specify the sample rate, default is 44100.
  4976. @item duration, d
  4977. Specify the duration of the generated audio stream.
  4978. @item samples_per_frame
  4979. Set the number of samples per output frame.
  4980. The expression can contain the following constants:
  4981. @table @option
  4982. @item n
  4983. The (sequential) number of the output audio frame, starting from 0.
  4984. @item pts
  4985. The PTS (Presentation TimeStamp) of the output audio frame,
  4986. expressed in @var{TB} units.
  4987. @item t
  4988. The PTS of the output audio frame, expressed in seconds.
  4989. @item TB
  4990. The timebase of the output audio frames.
  4991. @end table
  4992. Default is @code{1024}.
  4993. @end table
  4994. @subsection Examples
  4995. @itemize
  4996. @item
  4997. Generate a simple 440 Hz sine wave:
  4998. @example
  4999. sine
  5000. @end example
  5001. @item
  5002. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5003. @example
  5004. sine=220:4:d=5
  5005. sine=f=220:b=4:d=5
  5006. sine=frequency=220:beep_factor=4:duration=5
  5007. @end example
  5008. @item
  5009. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5010. pattern:
  5011. @example
  5012. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5013. @end example
  5014. @end itemize
  5015. @c man end AUDIO SOURCES
  5016. @chapter Audio Sinks
  5017. @c man begin AUDIO SINKS
  5018. Below is a description of the currently available audio sinks.
  5019. @section abuffersink
  5020. Buffer audio frames, and make them available to the end of filter chain.
  5021. This sink is mainly intended for programmatic use, in particular
  5022. through the interface defined in @file{libavfilter/buffersink.h}
  5023. or the options system.
  5024. It accepts a pointer to an AVABufferSinkContext structure, which
  5025. defines the incoming buffers' formats, to be passed as the opaque
  5026. parameter to @code{avfilter_init_filter} for initialization.
  5027. @section anullsink
  5028. Null audio sink; do absolutely nothing with the input audio. It is
  5029. mainly useful as a template and for use in analysis / debugging
  5030. tools.
  5031. @c man end AUDIO SINKS
  5032. @chapter Video Filters
  5033. @c man begin VIDEO FILTERS
  5034. When you configure your FFmpeg build, you can disable any of the
  5035. existing filters using @code{--disable-filters}.
  5036. The configure output will show the video filters included in your
  5037. build.
  5038. Below is a description of the currently available video filters.
  5039. @section addroi
  5040. Mark a region of interest in a video frame.
  5041. The frame data is passed through unchanged, but metadata is attached
  5042. to the frame indicating regions of interest which can affect the
  5043. behaviour of later encoding. Multiple regions can be marked by
  5044. applying the filter multiple times.
  5045. @table @option
  5046. @item x
  5047. Region distance in pixels from the left edge of the frame.
  5048. @item y
  5049. Region distance in pixels from the top edge of the frame.
  5050. @item w
  5051. Region width in pixels.
  5052. @item h
  5053. Region height in pixels.
  5054. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5055. and may contain the following variables:
  5056. @table @option
  5057. @item iw
  5058. Width of the input frame.
  5059. @item ih
  5060. Height of the input frame.
  5061. @end table
  5062. @item qoffset
  5063. Quantisation offset to apply within the region.
  5064. This must be a real value in the range -1 to +1. A value of zero
  5065. indicates no quality change. A negative value asks for better quality
  5066. (less quantisation), while a positive value asks for worse quality
  5067. (greater quantisation).
  5068. The range is calibrated so that the extreme values indicate the
  5069. largest possible offset - if the rest of the frame is encoded with the
  5070. worst possible quality, an offset of -1 indicates that this region
  5071. should be encoded with the best possible quality anyway. Intermediate
  5072. values are then interpolated in some codec-dependent way.
  5073. For example, in 10-bit H.264 the quantisation parameter varies between
  5074. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5075. this region should be encoded with a QP around one-tenth of the full
  5076. range better than the rest of the frame. So, if most of the frame
  5077. were to be encoded with a QP of around 30, this region would get a QP
  5078. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5079. An extreme value of -1 would indicate that this region should be
  5080. encoded with the best possible quality regardless of the treatment of
  5081. the rest of the frame - that is, should be encoded at a QP of -12.
  5082. @item clear
  5083. If set to true, remove any existing regions of interest marked on the
  5084. frame before adding the new one.
  5085. @end table
  5086. @subsection Examples
  5087. @itemize
  5088. @item
  5089. Mark the centre quarter of the frame as interesting.
  5090. @example
  5091. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5092. @end example
  5093. @item
  5094. Mark the 100-pixel-wide region on the left edge of the frame as very
  5095. uninteresting (to be encoded at much lower quality than the rest of
  5096. the frame).
  5097. @example
  5098. addroi=0:0:100:ih:+1/5
  5099. @end example
  5100. @end itemize
  5101. @section alphaextract
  5102. Extract the alpha component from the input as a grayscale video. This
  5103. is especially useful with the @var{alphamerge} filter.
  5104. @section alphamerge
  5105. Add or replace the alpha component of the primary input with the
  5106. grayscale value of a second input. This is intended for use with
  5107. @var{alphaextract} to allow the transmission or storage of frame
  5108. sequences that have alpha in a format that doesn't support an alpha
  5109. channel.
  5110. For example, to reconstruct full frames from a normal YUV-encoded video
  5111. and a separate video created with @var{alphaextract}, you might use:
  5112. @example
  5113. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5114. @end example
  5115. @section amplify
  5116. Amplify differences between current pixel and pixels of adjacent frames in
  5117. same pixel location.
  5118. This filter accepts the following options:
  5119. @table @option
  5120. @item radius
  5121. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5122. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5123. @item factor
  5124. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5125. @item threshold
  5126. Set threshold for difference amplification. Any difference greater or equal to
  5127. this value will not alter source pixel. Default is 10.
  5128. Allowed range is from 0 to 65535.
  5129. @item tolerance
  5130. Set tolerance for difference amplification. Any difference lower to
  5131. this value will not alter source pixel. Default is 0.
  5132. Allowed range is from 0 to 65535.
  5133. @item low
  5134. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5135. This option controls maximum possible value that will decrease source pixel value.
  5136. @item high
  5137. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5138. This option controls maximum possible value that will increase source pixel value.
  5139. @item planes
  5140. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5141. @end table
  5142. @subsection Commands
  5143. This filter supports the following @ref{commands} that corresponds to option of same name:
  5144. @table @option
  5145. @item factor
  5146. @item threshold
  5147. @item tolerance
  5148. @item low
  5149. @item high
  5150. @item planes
  5151. @end table
  5152. @section ass
  5153. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5154. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5155. Substation Alpha) subtitles files.
  5156. This filter accepts the following option in addition to the common options from
  5157. the @ref{subtitles} filter:
  5158. @table @option
  5159. @item shaping
  5160. Set the shaping engine
  5161. Available values are:
  5162. @table @samp
  5163. @item auto
  5164. The default libass shaping engine, which is the best available.
  5165. @item simple
  5166. Fast, font-agnostic shaper that can do only substitutions
  5167. @item complex
  5168. Slower shaper using OpenType for substitutions and positioning
  5169. @end table
  5170. The default is @code{auto}.
  5171. @end table
  5172. @section atadenoise
  5173. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5174. The filter accepts the following options:
  5175. @table @option
  5176. @item 0a
  5177. Set threshold A for 1st plane. Default is 0.02.
  5178. Valid range is 0 to 0.3.
  5179. @item 0b
  5180. Set threshold B for 1st plane. Default is 0.04.
  5181. Valid range is 0 to 5.
  5182. @item 1a
  5183. Set threshold A for 2nd plane. Default is 0.02.
  5184. Valid range is 0 to 0.3.
  5185. @item 1b
  5186. Set threshold B for 2nd plane. Default is 0.04.
  5187. Valid range is 0 to 5.
  5188. @item 2a
  5189. Set threshold A for 3rd plane. Default is 0.02.
  5190. Valid range is 0 to 0.3.
  5191. @item 2b
  5192. Set threshold B for 3rd plane. Default is 0.04.
  5193. Valid range is 0 to 5.
  5194. Threshold A is designed to react on abrupt changes in the input signal and
  5195. threshold B is designed to react on continuous changes in the input signal.
  5196. @item s
  5197. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5198. number in range [5, 129].
  5199. @item p
  5200. Set what planes of frame filter will use for averaging. Default is all.
  5201. @item a
  5202. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5203. Alternatively can be set to @code{s} serial.
  5204. Parallel can be faster then serial, while other way around is never true.
  5205. Parallel will abort early on first change being greater then thresholds, while serial
  5206. will continue processing other side of frames if they are equal or bellow thresholds.
  5207. @end table
  5208. @subsection Commands
  5209. This filter supports same @ref{commands} as options except option @code{s}.
  5210. The command accepts the same syntax of the corresponding option.
  5211. @section avgblur
  5212. Apply average blur filter.
  5213. The filter accepts the following options:
  5214. @table @option
  5215. @item sizeX
  5216. Set horizontal radius size.
  5217. @item planes
  5218. Set which planes to filter. By default all planes are filtered.
  5219. @item sizeY
  5220. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5221. Default is @code{0}.
  5222. @end table
  5223. @subsection Commands
  5224. This filter supports same commands as options.
  5225. The command accepts the same syntax of the corresponding option.
  5226. If the specified expression is not valid, it is kept at its current
  5227. value.
  5228. @section bbox
  5229. Compute the bounding box for the non-black pixels in the input frame
  5230. luminance plane.
  5231. This filter computes the bounding box containing all the pixels with a
  5232. luminance value greater than the minimum allowed value.
  5233. The parameters describing the bounding box are printed on the filter
  5234. log.
  5235. The filter accepts the following option:
  5236. @table @option
  5237. @item min_val
  5238. Set the minimal luminance value. Default is @code{16}.
  5239. @end table
  5240. @section bilateral
  5241. Apply bilateral filter, spatial smoothing while preserving edges.
  5242. The filter accepts the following options:
  5243. @table @option
  5244. @item sigmaS
  5245. Set sigma of gaussian function to calculate spatial weight.
  5246. Allowed range is 0 to 512. Default is 0.1.
  5247. @item sigmaR
  5248. Set sigma of gaussian function to calculate range weight.
  5249. Allowed range is 0 to 1. Default is 0.1.
  5250. @item planes
  5251. Set planes to filter. Default is first only.
  5252. @end table
  5253. @section bitplanenoise
  5254. Show and measure bit plane noise.
  5255. The filter accepts the following options:
  5256. @table @option
  5257. @item bitplane
  5258. Set which plane to analyze. Default is @code{1}.
  5259. @item filter
  5260. Filter out noisy pixels from @code{bitplane} set above.
  5261. Default is disabled.
  5262. @end table
  5263. @section blackdetect
  5264. Detect video intervals that are (almost) completely black. Can be
  5265. useful to detect chapter transitions, commercials, or invalid
  5266. recordings.
  5267. The filter outputs its detection analysis to both the log as well as
  5268. frame metadata. If a black segment of at least the specified minimum
  5269. duration is found, a line with the start and end timestamps as well
  5270. as duration is printed to the log with level @code{info}. In addition,
  5271. a log line with level @code{debug} is printed per frame showing the
  5272. black amount detected for that frame.
  5273. The filter also attaches metadata to the first frame of a black
  5274. segment with key @code{lavfi.black_start} and to the first frame
  5275. after the black segment ends with key @code{lavfi.black_end}. The
  5276. value is the frame's timestamp. This metadata is added regardless
  5277. of the minimum duration specified.
  5278. The filter accepts the following options:
  5279. @table @option
  5280. @item black_min_duration, d
  5281. Set the minimum detected black duration expressed in seconds. It must
  5282. be a non-negative floating point number.
  5283. Default value is 2.0.
  5284. @item picture_black_ratio_th, pic_th
  5285. Set the threshold for considering a picture "black".
  5286. Express the minimum value for the ratio:
  5287. @example
  5288. @var{nb_black_pixels} / @var{nb_pixels}
  5289. @end example
  5290. for which a picture is considered black.
  5291. Default value is 0.98.
  5292. @item pixel_black_th, pix_th
  5293. Set the threshold for considering a pixel "black".
  5294. The threshold expresses the maximum pixel luminance value for which a
  5295. pixel is considered "black". The provided value is scaled according to
  5296. the following equation:
  5297. @example
  5298. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5299. @end example
  5300. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5301. the input video format, the range is [0-255] for YUV full-range
  5302. formats and [16-235] for YUV non full-range formats.
  5303. Default value is 0.10.
  5304. @end table
  5305. The following example sets the maximum pixel threshold to the minimum
  5306. value, and detects only black intervals of 2 or more seconds:
  5307. @example
  5308. blackdetect=d=2:pix_th=0.00
  5309. @end example
  5310. @section blackframe
  5311. Detect frames that are (almost) completely black. Can be useful to
  5312. detect chapter transitions or commercials. Output lines consist of
  5313. the frame number of the detected frame, the percentage of blackness,
  5314. the position in the file if known or -1 and the timestamp in seconds.
  5315. In order to display the output lines, you need to set the loglevel at
  5316. least to the AV_LOG_INFO value.
  5317. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5318. The value represents the percentage of pixels in the picture that
  5319. are below the threshold value.
  5320. It accepts the following parameters:
  5321. @table @option
  5322. @item amount
  5323. The percentage of the pixels that have to be below the threshold; it defaults to
  5324. @code{98}.
  5325. @item threshold, thresh
  5326. The threshold below which a pixel value is considered black; it defaults to
  5327. @code{32}.
  5328. @end table
  5329. @anchor{blend}
  5330. @section blend
  5331. Blend two video frames into each other.
  5332. The @code{blend} filter takes two input streams and outputs one
  5333. stream, the first input is the "top" layer and second input is
  5334. "bottom" layer. By default, the output terminates when the longest input terminates.
  5335. The @code{tblend} (time blend) filter takes two consecutive frames
  5336. from one single stream, and outputs the result obtained by blending
  5337. the new frame on top of the old frame.
  5338. A description of the accepted options follows.
  5339. @table @option
  5340. @item c0_mode
  5341. @item c1_mode
  5342. @item c2_mode
  5343. @item c3_mode
  5344. @item all_mode
  5345. Set blend mode for specific pixel component or all pixel components in case
  5346. of @var{all_mode}. Default value is @code{normal}.
  5347. Available values for component modes are:
  5348. @table @samp
  5349. @item addition
  5350. @item grainmerge
  5351. @item and
  5352. @item average
  5353. @item burn
  5354. @item darken
  5355. @item difference
  5356. @item grainextract
  5357. @item divide
  5358. @item dodge
  5359. @item freeze
  5360. @item exclusion
  5361. @item extremity
  5362. @item glow
  5363. @item hardlight
  5364. @item hardmix
  5365. @item heat
  5366. @item lighten
  5367. @item linearlight
  5368. @item multiply
  5369. @item multiply128
  5370. @item negation
  5371. @item normal
  5372. @item or
  5373. @item overlay
  5374. @item phoenix
  5375. @item pinlight
  5376. @item reflect
  5377. @item screen
  5378. @item softlight
  5379. @item subtract
  5380. @item vividlight
  5381. @item xor
  5382. @end table
  5383. @item c0_opacity
  5384. @item c1_opacity
  5385. @item c2_opacity
  5386. @item c3_opacity
  5387. @item all_opacity
  5388. Set blend opacity for specific pixel component or all pixel components in case
  5389. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5390. @item c0_expr
  5391. @item c1_expr
  5392. @item c2_expr
  5393. @item c3_expr
  5394. @item all_expr
  5395. Set blend expression for specific pixel component or all pixel components in case
  5396. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5397. The expressions can use the following variables:
  5398. @table @option
  5399. @item N
  5400. The sequential number of the filtered frame, starting from @code{0}.
  5401. @item X
  5402. @item Y
  5403. the coordinates of the current sample
  5404. @item W
  5405. @item H
  5406. the width and height of currently filtered plane
  5407. @item SW
  5408. @item SH
  5409. Width and height scale for the plane being filtered. It is the
  5410. ratio between the dimensions of the current plane to the luma plane,
  5411. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5412. the luma plane and @code{0.5,0.5} for the chroma planes.
  5413. @item T
  5414. Time of the current frame, expressed in seconds.
  5415. @item TOP, A
  5416. Value of pixel component at current location for first video frame (top layer).
  5417. @item BOTTOM, B
  5418. Value of pixel component at current location for second video frame (bottom layer).
  5419. @end table
  5420. @end table
  5421. The @code{blend} filter also supports the @ref{framesync} options.
  5422. @subsection Examples
  5423. @itemize
  5424. @item
  5425. Apply transition from bottom layer to top layer in first 10 seconds:
  5426. @example
  5427. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5428. @end example
  5429. @item
  5430. Apply linear horizontal transition from top layer to bottom layer:
  5431. @example
  5432. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5433. @end example
  5434. @item
  5435. Apply 1x1 checkerboard effect:
  5436. @example
  5437. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5438. @end example
  5439. @item
  5440. Apply uncover left effect:
  5441. @example
  5442. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5443. @end example
  5444. @item
  5445. Apply uncover down effect:
  5446. @example
  5447. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5448. @end example
  5449. @item
  5450. Apply uncover up-left effect:
  5451. @example
  5452. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5453. @end example
  5454. @item
  5455. Split diagonally video and shows top and bottom layer on each side:
  5456. @example
  5457. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5458. @end example
  5459. @item
  5460. Display differences between the current and the previous frame:
  5461. @example
  5462. tblend=all_mode=grainextract
  5463. @end example
  5464. @end itemize
  5465. @section bm3d
  5466. Denoise frames using Block-Matching 3D algorithm.
  5467. The filter accepts the following options.
  5468. @table @option
  5469. @item sigma
  5470. Set denoising strength. Default value is 1.
  5471. Allowed range is from 0 to 999.9.
  5472. The denoising algorithm is very sensitive to sigma, so adjust it
  5473. according to the source.
  5474. @item block
  5475. Set local patch size. This sets dimensions in 2D.
  5476. @item bstep
  5477. Set sliding step for processing blocks. Default value is 4.
  5478. Allowed range is from 1 to 64.
  5479. Smaller values allows processing more reference blocks and is slower.
  5480. @item group
  5481. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5482. When set to 1, no block matching is done. Larger values allows more blocks
  5483. in single group.
  5484. Allowed range is from 1 to 256.
  5485. @item range
  5486. Set radius for search block matching. Default is 9.
  5487. Allowed range is from 1 to INT32_MAX.
  5488. @item mstep
  5489. Set step between two search locations for block matching. Default is 1.
  5490. Allowed range is from 1 to 64. Smaller is slower.
  5491. @item thmse
  5492. Set threshold of mean square error for block matching. Valid range is 0 to
  5493. INT32_MAX.
  5494. @item hdthr
  5495. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5496. Larger values results in stronger hard-thresholding filtering in frequency
  5497. domain.
  5498. @item estim
  5499. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5500. Default is @code{basic}.
  5501. @item ref
  5502. If enabled, filter will use 2nd stream for block matching.
  5503. Default is disabled for @code{basic} value of @var{estim} option,
  5504. and always enabled if value of @var{estim} is @code{final}.
  5505. @item planes
  5506. Set planes to filter. Default is all available except alpha.
  5507. @end table
  5508. @subsection Examples
  5509. @itemize
  5510. @item
  5511. Basic filtering with bm3d:
  5512. @example
  5513. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5514. @end example
  5515. @item
  5516. Same as above, but filtering only luma:
  5517. @example
  5518. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5519. @end example
  5520. @item
  5521. Same as above, but with both estimation modes:
  5522. @example
  5523. 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
  5524. @end example
  5525. @item
  5526. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5527. @example
  5528. 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
  5529. @end example
  5530. @end itemize
  5531. @section boxblur
  5532. Apply a boxblur algorithm to the input video.
  5533. It accepts the following parameters:
  5534. @table @option
  5535. @item luma_radius, lr
  5536. @item luma_power, lp
  5537. @item chroma_radius, cr
  5538. @item chroma_power, cp
  5539. @item alpha_radius, ar
  5540. @item alpha_power, ap
  5541. @end table
  5542. A description of the accepted options follows.
  5543. @table @option
  5544. @item luma_radius, lr
  5545. @item chroma_radius, cr
  5546. @item alpha_radius, ar
  5547. Set an expression for the box radius in pixels used for blurring the
  5548. corresponding input plane.
  5549. The radius value must be a non-negative number, and must not be
  5550. greater than the value of the expression @code{min(w,h)/2} for the
  5551. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5552. planes.
  5553. Default value for @option{luma_radius} is "2". If not specified,
  5554. @option{chroma_radius} and @option{alpha_radius} default to the
  5555. corresponding value set for @option{luma_radius}.
  5556. The expressions can contain the following constants:
  5557. @table @option
  5558. @item w
  5559. @item h
  5560. The input width and height in pixels.
  5561. @item cw
  5562. @item ch
  5563. The input chroma image width and height in pixels.
  5564. @item hsub
  5565. @item vsub
  5566. The horizontal and vertical chroma subsample values. For example, for the
  5567. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5568. @end table
  5569. @item luma_power, lp
  5570. @item chroma_power, cp
  5571. @item alpha_power, ap
  5572. Specify how many times the boxblur filter is applied to the
  5573. corresponding plane.
  5574. Default value for @option{luma_power} is 2. If not specified,
  5575. @option{chroma_power} and @option{alpha_power} default to the
  5576. corresponding value set for @option{luma_power}.
  5577. A value of 0 will disable the effect.
  5578. @end table
  5579. @subsection Examples
  5580. @itemize
  5581. @item
  5582. Apply a boxblur filter with the luma, chroma, and alpha radii
  5583. set to 2:
  5584. @example
  5585. boxblur=luma_radius=2:luma_power=1
  5586. boxblur=2:1
  5587. @end example
  5588. @item
  5589. Set the luma radius to 2, and alpha and chroma radius to 0:
  5590. @example
  5591. boxblur=2:1:cr=0:ar=0
  5592. @end example
  5593. @item
  5594. Set the luma and chroma radii to a fraction of the video dimension:
  5595. @example
  5596. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5597. @end example
  5598. @end itemize
  5599. @section bwdif
  5600. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5601. Deinterlacing Filter").
  5602. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5603. interpolation algorithms.
  5604. It accepts the following parameters:
  5605. @table @option
  5606. @item mode
  5607. The interlacing mode to adopt. It accepts one of the following values:
  5608. @table @option
  5609. @item 0, send_frame
  5610. Output one frame for each frame.
  5611. @item 1, send_field
  5612. Output one frame for each field.
  5613. @end table
  5614. The default value is @code{send_field}.
  5615. @item parity
  5616. The picture field parity assumed for the input interlaced video. It accepts one
  5617. of the following values:
  5618. @table @option
  5619. @item 0, tff
  5620. Assume the top field is first.
  5621. @item 1, bff
  5622. Assume the bottom field is first.
  5623. @item -1, auto
  5624. Enable automatic detection of field parity.
  5625. @end table
  5626. The default value is @code{auto}.
  5627. If the interlacing is unknown or the decoder does not export this information,
  5628. top field first will be assumed.
  5629. @item deint
  5630. Specify which frames to deinterlace. Accepts one of the following
  5631. values:
  5632. @table @option
  5633. @item 0, all
  5634. Deinterlace all frames.
  5635. @item 1, interlaced
  5636. Only deinterlace frames marked as interlaced.
  5637. @end table
  5638. The default value is @code{all}.
  5639. @end table
  5640. @section cas
  5641. Apply Contrast Adaptive Sharpen filter to video stream.
  5642. The filter accepts the following options:
  5643. @table @option
  5644. @item strength
  5645. Set the sharpening strength. Default value is 0.
  5646. @item planes
  5647. Set planes to filter. Default value is to filter all
  5648. planes except alpha plane.
  5649. @end table
  5650. @section chromahold
  5651. Remove all color information for all colors except for certain one.
  5652. The filter accepts the following options:
  5653. @table @option
  5654. @item color
  5655. The color which will not be replaced with neutral chroma.
  5656. @item similarity
  5657. Similarity percentage with the above color.
  5658. 0.01 matches only the exact key color, while 1.0 matches everything.
  5659. @item blend
  5660. Blend percentage.
  5661. 0.0 makes pixels either fully gray, or not gray at all.
  5662. Higher values result in more preserved color.
  5663. @item yuv
  5664. Signals that the color passed is already in YUV instead of RGB.
  5665. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5666. This can be used to pass exact YUV values as hexadecimal numbers.
  5667. @end table
  5668. @subsection Commands
  5669. This filter supports same @ref{commands} as options.
  5670. The command accepts the same syntax of the corresponding option.
  5671. If the specified expression is not valid, it is kept at its current
  5672. value.
  5673. @section chromakey
  5674. YUV colorspace color/chroma keying.
  5675. The filter accepts the following options:
  5676. @table @option
  5677. @item color
  5678. The color which will be replaced with transparency.
  5679. @item similarity
  5680. Similarity percentage with the key color.
  5681. 0.01 matches only the exact key color, while 1.0 matches everything.
  5682. @item blend
  5683. Blend percentage.
  5684. 0.0 makes pixels either fully transparent, or not transparent at all.
  5685. Higher values result in semi-transparent pixels, with a higher transparency
  5686. the more similar the pixels color is to the key color.
  5687. @item yuv
  5688. Signals that the color passed is already in YUV instead of RGB.
  5689. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5690. This can be used to pass exact YUV values as hexadecimal numbers.
  5691. @end table
  5692. @subsection Commands
  5693. This filter supports same @ref{commands} as options.
  5694. The command accepts the same syntax of the corresponding option.
  5695. If the specified expression is not valid, it is kept at its current
  5696. value.
  5697. @subsection Examples
  5698. @itemize
  5699. @item
  5700. Make every green pixel in the input image transparent:
  5701. @example
  5702. ffmpeg -i input.png -vf chromakey=green out.png
  5703. @end example
  5704. @item
  5705. Overlay a greenscreen-video on top of a static black background.
  5706. @example
  5707. 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
  5708. @end example
  5709. @end itemize
  5710. @section chromanr
  5711. Reduce chrominance noise.
  5712. The filter accepts the following options:
  5713. @table @option
  5714. @item thres
  5715. Set threshold for averaging chrominance values.
  5716. Sum of absolute difference of U and V pixel components or current
  5717. pixel and neighbour pixels lower than this threshold will be used in
  5718. averaging. Luma component is left unchanged and is copied to output.
  5719. Default value is 30. Allowed range is from 1 to 200.
  5720. @item sizew
  5721. Set horizontal radius of rectangle used for averaging.
  5722. Allowed range is from 1 to 100. Default value is 5.
  5723. @item sizeh
  5724. Set vertical radius of rectangle used for averaging.
  5725. Allowed range is from 1 to 100. Default value is 5.
  5726. @item stepw
  5727. Set horizontal step when averaging. Default value is 1.
  5728. Allowed range is from 1 to 50.
  5729. Mostly useful to speed-up filtering.
  5730. @item steph
  5731. Set vertical step when averaging. Default value is 1.
  5732. Allowed range is from 1 to 50.
  5733. Mostly useful to speed-up filtering.
  5734. @end table
  5735. @subsection Commands
  5736. This filter supports same @ref{commands} as options.
  5737. The command accepts the same syntax of the corresponding option.
  5738. @section chromashift
  5739. Shift chroma pixels horizontally and/or vertically.
  5740. The filter accepts the following options:
  5741. @table @option
  5742. @item cbh
  5743. Set amount to shift chroma-blue horizontally.
  5744. @item cbv
  5745. Set amount to shift chroma-blue vertically.
  5746. @item crh
  5747. Set amount to shift chroma-red horizontally.
  5748. @item crv
  5749. Set amount to shift chroma-red vertically.
  5750. @item edge
  5751. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5752. @end table
  5753. @subsection Commands
  5754. This filter supports the all above options as @ref{commands}.
  5755. @section ciescope
  5756. Display CIE color diagram with pixels overlaid onto it.
  5757. The filter accepts the following options:
  5758. @table @option
  5759. @item system
  5760. Set color system.
  5761. @table @samp
  5762. @item ntsc, 470m
  5763. @item ebu, 470bg
  5764. @item smpte
  5765. @item 240m
  5766. @item apple
  5767. @item widergb
  5768. @item cie1931
  5769. @item rec709, hdtv
  5770. @item uhdtv, rec2020
  5771. @item dcip3
  5772. @end table
  5773. @item cie
  5774. Set CIE system.
  5775. @table @samp
  5776. @item xyy
  5777. @item ucs
  5778. @item luv
  5779. @end table
  5780. @item gamuts
  5781. Set what gamuts to draw.
  5782. See @code{system} option for available values.
  5783. @item size, s
  5784. Set ciescope size, by default set to 512.
  5785. @item intensity, i
  5786. Set intensity used to map input pixel values to CIE diagram.
  5787. @item contrast
  5788. Set contrast used to draw tongue colors that are out of active color system gamut.
  5789. @item corrgamma
  5790. Correct gamma displayed on scope, by default enabled.
  5791. @item showwhite
  5792. Show white point on CIE diagram, by default disabled.
  5793. @item gamma
  5794. Set input gamma. Used only with XYZ input color space.
  5795. @end table
  5796. @section codecview
  5797. Visualize information exported by some codecs.
  5798. Some codecs can export information through frames using side-data or other
  5799. means. For example, some MPEG based codecs export motion vectors through the
  5800. @var{export_mvs} flag in the codec @option{flags2} option.
  5801. The filter accepts the following option:
  5802. @table @option
  5803. @item mv
  5804. Set motion vectors to visualize.
  5805. Available flags for @var{mv} are:
  5806. @table @samp
  5807. @item pf
  5808. forward predicted MVs of P-frames
  5809. @item bf
  5810. forward predicted MVs of B-frames
  5811. @item bb
  5812. backward predicted MVs of B-frames
  5813. @end table
  5814. @item qp
  5815. Display quantization parameters using the chroma planes.
  5816. @item mv_type, mvt
  5817. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5818. Available flags for @var{mv_type} are:
  5819. @table @samp
  5820. @item fp
  5821. forward predicted MVs
  5822. @item bp
  5823. backward predicted MVs
  5824. @end table
  5825. @item frame_type, ft
  5826. Set frame type to visualize motion vectors of.
  5827. Available flags for @var{frame_type} are:
  5828. @table @samp
  5829. @item if
  5830. intra-coded frames (I-frames)
  5831. @item pf
  5832. predicted frames (P-frames)
  5833. @item bf
  5834. bi-directionally predicted frames (B-frames)
  5835. @end table
  5836. @end table
  5837. @subsection Examples
  5838. @itemize
  5839. @item
  5840. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5841. @example
  5842. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5843. @end example
  5844. @item
  5845. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5846. @example
  5847. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5848. @end example
  5849. @end itemize
  5850. @section colorbalance
  5851. Modify intensity of primary colors (red, green and blue) of input frames.
  5852. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5853. regions for the red-cyan, green-magenta or blue-yellow balance.
  5854. A positive adjustment value shifts the balance towards the primary color, a negative
  5855. value towards the complementary color.
  5856. The filter accepts the following options:
  5857. @table @option
  5858. @item rs
  5859. @item gs
  5860. @item bs
  5861. Adjust red, green and blue shadows (darkest pixels).
  5862. @item rm
  5863. @item gm
  5864. @item bm
  5865. Adjust red, green and blue midtones (medium pixels).
  5866. @item rh
  5867. @item gh
  5868. @item bh
  5869. Adjust red, green and blue highlights (brightest pixels).
  5870. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5871. @item pl
  5872. Preserve lightness when changing color balance. Default is disabled.
  5873. @end table
  5874. @subsection Examples
  5875. @itemize
  5876. @item
  5877. Add red color cast to shadows:
  5878. @example
  5879. colorbalance=rs=.3
  5880. @end example
  5881. @end itemize
  5882. @subsection Commands
  5883. This filter supports the all above options as @ref{commands}.
  5884. @section colorchannelmixer
  5885. Adjust video input frames by re-mixing color channels.
  5886. This filter modifies a color channel by adding the values associated to
  5887. the other channels of the same pixels. For example if the value to
  5888. modify is red, the output value will be:
  5889. @example
  5890. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5891. @end example
  5892. The filter accepts the following options:
  5893. @table @option
  5894. @item rr
  5895. @item rg
  5896. @item rb
  5897. @item ra
  5898. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5899. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5900. @item gr
  5901. @item gg
  5902. @item gb
  5903. @item ga
  5904. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5905. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5906. @item br
  5907. @item bg
  5908. @item bb
  5909. @item ba
  5910. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5911. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5912. @item ar
  5913. @item ag
  5914. @item ab
  5915. @item aa
  5916. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5917. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5918. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5919. @end table
  5920. @subsection Examples
  5921. @itemize
  5922. @item
  5923. Convert source to grayscale:
  5924. @example
  5925. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5926. @end example
  5927. @item
  5928. Simulate sepia tones:
  5929. @example
  5930. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5931. @end example
  5932. @end itemize
  5933. @subsection Commands
  5934. This filter supports the all above options as @ref{commands}.
  5935. @section colorkey
  5936. RGB colorspace color keying.
  5937. The filter accepts the following options:
  5938. @table @option
  5939. @item color
  5940. The color which will be replaced with transparency.
  5941. @item similarity
  5942. Similarity percentage with the key color.
  5943. 0.01 matches only the exact key color, while 1.0 matches everything.
  5944. @item blend
  5945. Blend percentage.
  5946. 0.0 makes pixels either fully transparent, or not transparent at all.
  5947. Higher values result in semi-transparent pixels, with a higher transparency
  5948. the more similar the pixels color is to the key color.
  5949. @end table
  5950. @subsection Examples
  5951. @itemize
  5952. @item
  5953. Make every green pixel in the input image transparent:
  5954. @example
  5955. ffmpeg -i input.png -vf colorkey=green out.png
  5956. @end example
  5957. @item
  5958. Overlay a greenscreen-video on top of a static background image.
  5959. @example
  5960. 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
  5961. @end example
  5962. @end itemize
  5963. @subsection Commands
  5964. This filter supports same @ref{commands} as options.
  5965. The command accepts the same syntax of the corresponding option.
  5966. If the specified expression is not valid, it is kept at its current
  5967. value.
  5968. @section colorhold
  5969. Remove all color information for all RGB colors except for certain one.
  5970. The filter accepts the following options:
  5971. @table @option
  5972. @item color
  5973. The color which will not be replaced with neutral gray.
  5974. @item similarity
  5975. Similarity percentage with the above color.
  5976. 0.01 matches only the exact key color, while 1.0 matches everything.
  5977. @item blend
  5978. Blend percentage. 0.0 makes pixels fully gray.
  5979. Higher values result in more preserved color.
  5980. @end table
  5981. @subsection Commands
  5982. This filter supports same @ref{commands} as options.
  5983. The command accepts the same syntax of the corresponding option.
  5984. If the specified expression is not valid, it is kept at its current
  5985. value.
  5986. @section colorlevels
  5987. Adjust video input frames using levels.
  5988. The filter accepts the following options:
  5989. @table @option
  5990. @item rimin
  5991. @item gimin
  5992. @item bimin
  5993. @item aimin
  5994. Adjust red, green, blue and alpha input black point.
  5995. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5996. @item rimax
  5997. @item gimax
  5998. @item bimax
  5999. @item aimax
  6000. Adjust red, green, blue and alpha input white point.
  6001. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6002. Input levels are used to lighten highlights (bright tones), darken shadows
  6003. (dark tones), change the balance of bright and dark tones.
  6004. @item romin
  6005. @item gomin
  6006. @item bomin
  6007. @item aomin
  6008. Adjust red, green, blue and alpha output black point.
  6009. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6010. @item romax
  6011. @item gomax
  6012. @item bomax
  6013. @item aomax
  6014. Adjust red, green, blue and alpha output white point.
  6015. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6016. Output levels allows manual selection of a constrained output level range.
  6017. @end table
  6018. @subsection Examples
  6019. @itemize
  6020. @item
  6021. Make video output darker:
  6022. @example
  6023. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6024. @end example
  6025. @item
  6026. Increase contrast:
  6027. @example
  6028. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6029. @end example
  6030. @item
  6031. Make video output lighter:
  6032. @example
  6033. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6034. @end example
  6035. @item
  6036. Increase brightness:
  6037. @example
  6038. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6039. @end example
  6040. @end itemize
  6041. @subsection Commands
  6042. This filter supports the all above options as @ref{commands}.
  6043. @section colormatrix
  6044. Convert color matrix.
  6045. The filter accepts the following options:
  6046. @table @option
  6047. @item src
  6048. @item dst
  6049. Specify the source and destination color matrix. Both values must be
  6050. specified.
  6051. The accepted values are:
  6052. @table @samp
  6053. @item bt709
  6054. BT.709
  6055. @item fcc
  6056. FCC
  6057. @item bt601
  6058. BT.601
  6059. @item bt470
  6060. BT.470
  6061. @item bt470bg
  6062. BT.470BG
  6063. @item smpte170m
  6064. SMPTE-170M
  6065. @item smpte240m
  6066. SMPTE-240M
  6067. @item bt2020
  6068. BT.2020
  6069. @end table
  6070. @end table
  6071. For example to convert from BT.601 to SMPTE-240M, use the command:
  6072. @example
  6073. colormatrix=bt601:smpte240m
  6074. @end example
  6075. @section colorspace
  6076. Convert colorspace, transfer characteristics or color primaries.
  6077. Input video needs to have an even size.
  6078. The filter accepts the following options:
  6079. @table @option
  6080. @anchor{all}
  6081. @item all
  6082. Specify all color properties at once.
  6083. The accepted values are:
  6084. @table @samp
  6085. @item bt470m
  6086. BT.470M
  6087. @item bt470bg
  6088. BT.470BG
  6089. @item bt601-6-525
  6090. BT.601-6 525
  6091. @item bt601-6-625
  6092. BT.601-6 625
  6093. @item bt709
  6094. BT.709
  6095. @item smpte170m
  6096. SMPTE-170M
  6097. @item smpte240m
  6098. SMPTE-240M
  6099. @item bt2020
  6100. BT.2020
  6101. @end table
  6102. @anchor{space}
  6103. @item space
  6104. Specify output colorspace.
  6105. The accepted values are:
  6106. @table @samp
  6107. @item bt709
  6108. BT.709
  6109. @item fcc
  6110. FCC
  6111. @item bt470bg
  6112. BT.470BG or BT.601-6 625
  6113. @item smpte170m
  6114. SMPTE-170M or BT.601-6 525
  6115. @item smpte240m
  6116. SMPTE-240M
  6117. @item ycgco
  6118. YCgCo
  6119. @item bt2020ncl
  6120. BT.2020 with non-constant luminance
  6121. @end table
  6122. @anchor{trc}
  6123. @item trc
  6124. Specify output transfer characteristics.
  6125. The accepted values are:
  6126. @table @samp
  6127. @item bt709
  6128. BT.709
  6129. @item bt470m
  6130. BT.470M
  6131. @item bt470bg
  6132. BT.470BG
  6133. @item gamma22
  6134. Constant gamma of 2.2
  6135. @item gamma28
  6136. Constant gamma of 2.8
  6137. @item smpte170m
  6138. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6139. @item smpte240m
  6140. SMPTE-240M
  6141. @item srgb
  6142. SRGB
  6143. @item iec61966-2-1
  6144. iec61966-2-1
  6145. @item iec61966-2-4
  6146. iec61966-2-4
  6147. @item xvycc
  6148. xvycc
  6149. @item bt2020-10
  6150. BT.2020 for 10-bits content
  6151. @item bt2020-12
  6152. BT.2020 for 12-bits content
  6153. @end table
  6154. @anchor{primaries}
  6155. @item primaries
  6156. Specify output color primaries.
  6157. The accepted values are:
  6158. @table @samp
  6159. @item bt709
  6160. BT.709
  6161. @item bt470m
  6162. BT.470M
  6163. @item bt470bg
  6164. BT.470BG or BT.601-6 625
  6165. @item smpte170m
  6166. SMPTE-170M or BT.601-6 525
  6167. @item smpte240m
  6168. SMPTE-240M
  6169. @item film
  6170. film
  6171. @item smpte431
  6172. SMPTE-431
  6173. @item smpte432
  6174. SMPTE-432
  6175. @item bt2020
  6176. BT.2020
  6177. @item jedec-p22
  6178. JEDEC P22 phosphors
  6179. @end table
  6180. @anchor{range}
  6181. @item range
  6182. Specify output color range.
  6183. The accepted values are:
  6184. @table @samp
  6185. @item tv
  6186. TV (restricted) range
  6187. @item mpeg
  6188. MPEG (restricted) range
  6189. @item pc
  6190. PC (full) range
  6191. @item jpeg
  6192. JPEG (full) range
  6193. @end table
  6194. @item format
  6195. Specify output color format.
  6196. The accepted values are:
  6197. @table @samp
  6198. @item yuv420p
  6199. YUV 4:2:0 planar 8-bits
  6200. @item yuv420p10
  6201. YUV 4:2:0 planar 10-bits
  6202. @item yuv420p12
  6203. YUV 4:2:0 planar 12-bits
  6204. @item yuv422p
  6205. YUV 4:2:2 planar 8-bits
  6206. @item yuv422p10
  6207. YUV 4:2:2 planar 10-bits
  6208. @item yuv422p12
  6209. YUV 4:2:2 planar 12-bits
  6210. @item yuv444p
  6211. YUV 4:4:4 planar 8-bits
  6212. @item yuv444p10
  6213. YUV 4:4:4 planar 10-bits
  6214. @item yuv444p12
  6215. YUV 4:4:4 planar 12-bits
  6216. @end table
  6217. @item fast
  6218. Do a fast conversion, which skips gamma/primary correction. This will take
  6219. significantly less CPU, but will be mathematically incorrect. To get output
  6220. compatible with that produced by the colormatrix filter, use fast=1.
  6221. @item dither
  6222. Specify dithering mode.
  6223. The accepted values are:
  6224. @table @samp
  6225. @item none
  6226. No dithering
  6227. @item fsb
  6228. Floyd-Steinberg dithering
  6229. @end table
  6230. @item wpadapt
  6231. Whitepoint adaptation mode.
  6232. The accepted values are:
  6233. @table @samp
  6234. @item bradford
  6235. Bradford whitepoint adaptation
  6236. @item vonkries
  6237. von Kries whitepoint adaptation
  6238. @item identity
  6239. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6240. @end table
  6241. @item iall
  6242. Override all input properties at once. Same accepted values as @ref{all}.
  6243. @item ispace
  6244. Override input colorspace. Same accepted values as @ref{space}.
  6245. @item iprimaries
  6246. Override input color primaries. Same accepted values as @ref{primaries}.
  6247. @item itrc
  6248. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6249. @item irange
  6250. Override input color range. Same accepted values as @ref{range}.
  6251. @end table
  6252. The filter converts the transfer characteristics, color space and color
  6253. primaries to the specified user values. The output value, if not specified,
  6254. is set to a default value based on the "all" property. If that property is
  6255. also not specified, the filter will log an error. The output color range and
  6256. format default to the same value as the input color range and format. The
  6257. input transfer characteristics, color space, color primaries and color range
  6258. should be set on the input data. If any of these are missing, the filter will
  6259. log an error and no conversion will take place.
  6260. For example to convert the input to SMPTE-240M, use the command:
  6261. @example
  6262. colorspace=smpte240m
  6263. @end example
  6264. @section convolution
  6265. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6266. The filter accepts the following options:
  6267. @table @option
  6268. @item 0m
  6269. @item 1m
  6270. @item 2m
  6271. @item 3m
  6272. Set matrix for each plane.
  6273. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6274. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6275. @item 0rdiv
  6276. @item 1rdiv
  6277. @item 2rdiv
  6278. @item 3rdiv
  6279. Set multiplier for calculated value for each plane.
  6280. If unset or 0, it will be sum of all matrix elements.
  6281. @item 0bias
  6282. @item 1bias
  6283. @item 2bias
  6284. @item 3bias
  6285. Set bias for each plane. This value is added to the result of the multiplication.
  6286. Useful for making the overall image brighter or darker. Default is 0.0.
  6287. @item 0mode
  6288. @item 1mode
  6289. @item 2mode
  6290. @item 3mode
  6291. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6292. Default is @var{square}.
  6293. @end table
  6294. @subsection Examples
  6295. @itemize
  6296. @item
  6297. Apply sharpen:
  6298. @example
  6299. 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"
  6300. @end example
  6301. @item
  6302. Apply blur:
  6303. @example
  6304. 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"
  6305. @end example
  6306. @item
  6307. Apply edge enhance:
  6308. @example
  6309. 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"
  6310. @end example
  6311. @item
  6312. Apply edge detect:
  6313. @example
  6314. 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"
  6315. @end example
  6316. @item
  6317. Apply laplacian edge detector which includes diagonals:
  6318. @example
  6319. 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"
  6320. @end example
  6321. @item
  6322. Apply emboss:
  6323. @example
  6324. 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"
  6325. @end example
  6326. @end itemize
  6327. @section convolve
  6328. Apply 2D convolution of video stream in frequency domain using second stream
  6329. as impulse.
  6330. The filter accepts the following options:
  6331. @table @option
  6332. @item planes
  6333. Set which planes to process.
  6334. @item impulse
  6335. Set which impulse video frames will be processed, can be @var{first}
  6336. or @var{all}. Default is @var{all}.
  6337. @end table
  6338. The @code{convolve} filter also supports the @ref{framesync} options.
  6339. @section copy
  6340. Copy the input video source unchanged to the output. This is mainly useful for
  6341. testing purposes.
  6342. @anchor{coreimage}
  6343. @section coreimage
  6344. Video filtering on GPU using Apple's CoreImage API on OSX.
  6345. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6346. processed by video hardware. However, software-based OpenGL implementations
  6347. exist which means there is no guarantee for hardware processing. It depends on
  6348. the respective OSX.
  6349. There are many filters and image generators provided by Apple that come with a
  6350. large variety of options. The filter has to be referenced by its name along
  6351. with its options.
  6352. The coreimage filter accepts the following options:
  6353. @table @option
  6354. @item list_filters
  6355. List all available filters and generators along with all their respective
  6356. options as well as possible minimum and maximum values along with the default
  6357. values.
  6358. @example
  6359. list_filters=true
  6360. @end example
  6361. @item filter
  6362. Specify all filters by their respective name and options.
  6363. Use @var{list_filters} to determine all valid filter names and options.
  6364. Numerical options are specified by a float value and are automatically clamped
  6365. to their respective value range. Vector and color options have to be specified
  6366. by a list of space separated float values. Character escaping has to be done.
  6367. A special option name @code{default} is available to use default options for a
  6368. filter.
  6369. It is required to specify either @code{default} or at least one of the filter options.
  6370. All omitted options are used with their default values.
  6371. The syntax of the filter string is as follows:
  6372. @example
  6373. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6374. @end example
  6375. @item output_rect
  6376. Specify a rectangle where the output of the filter chain is copied into the
  6377. input image. It is given by a list of space separated float values:
  6378. @example
  6379. output_rect=x\ y\ width\ height
  6380. @end example
  6381. If not given, the output rectangle equals the dimensions of the input image.
  6382. The output rectangle is automatically cropped at the borders of the input
  6383. image. Negative values are valid for each component.
  6384. @example
  6385. output_rect=25\ 25\ 100\ 100
  6386. @end example
  6387. @end table
  6388. Several filters can be chained for successive processing without GPU-HOST
  6389. transfers allowing for fast processing of complex filter chains.
  6390. Currently, only filters with zero (generators) or exactly one (filters) input
  6391. image and one output image are supported. Also, transition filters are not yet
  6392. usable as intended.
  6393. Some filters generate output images with additional padding depending on the
  6394. respective filter kernel. The padding is automatically removed to ensure the
  6395. filter output has the same size as the input image.
  6396. For image generators, the size of the output image is determined by the
  6397. previous output image of the filter chain or the input image of the whole
  6398. filterchain, respectively. The generators do not use the pixel information of
  6399. this image to generate their output. However, the generated output is
  6400. blended onto this image, resulting in partial or complete coverage of the
  6401. output image.
  6402. The @ref{coreimagesrc} video source can be used for generating input images
  6403. which are directly fed into the filter chain. By using it, providing input
  6404. images by another video source or an input video is not required.
  6405. @subsection Examples
  6406. @itemize
  6407. @item
  6408. List all filters available:
  6409. @example
  6410. coreimage=list_filters=true
  6411. @end example
  6412. @item
  6413. Use the CIBoxBlur filter with default options to blur an image:
  6414. @example
  6415. coreimage=filter=CIBoxBlur@@default
  6416. @end example
  6417. @item
  6418. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6419. its center at 100x100 and a radius of 50 pixels:
  6420. @example
  6421. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6422. @end example
  6423. @item
  6424. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6425. given as complete and escaped command-line for Apple's standard bash shell:
  6426. @example
  6427. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6428. @end example
  6429. @end itemize
  6430. @section cover_rect
  6431. Cover a rectangular object
  6432. It accepts the following options:
  6433. @table @option
  6434. @item cover
  6435. Filepath of the optional cover image, needs to be in yuv420.
  6436. @item mode
  6437. Set covering mode.
  6438. It accepts the following values:
  6439. @table @samp
  6440. @item cover
  6441. cover it by the supplied image
  6442. @item blur
  6443. cover it by interpolating the surrounding pixels
  6444. @end table
  6445. Default value is @var{blur}.
  6446. @end table
  6447. @subsection Examples
  6448. @itemize
  6449. @item
  6450. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6451. @example
  6452. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6453. @end example
  6454. @end itemize
  6455. @section crop
  6456. Crop the input video to given dimensions.
  6457. It accepts the following parameters:
  6458. @table @option
  6459. @item w, out_w
  6460. The width of the output video. It defaults to @code{iw}.
  6461. This expression is evaluated only once during the filter
  6462. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6463. @item h, out_h
  6464. The height of the output video. It defaults to @code{ih}.
  6465. This expression is evaluated only once during the filter
  6466. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6467. @item x
  6468. The horizontal position, in the input video, of the left edge of the output
  6469. video. It defaults to @code{(in_w-out_w)/2}.
  6470. This expression is evaluated per-frame.
  6471. @item y
  6472. The vertical position, in the input video, of the top edge of the output video.
  6473. It defaults to @code{(in_h-out_h)/2}.
  6474. This expression is evaluated per-frame.
  6475. @item keep_aspect
  6476. If set to 1 will force the output display aspect ratio
  6477. to be the same of the input, by changing the output sample aspect
  6478. ratio. It defaults to 0.
  6479. @item exact
  6480. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6481. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6482. It defaults to 0.
  6483. @end table
  6484. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6485. expressions containing the following constants:
  6486. @table @option
  6487. @item x
  6488. @item y
  6489. The computed values for @var{x} and @var{y}. They are evaluated for
  6490. each new frame.
  6491. @item in_w
  6492. @item in_h
  6493. The input width and height.
  6494. @item iw
  6495. @item ih
  6496. These are the same as @var{in_w} and @var{in_h}.
  6497. @item out_w
  6498. @item out_h
  6499. The output (cropped) width and height.
  6500. @item ow
  6501. @item oh
  6502. These are the same as @var{out_w} and @var{out_h}.
  6503. @item a
  6504. same as @var{iw} / @var{ih}
  6505. @item sar
  6506. input sample aspect ratio
  6507. @item dar
  6508. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6509. @item hsub
  6510. @item vsub
  6511. horizontal and vertical chroma subsample values. For example for the
  6512. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6513. @item n
  6514. The number of the input frame, starting from 0.
  6515. @item pos
  6516. the position in the file of the input frame, NAN if unknown
  6517. @item t
  6518. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6519. @end table
  6520. The expression for @var{out_w} may depend on the value of @var{out_h},
  6521. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6522. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6523. evaluated after @var{out_w} and @var{out_h}.
  6524. The @var{x} and @var{y} parameters specify the expressions for the
  6525. position of the top-left corner of the output (non-cropped) area. They
  6526. are evaluated for each frame. If the evaluated value is not valid, it
  6527. is approximated to the nearest valid value.
  6528. The expression for @var{x} may depend on @var{y}, and the expression
  6529. for @var{y} may depend on @var{x}.
  6530. @subsection Examples
  6531. @itemize
  6532. @item
  6533. Crop area with size 100x100 at position (12,34).
  6534. @example
  6535. crop=100:100:12:34
  6536. @end example
  6537. Using named options, the example above becomes:
  6538. @example
  6539. crop=w=100:h=100:x=12:y=34
  6540. @end example
  6541. @item
  6542. Crop the central input area with size 100x100:
  6543. @example
  6544. crop=100:100
  6545. @end example
  6546. @item
  6547. Crop the central input area with size 2/3 of the input video:
  6548. @example
  6549. crop=2/3*in_w:2/3*in_h
  6550. @end example
  6551. @item
  6552. Crop the input video central square:
  6553. @example
  6554. crop=out_w=in_h
  6555. crop=in_h
  6556. @end example
  6557. @item
  6558. Delimit the rectangle with the top-left corner placed at position
  6559. 100:100 and the right-bottom corner corresponding to the right-bottom
  6560. corner of the input image.
  6561. @example
  6562. crop=in_w-100:in_h-100:100:100
  6563. @end example
  6564. @item
  6565. Crop 10 pixels from the left and right borders, and 20 pixels from
  6566. the top and bottom borders
  6567. @example
  6568. crop=in_w-2*10:in_h-2*20
  6569. @end example
  6570. @item
  6571. Keep only the bottom right quarter of the input image:
  6572. @example
  6573. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6574. @end example
  6575. @item
  6576. Crop height for getting Greek harmony:
  6577. @example
  6578. crop=in_w:1/PHI*in_w
  6579. @end example
  6580. @item
  6581. Apply trembling effect:
  6582. @example
  6583. 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)
  6584. @end example
  6585. @item
  6586. Apply erratic camera effect depending on timestamp:
  6587. @example
  6588. 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)"
  6589. @end example
  6590. @item
  6591. Set x depending on the value of y:
  6592. @example
  6593. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6594. @end example
  6595. @end itemize
  6596. @subsection Commands
  6597. This filter supports the following commands:
  6598. @table @option
  6599. @item w, out_w
  6600. @item h, out_h
  6601. @item x
  6602. @item y
  6603. Set width/height of the output video and the horizontal/vertical position
  6604. in the input video.
  6605. The command accepts the same syntax of the corresponding option.
  6606. If the specified expression is not valid, it is kept at its current
  6607. value.
  6608. @end table
  6609. @section cropdetect
  6610. Auto-detect the crop size.
  6611. It calculates the necessary cropping parameters and prints the
  6612. recommended parameters via the logging system. The detected dimensions
  6613. correspond to the non-black area of the input video.
  6614. It accepts the following parameters:
  6615. @table @option
  6616. @item limit
  6617. Set higher black value threshold, which can be optionally specified
  6618. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6619. value greater to the set value is considered non-black. It defaults to 24.
  6620. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6621. on the bitdepth of the pixel format.
  6622. @item round
  6623. The value which the width/height should be divisible by. It defaults to
  6624. 16. The offset is automatically adjusted to center the video. Use 2 to
  6625. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6626. encoding to most video codecs.
  6627. @item reset_count, reset
  6628. Set the counter that determines after how many frames cropdetect will
  6629. reset the previously detected largest video area and start over to
  6630. detect the current optimal crop area. Default value is 0.
  6631. This can be useful when channel logos distort the video area. 0
  6632. indicates 'never reset', and returns the largest area encountered during
  6633. playback.
  6634. @end table
  6635. @anchor{cue}
  6636. @section cue
  6637. Delay video filtering until a given wallclock timestamp. The filter first
  6638. passes on @option{preroll} amount of frames, then it buffers at most
  6639. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6640. it forwards the buffered frames and also any subsequent frames coming in its
  6641. input.
  6642. The filter can be used synchronize the output of multiple ffmpeg processes for
  6643. realtime output devices like decklink. By putting the delay in the filtering
  6644. chain and pre-buffering frames the process can pass on data to output almost
  6645. immediately after the target wallclock timestamp is reached.
  6646. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6647. some use cases.
  6648. @table @option
  6649. @item cue
  6650. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6651. @item preroll
  6652. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6653. @item buffer
  6654. The maximum duration of content to buffer before waiting for the cue expressed
  6655. in seconds. Default is 0.
  6656. @end table
  6657. @anchor{curves}
  6658. @section curves
  6659. Apply color adjustments using curves.
  6660. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6661. component (red, green and blue) has its values defined by @var{N} key points
  6662. tied from each other using a smooth curve. The x-axis represents the pixel
  6663. values from the input frame, and the y-axis the new pixel values to be set for
  6664. the output frame.
  6665. By default, a component curve is defined by the two points @var{(0;0)} and
  6666. @var{(1;1)}. This creates a straight line where each original pixel value is
  6667. "adjusted" to its own value, which means no change to the image.
  6668. The filter allows you to redefine these two points and add some more. A new
  6669. curve (using a natural cubic spline interpolation) will be define to pass
  6670. smoothly through all these new coordinates. The new defined points needs to be
  6671. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6672. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6673. the vector spaces, the values will be clipped accordingly.
  6674. The filter accepts the following options:
  6675. @table @option
  6676. @item preset
  6677. Select one of the available color presets. This option can be used in addition
  6678. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6679. options takes priority on the preset values.
  6680. Available presets are:
  6681. @table @samp
  6682. @item none
  6683. @item color_negative
  6684. @item cross_process
  6685. @item darker
  6686. @item increase_contrast
  6687. @item lighter
  6688. @item linear_contrast
  6689. @item medium_contrast
  6690. @item negative
  6691. @item strong_contrast
  6692. @item vintage
  6693. @end table
  6694. Default is @code{none}.
  6695. @item master, m
  6696. Set the master key points. These points will define a second pass mapping. It
  6697. is sometimes called a "luminance" or "value" mapping. It can be used with
  6698. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6699. post-processing LUT.
  6700. @item red, r
  6701. Set the key points for the red component.
  6702. @item green, g
  6703. Set the key points for the green component.
  6704. @item blue, b
  6705. Set the key points for the blue component.
  6706. @item all
  6707. Set the key points for all components (not including master).
  6708. Can be used in addition to the other key points component
  6709. options. In this case, the unset component(s) will fallback on this
  6710. @option{all} setting.
  6711. @item psfile
  6712. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6713. @item plot
  6714. Save Gnuplot script of the curves in specified file.
  6715. @end table
  6716. To avoid some filtergraph syntax conflicts, each key points list need to be
  6717. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6718. @subsection Examples
  6719. @itemize
  6720. @item
  6721. Increase slightly the middle level of blue:
  6722. @example
  6723. curves=blue='0/0 0.5/0.58 1/1'
  6724. @end example
  6725. @item
  6726. Vintage effect:
  6727. @example
  6728. 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'
  6729. @end example
  6730. Here we obtain the following coordinates for each components:
  6731. @table @var
  6732. @item red
  6733. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6734. @item green
  6735. @code{(0;0) (0.50;0.48) (1;1)}
  6736. @item blue
  6737. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6738. @end table
  6739. @item
  6740. The previous example can also be achieved with the associated built-in preset:
  6741. @example
  6742. curves=preset=vintage
  6743. @end example
  6744. @item
  6745. Or simply:
  6746. @example
  6747. curves=vintage
  6748. @end example
  6749. @item
  6750. Use a Photoshop preset and redefine the points of the green component:
  6751. @example
  6752. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6753. @end example
  6754. @item
  6755. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6756. and @command{gnuplot}:
  6757. @example
  6758. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6759. gnuplot -p /tmp/curves.plt
  6760. @end example
  6761. @end itemize
  6762. @section datascope
  6763. Video data analysis filter.
  6764. This filter shows hexadecimal pixel values of part of video.
  6765. The filter accepts the following options:
  6766. @table @option
  6767. @item size, s
  6768. Set output video size.
  6769. @item x
  6770. Set x offset from where to pick pixels.
  6771. @item y
  6772. Set y offset from where to pick pixels.
  6773. @item mode
  6774. Set scope mode, can be one of the following:
  6775. @table @samp
  6776. @item mono
  6777. Draw hexadecimal pixel values with white color on black background.
  6778. @item color
  6779. Draw hexadecimal pixel values with input video pixel color on black
  6780. background.
  6781. @item color2
  6782. Draw hexadecimal pixel values on color background picked from input video,
  6783. the text color is picked in such way so its always visible.
  6784. @end table
  6785. @item axis
  6786. Draw rows and columns numbers on left and top of video.
  6787. @item opacity
  6788. Set background opacity.
  6789. @item format
  6790. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6791. @end table
  6792. @section dblur
  6793. Apply Directional blur filter.
  6794. The filter accepts the following options:
  6795. @table @option
  6796. @item angle
  6797. Set angle of directional blur. Default is @code{45}.
  6798. @item radius
  6799. Set radius of directional blur. Default is @code{5}.
  6800. @item planes
  6801. Set which planes to filter. By default all planes are filtered.
  6802. @end table
  6803. @subsection Commands
  6804. This filter supports same @ref{commands} as options.
  6805. The command accepts the same syntax of the corresponding option.
  6806. If the specified expression is not valid, it is kept at its current
  6807. value.
  6808. @section dctdnoiz
  6809. Denoise frames using 2D DCT (frequency domain filtering).
  6810. This filter is not designed for real time.
  6811. The filter accepts the following options:
  6812. @table @option
  6813. @item sigma, s
  6814. Set the noise sigma constant.
  6815. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6816. coefficient (absolute value) below this threshold with be dropped.
  6817. If you need a more advanced filtering, see @option{expr}.
  6818. Default is @code{0}.
  6819. @item overlap
  6820. Set number overlapping pixels for each block. Since the filter can be slow, you
  6821. may want to reduce this value, at the cost of a less effective filter and the
  6822. risk of various artefacts.
  6823. If the overlapping value doesn't permit processing the whole input width or
  6824. height, a warning will be displayed and according borders won't be denoised.
  6825. Default value is @var{blocksize}-1, which is the best possible setting.
  6826. @item expr, e
  6827. Set the coefficient factor expression.
  6828. For each coefficient of a DCT block, this expression will be evaluated as a
  6829. multiplier value for the coefficient.
  6830. If this is option is set, the @option{sigma} option will be ignored.
  6831. The absolute value of the coefficient can be accessed through the @var{c}
  6832. variable.
  6833. @item n
  6834. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6835. @var{blocksize}, which is the width and height of the processed blocks.
  6836. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6837. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6838. on the speed processing. Also, a larger block size does not necessarily means a
  6839. better de-noising.
  6840. @end table
  6841. @subsection Examples
  6842. Apply a denoise with a @option{sigma} of @code{4.5}:
  6843. @example
  6844. dctdnoiz=4.5
  6845. @end example
  6846. The same operation can be achieved using the expression system:
  6847. @example
  6848. dctdnoiz=e='gte(c, 4.5*3)'
  6849. @end example
  6850. Violent denoise using a block size of @code{16x16}:
  6851. @example
  6852. dctdnoiz=15:n=4
  6853. @end example
  6854. @section deband
  6855. Remove banding artifacts from input video.
  6856. It works by replacing banded pixels with average value of referenced pixels.
  6857. The filter accepts the following options:
  6858. @table @option
  6859. @item 1thr
  6860. @item 2thr
  6861. @item 3thr
  6862. @item 4thr
  6863. Set banding detection threshold for each plane. Default is 0.02.
  6864. Valid range is 0.00003 to 0.5.
  6865. If difference between current pixel and reference pixel is less than threshold,
  6866. it will be considered as banded.
  6867. @item range, r
  6868. Banding detection range in pixels. Default is 16. If positive, random number
  6869. in range 0 to set value will be used. If negative, exact absolute value
  6870. will be used.
  6871. The range defines square of four pixels around current pixel.
  6872. @item direction, d
  6873. Set direction in radians from which four pixel will be compared. If positive,
  6874. random direction from 0 to set direction will be picked. If negative, exact of
  6875. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6876. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6877. column.
  6878. @item blur, b
  6879. If enabled, current pixel is compared with average value of all four
  6880. surrounding pixels. The default is enabled. If disabled current pixel is
  6881. compared with all four surrounding pixels. The pixel is considered banded
  6882. if only all four differences with surrounding pixels are less than threshold.
  6883. @item coupling, c
  6884. If enabled, current pixel is changed if and only if all pixel components are banded,
  6885. e.g. banding detection threshold is triggered for all color components.
  6886. The default is disabled.
  6887. @end table
  6888. @section deblock
  6889. Remove blocking artifacts from input video.
  6890. The filter accepts the following options:
  6891. @table @option
  6892. @item filter
  6893. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6894. This controls what kind of deblocking is applied.
  6895. @item block
  6896. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6897. @item alpha
  6898. @item beta
  6899. @item gamma
  6900. @item delta
  6901. Set blocking detection thresholds. Allowed range is 0 to 1.
  6902. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6903. Using higher threshold gives more deblocking strength.
  6904. Setting @var{alpha} controls threshold detection at exact edge of block.
  6905. Remaining options controls threshold detection near the edge. Each one for
  6906. below/above or left/right. Setting any of those to @var{0} disables
  6907. deblocking.
  6908. @item planes
  6909. Set planes to filter. Default is to filter all available planes.
  6910. @end table
  6911. @subsection Examples
  6912. @itemize
  6913. @item
  6914. Deblock using weak filter and block size of 4 pixels.
  6915. @example
  6916. deblock=filter=weak:block=4
  6917. @end example
  6918. @item
  6919. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6920. deblocking more edges.
  6921. @example
  6922. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6923. @end example
  6924. @item
  6925. Similar as above, but filter only first plane.
  6926. @example
  6927. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6928. @end example
  6929. @item
  6930. Similar as above, but filter only second and third plane.
  6931. @example
  6932. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6933. @end example
  6934. @end itemize
  6935. @anchor{decimate}
  6936. @section decimate
  6937. Drop duplicated frames at regular intervals.
  6938. The filter accepts the following options:
  6939. @table @option
  6940. @item cycle
  6941. Set the number of frames from which one will be dropped. Setting this to
  6942. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6943. Default is @code{5}.
  6944. @item dupthresh
  6945. Set the threshold for duplicate detection. If the difference metric for a frame
  6946. is less than or equal to this value, then it is declared as duplicate. Default
  6947. is @code{1.1}
  6948. @item scthresh
  6949. Set scene change threshold. Default is @code{15}.
  6950. @item blockx
  6951. @item blocky
  6952. Set the size of the x and y-axis blocks used during metric calculations.
  6953. Larger blocks give better noise suppression, but also give worse detection of
  6954. small movements. Must be a power of two. Default is @code{32}.
  6955. @item ppsrc
  6956. Mark main input as a pre-processed input and activate clean source input
  6957. stream. This allows the input to be pre-processed with various filters to help
  6958. the metrics calculation while keeping the frame selection lossless. When set to
  6959. @code{1}, the first stream is for the pre-processed input, and the second
  6960. stream is the clean source from where the kept frames are chosen. Default is
  6961. @code{0}.
  6962. @item chroma
  6963. Set whether or not chroma is considered in the metric calculations. Default is
  6964. @code{1}.
  6965. @end table
  6966. @section deconvolve
  6967. Apply 2D deconvolution of video stream in frequency domain using second stream
  6968. as impulse.
  6969. The filter accepts the following options:
  6970. @table @option
  6971. @item planes
  6972. Set which planes to process.
  6973. @item impulse
  6974. Set which impulse video frames will be processed, can be @var{first}
  6975. or @var{all}. Default is @var{all}.
  6976. @item noise
  6977. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6978. and height are not same and not power of 2 or if stream prior to convolving
  6979. had noise.
  6980. @end table
  6981. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6982. @section dedot
  6983. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6984. It accepts the following options:
  6985. @table @option
  6986. @item m
  6987. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6988. @var{rainbows} for cross-color reduction.
  6989. @item lt
  6990. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6991. @item tl
  6992. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6993. @item tc
  6994. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6995. @item ct
  6996. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6997. @end table
  6998. @section deflate
  6999. Apply deflate effect to the video.
  7000. This filter replaces the pixel by the local(3x3) average by taking into account
  7001. only values lower than the pixel.
  7002. It accepts the following options:
  7003. @table @option
  7004. @item threshold0
  7005. @item threshold1
  7006. @item threshold2
  7007. @item threshold3
  7008. Limit the maximum change for each plane, default is 65535.
  7009. If 0, plane will remain unchanged.
  7010. @end table
  7011. @subsection Commands
  7012. This filter supports the all above options as @ref{commands}.
  7013. @section deflicker
  7014. Remove temporal frame luminance variations.
  7015. It accepts the following options:
  7016. @table @option
  7017. @item size, s
  7018. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7019. @item mode, m
  7020. Set averaging mode to smooth temporal luminance variations.
  7021. Available values are:
  7022. @table @samp
  7023. @item am
  7024. Arithmetic mean
  7025. @item gm
  7026. Geometric mean
  7027. @item hm
  7028. Harmonic mean
  7029. @item qm
  7030. Quadratic mean
  7031. @item cm
  7032. Cubic mean
  7033. @item pm
  7034. Power mean
  7035. @item median
  7036. Median
  7037. @end table
  7038. @item bypass
  7039. Do not actually modify frame. Useful when one only wants metadata.
  7040. @end table
  7041. @section dejudder
  7042. Remove judder produced by partially interlaced telecined content.
  7043. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7044. source was partially telecined content then the output of @code{pullup,dejudder}
  7045. will have a variable frame rate. May change the recorded frame rate of the
  7046. container. Aside from that change, this filter will not affect constant frame
  7047. rate video.
  7048. The option available in this filter is:
  7049. @table @option
  7050. @item cycle
  7051. Specify the length of the window over which the judder repeats.
  7052. Accepts any integer greater than 1. Useful values are:
  7053. @table @samp
  7054. @item 4
  7055. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7056. @item 5
  7057. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7058. @item 20
  7059. If a mixture of the two.
  7060. @end table
  7061. The default is @samp{4}.
  7062. @end table
  7063. @section delogo
  7064. Suppress a TV station logo by a simple interpolation of the surrounding
  7065. pixels. Just set a rectangle covering the logo and watch it disappear
  7066. (and sometimes something even uglier appear - your mileage may vary).
  7067. It accepts the following parameters:
  7068. @table @option
  7069. @item x
  7070. @item y
  7071. Specify the top left corner coordinates of the logo. They must be
  7072. specified.
  7073. @item w
  7074. @item h
  7075. Specify the width and height of the logo to clear. They must be
  7076. specified.
  7077. @item band, t
  7078. Specify the thickness of the fuzzy edge of the rectangle (added to
  7079. @var{w} and @var{h}). The default value is 1. This option is
  7080. deprecated, setting higher values should no longer be necessary and
  7081. is not recommended.
  7082. @item show
  7083. When set to 1, a green rectangle is drawn on the screen to simplify
  7084. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7085. The default value is 0.
  7086. The rectangle is drawn on the outermost pixels which will be (partly)
  7087. replaced with interpolated values. The values of the next pixels
  7088. immediately outside this rectangle in each direction will be used to
  7089. compute the interpolated pixel values inside the rectangle.
  7090. @end table
  7091. @subsection Examples
  7092. @itemize
  7093. @item
  7094. Set a rectangle covering the area with top left corner coordinates 0,0
  7095. and size 100x77, and a band of size 10:
  7096. @example
  7097. delogo=x=0:y=0:w=100:h=77:band=10
  7098. @end example
  7099. @end itemize
  7100. @anchor{derain}
  7101. @section derain
  7102. Remove the rain in the input image/video by applying the derain methods based on
  7103. convolutional neural networks. Supported models:
  7104. @itemize
  7105. @item
  7106. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7107. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7108. @end itemize
  7109. Training as well as model generation scripts are provided in
  7110. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7111. Native model files (.model) can be generated from TensorFlow model
  7112. files (.pb) by using tools/python/convert.py
  7113. The filter accepts the following options:
  7114. @table @option
  7115. @item filter_type
  7116. Specify which filter to use. This option accepts the following values:
  7117. @table @samp
  7118. @item derain
  7119. Derain filter. To conduct derain filter, you need to use a derain model.
  7120. @item dehaze
  7121. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7122. @end table
  7123. Default value is @samp{derain}.
  7124. @item dnn_backend
  7125. Specify which DNN backend to use for model loading and execution. This option accepts
  7126. the following values:
  7127. @table @samp
  7128. @item native
  7129. Native implementation of DNN loading and execution.
  7130. @item tensorflow
  7131. TensorFlow backend. To enable this backend you
  7132. need to install the TensorFlow for C library (see
  7133. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7134. @code{--enable-libtensorflow}
  7135. @end table
  7136. Default value is @samp{native}.
  7137. @item model
  7138. Set path to model file specifying network architecture and its parameters.
  7139. Note that different backends use different file formats. TensorFlow and native
  7140. backend can load files for only its format.
  7141. @end table
  7142. It can also be finished with @ref{dnn_processing} filter.
  7143. @section deshake
  7144. Attempt to fix small changes in horizontal and/or vertical shift. This
  7145. filter helps remove camera shake from hand-holding a camera, bumping a
  7146. tripod, moving on a vehicle, etc.
  7147. The filter accepts the following options:
  7148. @table @option
  7149. @item x
  7150. @item y
  7151. @item w
  7152. @item h
  7153. Specify a rectangular area where to limit the search for motion
  7154. vectors.
  7155. If desired the search for motion vectors can be limited to a
  7156. rectangular area of the frame defined by its top left corner, width
  7157. and height. These parameters have the same meaning as the drawbox
  7158. filter which can be used to visualise the position of the bounding
  7159. box.
  7160. This is useful when simultaneous movement of subjects within the frame
  7161. might be confused for camera motion by the motion vector search.
  7162. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7163. then the full frame is used. This allows later options to be set
  7164. without specifying the bounding box for the motion vector search.
  7165. Default - search the whole frame.
  7166. @item rx
  7167. @item ry
  7168. Specify the maximum extent of movement in x and y directions in the
  7169. range 0-64 pixels. Default 16.
  7170. @item edge
  7171. Specify how to generate pixels to fill blanks at the edge of the
  7172. frame. Available values are:
  7173. @table @samp
  7174. @item blank, 0
  7175. Fill zeroes at blank locations
  7176. @item original, 1
  7177. Original image at blank locations
  7178. @item clamp, 2
  7179. Extruded edge value at blank locations
  7180. @item mirror, 3
  7181. Mirrored edge at blank locations
  7182. @end table
  7183. Default value is @samp{mirror}.
  7184. @item blocksize
  7185. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7186. default 8.
  7187. @item contrast
  7188. Specify the contrast threshold for blocks. Only blocks with more than
  7189. the specified contrast (difference between darkest and lightest
  7190. pixels) will be considered. Range 1-255, default 125.
  7191. @item search
  7192. Specify the search strategy. Available values are:
  7193. @table @samp
  7194. @item exhaustive, 0
  7195. Set exhaustive search
  7196. @item less, 1
  7197. Set less exhaustive search.
  7198. @end table
  7199. Default value is @samp{exhaustive}.
  7200. @item filename
  7201. If set then a detailed log of the motion search is written to the
  7202. specified file.
  7203. @end table
  7204. @section despill
  7205. Remove unwanted contamination of foreground colors, caused by reflected color of
  7206. greenscreen or bluescreen.
  7207. This filter accepts the following options:
  7208. @table @option
  7209. @item type
  7210. Set what type of despill to use.
  7211. @item mix
  7212. Set how spillmap will be generated.
  7213. @item expand
  7214. Set how much to get rid of still remaining spill.
  7215. @item red
  7216. Controls amount of red in spill area.
  7217. @item green
  7218. Controls amount of green in spill area.
  7219. Should be -1 for greenscreen.
  7220. @item blue
  7221. Controls amount of blue in spill area.
  7222. Should be -1 for bluescreen.
  7223. @item brightness
  7224. Controls brightness of spill area, preserving colors.
  7225. @item alpha
  7226. Modify alpha from generated spillmap.
  7227. @end table
  7228. @subsection Commands
  7229. This filter supports the all above options as @ref{commands}.
  7230. @section detelecine
  7231. Apply an exact inverse of the telecine operation. It requires a predefined
  7232. pattern specified using the pattern option which must be the same as that passed
  7233. to the telecine filter.
  7234. This filter accepts the following options:
  7235. @table @option
  7236. @item first_field
  7237. @table @samp
  7238. @item top, t
  7239. top field first
  7240. @item bottom, b
  7241. bottom field first
  7242. The default value is @code{top}.
  7243. @end table
  7244. @item pattern
  7245. A string of numbers representing the pulldown pattern you wish to apply.
  7246. The default value is @code{23}.
  7247. @item start_frame
  7248. A number representing position of the first frame with respect to the telecine
  7249. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7250. @end table
  7251. @section dilation
  7252. Apply dilation effect to the video.
  7253. This filter replaces the pixel by the local(3x3) maximum.
  7254. It accepts the following options:
  7255. @table @option
  7256. @item threshold0
  7257. @item threshold1
  7258. @item threshold2
  7259. @item threshold3
  7260. Limit the maximum change for each plane, default is 65535.
  7261. If 0, plane will remain unchanged.
  7262. @item coordinates
  7263. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7264. pixels are used.
  7265. Flags to local 3x3 coordinates maps like this:
  7266. 1 2 3
  7267. 4 5
  7268. 6 7 8
  7269. @end table
  7270. @subsection Commands
  7271. This filter supports the all above options as @ref{commands}.
  7272. @section displace
  7273. Displace pixels as indicated by second and third input stream.
  7274. It takes three input streams and outputs one stream, the first input is the
  7275. source, and second and third input are displacement maps.
  7276. The second input specifies how much to displace pixels along the
  7277. x-axis, while the third input specifies how much to displace pixels
  7278. along the y-axis.
  7279. If one of displacement map streams terminates, last frame from that
  7280. displacement map will be used.
  7281. Note that once generated, displacements maps can be reused over and over again.
  7282. A description of the accepted options follows.
  7283. @table @option
  7284. @item edge
  7285. Set displace behavior for pixels that are out of range.
  7286. Available values are:
  7287. @table @samp
  7288. @item blank
  7289. Missing pixels are replaced by black pixels.
  7290. @item smear
  7291. Adjacent pixels will spread out to replace missing pixels.
  7292. @item wrap
  7293. Out of range pixels are wrapped so they point to pixels of other side.
  7294. @item mirror
  7295. Out of range pixels will be replaced with mirrored pixels.
  7296. @end table
  7297. Default is @samp{smear}.
  7298. @end table
  7299. @subsection Examples
  7300. @itemize
  7301. @item
  7302. Add ripple effect to rgb input of video size hd720:
  7303. @example
  7304. 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
  7305. @end example
  7306. @item
  7307. Add wave effect to rgb input of video size hd720:
  7308. @example
  7309. 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
  7310. @end example
  7311. @end itemize
  7312. @anchor{dnn_processing}
  7313. @section dnn_processing
  7314. Do image processing with deep neural networks. It works together with another filter
  7315. which converts the pixel format of the Frame to what the dnn network requires.
  7316. The filter accepts the following options:
  7317. @table @option
  7318. @item dnn_backend
  7319. Specify which DNN backend to use for model loading and execution. This option accepts
  7320. the following values:
  7321. @table @samp
  7322. @item native
  7323. Native implementation of DNN loading and execution.
  7324. @item tensorflow
  7325. TensorFlow backend. To enable this backend you
  7326. need to install the TensorFlow for C library (see
  7327. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7328. @code{--enable-libtensorflow}
  7329. @item openvino
  7330. OpenVINO backend. To enable this backend you
  7331. need to build and install the OpenVINO for C library (see
  7332. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7333. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7334. be needed if the header files and libraries are not installed into system path)
  7335. @end table
  7336. Default value is @samp{native}.
  7337. @item model
  7338. Set path to model file specifying network architecture and its parameters.
  7339. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7340. backend can load files for only its format.
  7341. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7342. @item input
  7343. Set the input name of the dnn network.
  7344. @item output
  7345. Set the output name of the dnn network.
  7346. @end table
  7347. @subsection Examples
  7348. @itemize
  7349. @item
  7350. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7351. @example
  7352. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7353. @end example
  7354. @item
  7355. Halve the pixel value of the frame with format gray32f:
  7356. @example
  7357. 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
  7358. @end example
  7359. @item
  7360. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7361. @example
  7362. ./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
  7363. @end example
  7364. @item
  7365. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7366. @example
  7367. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7368. @end example
  7369. @end itemize
  7370. @section drawbox
  7371. Draw a colored box on the input image.
  7372. It accepts the following parameters:
  7373. @table @option
  7374. @item x
  7375. @item y
  7376. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7377. @item width, w
  7378. @item height, h
  7379. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7380. the input width and height. It defaults to 0.
  7381. @item color, c
  7382. Specify the color of the box to write. For the general syntax of this option,
  7383. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7384. value @code{invert} is used, the box edge color is the same as the
  7385. video with inverted luma.
  7386. @item thickness, t
  7387. The expression which sets the thickness of the box edge.
  7388. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7389. See below for the list of accepted constants.
  7390. @item replace
  7391. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7392. will overwrite the video's color and alpha pixels.
  7393. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7394. @end table
  7395. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7396. following constants:
  7397. @table @option
  7398. @item dar
  7399. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7400. @item hsub
  7401. @item vsub
  7402. horizontal and vertical chroma subsample values. For example for the
  7403. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7404. @item in_h, ih
  7405. @item in_w, iw
  7406. The input width and height.
  7407. @item sar
  7408. The input sample aspect ratio.
  7409. @item x
  7410. @item y
  7411. The x and y offset coordinates where the box is drawn.
  7412. @item w
  7413. @item h
  7414. The width and height of the drawn box.
  7415. @item t
  7416. The thickness of the drawn box.
  7417. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7418. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7419. @end table
  7420. @subsection Examples
  7421. @itemize
  7422. @item
  7423. Draw a black box around the edge of the input image:
  7424. @example
  7425. drawbox
  7426. @end example
  7427. @item
  7428. Draw a box with color red and an opacity of 50%:
  7429. @example
  7430. drawbox=10:20:200:60:red@@0.5
  7431. @end example
  7432. The previous example can be specified as:
  7433. @example
  7434. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7435. @end example
  7436. @item
  7437. Fill the box with pink color:
  7438. @example
  7439. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7440. @end example
  7441. @item
  7442. Draw a 2-pixel red 2.40:1 mask:
  7443. @example
  7444. 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
  7445. @end example
  7446. @end itemize
  7447. @subsection Commands
  7448. This filter supports same commands as options.
  7449. The command accepts the same syntax of the corresponding option.
  7450. If the specified expression is not valid, it is kept at its current
  7451. value.
  7452. @anchor{drawgraph}
  7453. @section drawgraph
  7454. Draw a graph using input video metadata.
  7455. It accepts the following parameters:
  7456. @table @option
  7457. @item m1
  7458. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7459. @item fg1
  7460. Set 1st foreground color expression.
  7461. @item m2
  7462. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7463. @item fg2
  7464. Set 2nd foreground color expression.
  7465. @item m3
  7466. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7467. @item fg3
  7468. Set 3rd foreground color expression.
  7469. @item m4
  7470. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7471. @item fg4
  7472. Set 4th foreground color expression.
  7473. @item min
  7474. Set minimal value of metadata value.
  7475. @item max
  7476. Set maximal value of metadata value.
  7477. @item bg
  7478. Set graph background color. Default is white.
  7479. @item mode
  7480. Set graph mode.
  7481. Available values for mode is:
  7482. @table @samp
  7483. @item bar
  7484. @item dot
  7485. @item line
  7486. @end table
  7487. Default is @code{line}.
  7488. @item slide
  7489. Set slide mode.
  7490. Available values for slide is:
  7491. @table @samp
  7492. @item frame
  7493. Draw new frame when right border is reached.
  7494. @item replace
  7495. Replace old columns with new ones.
  7496. @item scroll
  7497. Scroll from right to left.
  7498. @item rscroll
  7499. Scroll from left to right.
  7500. @item picture
  7501. Draw single picture.
  7502. @end table
  7503. Default is @code{frame}.
  7504. @item size
  7505. Set size of graph video. For the syntax of this option, check the
  7506. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7507. The default value is @code{900x256}.
  7508. @item rate, r
  7509. Set the output frame rate. Default value is @code{25}.
  7510. The foreground color expressions can use the following variables:
  7511. @table @option
  7512. @item MIN
  7513. Minimal value of metadata value.
  7514. @item MAX
  7515. Maximal value of metadata value.
  7516. @item VAL
  7517. Current metadata key value.
  7518. @end table
  7519. The color is defined as 0xAABBGGRR.
  7520. @end table
  7521. Example using metadata from @ref{signalstats} filter:
  7522. @example
  7523. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7524. @end example
  7525. Example using metadata from @ref{ebur128} filter:
  7526. @example
  7527. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7528. @end example
  7529. @section drawgrid
  7530. Draw a grid on the input image.
  7531. It accepts the following parameters:
  7532. @table @option
  7533. @item x
  7534. @item y
  7535. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7536. @item width, w
  7537. @item height, h
  7538. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7539. input width and height, respectively, minus @code{thickness}, so image gets
  7540. framed. Default to 0.
  7541. @item color, c
  7542. Specify the color of the grid. For the general syntax of this option,
  7543. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7544. value @code{invert} is used, the grid color is the same as the
  7545. video with inverted luma.
  7546. @item thickness, t
  7547. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7548. See below for the list of accepted constants.
  7549. @item replace
  7550. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7551. will overwrite the video's color and alpha pixels.
  7552. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7553. @end table
  7554. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7555. following constants:
  7556. @table @option
  7557. @item dar
  7558. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7559. @item hsub
  7560. @item vsub
  7561. horizontal and vertical chroma subsample values. For example for the
  7562. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7563. @item in_h, ih
  7564. @item in_w, iw
  7565. The input grid cell width and height.
  7566. @item sar
  7567. The input sample aspect ratio.
  7568. @item x
  7569. @item y
  7570. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7571. @item w
  7572. @item h
  7573. The width and height of the drawn cell.
  7574. @item t
  7575. The thickness of the drawn cell.
  7576. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7577. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7578. @end table
  7579. @subsection Examples
  7580. @itemize
  7581. @item
  7582. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7583. @example
  7584. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7585. @end example
  7586. @item
  7587. Draw a white 3x3 grid with an opacity of 50%:
  7588. @example
  7589. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7590. @end example
  7591. @end itemize
  7592. @subsection Commands
  7593. This filter supports same commands as options.
  7594. The command accepts the same syntax of the corresponding option.
  7595. If the specified expression is not valid, it is kept at its current
  7596. value.
  7597. @anchor{drawtext}
  7598. @section drawtext
  7599. Draw a text string or text from a specified file on top of a video, using the
  7600. libfreetype library.
  7601. To enable compilation of this filter, you need to configure FFmpeg with
  7602. @code{--enable-libfreetype}.
  7603. To enable default font fallback and the @var{font} option you need to
  7604. configure FFmpeg with @code{--enable-libfontconfig}.
  7605. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7606. @code{--enable-libfribidi}.
  7607. @subsection Syntax
  7608. It accepts the following parameters:
  7609. @table @option
  7610. @item box
  7611. Used to draw a box around text using the background color.
  7612. The value must be either 1 (enable) or 0 (disable).
  7613. The default value of @var{box} is 0.
  7614. @item boxborderw
  7615. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7616. The default value of @var{boxborderw} is 0.
  7617. @item boxcolor
  7618. The color to be used for drawing box around text. For the syntax of this
  7619. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7620. The default value of @var{boxcolor} is "white".
  7621. @item line_spacing
  7622. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7623. The default value of @var{line_spacing} is 0.
  7624. @item borderw
  7625. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7626. The default value of @var{borderw} is 0.
  7627. @item bordercolor
  7628. Set the color to be used for drawing border around text. For the syntax of this
  7629. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7630. The default value of @var{bordercolor} is "black".
  7631. @item expansion
  7632. Select how the @var{text} is expanded. Can be either @code{none},
  7633. @code{strftime} (deprecated) or
  7634. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7635. below for details.
  7636. @item basetime
  7637. Set a start time for the count. Value is in microseconds. Only applied
  7638. in the deprecated strftime expansion mode. To emulate in normal expansion
  7639. mode use the @code{pts} function, supplying the start time (in seconds)
  7640. as the second argument.
  7641. @item fix_bounds
  7642. If true, check and fix text coords to avoid clipping.
  7643. @item fontcolor
  7644. The color to be used for drawing fonts. For the syntax of this option, check
  7645. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7646. The default value of @var{fontcolor} is "black".
  7647. @item fontcolor_expr
  7648. String which is expanded the same way as @var{text} to obtain dynamic
  7649. @var{fontcolor} value. By default this option has empty value and is not
  7650. processed. When this option is set, it overrides @var{fontcolor} option.
  7651. @item font
  7652. The font family to be used for drawing text. By default Sans.
  7653. @item fontfile
  7654. The font file to be used for drawing text. The path must be included.
  7655. This parameter is mandatory if the fontconfig support is disabled.
  7656. @item alpha
  7657. Draw the text applying alpha blending. The value can
  7658. be a number between 0.0 and 1.0.
  7659. The expression accepts the same variables @var{x, y} as well.
  7660. The default value is 1.
  7661. Please see @var{fontcolor_expr}.
  7662. @item fontsize
  7663. The font size to be used for drawing text.
  7664. The default value of @var{fontsize} is 16.
  7665. @item text_shaping
  7666. If set to 1, attempt to shape the text (for example, reverse the order of
  7667. right-to-left text and join Arabic characters) before drawing it.
  7668. Otherwise, just draw the text exactly as given.
  7669. By default 1 (if supported).
  7670. @item ft_load_flags
  7671. The flags to be used for loading the fonts.
  7672. The flags map the corresponding flags supported by libfreetype, and are
  7673. a combination of the following values:
  7674. @table @var
  7675. @item default
  7676. @item no_scale
  7677. @item no_hinting
  7678. @item render
  7679. @item no_bitmap
  7680. @item vertical_layout
  7681. @item force_autohint
  7682. @item crop_bitmap
  7683. @item pedantic
  7684. @item ignore_global_advance_width
  7685. @item no_recurse
  7686. @item ignore_transform
  7687. @item monochrome
  7688. @item linear_design
  7689. @item no_autohint
  7690. @end table
  7691. Default value is "default".
  7692. For more information consult the documentation for the FT_LOAD_*
  7693. libfreetype flags.
  7694. @item shadowcolor
  7695. The color to be used for drawing a shadow behind the drawn text. For the
  7696. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7697. ffmpeg-utils manual,ffmpeg-utils}.
  7698. The default value of @var{shadowcolor} is "black".
  7699. @item shadowx
  7700. @item shadowy
  7701. The x and y offsets for the text shadow position with respect to the
  7702. position of the text. They can be either positive or negative
  7703. values. The default value for both is "0".
  7704. @item start_number
  7705. The starting frame number for the n/frame_num variable. The default value
  7706. is "0".
  7707. @item tabsize
  7708. The size in number of spaces to use for rendering the tab.
  7709. Default value is 4.
  7710. @item timecode
  7711. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7712. format. It can be used with or without text parameter. @var{timecode_rate}
  7713. option must be specified.
  7714. @item timecode_rate, rate, r
  7715. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7716. integer. Minimum value is "1".
  7717. Drop-frame timecode is supported for frame rates 30 & 60.
  7718. @item tc24hmax
  7719. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7720. Default is 0 (disabled).
  7721. @item text
  7722. The text string to be drawn. The text must be a sequence of UTF-8
  7723. encoded characters.
  7724. This parameter is mandatory if no file is specified with the parameter
  7725. @var{textfile}.
  7726. @item textfile
  7727. A text file containing text to be drawn. The text must be a sequence
  7728. of UTF-8 encoded characters.
  7729. This parameter is mandatory if no text string is specified with the
  7730. parameter @var{text}.
  7731. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7732. @item reload
  7733. If set to 1, the @var{textfile} will be reloaded before each frame.
  7734. Be sure to update it atomically, or it may be read partially, or even fail.
  7735. @item x
  7736. @item y
  7737. The expressions which specify the offsets where text will be drawn
  7738. within the video frame. They are relative to the top/left border of the
  7739. output image.
  7740. The default value of @var{x} and @var{y} is "0".
  7741. See below for the list of accepted constants and functions.
  7742. @end table
  7743. The parameters for @var{x} and @var{y} are expressions containing the
  7744. following constants and functions:
  7745. @table @option
  7746. @item dar
  7747. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7748. @item hsub
  7749. @item vsub
  7750. horizontal and vertical chroma subsample values. For example for the
  7751. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7752. @item line_h, lh
  7753. the height of each text line
  7754. @item main_h, h, H
  7755. the input height
  7756. @item main_w, w, W
  7757. the input width
  7758. @item max_glyph_a, ascent
  7759. the maximum distance from the baseline to the highest/upper grid
  7760. coordinate used to place a glyph outline point, for all the rendered
  7761. glyphs.
  7762. It is a positive value, due to the grid's orientation with the Y axis
  7763. upwards.
  7764. @item max_glyph_d, descent
  7765. the maximum distance from the baseline to the lowest grid coordinate
  7766. used to place a glyph outline point, for all the rendered glyphs.
  7767. This is a negative value, due to the grid's orientation, with the Y axis
  7768. upwards.
  7769. @item max_glyph_h
  7770. maximum glyph height, that is the maximum height for all the glyphs
  7771. contained in the rendered text, it is equivalent to @var{ascent} -
  7772. @var{descent}.
  7773. @item max_glyph_w
  7774. maximum glyph width, that is the maximum width for all the glyphs
  7775. contained in the rendered text
  7776. @item n
  7777. the number of input frame, starting from 0
  7778. @item rand(min, max)
  7779. return a random number included between @var{min} and @var{max}
  7780. @item sar
  7781. The input sample aspect ratio.
  7782. @item t
  7783. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7784. @item text_h, th
  7785. the height of the rendered text
  7786. @item text_w, tw
  7787. the width of the rendered text
  7788. @item x
  7789. @item y
  7790. the x and y offset coordinates where the text is drawn.
  7791. These parameters allow the @var{x} and @var{y} expressions to refer
  7792. to each other, so you can for example specify @code{y=x/dar}.
  7793. @item pict_type
  7794. A one character description of the current frame's picture type.
  7795. @item pkt_pos
  7796. The current packet's position in the input file or stream
  7797. (in bytes, from the start of the input). A value of -1 indicates
  7798. this info is not available.
  7799. @item pkt_duration
  7800. The current packet's duration, in seconds.
  7801. @item pkt_size
  7802. The current packet's size (in bytes).
  7803. @end table
  7804. @anchor{drawtext_expansion}
  7805. @subsection Text expansion
  7806. If @option{expansion} is set to @code{strftime},
  7807. the filter recognizes strftime() sequences in the provided text and
  7808. expands them accordingly. Check the documentation of strftime(). This
  7809. feature is deprecated.
  7810. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7811. If @option{expansion} is set to @code{normal} (which is the default),
  7812. the following expansion mechanism is used.
  7813. The backslash character @samp{\}, followed by any character, always expands to
  7814. the second character.
  7815. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7816. braces is a function name, possibly followed by arguments separated by ':'.
  7817. If the arguments contain special characters or delimiters (':' or '@}'),
  7818. they should be escaped.
  7819. Note that they probably must also be escaped as the value for the
  7820. @option{text} option in the filter argument string and as the filter
  7821. argument in the filtergraph description, and possibly also for the shell,
  7822. that makes up to four levels of escaping; using a text file avoids these
  7823. problems.
  7824. The following functions are available:
  7825. @table @command
  7826. @item expr, e
  7827. The expression evaluation result.
  7828. It must take one argument specifying the expression to be evaluated,
  7829. which accepts the same constants and functions as the @var{x} and
  7830. @var{y} values. Note that not all constants should be used, for
  7831. example the text size is not known when evaluating the expression, so
  7832. the constants @var{text_w} and @var{text_h} will have an undefined
  7833. value.
  7834. @item expr_int_format, eif
  7835. Evaluate the expression's value and output as formatted integer.
  7836. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7837. The second argument specifies the output format. Allowed values are @samp{x},
  7838. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7839. @code{printf} function.
  7840. The third parameter is optional and sets the number of positions taken by the output.
  7841. It can be used to add padding with zeros from the left.
  7842. @item gmtime
  7843. The time at which the filter is running, expressed in UTC.
  7844. It can accept an argument: a strftime() format string.
  7845. @item localtime
  7846. The time at which the filter is running, expressed in the local time zone.
  7847. It can accept an argument: a strftime() format string.
  7848. @item metadata
  7849. Frame metadata. Takes one or two arguments.
  7850. The first argument is mandatory and specifies the metadata key.
  7851. The second argument is optional and specifies a default value, used when the
  7852. metadata key is not found or empty.
  7853. Available metadata can be identified by inspecting entries
  7854. starting with TAG included within each frame section
  7855. printed by running @code{ffprobe -show_frames}.
  7856. String metadata generated in filters leading to
  7857. the drawtext filter are also available.
  7858. @item n, frame_num
  7859. The frame number, starting from 0.
  7860. @item pict_type
  7861. A one character description of the current picture type.
  7862. @item pts
  7863. The timestamp of the current frame.
  7864. It can take up to three arguments.
  7865. The first argument is the format of the timestamp; it defaults to @code{flt}
  7866. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7867. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7868. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7869. @code{localtime} stands for the timestamp of the frame formatted as
  7870. local time zone time.
  7871. The second argument is an offset added to the timestamp.
  7872. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7873. supplied to present the hour part of the formatted timestamp in 24h format
  7874. (00-23).
  7875. If the format is set to @code{localtime} or @code{gmtime},
  7876. a third argument may be supplied: a strftime() format string.
  7877. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7878. @end table
  7879. @subsection Commands
  7880. This filter supports altering parameters via commands:
  7881. @table @option
  7882. @item reinit
  7883. Alter existing filter parameters.
  7884. Syntax for the argument is the same as for filter invocation, e.g.
  7885. @example
  7886. fontsize=56:fontcolor=green:text='Hello World'
  7887. @end example
  7888. Full filter invocation with sendcmd would look like this:
  7889. @example
  7890. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7891. @end example
  7892. @end table
  7893. If the entire argument can't be parsed or applied as valid values then the filter will
  7894. continue with its existing parameters.
  7895. @subsection Examples
  7896. @itemize
  7897. @item
  7898. Draw "Test Text" with font FreeSerif, using the default values for the
  7899. optional parameters.
  7900. @example
  7901. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7902. @end example
  7903. @item
  7904. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7905. and y=50 (counting from the top-left corner of the screen), text is
  7906. yellow with a red box around it. Both the text and the box have an
  7907. opacity of 20%.
  7908. @example
  7909. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7910. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7911. @end example
  7912. Note that the double quotes are not necessary if spaces are not used
  7913. within the parameter list.
  7914. @item
  7915. Show the text at the center of the video frame:
  7916. @example
  7917. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7918. @end example
  7919. @item
  7920. Show the text at a random position, switching to a new position every 30 seconds:
  7921. @example
  7922. 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)"
  7923. @end example
  7924. @item
  7925. Show a text line sliding from right to left in the last row of the video
  7926. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7927. with no newlines.
  7928. @example
  7929. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7930. @end example
  7931. @item
  7932. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7933. @example
  7934. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7935. @end example
  7936. @item
  7937. Draw a single green letter "g", at the center of the input video.
  7938. The glyph baseline is placed at half screen height.
  7939. @example
  7940. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7941. @end example
  7942. @item
  7943. Show text for 1 second every 3 seconds:
  7944. @example
  7945. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7946. @end example
  7947. @item
  7948. Use fontconfig to set the font. Note that the colons need to be escaped.
  7949. @example
  7950. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7951. @end example
  7952. @item
  7953. Draw "Test Text" with font size dependent on height of the video.
  7954. @example
  7955. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  7956. @end example
  7957. @item
  7958. Print the date of a real-time encoding (see strftime(3)):
  7959. @example
  7960. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7961. @end example
  7962. @item
  7963. Show text fading in and out (appearing/disappearing):
  7964. @example
  7965. #!/bin/sh
  7966. DS=1.0 # display start
  7967. DE=10.0 # display end
  7968. FID=1.5 # fade in duration
  7969. FOD=5 # fade out duration
  7970. 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 @}"
  7971. @end example
  7972. @item
  7973. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7974. and the @option{fontsize} value are included in the @option{y} offset.
  7975. @example
  7976. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7977. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7978. @end example
  7979. @item
  7980. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  7981. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  7982. must have option @option{-export_path_metadata 1} for the special metadata fields
  7983. to be available for filters.
  7984. @example
  7985. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  7986. @end example
  7987. @end itemize
  7988. For more information about libfreetype, check:
  7989. @url{http://www.freetype.org/}.
  7990. For more information about fontconfig, check:
  7991. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7992. For more information about libfribidi, check:
  7993. @url{http://fribidi.org/}.
  7994. @section edgedetect
  7995. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7996. The filter accepts the following options:
  7997. @table @option
  7998. @item low
  7999. @item high
  8000. Set low and high threshold values used by the Canny thresholding
  8001. algorithm.
  8002. The high threshold selects the "strong" edge pixels, which are then
  8003. connected through 8-connectivity with the "weak" edge pixels selected
  8004. by the low threshold.
  8005. @var{low} and @var{high} threshold values must be chosen in the range
  8006. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8007. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8008. is @code{50/255}.
  8009. @item mode
  8010. Define the drawing mode.
  8011. @table @samp
  8012. @item wires
  8013. Draw white/gray wires on black background.
  8014. @item colormix
  8015. Mix the colors to create a paint/cartoon effect.
  8016. @item canny
  8017. Apply Canny edge detector on all selected planes.
  8018. @end table
  8019. Default value is @var{wires}.
  8020. @item planes
  8021. Select planes for filtering. By default all available planes are filtered.
  8022. @end table
  8023. @subsection Examples
  8024. @itemize
  8025. @item
  8026. Standard edge detection with custom values for the hysteresis thresholding:
  8027. @example
  8028. edgedetect=low=0.1:high=0.4
  8029. @end example
  8030. @item
  8031. Painting effect without thresholding:
  8032. @example
  8033. edgedetect=mode=colormix:high=0
  8034. @end example
  8035. @end itemize
  8036. @section elbg
  8037. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8038. For each input image, the filter will compute the optimal mapping from
  8039. the input to the output given the codebook length, that is the number
  8040. of distinct output colors.
  8041. This filter accepts the following options.
  8042. @table @option
  8043. @item codebook_length, l
  8044. Set codebook length. The value must be a positive integer, and
  8045. represents the number of distinct output colors. Default value is 256.
  8046. @item nb_steps, n
  8047. Set the maximum number of iterations to apply for computing the optimal
  8048. mapping. The higher the value the better the result and the higher the
  8049. computation time. Default value is 1.
  8050. @item seed, s
  8051. Set a random seed, must be an integer included between 0 and
  8052. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8053. will try to use a good random seed on a best effort basis.
  8054. @item pal8
  8055. Set pal8 output pixel format. This option does not work with codebook
  8056. length greater than 256.
  8057. @end table
  8058. @section entropy
  8059. Measure graylevel entropy in histogram of color channels of video frames.
  8060. It accepts the following parameters:
  8061. @table @option
  8062. @item mode
  8063. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8064. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8065. between neighbour histogram values.
  8066. @end table
  8067. @section eq
  8068. Set brightness, contrast, saturation and approximate gamma adjustment.
  8069. The filter accepts the following options:
  8070. @table @option
  8071. @item contrast
  8072. Set the contrast expression. The value must be a float value in range
  8073. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8074. @item brightness
  8075. Set the brightness expression. The value must be a float value in
  8076. range @code{-1.0} to @code{1.0}. The default value is "0".
  8077. @item saturation
  8078. Set the saturation expression. The value must be a float in
  8079. range @code{0.0} to @code{3.0}. The default value is "1".
  8080. @item gamma
  8081. Set the gamma expression. The value must be a float in range
  8082. @code{0.1} to @code{10.0}. The default value is "1".
  8083. @item gamma_r
  8084. Set the gamma expression for red. The value must be a float in
  8085. range @code{0.1} to @code{10.0}. The default value is "1".
  8086. @item gamma_g
  8087. Set the gamma expression for green. The value must be a float in range
  8088. @code{0.1} to @code{10.0}. The default value is "1".
  8089. @item gamma_b
  8090. Set the gamma expression for blue. The value must be a float in range
  8091. @code{0.1} to @code{10.0}. The default value is "1".
  8092. @item gamma_weight
  8093. Set the gamma weight expression. It can be used to reduce the effect
  8094. of a high gamma value on bright image areas, e.g. keep them from
  8095. getting overamplified and just plain white. The value must be a float
  8096. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8097. gamma correction all the way down while @code{1.0} leaves it at its
  8098. full strength. Default is "1".
  8099. @item eval
  8100. Set when the expressions for brightness, contrast, saturation and
  8101. gamma expressions are evaluated.
  8102. It accepts the following values:
  8103. @table @samp
  8104. @item init
  8105. only evaluate expressions once during the filter initialization or
  8106. when a command is processed
  8107. @item frame
  8108. evaluate expressions for each incoming frame
  8109. @end table
  8110. Default value is @samp{init}.
  8111. @end table
  8112. The expressions accept the following parameters:
  8113. @table @option
  8114. @item n
  8115. frame count of the input frame starting from 0
  8116. @item pos
  8117. byte position of the corresponding packet in the input file, NAN if
  8118. unspecified
  8119. @item r
  8120. frame rate of the input video, NAN if the input frame rate is unknown
  8121. @item t
  8122. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8123. @end table
  8124. @subsection Commands
  8125. The filter supports the following commands:
  8126. @table @option
  8127. @item contrast
  8128. Set the contrast expression.
  8129. @item brightness
  8130. Set the brightness expression.
  8131. @item saturation
  8132. Set the saturation expression.
  8133. @item gamma
  8134. Set the gamma expression.
  8135. @item gamma_r
  8136. Set the gamma_r expression.
  8137. @item gamma_g
  8138. Set gamma_g expression.
  8139. @item gamma_b
  8140. Set gamma_b expression.
  8141. @item gamma_weight
  8142. Set gamma_weight expression.
  8143. The command accepts the same syntax of the corresponding option.
  8144. If the specified expression is not valid, it is kept at its current
  8145. value.
  8146. @end table
  8147. @section erosion
  8148. Apply erosion effect to the video.
  8149. This filter replaces the pixel by the local(3x3) minimum.
  8150. It accepts the following options:
  8151. @table @option
  8152. @item threshold0
  8153. @item threshold1
  8154. @item threshold2
  8155. @item threshold3
  8156. Limit the maximum change for each plane, default is 65535.
  8157. If 0, plane will remain unchanged.
  8158. @item coordinates
  8159. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8160. pixels are used.
  8161. Flags to local 3x3 coordinates maps like this:
  8162. 1 2 3
  8163. 4 5
  8164. 6 7 8
  8165. @end table
  8166. @subsection Commands
  8167. This filter supports the all above options as @ref{commands}.
  8168. @section extractplanes
  8169. Extract color channel components from input video stream into
  8170. separate grayscale video streams.
  8171. The filter accepts the following option:
  8172. @table @option
  8173. @item planes
  8174. Set plane(s) to extract.
  8175. Available values for planes are:
  8176. @table @samp
  8177. @item y
  8178. @item u
  8179. @item v
  8180. @item a
  8181. @item r
  8182. @item g
  8183. @item b
  8184. @end table
  8185. Choosing planes not available in the input will result in an error.
  8186. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8187. with @code{y}, @code{u}, @code{v} planes at same time.
  8188. @end table
  8189. @subsection Examples
  8190. @itemize
  8191. @item
  8192. Extract luma, u and v color channel component from input video frame
  8193. into 3 grayscale outputs:
  8194. @example
  8195. 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
  8196. @end example
  8197. @end itemize
  8198. @section fade
  8199. Apply a fade-in/out effect to the input video.
  8200. It accepts the following parameters:
  8201. @table @option
  8202. @item type, t
  8203. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8204. effect.
  8205. Default is @code{in}.
  8206. @item start_frame, s
  8207. Specify the number of the frame to start applying the fade
  8208. effect at. Default is 0.
  8209. @item nb_frames, n
  8210. The number of frames that the fade effect lasts. At the end of the
  8211. fade-in effect, the output video will have the same intensity as the input video.
  8212. At the end of the fade-out transition, the output video will be filled with the
  8213. selected @option{color}.
  8214. Default is 25.
  8215. @item alpha
  8216. If set to 1, fade only alpha channel, if one exists on the input.
  8217. Default value is 0.
  8218. @item start_time, st
  8219. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8220. effect. If both start_frame and start_time are specified, the fade will start at
  8221. whichever comes last. Default is 0.
  8222. @item duration, d
  8223. The number of seconds for which the fade effect has to last. At the end of the
  8224. fade-in effect the output video will have the same intensity as the input video,
  8225. at the end of the fade-out transition the output video will be filled with the
  8226. selected @option{color}.
  8227. If both duration and nb_frames are specified, duration is used. Default is 0
  8228. (nb_frames is used by default).
  8229. @item color, c
  8230. Specify the color of the fade. Default is "black".
  8231. @end table
  8232. @subsection Examples
  8233. @itemize
  8234. @item
  8235. Fade in the first 30 frames of video:
  8236. @example
  8237. fade=in:0:30
  8238. @end example
  8239. The command above is equivalent to:
  8240. @example
  8241. fade=t=in:s=0:n=30
  8242. @end example
  8243. @item
  8244. Fade out the last 45 frames of a 200-frame video:
  8245. @example
  8246. fade=out:155:45
  8247. fade=type=out:start_frame=155:nb_frames=45
  8248. @end example
  8249. @item
  8250. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8251. @example
  8252. fade=in:0:25, fade=out:975:25
  8253. @end example
  8254. @item
  8255. Make the first 5 frames yellow, then fade in from frame 5-24:
  8256. @example
  8257. fade=in:5:20:color=yellow
  8258. @end example
  8259. @item
  8260. Fade in alpha over first 25 frames of video:
  8261. @example
  8262. fade=in:0:25:alpha=1
  8263. @end example
  8264. @item
  8265. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8266. @example
  8267. fade=t=in:st=5.5:d=0.5
  8268. @end example
  8269. @end itemize
  8270. @section fftdnoiz
  8271. Denoise frames using 3D FFT (frequency domain filtering).
  8272. The filter accepts the following options:
  8273. @table @option
  8274. @item sigma
  8275. Set the noise sigma constant. This sets denoising strength.
  8276. Default value is 1. Allowed range is from 0 to 30.
  8277. Using very high sigma with low overlap may give blocking artifacts.
  8278. @item amount
  8279. Set amount of denoising. By default all detected noise is reduced.
  8280. Default value is 1. Allowed range is from 0 to 1.
  8281. @item block
  8282. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8283. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8284. block size in pixels is 2^4 which is 16.
  8285. @item overlap
  8286. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8287. @item prev
  8288. Set number of previous frames to use for denoising. By default is set to 0.
  8289. @item next
  8290. Set number of next frames to to use for denoising. By default is set to 0.
  8291. @item planes
  8292. Set planes which will be filtered, by default are all available filtered
  8293. except alpha.
  8294. @end table
  8295. @section fftfilt
  8296. Apply arbitrary expressions to samples in frequency domain
  8297. @table @option
  8298. @item dc_Y
  8299. Adjust the dc value (gain) of the luma plane of the image. The filter
  8300. accepts an integer value in range @code{0} to @code{1000}. The default
  8301. value is set to @code{0}.
  8302. @item dc_U
  8303. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8304. filter accepts an integer value in range @code{0} to @code{1000}. The
  8305. default value is set to @code{0}.
  8306. @item dc_V
  8307. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8308. filter accepts an integer value in range @code{0} to @code{1000}. The
  8309. default value is set to @code{0}.
  8310. @item weight_Y
  8311. Set the frequency domain weight expression for the luma plane.
  8312. @item weight_U
  8313. Set the frequency domain weight expression for the 1st chroma plane.
  8314. @item weight_V
  8315. Set the frequency domain weight expression for the 2nd chroma plane.
  8316. @item eval
  8317. Set when the expressions are evaluated.
  8318. It accepts the following values:
  8319. @table @samp
  8320. @item init
  8321. Only evaluate expressions once during the filter initialization.
  8322. @item frame
  8323. Evaluate expressions for each incoming frame.
  8324. @end table
  8325. Default value is @samp{init}.
  8326. The filter accepts the following variables:
  8327. @item X
  8328. @item Y
  8329. The coordinates of the current sample.
  8330. @item W
  8331. @item H
  8332. The width and height of the image.
  8333. @item N
  8334. The number of input frame, starting from 0.
  8335. @end table
  8336. @subsection Examples
  8337. @itemize
  8338. @item
  8339. High-pass:
  8340. @example
  8341. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8342. @end example
  8343. @item
  8344. Low-pass:
  8345. @example
  8346. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8347. @end example
  8348. @item
  8349. Sharpen:
  8350. @example
  8351. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8352. @end example
  8353. @item
  8354. Blur:
  8355. @example
  8356. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8357. @end example
  8358. @end itemize
  8359. @section field
  8360. Extract a single field from an interlaced image using stride
  8361. arithmetic to avoid wasting CPU time. The output frames are marked as
  8362. non-interlaced.
  8363. The filter accepts the following options:
  8364. @table @option
  8365. @item type
  8366. Specify whether to extract the top (if the value is @code{0} or
  8367. @code{top}) or the bottom field (if the value is @code{1} or
  8368. @code{bottom}).
  8369. @end table
  8370. @section fieldhint
  8371. Create new frames by copying the top and bottom fields from surrounding frames
  8372. supplied as numbers by the hint file.
  8373. @table @option
  8374. @item hint
  8375. Set file containing hints: absolute/relative frame numbers.
  8376. There must be one line for each frame in a clip. Each line must contain two
  8377. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8378. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8379. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8380. for @code{relative} mode. First number tells from which frame to pick up top
  8381. field and second number tells from which frame to pick up bottom field.
  8382. If optionally followed by @code{+} output frame will be marked as interlaced,
  8383. else if followed by @code{-} output frame will be marked as progressive, else
  8384. it will be marked same as input frame.
  8385. If optionally followed by @code{t} output frame will use only top field, or in
  8386. case of @code{b} it will use only bottom field.
  8387. If line starts with @code{#} or @code{;} that line is skipped.
  8388. @item mode
  8389. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8390. @end table
  8391. Example of first several lines of @code{hint} file for @code{relative} mode:
  8392. @example
  8393. 0,0 - # first frame
  8394. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8395. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8396. 1,0 -
  8397. 0,0 -
  8398. 0,0 -
  8399. 1,0 -
  8400. 1,0 -
  8401. 1,0 -
  8402. 0,0 -
  8403. 0,0 -
  8404. 1,0 -
  8405. 1,0 -
  8406. 1,0 -
  8407. 0,0 -
  8408. @end example
  8409. @section fieldmatch
  8410. Field matching filter for inverse telecine. It is meant to reconstruct the
  8411. progressive frames from a telecined stream. The filter does not drop duplicated
  8412. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8413. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8414. The separation of the field matching and the decimation is notably motivated by
  8415. the possibility of inserting a de-interlacing filter fallback between the two.
  8416. If the source has mixed telecined and real interlaced content,
  8417. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8418. But these remaining combed frames will be marked as interlaced, and thus can be
  8419. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8420. In addition to the various configuration options, @code{fieldmatch} can take an
  8421. optional second stream, activated through the @option{ppsrc} option. If
  8422. enabled, the frames reconstruction will be based on the fields and frames from
  8423. this second stream. This allows the first input to be pre-processed in order to
  8424. help the various algorithms of the filter, while keeping the output lossless
  8425. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8426. or brightness/contrast adjustments can help.
  8427. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8428. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8429. which @code{fieldmatch} is based on. While the semantic and usage are very
  8430. close, some behaviour and options names can differ.
  8431. The @ref{decimate} filter currently only works for constant frame rate input.
  8432. If your input has mixed telecined (30fps) and progressive content with a lower
  8433. framerate like 24fps use the following filterchain to produce the necessary cfr
  8434. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8435. The filter accepts the following options:
  8436. @table @option
  8437. @item order
  8438. Specify the assumed field order of the input stream. Available values are:
  8439. @table @samp
  8440. @item auto
  8441. Auto detect parity (use FFmpeg's internal parity value).
  8442. @item bff
  8443. Assume bottom field first.
  8444. @item tff
  8445. Assume top field first.
  8446. @end table
  8447. Note that it is sometimes recommended not to trust the parity announced by the
  8448. stream.
  8449. Default value is @var{auto}.
  8450. @item mode
  8451. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8452. sense that it won't risk creating jerkiness due to duplicate frames when
  8453. possible, but if there are bad edits or blended fields it will end up
  8454. outputting combed frames when a good match might actually exist. On the other
  8455. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8456. but will almost always find a good frame if there is one. The other values are
  8457. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8458. jerkiness and creating duplicate frames versus finding good matches in sections
  8459. with bad edits, orphaned fields, blended fields, etc.
  8460. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8461. Available values are:
  8462. @table @samp
  8463. @item pc
  8464. 2-way matching (p/c)
  8465. @item pc_n
  8466. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8467. @item pc_u
  8468. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8469. @item pc_n_ub
  8470. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8471. still combed (p/c + n + u/b)
  8472. @item pcn
  8473. 3-way matching (p/c/n)
  8474. @item pcn_ub
  8475. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8476. detected as combed (p/c/n + u/b)
  8477. @end table
  8478. The parenthesis at the end indicate the matches that would be used for that
  8479. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8480. @var{top}).
  8481. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8482. the slowest.
  8483. Default value is @var{pc_n}.
  8484. @item ppsrc
  8485. Mark the main input stream as a pre-processed input, and enable the secondary
  8486. input stream as the clean source to pick the fields from. See the filter
  8487. introduction for more details. It is similar to the @option{clip2} feature from
  8488. VFM/TFM.
  8489. Default value is @code{0} (disabled).
  8490. @item field
  8491. Set the field to match from. It is recommended to set this to the same value as
  8492. @option{order} unless you experience matching failures with that setting. In
  8493. certain circumstances changing the field that is used to match from can have a
  8494. large impact on matching performance. Available values are:
  8495. @table @samp
  8496. @item auto
  8497. Automatic (same value as @option{order}).
  8498. @item bottom
  8499. Match from the bottom field.
  8500. @item top
  8501. Match from the top field.
  8502. @end table
  8503. Default value is @var{auto}.
  8504. @item mchroma
  8505. Set whether or not chroma is included during the match comparisons. In most
  8506. cases it is recommended to leave this enabled. You should set this to @code{0}
  8507. only if your clip has bad chroma problems such as heavy rainbowing or other
  8508. artifacts. Setting this to @code{0} could also be used to speed things up at
  8509. the cost of some accuracy.
  8510. Default value is @code{1}.
  8511. @item y0
  8512. @item y1
  8513. These define an exclusion band which excludes the lines between @option{y0} and
  8514. @option{y1} from being included in the field matching decision. An exclusion
  8515. band can be used to ignore subtitles, a logo, or other things that may
  8516. interfere with the matching. @option{y0} sets the starting scan line and
  8517. @option{y1} sets the ending line; all lines in between @option{y0} and
  8518. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8519. @option{y0} and @option{y1} to the same value will disable the feature.
  8520. @option{y0} and @option{y1} defaults to @code{0}.
  8521. @item scthresh
  8522. Set the scene change detection threshold as a percentage of maximum change on
  8523. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8524. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8525. @option{scthresh} is @code{[0.0, 100.0]}.
  8526. Default value is @code{12.0}.
  8527. @item combmatch
  8528. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8529. account the combed scores of matches when deciding what match to use as the
  8530. final match. Available values are:
  8531. @table @samp
  8532. @item none
  8533. No final matching based on combed scores.
  8534. @item sc
  8535. Combed scores are only used when a scene change is detected.
  8536. @item full
  8537. Use combed scores all the time.
  8538. @end table
  8539. Default is @var{sc}.
  8540. @item combdbg
  8541. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8542. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8543. Available values are:
  8544. @table @samp
  8545. @item none
  8546. No forced calculation.
  8547. @item pcn
  8548. Force p/c/n calculations.
  8549. @item pcnub
  8550. Force p/c/n/u/b calculations.
  8551. @end table
  8552. Default value is @var{none}.
  8553. @item cthresh
  8554. This is the area combing threshold used for combed frame detection. This
  8555. essentially controls how "strong" or "visible" combing must be to be detected.
  8556. Larger values mean combing must be more visible and smaller values mean combing
  8557. can be less visible or strong and still be detected. Valid settings are from
  8558. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8559. be detected as combed). This is basically a pixel difference value. A good
  8560. range is @code{[8, 12]}.
  8561. Default value is @code{9}.
  8562. @item chroma
  8563. Sets whether or not chroma is considered in the combed frame decision. Only
  8564. disable this if your source has chroma problems (rainbowing, etc.) that are
  8565. causing problems for the combed frame detection with chroma enabled. Actually,
  8566. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8567. where there is chroma only combing in the source.
  8568. Default value is @code{0}.
  8569. @item blockx
  8570. @item blocky
  8571. Respectively set the x-axis and y-axis size of the window used during combed
  8572. frame detection. This has to do with the size of the area in which
  8573. @option{combpel} pixels are required to be detected as combed for a frame to be
  8574. declared combed. See the @option{combpel} parameter description for more info.
  8575. Possible values are any number that is a power of 2 starting at 4 and going up
  8576. to 512.
  8577. Default value is @code{16}.
  8578. @item combpel
  8579. The number of combed pixels inside any of the @option{blocky} by
  8580. @option{blockx} size blocks on the frame for the frame to be detected as
  8581. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8582. setting controls "how much" combing there must be in any localized area (a
  8583. window defined by the @option{blockx} and @option{blocky} settings) on the
  8584. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8585. which point no frames will ever be detected as combed). This setting is known
  8586. as @option{MI} in TFM/VFM vocabulary.
  8587. Default value is @code{80}.
  8588. @end table
  8589. @anchor{p/c/n/u/b meaning}
  8590. @subsection p/c/n/u/b meaning
  8591. @subsubsection p/c/n
  8592. We assume the following telecined stream:
  8593. @example
  8594. Top fields: 1 2 2 3 4
  8595. Bottom fields: 1 2 3 4 4
  8596. @end example
  8597. The numbers correspond to the progressive frame the fields relate to. Here, the
  8598. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8599. When @code{fieldmatch} is configured to run a matching from bottom
  8600. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8601. @example
  8602. Input stream:
  8603. T 1 2 2 3 4
  8604. B 1 2 3 4 4 <-- matching reference
  8605. Matches: c c n n c
  8606. Output stream:
  8607. T 1 2 3 4 4
  8608. B 1 2 3 4 4
  8609. @end example
  8610. As a result of the field matching, we can see that some frames get duplicated.
  8611. To perform a complete inverse telecine, you need to rely on a decimation filter
  8612. after this operation. See for instance the @ref{decimate} filter.
  8613. The same operation now matching from top fields (@option{field}=@var{top})
  8614. looks like this:
  8615. @example
  8616. Input stream:
  8617. T 1 2 2 3 4 <-- matching reference
  8618. B 1 2 3 4 4
  8619. Matches: c c p p c
  8620. Output stream:
  8621. T 1 2 2 3 4
  8622. B 1 2 2 3 4
  8623. @end example
  8624. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8625. basically, they refer to the frame and field of the opposite parity:
  8626. @itemize
  8627. @item @var{p} matches the field of the opposite parity in the previous frame
  8628. @item @var{c} matches the field of the opposite parity in the current frame
  8629. @item @var{n} matches the field of the opposite parity in the next frame
  8630. @end itemize
  8631. @subsubsection u/b
  8632. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8633. from the opposite parity flag. In the following examples, we assume that we are
  8634. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8635. 'x' is placed above and below each matched fields.
  8636. With bottom matching (@option{field}=@var{bottom}):
  8637. @example
  8638. Match: c p n b u
  8639. x x x x x
  8640. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8641. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8642. x x x x x
  8643. Output frames:
  8644. 2 1 2 2 2
  8645. 2 2 2 1 3
  8646. @end example
  8647. With top matching (@option{field}=@var{top}):
  8648. @example
  8649. Match: c p n b u
  8650. x x x x x
  8651. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8652. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8653. x x x x x
  8654. Output frames:
  8655. 2 2 2 1 2
  8656. 2 1 3 2 2
  8657. @end example
  8658. @subsection Examples
  8659. Simple IVTC of a top field first telecined stream:
  8660. @example
  8661. fieldmatch=order=tff:combmatch=none, decimate
  8662. @end example
  8663. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8664. @example
  8665. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8666. @end example
  8667. @section fieldorder
  8668. Transform the field order of the input video.
  8669. It accepts the following parameters:
  8670. @table @option
  8671. @item order
  8672. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8673. for bottom field first.
  8674. @end table
  8675. The default value is @samp{tff}.
  8676. The transformation is done by shifting the picture content up or down
  8677. by one line, and filling the remaining line with appropriate picture content.
  8678. This method is consistent with most broadcast field order converters.
  8679. If the input video is not flagged as being interlaced, or it is already
  8680. flagged as being of the required output field order, then this filter does
  8681. not alter the incoming video.
  8682. It is very useful when converting to or from PAL DV material,
  8683. which is bottom field first.
  8684. For example:
  8685. @example
  8686. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8687. @end example
  8688. @section fifo, afifo
  8689. Buffer input images and send them when they are requested.
  8690. It is mainly useful when auto-inserted by the libavfilter
  8691. framework.
  8692. It does not take parameters.
  8693. @section fillborders
  8694. Fill borders of the input video, without changing video stream dimensions.
  8695. Sometimes video can have garbage at the four edges and you may not want to
  8696. crop video input to keep size multiple of some number.
  8697. This filter accepts the following options:
  8698. @table @option
  8699. @item left
  8700. Number of pixels to fill from left border.
  8701. @item right
  8702. Number of pixels to fill from right border.
  8703. @item top
  8704. Number of pixels to fill from top border.
  8705. @item bottom
  8706. Number of pixels to fill from bottom border.
  8707. @item mode
  8708. Set fill mode.
  8709. It accepts the following values:
  8710. @table @samp
  8711. @item smear
  8712. fill pixels using outermost pixels
  8713. @item mirror
  8714. fill pixels using mirroring
  8715. @item fixed
  8716. fill pixels with constant value
  8717. @end table
  8718. Default is @var{smear}.
  8719. @item color
  8720. Set color for pixels in fixed mode. Default is @var{black}.
  8721. @end table
  8722. @subsection Commands
  8723. This filter supports same @ref{commands} as options.
  8724. The command accepts the same syntax of the corresponding option.
  8725. If the specified expression is not valid, it is kept at its current
  8726. value.
  8727. @section find_rect
  8728. Find a rectangular object
  8729. It accepts the following options:
  8730. @table @option
  8731. @item object
  8732. Filepath of the object image, needs to be in gray8.
  8733. @item threshold
  8734. Detection threshold, default is 0.5.
  8735. @item mipmaps
  8736. Number of mipmaps, default is 3.
  8737. @item xmin, ymin, xmax, ymax
  8738. Specifies the rectangle in which to search.
  8739. @end table
  8740. @subsection Examples
  8741. @itemize
  8742. @item
  8743. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8744. @example
  8745. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8746. @end example
  8747. @end itemize
  8748. @section floodfill
  8749. Flood area with values of same pixel components with another values.
  8750. It accepts the following options:
  8751. @table @option
  8752. @item x
  8753. Set pixel x coordinate.
  8754. @item y
  8755. Set pixel y coordinate.
  8756. @item s0
  8757. Set source #0 component value.
  8758. @item s1
  8759. Set source #1 component value.
  8760. @item s2
  8761. Set source #2 component value.
  8762. @item s3
  8763. Set source #3 component value.
  8764. @item d0
  8765. Set destination #0 component value.
  8766. @item d1
  8767. Set destination #1 component value.
  8768. @item d2
  8769. Set destination #2 component value.
  8770. @item d3
  8771. Set destination #3 component value.
  8772. @end table
  8773. @anchor{format}
  8774. @section format
  8775. Convert the input video to one of the specified pixel formats.
  8776. Libavfilter will try to pick one that is suitable as input to
  8777. the next filter.
  8778. It accepts the following parameters:
  8779. @table @option
  8780. @item pix_fmts
  8781. A '|'-separated list of pixel format names, such as
  8782. "pix_fmts=yuv420p|monow|rgb24".
  8783. @end table
  8784. @subsection Examples
  8785. @itemize
  8786. @item
  8787. Convert the input video to the @var{yuv420p} format
  8788. @example
  8789. format=pix_fmts=yuv420p
  8790. @end example
  8791. Convert the input video to any of the formats in the list
  8792. @example
  8793. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8794. @end example
  8795. @end itemize
  8796. @anchor{fps}
  8797. @section fps
  8798. Convert the video to specified constant frame rate by duplicating or dropping
  8799. frames as necessary.
  8800. It accepts the following parameters:
  8801. @table @option
  8802. @item fps
  8803. The desired output frame rate. The default is @code{25}.
  8804. @item start_time
  8805. Assume the first PTS should be the given value, in seconds. This allows for
  8806. padding/trimming at the start of stream. By default, no assumption is made
  8807. about the first frame's expected PTS, so no padding or trimming is done.
  8808. For example, this could be set to 0 to pad the beginning with duplicates of
  8809. the first frame if a video stream starts after the audio stream or to trim any
  8810. frames with a negative PTS.
  8811. @item round
  8812. Timestamp (PTS) rounding method.
  8813. Possible values are:
  8814. @table @option
  8815. @item zero
  8816. round towards 0
  8817. @item inf
  8818. round away from 0
  8819. @item down
  8820. round towards -infinity
  8821. @item up
  8822. round towards +infinity
  8823. @item near
  8824. round to nearest
  8825. @end table
  8826. The default is @code{near}.
  8827. @item eof_action
  8828. Action performed when reading the last frame.
  8829. Possible values are:
  8830. @table @option
  8831. @item round
  8832. Use same timestamp rounding method as used for other frames.
  8833. @item pass
  8834. Pass through last frame if input duration has not been reached yet.
  8835. @end table
  8836. The default is @code{round}.
  8837. @end table
  8838. Alternatively, the options can be specified as a flat string:
  8839. @var{fps}[:@var{start_time}[:@var{round}]].
  8840. See also the @ref{setpts} filter.
  8841. @subsection Examples
  8842. @itemize
  8843. @item
  8844. A typical usage in order to set the fps to 25:
  8845. @example
  8846. fps=fps=25
  8847. @end example
  8848. @item
  8849. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8850. @example
  8851. fps=fps=film:round=near
  8852. @end example
  8853. @end itemize
  8854. @section framepack
  8855. Pack two different video streams into a stereoscopic video, setting proper
  8856. metadata on supported codecs. The two views should have the same size and
  8857. framerate and processing will stop when the shorter video ends. Please note
  8858. that you may conveniently adjust view properties with the @ref{scale} and
  8859. @ref{fps} filters.
  8860. It accepts the following parameters:
  8861. @table @option
  8862. @item format
  8863. The desired packing format. Supported values are:
  8864. @table @option
  8865. @item sbs
  8866. The views are next to each other (default).
  8867. @item tab
  8868. The views are on top of each other.
  8869. @item lines
  8870. The views are packed by line.
  8871. @item columns
  8872. The views are packed by column.
  8873. @item frameseq
  8874. The views are temporally interleaved.
  8875. @end table
  8876. @end table
  8877. Some examples:
  8878. @example
  8879. # Convert left and right views into a frame-sequential video
  8880. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8881. # Convert views into a side-by-side video with the same output resolution as the input
  8882. 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
  8883. @end example
  8884. @section framerate
  8885. Change the frame rate by interpolating new video output frames from the source
  8886. frames.
  8887. This filter is not designed to function correctly with interlaced media. If
  8888. you wish to change the frame rate of interlaced media then you are required
  8889. to deinterlace before this filter and re-interlace after this filter.
  8890. A description of the accepted options follows.
  8891. @table @option
  8892. @item fps
  8893. Specify the output frames per second. This option can also be specified
  8894. as a value alone. The default is @code{50}.
  8895. @item interp_start
  8896. Specify the start of a range where the output frame will be created as a
  8897. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8898. the default is @code{15}.
  8899. @item interp_end
  8900. Specify the end of a range where the output frame will be created as a
  8901. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8902. the default is @code{240}.
  8903. @item scene
  8904. Specify the level at which a scene change is detected as a value between
  8905. 0 and 100 to indicate a new scene; a low value reflects a low
  8906. probability for the current frame to introduce a new scene, while a higher
  8907. value means the current frame is more likely to be one.
  8908. The default is @code{8.2}.
  8909. @item flags
  8910. Specify flags influencing the filter process.
  8911. Available value for @var{flags} is:
  8912. @table @option
  8913. @item scene_change_detect, scd
  8914. Enable scene change detection using the value of the option @var{scene}.
  8915. This flag is enabled by default.
  8916. @end table
  8917. @end table
  8918. @section framestep
  8919. Select one frame every N-th frame.
  8920. This filter accepts the following option:
  8921. @table @option
  8922. @item step
  8923. Select frame after every @code{step} frames.
  8924. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8925. @end table
  8926. @section freezedetect
  8927. Detect frozen video.
  8928. This filter logs a message and sets frame metadata when it detects that the
  8929. input video has no significant change in content during a specified duration.
  8930. Video freeze detection calculates the mean average absolute difference of all
  8931. the components of video frames and compares it to a noise floor.
  8932. The printed times and duration are expressed in seconds. The
  8933. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8934. whose timestamp equals or exceeds the detection duration and it contains the
  8935. timestamp of the first frame of the freeze. The
  8936. @code{lavfi.freezedetect.freeze_duration} and
  8937. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8938. after the freeze.
  8939. The filter accepts the following options:
  8940. @table @option
  8941. @item noise, n
  8942. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8943. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8944. 0.001.
  8945. @item duration, d
  8946. Set freeze duration until notification (default is 2 seconds).
  8947. @end table
  8948. @section freezeframes
  8949. Freeze video frames.
  8950. This filter freezes video frames using frame from 2nd input.
  8951. The filter accepts the following options:
  8952. @table @option
  8953. @item first
  8954. Set number of first frame from which to start freeze.
  8955. @item last
  8956. Set number of last frame from which to end freeze.
  8957. @item replace
  8958. Set number of frame from 2nd input which will be used instead of replaced frames.
  8959. @end table
  8960. @anchor{frei0r}
  8961. @section frei0r
  8962. Apply a frei0r effect to the input video.
  8963. To enable the compilation of this filter, you need to install the frei0r
  8964. header and configure FFmpeg with @code{--enable-frei0r}.
  8965. It accepts the following parameters:
  8966. @table @option
  8967. @item filter_name
  8968. The name of the frei0r effect to load. If the environment variable
  8969. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8970. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8971. Otherwise, the standard frei0r paths are searched, in this order:
  8972. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8973. @file{/usr/lib/frei0r-1/}.
  8974. @item filter_params
  8975. A '|'-separated list of parameters to pass to the frei0r effect.
  8976. @end table
  8977. A frei0r effect parameter can be a boolean (its value is either
  8978. "y" or "n"), a double, a color (specified as
  8979. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8980. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8981. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8982. a position (specified as @var{X}/@var{Y}, where
  8983. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8984. The number and types of parameters depend on the loaded effect. If an
  8985. effect parameter is not specified, the default value is set.
  8986. @subsection Examples
  8987. @itemize
  8988. @item
  8989. Apply the distort0r effect, setting the first two double parameters:
  8990. @example
  8991. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8992. @end example
  8993. @item
  8994. Apply the colordistance effect, taking a color as the first parameter:
  8995. @example
  8996. frei0r=colordistance:0.2/0.3/0.4
  8997. frei0r=colordistance:violet
  8998. frei0r=colordistance:0x112233
  8999. @end example
  9000. @item
  9001. Apply the perspective effect, specifying the top left and top right image
  9002. positions:
  9003. @example
  9004. frei0r=perspective:0.2/0.2|0.8/0.2
  9005. @end example
  9006. @end itemize
  9007. For more information, see
  9008. @url{http://frei0r.dyne.org}
  9009. @section fspp
  9010. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  9011. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  9012. processing filter, one of them is performed once per block, not per pixel.
  9013. This allows for much higher speed.
  9014. The filter accepts the following options:
  9015. @table @option
  9016. @item quality
  9017. Set quality. This option defines the number of levels for averaging. It accepts
  9018. an integer in the range 4-5. Default value is @code{4}.
  9019. @item qp
  9020. Force a constant quantization parameter. It accepts an integer in range 0-63.
  9021. If not set, the filter will use the QP from the video stream (if available).
  9022. @item strength
  9023. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  9024. more details but also more artifacts, while higher values make the image smoother
  9025. but also blurrier. Default value is @code{0} − PSNR optimal.
  9026. @item use_bframe_qp
  9027. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9028. option may cause flicker since the B-Frames have often larger QP. Default is
  9029. @code{0} (not enabled).
  9030. @end table
  9031. @section gblur
  9032. Apply Gaussian blur filter.
  9033. The filter accepts the following options:
  9034. @table @option
  9035. @item sigma
  9036. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  9037. @item steps
  9038. Set number of steps for Gaussian approximation. Default is @code{1}.
  9039. @item planes
  9040. Set which planes to filter. By default all planes are filtered.
  9041. @item sigmaV
  9042. Set vertical sigma, if negative it will be same as @code{sigma}.
  9043. Default is @code{-1}.
  9044. @end table
  9045. @subsection Commands
  9046. This filter supports same commands as options.
  9047. The command accepts the same syntax of the corresponding option.
  9048. If the specified expression is not valid, it is kept at its current
  9049. value.
  9050. @section geq
  9051. Apply generic equation to each pixel.
  9052. The filter accepts the following options:
  9053. @table @option
  9054. @item lum_expr, lum
  9055. Set the luminance expression.
  9056. @item cb_expr, cb
  9057. Set the chrominance blue expression.
  9058. @item cr_expr, cr
  9059. Set the chrominance red expression.
  9060. @item alpha_expr, a
  9061. Set the alpha expression.
  9062. @item red_expr, r
  9063. Set the red expression.
  9064. @item green_expr, g
  9065. Set the green expression.
  9066. @item blue_expr, b
  9067. Set the blue expression.
  9068. @end table
  9069. The colorspace is selected according to the specified options. If one
  9070. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9071. options is specified, the filter will automatically select a YCbCr
  9072. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9073. @option{blue_expr} options is specified, it will select an RGB
  9074. colorspace.
  9075. If one of the chrominance expression is not defined, it falls back on the other
  9076. one. If no alpha expression is specified it will evaluate to opaque value.
  9077. If none of chrominance expressions are specified, they will evaluate
  9078. to the luminance expression.
  9079. The expressions can use the following variables and functions:
  9080. @table @option
  9081. @item N
  9082. The sequential number of the filtered frame, starting from @code{0}.
  9083. @item X
  9084. @item Y
  9085. The coordinates of the current sample.
  9086. @item W
  9087. @item H
  9088. The width and height of the image.
  9089. @item SW
  9090. @item SH
  9091. Width and height scale depending on the currently filtered plane. It is the
  9092. ratio between the corresponding luma plane number of pixels and the current
  9093. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9094. @code{0.5,0.5} for chroma planes.
  9095. @item T
  9096. Time of the current frame, expressed in seconds.
  9097. @item p(x, y)
  9098. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9099. plane.
  9100. @item lum(x, y)
  9101. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9102. plane.
  9103. @item cb(x, y)
  9104. Return the value of the pixel at location (@var{x},@var{y}) of the
  9105. blue-difference chroma plane. Return 0 if there is no such plane.
  9106. @item cr(x, y)
  9107. Return the value of the pixel at location (@var{x},@var{y}) of the
  9108. red-difference chroma plane. Return 0 if there is no such plane.
  9109. @item r(x, y)
  9110. @item g(x, y)
  9111. @item b(x, y)
  9112. Return the value of the pixel at location (@var{x},@var{y}) of the
  9113. red/green/blue component. Return 0 if there is no such component.
  9114. @item alpha(x, y)
  9115. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9116. plane. Return 0 if there is no such plane.
  9117. @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)
  9118. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9119. sums of samples within a rectangle. See the functions without the sum postfix.
  9120. @item interpolation
  9121. Set one of interpolation methods:
  9122. @table @option
  9123. @item nearest, n
  9124. @item bilinear, b
  9125. @end table
  9126. Default is bilinear.
  9127. @end table
  9128. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9129. automatically clipped to the closer edge.
  9130. Please note that this filter can use multiple threads in which case each slice
  9131. will have its own expression state. If you want to use only a single expression
  9132. state because your expressions depend on previous state then you should limit
  9133. the number of filter threads to 1.
  9134. @subsection Examples
  9135. @itemize
  9136. @item
  9137. Flip the image horizontally:
  9138. @example
  9139. geq=p(W-X\,Y)
  9140. @end example
  9141. @item
  9142. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9143. wavelength of 100 pixels:
  9144. @example
  9145. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9146. @end example
  9147. @item
  9148. Generate a fancy enigmatic moving light:
  9149. @example
  9150. 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
  9151. @end example
  9152. @item
  9153. Generate a quick emboss effect:
  9154. @example
  9155. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9156. @end example
  9157. @item
  9158. Modify RGB components depending on pixel position:
  9159. @example
  9160. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9161. @end example
  9162. @item
  9163. Create a radial gradient that is the same size as the input (also see
  9164. the @ref{vignette} filter):
  9165. @example
  9166. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9167. @end example
  9168. @end itemize
  9169. @section gradfun
  9170. Fix the banding artifacts that are sometimes introduced into nearly flat
  9171. regions by truncation to 8-bit color depth.
  9172. Interpolate the gradients that should go where the bands are, and
  9173. dither them.
  9174. It is designed for playback only. Do not use it prior to
  9175. lossy compression, because compression tends to lose the dither and
  9176. bring back the bands.
  9177. It accepts the following parameters:
  9178. @table @option
  9179. @item strength
  9180. The maximum amount by which the filter will change any one pixel. This is also
  9181. the threshold for detecting nearly flat regions. Acceptable values range from
  9182. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9183. valid range.
  9184. @item radius
  9185. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9186. gradients, but also prevents the filter from modifying the pixels near detailed
  9187. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9188. values will be clipped to the valid range.
  9189. @end table
  9190. Alternatively, the options can be specified as a flat string:
  9191. @var{strength}[:@var{radius}]
  9192. @subsection Examples
  9193. @itemize
  9194. @item
  9195. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9196. @example
  9197. gradfun=3.5:8
  9198. @end example
  9199. @item
  9200. Specify radius, omitting the strength (which will fall-back to the default
  9201. value):
  9202. @example
  9203. gradfun=radius=8
  9204. @end example
  9205. @end itemize
  9206. @anchor{graphmonitor}
  9207. @section graphmonitor
  9208. Show various filtergraph stats.
  9209. With this filter one can debug complete filtergraph.
  9210. Especially issues with links filling with queued frames.
  9211. The filter accepts the following options:
  9212. @table @option
  9213. @item size, s
  9214. Set video output size. Default is @var{hd720}.
  9215. @item opacity, o
  9216. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9217. @item mode, m
  9218. Set output mode, can be @var{fulll} or @var{compact}.
  9219. In @var{compact} mode only filters with some queued frames have displayed stats.
  9220. @item flags, f
  9221. Set flags which enable which stats are shown in video.
  9222. Available values for flags are:
  9223. @table @samp
  9224. @item queue
  9225. Display number of queued frames in each link.
  9226. @item frame_count_in
  9227. Display number of frames taken from filter.
  9228. @item frame_count_out
  9229. Display number of frames given out from filter.
  9230. @item pts
  9231. Display current filtered frame pts.
  9232. @item time
  9233. Display current filtered frame time.
  9234. @item timebase
  9235. Display time base for filter link.
  9236. @item format
  9237. Display used format for filter link.
  9238. @item size
  9239. Display video size or number of audio channels in case of audio used by filter link.
  9240. @item rate
  9241. Display video frame rate or sample rate in case of audio used by filter link.
  9242. @item eof
  9243. Display link output status.
  9244. @end table
  9245. @item rate, r
  9246. Set upper limit for video rate of output stream, Default value is @var{25}.
  9247. This guarantee that output video frame rate will not be higher than this value.
  9248. @end table
  9249. @section greyedge
  9250. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9251. and corrects the scene colors accordingly.
  9252. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9253. The filter accepts the following options:
  9254. @table @option
  9255. @item difford
  9256. The order of differentiation to be applied on the scene. Must be chosen in the range
  9257. [0,2] and default value is 1.
  9258. @item minknorm
  9259. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9260. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9261. max value instead of calculating Minkowski distance.
  9262. @item sigma
  9263. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9264. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9265. can't be equal to 0 if @var{difford} is greater than 0.
  9266. @end table
  9267. @subsection Examples
  9268. @itemize
  9269. @item
  9270. Grey Edge:
  9271. @example
  9272. greyedge=difford=1:minknorm=5:sigma=2
  9273. @end example
  9274. @item
  9275. Max Edge:
  9276. @example
  9277. greyedge=difford=1:minknorm=0:sigma=2
  9278. @end example
  9279. @end itemize
  9280. @anchor{haldclut}
  9281. @section haldclut
  9282. Apply a Hald CLUT to a video stream.
  9283. First input is the video stream to process, and second one is the Hald CLUT.
  9284. The Hald CLUT input can be a simple picture or a complete video stream.
  9285. The filter accepts the following options:
  9286. @table @option
  9287. @item shortest
  9288. Force termination when the shortest input terminates. Default is @code{0}.
  9289. @item repeatlast
  9290. Continue applying the last CLUT after the end of the stream. A value of
  9291. @code{0} disable the filter after the last frame of the CLUT is reached.
  9292. Default is @code{1}.
  9293. @end table
  9294. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9295. filters share the same internals).
  9296. This filter also supports the @ref{framesync} options.
  9297. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9298. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9299. @subsection Workflow examples
  9300. @subsubsection Hald CLUT video stream
  9301. Generate an identity Hald CLUT stream altered with various effects:
  9302. @example
  9303. 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
  9304. @end example
  9305. Note: make sure you use a lossless codec.
  9306. Then use it with @code{haldclut} to apply it on some random stream:
  9307. @example
  9308. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9309. @end example
  9310. The Hald CLUT will be applied to the 10 first seconds (duration of
  9311. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9312. to the remaining frames of the @code{mandelbrot} stream.
  9313. @subsubsection Hald CLUT with preview
  9314. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9315. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9316. biggest possible square starting at the top left of the picture. The remaining
  9317. padding pixels (bottom or right) will be ignored. This area can be used to add
  9318. a preview of the Hald CLUT.
  9319. Typically, the following generated Hald CLUT will be supported by the
  9320. @code{haldclut} filter:
  9321. @example
  9322. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9323. pad=iw+320 [padded_clut];
  9324. smptebars=s=320x256, split [a][b];
  9325. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9326. [main][b] overlay=W-320" -frames:v 1 clut.png
  9327. @end example
  9328. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9329. bars are displayed on the right-top, and below the same color bars processed by
  9330. the color changes.
  9331. Then, the effect of this Hald CLUT can be visualized with:
  9332. @example
  9333. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9334. @end example
  9335. @section hflip
  9336. Flip the input video horizontally.
  9337. For example, to horizontally flip the input video with @command{ffmpeg}:
  9338. @example
  9339. ffmpeg -i in.avi -vf "hflip" out.avi
  9340. @end example
  9341. @section histeq
  9342. This filter applies a global color histogram equalization on a
  9343. per-frame basis.
  9344. It can be used to correct video that has a compressed range of pixel
  9345. intensities. The filter redistributes the pixel intensities to
  9346. equalize their distribution across the intensity range. It may be
  9347. viewed as an "automatically adjusting contrast filter". This filter is
  9348. useful only for correcting degraded or poorly captured source
  9349. video.
  9350. The filter accepts the following options:
  9351. @table @option
  9352. @item strength
  9353. Determine the amount of equalization to be applied. As the strength
  9354. is reduced, the distribution of pixel intensities more-and-more
  9355. approaches that of the input frame. The value must be a float number
  9356. in the range [0,1] and defaults to 0.200.
  9357. @item intensity
  9358. Set the maximum intensity that can generated and scale the output
  9359. values appropriately. The strength should be set as desired and then
  9360. the intensity can be limited if needed to avoid washing-out. The value
  9361. must be a float number in the range [0,1] and defaults to 0.210.
  9362. @item antibanding
  9363. Set the antibanding level. If enabled the filter will randomly vary
  9364. the luminance of output pixels by a small amount to avoid banding of
  9365. the histogram. Possible values are @code{none}, @code{weak} or
  9366. @code{strong}. It defaults to @code{none}.
  9367. @end table
  9368. @anchor{histogram}
  9369. @section histogram
  9370. Compute and draw a color distribution histogram for the input video.
  9371. The computed histogram is a representation of the color component
  9372. distribution in an image.
  9373. Standard histogram displays the color components distribution in an image.
  9374. Displays color graph for each color component. Shows distribution of
  9375. the Y, U, V, A or R, G, B components, depending on input format, in the
  9376. current frame. Below each graph a color component scale meter is shown.
  9377. The filter accepts the following options:
  9378. @table @option
  9379. @item level_height
  9380. Set height of level. Default value is @code{200}.
  9381. Allowed range is [50, 2048].
  9382. @item scale_height
  9383. Set height of color scale. Default value is @code{12}.
  9384. Allowed range is [0, 40].
  9385. @item display_mode
  9386. Set display mode.
  9387. It accepts the following values:
  9388. @table @samp
  9389. @item stack
  9390. Per color component graphs are placed below each other.
  9391. @item parade
  9392. Per color component graphs are placed side by side.
  9393. @item overlay
  9394. Presents information identical to that in the @code{parade}, except
  9395. that the graphs representing color components are superimposed directly
  9396. over one another.
  9397. @end table
  9398. Default is @code{stack}.
  9399. @item levels_mode
  9400. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9401. Default is @code{linear}.
  9402. @item components
  9403. Set what color components to display.
  9404. Default is @code{7}.
  9405. @item fgopacity
  9406. Set foreground opacity. Default is @code{0.7}.
  9407. @item bgopacity
  9408. Set background opacity. Default is @code{0.5}.
  9409. @end table
  9410. @subsection Examples
  9411. @itemize
  9412. @item
  9413. Calculate and draw histogram:
  9414. @example
  9415. ffplay -i input -vf histogram
  9416. @end example
  9417. @end itemize
  9418. @anchor{hqdn3d}
  9419. @section hqdn3d
  9420. This is a high precision/quality 3d denoise filter. It aims to reduce
  9421. image noise, producing smooth images and making still images really
  9422. still. It should enhance compressibility.
  9423. It accepts the following optional parameters:
  9424. @table @option
  9425. @item luma_spatial
  9426. A non-negative floating point number which specifies spatial luma strength.
  9427. It defaults to 4.0.
  9428. @item chroma_spatial
  9429. A non-negative floating point number which specifies spatial chroma strength.
  9430. It defaults to 3.0*@var{luma_spatial}/4.0.
  9431. @item luma_tmp
  9432. A floating point number which specifies luma temporal strength. It defaults to
  9433. 6.0*@var{luma_spatial}/4.0.
  9434. @item chroma_tmp
  9435. A floating point number which specifies chroma temporal strength. It defaults to
  9436. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9437. @end table
  9438. @subsection Commands
  9439. This filter supports same @ref{commands} as options.
  9440. The command accepts the same syntax of the corresponding option.
  9441. If the specified expression is not valid, it is kept at its current
  9442. value.
  9443. @anchor{hwdownload}
  9444. @section hwdownload
  9445. Download hardware frames to system memory.
  9446. The input must be in hardware frames, and the output a non-hardware format.
  9447. Not all formats will be supported on the output - it may be necessary to insert
  9448. an additional @option{format} filter immediately following in the graph to get
  9449. the output in a supported format.
  9450. @section hwmap
  9451. Map hardware frames to system memory or to another device.
  9452. This filter has several different modes of operation; which one is used depends
  9453. on the input and output formats:
  9454. @itemize
  9455. @item
  9456. Hardware frame input, normal frame output
  9457. Map the input frames to system memory and pass them to the output. If the
  9458. original hardware frame is later required (for example, after overlaying
  9459. something else on part of it), the @option{hwmap} filter can be used again
  9460. in the next mode to retrieve it.
  9461. @item
  9462. Normal frame input, hardware frame output
  9463. If the input is actually a software-mapped hardware frame, then unmap it -
  9464. that is, return the original hardware frame.
  9465. Otherwise, a device must be provided. Create new hardware surfaces on that
  9466. device for the output, then map them back to the software format at the input
  9467. and give those frames to the preceding filter. This will then act like the
  9468. @option{hwupload} filter, but may be able to avoid an additional copy when
  9469. the input is already in a compatible format.
  9470. @item
  9471. Hardware frame input and output
  9472. A device must be supplied for the output, either directly or with the
  9473. @option{derive_device} option. The input and output devices must be of
  9474. different types and compatible - the exact meaning of this is
  9475. system-dependent, but typically it means that they must refer to the same
  9476. underlying hardware context (for example, refer to the same graphics card).
  9477. If the input frames were originally created on the output device, then unmap
  9478. to retrieve the original frames.
  9479. Otherwise, map the frames to the output device - create new hardware frames
  9480. on the output corresponding to the frames on the input.
  9481. @end itemize
  9482. The following additional parameters are accepted:
  9483. @table @option
  9484. @item mode
  9485. Set the frame mapping mode. Some combination of:
  9486. @table @var
  9487. @item read
  9488. The mapped frame should be readable.
  9489. @item write
  9490. The mapped frame should be writeable.
  9491. @item overwrite
  9492. The mapping will always overwrite the entire frame.
  9493. This may improve performance in some cases, as the original contents of the
  9494. frame need not be loaded.
  9495. @item direct
  9496. The mapping must not involve any copying.
  9497. Indirect mappings to copies of frames are created in some cases where either
  9498. direct mapping is not possible or it would have unexpected properties.
  9499. Setting this flag ensures that the mapping is direct and will fail if that is
  9500. not possible.
  9501. @end table
  9502. Defaults to @var{read+write} if not specified.
  9503. @item derive_device @var{type}
  9504. Rather than using the device supplied at initialisation, instead derive a new
  9505. device of type @var{type} from the device the input frames exist on.
  9506. @item reverse
  9507. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9508. and map them back to the source. This may be necessary in some cases where
  9509. a mapping in one direction is required but only the opposite direction is
  9510. supported by the devices being used.
  9511. This option is dangerous - it may break the preceding filter in undefined
  9512. ways if there are any additional constraints on that filter's output.
  9513. Do not use it without fully understanding the implications of its use.
  9514. @end table
  9515. @anchor{hwupload}
  9516. @section hwupload
  9517. Upload system memory frames to hardware surfaces.
  9518. The device to upload to must be supplied when the filter is initialised. If
  9519. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9520. option or with the @option{derive_device} option. The input and output devices
  9521. must be of different types and compatible - the exact meaning of this is
  9522. system-dependent, but typically it means that they must refer to the same
  9523. underlying hardware context (for example, refer to the same graphics card).
  9524. The following additional parameters are accepted:
  9525. @table @option
  9526. @item derive_device @var{type}
  9527. Rather than using the device supplied at initialisation, instead derive a new
  9528. device of type @var{type} from the device the input frames exist on.
  9529. @end table
  9530. @anchor{hwupload_cuda}
  9531. @section hwupload_cuda
  9532. Upload system memory frames to a CUDA device.
  9533. It accepts the following optional parameters:
  9534. @table @option
  9535. @item device
  9536. The number of the CUDA device to use
  9537. @end table
  9538. @section hqx
  9539. Apply a high-quality magnification filter designed for pixel art. This filter
  9540. was originally created by Maxim Stepin.
  9541. It accepts the following option:
  9542. @table @option
  9543. @item n
  9544. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9545. @code{hq3x} and @code{4} for @code{hq4x}.
  9546. Default is @code{3}.
  9547. @end table
  9548. @section hstack
  9549. Stack input videos horizontally.
  9550. All streams must be of same pixel format and of same height.
  9551. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9552. to create same output.
  9553. The filter accepts the following option:
  9554. @table @option
  9555. @item inputs
  9556. Set number of input streams. Default is 2.
  9557. @item shortest
  9558. If set to 1, force the output to terminate when the shortest input
  9559. terminates. Default value is 0.
  9560. @end table
  9561. @section hue
  9562. Modify the hue and/or the saturation of the input.
  9563. It accepts the following parameters:
  9564. @table @option
  9565. @item h
  9566. Specify the hue angle as a number of degrees. It accepts an expression,
  9567. and defaults to "0".
  9568. @item s
  9569. Specify the saturation in the [-10,10] range. It accepts an expression and
  9570. defaults to "1".
  9571. @item H
  9572. Specify the hue angle as a number of radians. It accepts an
  9573. expression, and defaults to "0".
  9574. @item b
  9575. Specify the brightness in the [-10,10] range. It accepts an expression and
  9576. defaults to "0".
  9577. @end table
  9578. @option{h} and @option{H} are mutually exclusive, and can't be
  9579. specified at the same time.
  9580. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9581. expressions containing the following constants:
  9582. @table @option
  9583. @item n
  9584. frame count of the input frame starting from 0
  9585. @item pts
  9586. presentation timestamp of the input frame expressed in time base units
  9587. @item r
  9588. frame rate of the input video, NAN if the input frame rate is unknown
  9589. @item t
  9590. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9591. @item tb
  9592. time base of the input video
  9593. @end table
  9594. @subsection Examples
  9595. @itemize
  9596. @item
  9597. Set the hue to 90 degrees and the saturation to 1.0:
  9598. @example
  9599. hue=h=90:s=1
  9600. @end example
  9601. @item
  9602. Same command but expressing the hue in radians:
  9603. @example
  9604. hue=H=PI/2:s=1
  9605. @end example
  9606. @item
  9607. Rotate hue and make the saturation swing between 0
  9608. and 2 over a period of 1 second:
  9609. @example
  9610. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9611. @end example
  9612. @item
  9613. Apply a 3 seconds saturation fade-in effect starting at 0:
  9614. @example
  9615. hue="s=min(t/3\,1)"
  9616. @end example
  9617. The general fade-in expression can be written as:
  9618. @example
  9619. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9620. @end example
  9621. @item
  9622. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9623. @example
  9624. hue="s=max(0\, min(1\, (8-t)/3))"
  9625. @end example
  9626. The general fade-out expression can be written as:
  9627. @example
  9628. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9629. @end example
  9630. @end itemize
  9631. @subsection Commands
  9632. This filter supports the following commands:
  9633. @table @option
  9634. @item b
  9635. @item s
  9636. @item h
  9637. @item H
  9638. Modify the hue and/or the saturation and/or brightness of the input video.
  9639. The command accepts the same syntax of the corresponding option.
  9640. If the specified expression is not valid, it is kept at its current
  9641. value.
  9642. @end table
  9643. @section hysteresis
  9644. Grow first stream into second stream by connecting components.
  9645. This makes it possible to build more robust edge masks.
  9646. This filter accepts the following options:
  9647. @table @option
  9648. @item planes
  9649. Set which planes will be processed as bitmap, unprocessed planes will be
  9650. copied from first stream.
  9651. By default value 0xf, all planes will be processed.
  9652. @item threshold
  9653. Set threshold which is used in filtering. If pixel component value is higher than
  9654. this value filter algorithm for connecting components is activated.
  9655. By default value is 0.
  9656. @end table
  9657. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9658. @section idet
  9659. Detect video interlacing type.
  9660. This filter tries to detect if the input frames are interlaced, progressive,
  9661. top or bottom field first. It will also try to detect fields that are
  9662. repeated between adjacent frames (a sign of telecine).
  9663. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9664. Multiple frame detection incorporates the classification history of previous frames.
  9665. The filter will log these metadata values:
  9666. @table @option
  9667. @item single.current_frame
  9668. Detected type of current frame using single-frame detection. One of:
  9669. ``tff'' (top field first), ``bff'' (bottom field first),
  9670. ``progressive'', or ``undetermined''
  9671. @item single.tff
  9672. Cumulative number of frames detected as top field first using single-frame detection.
  9673. @item multiple.tff
  9674. Cumulative number of frames detected as top field first using multiple-frame detection.
  9675. @item single.bff
  9676. Cumulative number of frames detected as bottom field first using single-frame detection.
  9677. @item multiple.current_frame
  9678. Detected type of current frame using multiple-frame detection. One of:
  9679. ``tff'' (top field first), ``bff'' (bottom field first),
  9680. ``progressive'', or ``undetermined''
  9681. @item multiple.bff
  9682. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9683. @item single.progressive
  9684. Cumulative number of frames detected as progressive using single-frame detection.
  9685. @item multiple.progressive
  9686. Cumulative number of frames detected as progressive using multiple-frame detection.
  9687. @item single.undetermined
  9688. Cumulative number of frames that could not be classified using single-frame detection.
  9689. @item multiple.undetermined
  9690. Cumulative number of frames that could not be classified using multiple-frame detection.
  9691. @item repeated.current_frame
  9692. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9693. @item repeated.neither
  9694. Cumulative number of frames with no repeated field.
  9695. @item repeated.top
  9696. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9697. @item repeated.bottom
  9698. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9699. @end table
  9700. The filter accepts the following options:
  9701. @table @option
  9702. @item intl_thres
  9703. Set interlacing threshold.
  9704. @item prog_thres
  9705. Set progressive threshold.
  9706. @item rep_thres
  9707. Threshold for repeated field detection.
  9708. @item half_life
  9709. Number of frames after which a given frame's contribution to the
  9710. statistics is halved (i.e., it contributes only 0.5 to its
  9711. classification). The default of 0 means that all frames seen are given
  9712. full weight of 1.0 forever.
  9713. @item analyze_interlaced_flag
  9714. When this is not 0 then idet will use the specified number of frames to determine
  9715. if the interlaced flag is accurate, it will not count undetermined frames.
  9716. If the flag is found to be accurate it will be used without any further
  9717. computations, if it is found to be inaccurate it will be cleared without any
  9718. further computations. This allows inserting the idet filter as a low computational
  9719. method to clean up the interlaced flag
  9720. @end table
  9721. @section il
  9722. Deinterleave or interleave fields.
  9723. This filter allows one to process interlaced images fields without
  9724. deinterlacing them. Deinterleaving splits the input frame into 2
  9725. fields (so called half pictures). Odd lines are moved to the top
  9726. half of the output image, even lines to the bottom half.
  9727. You can process (filter) them independently and then re-interleave them.
  9728. The filter accepts the following options:
  9729. @table @option
  9730. @item luma_mode, l
  9731. @item chroma_mode, c
  9732. @item alpha_mode, a
  9733. Available values for @var{luma_mode}, @var{chroma_mode} and
  9734. @var{alpha_mode} are:
  9735. @table @samp
  9736. @item none
  9737. Do nothing.
  9738. @item deinterleave, d
  9739. Deinterleave fields, placing one above the other.
  9740. @item interleave, i
  9741. Interleave fields. Reverse the effect of deinterleaving.
  9742. @end table
  9743. Default value is @code{none}.
  9744. @item luma_swap, ls
  9745. @item chroma_swap, cs
  9746. @item alpha_swap, as
  9747. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9748. @end table
  9749. @subsection Commands
  9750. This filter supports the all above options as @ref{commands}.
  9751. @section inflate
  9752. Apply inflate effect to the video.
  9753. This filter replaces the pixel by the local(3x3) average by taking into account
  9754. only values higher than the pixel.
  9755. It accepts the following options:
  9756. @table @option
  9757. @item threshold0
  9758. @item threshold1
  9759. @item threshold2
  9760. @item threshold3
  9761. Limit the maximum change for each plane, default is 65535.
  9762. If 0, plane will remain unchanged.
  9763. @end table
  9764. @subsection Commands
  9765. This filter supports the all above options as @ref{commands}.
  9766. @section interlace
  9767. Simple interlacing filter from progressive contents. This interleaves upper (or
  9768. lower) lines from odd frames with lower (or upper) lines from even frames,
  9769. halving the frame rate and preserving image height.
  9770. @example
  9771. Original Original New Frame
  9772. Frame 'j' Frame 'j+1' (tff)
  9773. ========== =========== ==================
  9774. Line 0 --------------------> Frame 'j' Line 0
  9775. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9776. Line 2 ---------------------> Frame 'j' Line 2
  9777. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9778. ... ... ...
  9779. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9780. @end example
  9781. It accepts the following optional parameters:
  9782. @table @option
  9783. @item scan
  9784. This determines whether the interlaced frame is taken from the even
  9785. (tff - default) or odd (bff) lines of the progressive frame.
  9786. @item lowpass
  9787. Vertical lowpass filter to avoid twitter interlacing and
  9788. reduce moire patterns.
  9789. @table @samp
  9790. @item 0, off
  9791. Disable vertical lowpass filter
  9792. @item 1, linear
  9793. Enable linear filter (default)
  9794. @item 2, complex
  9795. Enable complex filter. This will slightly less reduce twitter and moire
  9796. but better retain detail and subjective sharpness impression.
  9797. @end table
  9798. @end table
  9799. @section kerndeint
  9800. Deinterlace input video by applying Donald Graft's adaptive kernel
  9801. deinterling. Work on interlaced parts of a video to produce
  9802. progressive frames.
  9803. The description of the accepted parameters follows.
  9804. @table @option
  9805. @item thresh
  9806. Set the threshold which affects the filter's tolerance when
  9807. determining if a pixel line must be processed. It must be an integer
  9808. in the range [0,255] and defaults to 10. A value of 0 will result in
  9809. applying the process on every pixels.
  9810. @item map
  9811. Paint pixels exceeding the threshold value to white if set to 1.
  9812. Default is 0.
  9813. @item order
  9814. Set the fields order. Swap fields if set to 1, leave fields alone if
  9815. 0. Default is 0.
  9816. @item sharp
  9817. Enable additional sharpening if set to 1. Default is 0.
  9818. @item twoway
  9819. Enable twoway sharpening if set to 1. Default is 0.
  9820. @end table
  9821. @subsection Examples
  9822. @itemize
  9823. @item
  9824. Apply default values:
  9825. @example
  9826. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9827. @end example
  9828. @item
  9829. Enable additional sharpening:
  9830. @example
  9831. kerndeint=sharp=1
  9832. @end example
  9833. @item
  9834. Paint processed pixels in white:
  9835. @example
  9836. kerndeint=map=1
  9837. @end example
  9838. @end itemize
  9839. @section lagfun
  9840. Slowly update darker pixels.
  9841. This filter makes short flashes of light appear longer.
  9842. This filter accepts the following options:
  9843. @table @option
  9844. @item decay
  9845. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9846. @item planes
  9847. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9848. @end table
  9849. @section lenscorrection
  9850. Correct radial lens distortion
  9851. This filter can be used to correct for radial distortion as can result from the use
  9852. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9853. one can use tools available for example as part of opencv or simply trial-and-error.
  9854. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9855. and extract the k1 and k2 coefficients from the resulting matrix.
  9856. Note that effectively the same filter is available in the open-source tools Krita and
  9857. Digikam from the KDE project.
  9858. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9859. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9860. brightness distribution, so you may want to use both filters together in certain
  9861. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9862. be applied before or after lens correction.
  9863. @subsection Options
  9864. The filter accepts the following options:
  9865. @table @option
  9866. @item cx
  9867. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9868. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9869. width. Default is 0.5.
  9870. @item cy
  9871. Relative y-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. height. Default is 0.5.
  9874. @item k1
  9875. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9876. no correction. Default is 0.
  9877. @item k2
  9878. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9879. 0 means no correction. Default is 0.
  9880. @end table
  9881. The formula that generates the correction is:
  9882. @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)
  9883. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9884. distances from the focal point in the source and target images, respectively.
  9885. @section lensfun
  9886. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9887. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9888. to apply the lens correction. The filter will load the lensfun database and
  9889. query it to find the corresponding camera and lens entries in the database. As
  9890. long as these entries can be found with the given options, the filter can
  9891. perform corrections on frames. Note that incomplete strings will result in the
  9892. filter choosing the best match with the given options, and the filter will
  9893. output the chosen camera and lens models (logged with level "info"). You must
  9894. provide the make, camera model, and lens model as they are required.
  9895. The filter accepts the following options:
  9896. @table @option
  9897. @item make
  9898. The make of the camera (for example, "Canon"). This option is required.
  9899. @item model
  9900. The model of the camera (for example, "Canon EOS 100D"). This option is
  9901. required.
  9902. @item lens_model
  9903. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9904. option is required.
  9905. @item mode
  9906. The type of correction to apply. The following values are valid options:
  9907. @table @samp
  9908. @item vignetting
  9909. Enables fixing lens vignetting.
  9910. @item geometry
  9911. Enables fixing lens geometry. This is the default.
  9912. @item subpixel
  9913. Enables fixing chromatic aberrations.
  9914. @item vig_geo
  9915. Enables fixing lens vignetting and lens geometry.
  9916. @item vig_subpixel
  9917. Enables fixing lens vignetting and chromatic aberrations.
  9918. @item distortion
  9919. Enables fixing both lens geometry and chromatic aberrations.
  9920. @item all
  9921. Enables all possible corrections.
  9922. @end table
  9923. @item focal_length
  9924. The focal length of the image/video (zoom; expected constant for video). For
  9925. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9926. range should be chosen when using that lens. Default 18.
  9927. @item aperture
  9928. The aperture of the image/video (expected constant for video). Note that
  9929. aperture is only used for vignetting correction. Default 3.5.
  9930. @item focus_distance
  9931. The focus distance of the image/video (expected constant for video). Note that
  9932. focus distance is only used for vignetting and only slightly affects the
  9933. vignetting correction process. If unknown, leave it at the default value (which
  9934. is 1000).
  9935. @item scale
  9936. The scale factor which is applied after transformation. After correction the
  9937. video is no longer necessarily rectangular. This parameter controls how much of
  9938. the resulting image is visible. The value 0 means that a value will be chosen
  9939. automatically such that there is little or no unmapped area in the output
  9940. image. 1.0 means that no additional scaling is done. Lower values may result
  9941. in more of the corrected image being visible, while higher values may avoid
  9942. unmapped areas in the output.
  9943. @item target_geometry
  9944. The target geometry of the output image/video. The following values are valid
  9945. options:
  9946. @table @samp
  9947. @item rectilinear (default)
  9948. @item fisheye
  9949. @item panoramic
  9950. @item equirectangular
  9951. @item fisheye_orthographic
  9952. @item fisheye_stereographic
  9953. @item fisheye_equisolid
  9954. @item fisheye_thoby
  9955. @end table
  9956. @item reverse
  9957. Apply the reverse of image correction (instead of correcting distortion, apply
  9958. it).
  9959. @item interpolation
  9960. The type of interpolation used when correcting distortion. The following values
  9961. are valid options:
  9962. @table @samp
  9963. @item nearest
  9964. @item linear (default)
  9965. @item lanczos
  9966. @end table
  9967. @end table
  9968. @subsection Examples
  9969. @itemize
  9970. @item
  9971. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9972. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9973. aperture of "8.0".
  9974. @example
  9975. 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
  9976. @end example
  9977. @item
  9978. Apply the same as before, but only for the first 5 seconds of video.
  9979. @example
  9980. 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
  9981. @end example
  9982. @end itemize
  9983. @section libvmaf
  9984. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9985. score between two input videos.
  9986. The obtained VMAF score is printed through the logging system.
  9987. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9988. After installing the library it can be enabled using:
  9989. @code{./configure --enable-libvmaf}.
  9990. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9991. The filter has following options:
  9992. @table @option
  9993. @item model_path
  9994. Set the model path which is to be used for SVM.
  9995. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9996. @item log_path
  9997. Set the file path to be used to store logs.
  9998. @item log_fmt
  9999. Set the format of the log file (csv, json or xml).
  10000. @item enable_transform
  10001. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  10002. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  10003. Default value: @code{false}
  10004. @item phone_model
  10005. Invokes the phone model which will generate VMAF scores higher than in the
  10006. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  10007. Default value: @code{false}
  10008. @item psnr
  10009. Enables computing psnr along with vmaf.
  10010. Default value: @code{false}
  10011. @item ssim
  10012. Enables computing ssim along with vmaf.
  10013. Default value: @code{false}
  10014. @item ms_ssim
  10015. Enables computing ms_ssim along with vmaf.
  10016. Default value: @code{false}
  10017. @item pool
  10018. Set the pool method to be used for computing vmaf.
  10019. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  10020. @item n_threads
  10021. Set number of threads to be used when computing vmaf.
  10022. Default value: @code{0}, which makes use of all available logical processors.
  10023. @item n_subsample
  10024. Set interval for frame subsampling used when computing vmaf.
  10025. Default value: @code{1}
  10026. @item enable_conf_interval
  10027. Enables confidence interval.
  10028. Default value: @code{false}
  10029. @end table
  10030. This filter also supports the @ref{framesync} options.
  10031. @subsection Examples
  10032. @itemize
  10033. @item
  10034. On the below examples the input file @file{main.mpg} being processed is
  10035. compared with the reference file @file{ref.mpg}.
  10036. @example
  10037. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  10038. @end example
  10039. @item
  10040. Example with options:
  10041. @example
  10042. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  10043. @end example
  10044. @item
  10045. Example with options and different containers:
  10046. @example
  10047. 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 -
  10048. @end example
  10049. @end itemize
  10050. @section limiter
  10051. Limits the pixel components values to the specified range [min, max].
  10052. The filter accepts the following options:
  10053. @table @option
  10054. @item min
  10055. Lower bound. Defaults to the lowest allowed value for the input.
  10056. @item max
  10057. Upper bound. Defaults to the highest allowed value for the input.
  10058. @item planes
  10059. Specify which planes will be processed. Defaults to all available.
  10060. @end table
  10061. @section loop
  10062. Loop video frames.
  10063. The filter accepts the following options:
  10064. @table @option
  10065. @item loop
  10066. Set the number of loops. Setting this value to -1 will result in infinite loops.
  10067. Default is 0.
  10068. @item size
  10069. Set maximal size in number of frames. Default is 0.
  10070. @item start
  10071. Set first frame of loop. Default is 0.
  10072. @end table
  10073. @subsection Examples
  10074. @itemize
  10075. @item
  10076. Loop single first frame infinitely:
  10077. @example
  10078. loop=loop=-1:size=1:start=0
  10079. @end example
  10080. @item
  10081. Loop single first frame 10 times:
  10082. @example
  10083. loop=loop=10:size=1:start=0
  10084. @end example
  10085. @item
  10086. Loop 10 first frames 5 times:
  10087. @example
  10088. loop=loop=5:size=10:start=0
  10089. @end example
  10090. @end itemize
  10091. @section lut1d
  10092. Apply a 1D LUT to an input video.
  10093. The filter accepts the following options:
  10094. @table @option
  10095. @item file
  10096. Set the 1D LUT file name.
  10097. Currently supported formats:
  10098. @table @samp
  10099. @item cube
  10100. Iridas
  10101. @item csp
  10102. cineSpace
  10103. @end table
  10104. @item interp
  10105. Select interpolation mode.
  10106. Available values are:
  10107. @table @samp
  10108. @item nearest
  10109. Use values from the nearest defined point.
  10110. @item linear
  10111. Interpolate values using the linear interpolation.
  10112. @item cosine
  10113. Interpolate values using the cosine interpolation.
  10114. @item cubic
  10115. Interpolate values using the cubic interpolation.
  10116. @item spline
  10117. Interpolate values using the spline interpolation.
  10118. @end table
  10119. @end table
  10120. @anchor{lut3d}
  10121. @section lut3d
  10122. Apply a 3D LUT to an input video.
  10123. The filter accepts the following options:
  10124. @table @option
  10125. @item file
  10126. Set the 3D LUT file name.
  10127. Currently supported formats:
  10128. @table @samp
  10129. @item 3dl
  10130. AfterEffects
  10131. @item cube
  10132. Iridas
  10133. @item dat
  10134. DaVinci
  10135. @item m3d
  10136. Pandora
  10137. @item csp
  10138. cineSpace
  10139. @end table
  10140. @item interp
  10141. Select interpolation mode.
  10142. Available values are:
  10143. @table @samp
  10144. @item nearest
  10145. Use values from the nearest defined point.
  10146. @item trilinear
  10147. Interpolate values using the 8 points defining a cube.
  10148. @item tetrahedral
  10149. Interpolate values using a tetrahedron.
  10150. @end table
  10151. @end table
  10152. @section lumakey
  10153. Turn certain luma values into transparency.
  10154. The filter accepts the following options:
  10155. @table @option
  10156. @item threshold
  10157. Set the luma which will be used as base for transparency.
  10158. Default value is @code{0}.
  10159. @item tolerance
  10160. Set the range of luma values to be keyed out.
  10161. Default value is @code{0.01}.
  10162. @item softness
  10163. Set the range of softness. Default value is @code{0}.
  10164. Use this to control gradual transition from zero to full transparency.
  10165. @end table
  10166. @subsection Commands
  10167. This filter supports same @ref{commands} as options.
  10168. The command accepts the same syntax of the corresponding option.
  10169. If the specified expression is not valid, it is kept at its current
  10170. value.
  10171. @section lut, lutrgb, lutyuv
  10172. Compute a look-up table for binding each pixel component input value
  10173. to an output value, and apply it to the input video.
  10174. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10175. to an RGB input video.
  10176. These filters accept the following parameters:
  10177. @table @option
  10178. @item c0
  10179. set first pixel component expression
  10180. @item c1
  10181. set second pixel component expression
  10182. @item c2
  10183. set third pixel component expression
  10184. @item c3
  10185. set fourth pixel component expression, corresponds to the alpha component
  10186. @item r
  10187. set red component expression
  10188. @item g
  10189. set green component expression
  10190. @item b
  10191. set blue component expression
  10192. @item a
  10193. alpha component expression
  10194. @item y
  10195. set Y/luminance component expression
  10196. @item u
  10197. set U/Cb component expression
  10198. @item v
  10199. set V/Cr component expression
  10200. @end table
  10201. Each of them specifies the expression to use for computing the lookup table for
  10202. the corresponding pixel component values.
  10203. The exact component associated to each of the @var{c*} options depends on the
  10204. format in input.
  10205. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10206. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10207. The expressions can contain the following constants and functions:
  10208. @table @option
  10209. @item w
  10210. @item h
  10211. The input width and height.
  10212. @item val
  10213. The input value for the pixel component.
  10214. @item clipval
  10215. The input value, clipped to the @var{minval}-@var{maxval} range.
  10216. @item maxval
  10217. The maximum value for the pixel component.
  10218. @item minval
  10219. The minimum value for the pixel component.
  10220. @item negval
  10221. The negated value for the pixel component value, clipped to the
  10222. @var{minval}-@var{maxval} range; it corresponds to the expression
  10223. "maxval-clipval+minval".
  10224. @item clip(val)
  10225. The computed value in @var{val}, clipped to the
  10226. @var{minval}-@var{maxval} range.
  10227. @item gammaval(gamma)
  10228. The computed gamma correction value of the pixel component value,
  10229. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10230. expression
  10231. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10232. @end table
  10233. All expressions default to "val".
  10234. @subsection Examples
  10235. @itemize
  10236. @item
  10237. Negate input video:
  10238. @example
  10239. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10240. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10241. @end example
  10242. The above is the same as:
  10243. @example
  10244. lutrgb="r=negval:g=negval:b=negval"
  10245. lutyuv="y=negval:u=negval:v=negval"
  10246. @end example
  10247. @item
  10248. Negate luminance:
  10249. @example
  10250. lutyuv=y=negval
  10251. @end example
  10252. @item
  10253. Remove chroma components, turning the video into a graytone image:
  10254. @example
  10255. lutyuv="u=128:v=128"
  10256. @end example
  10257. @item
  10258. Apply a luma burning effect:
  10259. @example
  10260. lutyuv="y=2*val"
  10261. @end example
  10262. @item
  10263. Remove green and blue components:
  10264. @example
  10265. lutrgb="g=0:b=0"
  10266. @end example
  10267. @item
  10268. Set a constant alpha channel value on input:
  10269. @example
  10270. format=rgba,lutrgb=a="maxval-minval/2"
  10271. @end example
  10272. @item
  10273. Correct luminance gamma by a factor of 0.5:
  10274. @example
  10275. lutyuv=y=gammaval(0.5)
  10276. @end example
  10277. @item
  10278. Discard least significant bits of luma:
  10279. @example
  10280. lutyuv=y='bitand(val, 128+64+32)'
  10281. @end example
  10282. @item
  10283. Technicolor like effect:
  10284. @example
  10285. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10286. @end example
  10287. @end itemize
  10288. @section lut2, tlut2
  10289. The @code{lut2} filter takes two input streams and outputs one
  10290. stream.
  10291. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10292. from one single stream.
  10293. This filter accepts the following parameters:
  10294. @table @option
  10295. @item c0
  10296. set first pixel component expression
  10297. @item c1
  10298. set second pixel component expression
  10299. @item c2
  10300. set third pixel component expression
  10301. @item c3
  10302. set fourth pixel component expression, corresponds to the alpha component
  10303. @item d
  10304. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10305. which means bit depth is automatically picked from first input format.
  10306. @end table
  10307. The @code{lut2} filter also supports the @ref{framesync} options.
  10308. Each of them specifies the expression to use for computing the lookup table for
  10309. the corresponding pixel component values.
  10310. The exact component associated to each of the @var{c*} options depends on the
  10311. format in inputs.
  10312. The expressions can contain the following constants:
  10313. @table @option
  10314. @item w
  10315. @item h
  10316. The input width and height.
  10317. @item x
  10318. The first input value for the pixel component.
  10319. @item y
  10320. The second input value for the pixel component.
  10321. @item bdx
  10322. The first input video bit depth.
  10323. @item bdy
  10324. The second input video bit depth.
  10325. @end table
  10326. All expressions default to "x".
  10327. @subsection Examples
  10328. @itemize
  10329. @item
  10330. Highlight differences between two RGB video streams:
  10331. @example
  10332. 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)'
  10333. @end example
  10334. @item
  10335. Highlight differences between two YUV video streams:
  10336. @example
  10337. 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)'
  10338. @end example
  10339. @item
  10340. Show max difference between two video streams:
  10341. @example
  10342. 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)))'
  10343. @end example
  10344. @end itemize
  10345. @section maskedclamp
  10346. Clamp the first input stream with the second input and third input stream.
  10347. Returns the value of first stream to be between second input
  10348. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10349. This filter accepts the following options:
  10350. @table @option
  10351. @item undershoot
  10352. Default value is @code{0}.
  10353. @item overshoot
  10354. Default value is @code{0}.
  10355. @item planes
  10356. Set which planes will be processed as bitmap, unprocessed planes will be
  10357. copied from first stream.
  10358. By default value 0xf, all planes will be processed.
  10359. @end table
  10360. @section maskedmax
  10361. Merge the second and third input stream into output stream using absolute differences
  10362. between second input stream and first input stream and absolute difference between
  10363. third input stream and first input stream. The picked value will be from second input
  10364. stream if second absolute difference is greater than first one or from third input stream
  10365. otherwise.
  10366. This filter accepts the following options:
  10367. @table @option
  10368. @item planes
  10369. Set which planes will be processed as bitmap, unprocessed planes will be
  10370. copied from first stream.
  10371. By default value 0xf, all planes will be processed.
  10372. @end table
  10373. @section maskedmerge
  10374. Merge the first input stream with the second input stream using per pixel
  10375. weights in the third input stream.
  10376. A value of 0 in the third stream pixel component means that pixel component
  10377. from first stream is returned unchanged, while maximum value (eg. 255 for
  10378. 8-bit videos) means that pixel component from second stream is returned
  10379. unchanged. Intermediate values define the amount of merging between both
  10380. input stream's pixel components.
  10381. This filter accepts the following options:
  10382. @table @option
  10383. @item planes
  10384. Set which planes will be processed as bitmap, unprocessed planes will be
  10385. copied from first stream.
  10386. By default value 0xf, all planes will be processed.
  10387. @end table
  10388. @section maskedmin
  10389. Merge the second and third input stream into output stream using absolute differences
  10390. between second input stream and first input stream and absolute difference between
  10391. third input stream and first input stream. The picked value will be from second input
  10392. stream if second absolute difference is less than first one or from third input stream
  10393. otherwise.
  10394. This filter accepts the following options:
  10395. @table @option
  10396. @item planes
  10397. Set which planes will be processed as bitmap, unprocessed planes will be
  10398. copied from first stream.
  10399. By default value 0xf, all planes will be processed.
  10400. @end table
  10401. @section maskedthreshold
  10402. Pick pixels comparing absolute difference of two video streams with fixed
  10403. threshold.
  10404. If absolute difference between pixel component of first and second video
  10405. stream is equal or lower than user supplied threshold than pixel component
  10406. from first video stream is picked, otherwise pixel component from second
  10407. video stream is picked.
  10408. This filter accepts the following options:
  10409. @table @option
  10410. @item threshold
  10411. Set threshold used when picking pixels from absolute difference from two input
  10412. video streams.
  10413. @item planes
  10414. Set which planes will be processed as bitmap, unprocessed planes will be
  10415. copied from second stream.
  10416. By default value 0xf, all planes will be processed.
  10417. @end table
  10418. @section maskfun
  10419. Create mask from input video.
  10420. For example it is useful to create motion masks after @code{tblend} filter.
  10421. This filter accepts the following options:
  10422. @table @option
  10423. @item low
  10424. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10425. @item high
  10426. Set high threshold. Any pixel component higher than this value will be set to max value
  10427. allowed for current pixel format.
  10428. @item planes
  10429. Set planes to filter, by default all available planes are filtered.
  10430. @item fill
  10431. Fill all frame pixels with this value.
  10432. @item sum
  10433. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10434. average, output frame will be completely filled with value set by @var{fill} option.
  10435. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10436. @end table
  10437. @section mcdeint
  10438. Apply motion-compensation deinterlacing.
  10439. It needs one field per frame as input and must thus be used together
  10440. with yadif=1/3 or equivalent.
  10441. This filter accepts the following options:
  10442. @table @option
  10443. @item mode
  10444. Set the deinterlacing mode.
  10445. It accepts one of the following values:
  10446. @table @samp
  10447. @item fast
  10448. @item medium
  10449. @item slow
  10450. use iterative motion estimation
  10451. @item extra_slow
  10452. like @samp{slow}, but use multiple reference frames.
  10453. @end table
  10454. Default value is @samp{fast}.
  10455. @item parity
  10456. Set the picture field parity assumed for the input video. It must be
  10457. one of the following values:
  10458. @table @samp
  10459. @item 0, tff
  10460. assume top field first
  10461. @item 1, bff
  10462. assume bottom field first
  10463. @end table
  10464. Default value is @samp{bff}.
  10465. @item qp
  10466. Set per-block quantization parameter (QP) used by the internal
  10467. encoder.
  10468. Higher values should result in a smoother motion vector field but less
  10469. optimal individual vectors. Default value is 1.
  10470. @end table
  10471. @section median
  10472. Pick median pixel from certain rectangle defined by radius.
  10473. This filter accepts the following options:
  10474. @table @option
  10475. @item radius
  10476. Set horizontal radius size. Default value is @code{1}.
  10477. Allowed range is integer from 1 to 127.
  10478. @item planes
  10479. Set which planes to process. Default is @code{15}, which is all available planes.
  10480. @item radiusV
  10481. Set vertical radius size. Default value is @code{0}.
  10482. Allowed range is integer from 0 to 127.
  10483. If it is 0, value will be picked from horizontal @code{radius} option.
  10484. @item percentile
  10485. Set median percentile. Default value is @code{0.5}.
  10486. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10487. minimum values, and @code{1} maximum values.
  10488. @end table
  10489. @subsection Commands
  10490. This filter supports same @ref{commands} as options.
  10491. The command accepts the same syntax of the corresponding option.
  10492. If the specified expression is not valid, it is kept at its current
  10493. value.
  10494. @section mergeplanes
  10495. Merge color channel components from several video streams.
  10496. The filter accepts up to 4 input streams, and merge selected input
  10497. planes to the output video.
  10498. This filter accepts the following options:
  10499. @table @option
  10500. @item mapping
  10501. Set input to output plane mapping. Default is @code{0}.
  10502. The mappings is specified as a bitmap. It should be specified as a
  10503. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10504. mapping for the first plane of the output stream. 'A' sets the number of
  10505. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10506. corresponding input to use (from 0 to 3). The rest of the mappings is
  10507. similar, 'Bb' describes the mapping for the output stream second
  10508. plane, 'Cc' describes the mapping for the output stream third plane and
  10509. 'Dd' describes the mapping for the output stream fourth plane.
  10510. @item format
  10511. Set output pixel format. Default is @code{yuva444p}.
  10512. @end table
  10513. @subsection Examples
  10514. @itemize
  10515. @item
  10516. Merge three gray video streams of same width and height into single video stream:
  10517. @example
  10518. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10519. @end example
  10520. @item
  10521. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10522. @example
  10523. [a0][a1]mergeplanes=0x00010210:yuva444p
  10524. @end example
  10525. @item
  10526. Swap Y and A plane in yuva444p stream:
  10527. @example
  10528. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10529. @end example
  10530. @item
  10531. Swap U and V plane in yuv420p stream:
  10532. @example
  10533. format=yuv420p,mergeplanes=0x000201:yuv420p
  10534. @end example
  10535. @item
  10536. Cast a rgb24 clip to yuv444p:
  10537. @example
  10538. format=rgb24,mergeplanes=0x000102:yuv444p
  10539. @end example
  10540. @end itemize
  10541. @section mestimate
  10542. Estimate and export motion vectors using block matching algorithms.
  10543. Motion vectors are stored in frame side data to be used by other filters.
  10544. This filter accepts the following options:
  10545. @table @option
  10546. @item method
  10547. Specify the motion estimation method. Accepts one of the following values:
  10548. @table @samp
  10549. @item esa
  10550. Exhaustive search algorithm.
  10551. @item tss
  10552. Three step search algorithm.
  10553. @item tdls
  10554. Two dimensional logarithmic search algorithm.
  10555. @item ntss
  10556. New three step search algorithm.
  10557. @item fss
  10558. Four step search algorithm.
  10559. @item ds
  10560. Diamond search algorithm.
  10561. @item hexbs
  10562. Hexagon-based search algorithm.
  10563. @item epzs
  10564. Enhanced predictive zonal search algorithm.
  10565. @item umh
  10566. Uneven multi-hexagon search algorithm.
  10567. @end table
  10568. Default value is @samp{esa}.
  10569. @item mb_size
  10570. Macroblock size. Default @code{16}.
  10571. @item search_param
  10572. Search parameter. Default @code{7}.
  10573. @end table
  10574. @section midequalizer
  10575. Apply Midway Image Equalization effect using two video streams.
  10576. Midway Image Equalization adjusts a pair of images to have the same
  10577. histogram, while maintaining their dynamics as much as possible. It's
  10578. useful for e.g. matching exposures from a pair of stereo cameras.
  10579. This filter has two inputs and one output, which must be of same pixel format, but
  10580. may be of different sizes. The output of filter is first input adjusted with
  10581. midway histogram of both inputs.
  10582. This filter accepts the following option:
  10583. @table @option
  10584. @item planes
  10585. Set which planes to process. Default is @code{15}, which is all available planes.
  10586. @end table
  10587. @section minterpolate
  10588. Convert the video to specified frame rate using motion interpolation.
  10589. This filter accepts the following options:
  10590. @table @option
  10591. @item fps
  10592. 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}.
  10593. @item mi_mode
  10594. Motion interpolation mode. Following values are accepted:
  10595. @table @samp
  10596. @item dup
  10597. Duplicate previous or next frame for interpolating new ones.
  10598. @item blend
  10599. Blend source frames. Interpolated frame is mean of previous and next frames.
  10600. @item mci
  10601. Motion compensated interpolation. Following options are effective when this mode is selected:
  10602. @table @samp
  10603. @item mc_mode
  10604. Motion compensation mode. Following values are accepted:
  10605. @table @samp
  10606. @item obmc
  10607. Overlapped block motion compensation.
  10608. @item aobmc
  10609. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10610. @end table
  10611. Default mode is @samp{obmc}.
  10612. @item me_mode
  10613. Motion estimation mode. Following values are accepted:
  10614. @table @samp
  10615. @item bidir
  10616. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10617. @item bilat
  10618. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10619. @end table
  10620. Default mode is @samp{bilat}.
  10621. @item me
  10622. The algorithm to be used for motion estimation. Following values are accepted:
  10623. @table @samp
  10624. @item esa
  10625. Exhaustive search algorithm.
  10626. @item tss
  10627. Three step search algorithm.
  10628. @item tdls
  10629. Two dimensional logarithmic search algorithm.
  10630. @item ntss
  10631. New three step search algorithm.
  10632. @item fss
  10633. Four step search algorithm.
  10634. @item ds
  10635. Diamond search algorithm.
  10636. @item hexbs
  10637. Hexagon-based search algorithm.
  10638. @item epzs
  10639. Enhanced predictive zonal search algorithm.
  10640. @item umh
  10641. Uneven multi-hexagon search algorithm.
  10642. @end table
  10643. Default algorithm is @samp{epzs}.
  10644. @item mb_size
  10645. Macroblock size. Default @code{16}.
  10646. @item search_param
  10647. Motion estimation search parameter. Default @code{32}.
  10648. @item vsbmc
  10649. 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).
  10650. @end table
  10651. @end table
  10652. @item scd
  10653. 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:
  10654. @table @samp
  10655. @item none
  10656. Disable scene change detection.
  10657. @item fdiff
  10658. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10659. @end table
  10660. Default method is @samp{fdiff}.
  10661. @item scd_threshold
  10662. Scene change detection threshold. Default is @code{10.}.
  10663. @end table
  10664. @section mix
  10665. Mix several video input streams into one video stream.
  10666. A description of the accepted options follows.
  10667. @table @option
  10668. @item nb_inputs
  10669. The number of inputs. If unspecified, it defaults to 2.
  10670. @item weights
  10671. Specify weight of each input video stream as sequence.
  10672. Each weight is separated by space. If number of weights
  10673. is smaller than number of @var{frames} last specified
  10674. weight will be used for all remaining unset weights.
  10675. @item scale
  10676. Specify scale, if it is set it will be multiplied with sum
  10677. of each weight multiplied with pixel values to give final destination
  10678. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10679. @item duration
  10680. Specify how end of stream is determined.
  10681. @table @samp
  10682. @item longest
  10683. The duration of the longest input. (default)
  10684. @item shortest
  10685. The duration of the shortest input.
  10686. @item first
  10687. The duration of the first input.
  10688. @end table
  10689. @end table
  10690. @section mpdecimate
  10691. Drop frames that do not differ greatly from the previous frame in
  10692. order to reduce frame rate.
  10693. The main use of this filter is for very-low-bitrate encoding
  10694. (e.g. streaming over dialup modem), but it could in theory be used for
  10695. fixing movies that were inverse-telecined incorrectly.
  10696. A description of the accepted options follows.
  10697. @table @option
  10698. @item max
  10699. Set the maximum number of consecutive frames which can be dropped (if
  10700. positive), or the minimum interval between dropped frames (if
  10701. negative). If the value is 0, the frame is dropped disregarding the
  10702. number of previous sequentially dropped frames.
  10703. Default value is 0.
  10704. @item hi
  10705. @item lo
  10706. @item frac
  10707. Set the dropping threshold values.
  10708. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10709. represent actual pixel value differences, so a threshold of 64
  10710. corresponds to 1 unit of difference for each pixel, or the same spread
  10711. out differently over the block.
  10712. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10713. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10714. meaning the whole image) differ by more than a threshold of @option{lo}.
  10715. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10716. 64*5, and default value for @option{frac} is 0.33.
  10717. @end table
  10718. @section negate
  10719. Negate (invert) the input video.
  10720. It accepts the following option:
  10721. @table @option
  10722. @item negate_alpha
  10723. With value 1, it negates the alpha component, if present. Default value is 0.
  10724. @end table
  10725. @anchor{nlmeans}
  10726. @section nlmeans
  10727. Denoise frames using Non-Local Means algorithm.
  10728. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10729. context similarity is defined by comparing their surrounding patches of size
  10730. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10731. around the pixel.
  10732. Note that the research area defines centers for patches, which means some
  10733. patches will be made of pixels outside that research area.
  10734. The filter accepts the following options.
  10735. @table @option
  10736. @item s
  10737. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10738. @item p
  10739. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10740. @item pc
  10741. Same as @option{p} but for chroma planes.
  10742. The default value is @var{0} and means automatic.
  10743. @item r
  10744. Set research size. Default is 15. Must be odd number in range [0, 99].
  10745. @item rc
  10746. Same as @option{r} but for chroma planes.
  10747. The default value is @var{0} and means automatic.
  10748. @end table
  10749. @section nnedi
  10750. Deinterlace video using neural network edge directed interpolation.
  10751. This filter accepts the following options:
  10752. @table @option
  10753. @item weights
  10754. Mandatory option, without binary file filter can not work.
  10755. Currently file can be found here:
  10756. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10757. @item deint
  10758. Set which frames to deinterlace, by default it is @code{all}.
  10759. Can be @code{all} or @code{interlaced}.
  10760. @item field
  10761. Set mode of operation.
  10762. Can be one of the following:
  10763. @table @samp
  10764. @item af
  10765. Use frame flags, both fields.
  10766. @item a
  10767. Use frame flags, single field.
  10768. @item t
  10769. Use top field only.
  10770. @item b
  10771. Use bottom field only.
  10772. @item tf
  10773. Use both fields, top first.
  10774. @item bf
  10775. Use both fields, bottom first.
  10776. @end table
  10777. @item planes
  10778. Set which planes to process, by default filter process all frames.
  10779. @item nsize
  10780. Set size of local neighborhood around each pixel, used by the predictor neural
  10781. network.
  10782. Can be one of the following:
  10783. @table @samp
  10784. @item s8x6
  10785. @item s16x6
  10786. @item s32x6
  10787. @item s48x6
  10788. @item s8x4
  10789. @item s16x4
  10790. @item s32x4
  10791. @end table
  10792. @item nns
  10793. Set the number of neurons in predictor neural network.
  10794. Can be one of the following:
  10795. @table @samp
  10796. @item n16
  10797. @item n32
  10798. @item n64
  10799. @item n128
  10800. @item n256
  10801. @end table
  10802. @item qual
  10803. Controls the number of different neural network predictions that are blended
  10804. together to compute the final output value. Can be @code{fast}, default or
  10805. @code{slow}.
  10806. @item etype
  10807. Set which set of weights to use in the predictor.
  10808. Can be one of the following:
  10809. @table @samp
  10810. @item a
  10811. weights trained to minimize absolute error
  10812. @item s
  10813. weights trained to minimize squared error
  10814. @end table
  10815. @item pscrn
  10816. Controls whether or not the prescreener neural network is used to decide
  10817. which pixels should be processed by the predictor neural network and which
  10818. can be handled by simple cubic interpolation.
  10819. The prescreener is trained to know whether cubic interpolation will be
  10820. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10821. The computational complexity of the prescreener nn is much less than that of
  10822. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10823. using the prescreener generally results in much faster processing.
  10824. The prescreener is pretty accurate, so the difference between using it and not
  10825. using it is almost always unnoticeable.
  10826. Can be one of the following:
  10827. @table @samp
  10828. @item none
  10829. @item original
  10830. @item new
  10831. @end table
  10832. Default is @code{new}.
  10833. @item fapprox
  10834. Set various debugging flags.
  10835. @end table
  10836. @section noformat
  10837. Force libavfilter not to use any of the specified pixel formats for the
  10838. input to the next filter.
  10839. It accepts the following parameters:
  10840. @table @option
  10841. @item pix_fmts
  10842. A '|'-separated list of pixel format names, such as
  10843. pix_fmts=yuv420p|monow|rgb24".
  10844. @end table
  10845. @subsection Examples
  10846. @itemize
  10847. @item
  10848. Force libavfilter to use a format different from @var{yuv420p} for the
  10849. input to the vflip filter:
  10850. @example
  10851. noformat=pix_fmts=yuv420p,vflip
  10852. @end example
  10853. @item
  10854. Convert the input video to any of the formats not contained in the list:
  10855. @example
  10856. noformat=yuv420p|yuv444p|yuv410p
  10857. @end example
  10858. @end itemize
  10859. @section noise
  10860. Add noise on video input frame.
  10861. The filter accepts the following options:
  10862. @table @option
  10863. @item all_seed
  10864. @item c0_seed
  10865. @item c1_seed
  10866. @item c2_seed
  10867. @item c3_seed
  10868. Set noise seed for specific pixel component or all pixel components in case
  10869. of @var{all_seed}. Default value is @code{123457}.
  10870. @item all_strength, alls
  10871. @item c0_strength, c0s
  10872. @item c1_strength, c1s
  10873. @item c2_strength, c2s
  10874. @item c3_strength, c3s
  10875. Set noise strength for specific pixel component or all pixel components in case
  10876. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10877. @item all_flags, allf
  10878. @item c0_flags, c0f
  10879. @item c1_flags, c1f
  10880. @item c2_flags, c2f
  10881. @item c3_flags, c3f
  10882. Set pixel component flags or set flags for all components if @var{all_flags}.
  10883. Available values for component flags are:
  10884. @table @samp
  10885. @item a
  10886. averaged temporal noise (smoother)
  10887. @item p
  10888. mix random noise with a (semi)regular pattern
  10889. @item t
  10890. temporal noise (noise pattern changes between frames)
  10891. @item u
  10892. uniform noise (gaussian otherwise)
  10893. @end table
  10894. @end table
  10895. @subsection Examples
  10896. Add temporal and uniform noise to input video:
  10897. @example
  10898. noise=alls=20:allf=t+u
  10899. @end example
  10900. @section normalize
  10901. Normalize RGB video (aka histogram stretching, contrast stretching).
  10902. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10903. For each channel of each frame, the filter computes the input range and maps
  10904. it linearly to the user-specified output range. The output range defaults
  10905. to the full dynamic range from pure black to pure white.
  10906. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10907. changes in brightness) caused when small dark or bright objects enter or leave
  10908. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10909. video camera, and, like a video camera, it may cause a period of over- or
  10910. under-exposure of the video.
  10911. The R,G,B channels can be normalized independently, which may cause some
  10912. color shifting, or linked together as a single channel, which prevents
  10913. color shifting. Linked normalization preserves hue. Independent normalization
  10914. does not, so it can be used to remove some color casts. Independent and linked
  10915. normalization can be combined in any ratio.
  10916. The normalize filter accepts the following options:
  10917. @table @option
  10918. @item blackpt
  10919. @item whitept
  10920. Colors which define the output range. The minimum input value is mapped to
  10921. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10922. The defaults are black and white respectively. Specifying white for
  10923. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10924. normalized video. Shades of grey can be used to reduce the dynamic range
  10925. (contrast). Specifying saturated colors here can create some interesting
  10926. effects.
  10927. @item smoothing
  10928. The number of previous frames to use for temporal smoothing. The input range
  10929. of each channel is smoothed using a rolling average over the current frame
  10930. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10931. smoothing).
  10932. @item independence
  10933. Controls the ratio of independent (color shifting) channel normalization to
  10934. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10935. independent. Defaults to 1.0 (fully independent).
  10936. @item strength
  10937. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10938. expensive no-op. Defaults to 1.0 (full strength).
  10939. @end table
  10940. @subsection Commands
  10941. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10942. The command accepts the same syntax of the corresponding option.
  10943. If the specified expression is not valid, it is kept at its current
  10944. value.
  10945. @subsection Examples
  10946. Stretch video contrast to use the full dynamic range, with no temporal
  10947. smoothing; may flicker depending on the source content:
  10948. @example
  10949. normalize=blackpt=black:whitept=white:smoothing=0
  10950. @end example
  10951. As above, but with 50 frames of temporal smoothing; flicker should be
  10952. reduced, depending on the source content:
  10953. @example
  10954. normalize=blackpt=black:whitept=white:smoothing=50
  10955. @end example
  10956. As above, but with hue-preserving linked channel normalization:
  10957. @example
  10958. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10959. @end example
  10960. As above, but with half strength:
  10961. @example
  10962. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10963. @end example
  10964. Map the darkest input color to red, the brightest input color to cyan:
  10965. @example
  10966. normalize=blackpt=red:whitept=cyan
  10967. @end example
  10968. @section null
  10969. Pass the video source unchanged to the output.
  10970. @section ocr
  10971. Optical Character Recognition
  10972. This filter uses Tesseract for optical character recognition. To enable
  10973. compilation of this filter, you need to configure FFmpeg with
  10974. @code{--enable-libtesseract}.
  10975. It accepts the following options:
  10976. @table @option
  10977. @item datapath
  10978. Set datapath to tesseract data. Default is to use whatever was
  10979. set at installation.
  10980. @item language
  10981. Set language, default is "eng".
  10982. @item whitelist
  10983. Set character whitelist.
  10984. @item blacklist
  10985. Set character blacklist.
  10986. @end table
  10987. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10988. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10989. @section ocv
  10990. Apply a video transform using libopencv.
  10991. To enable this filter, install the libopencv library and headers and
  10992. configure FFmpeg with @code{--enable-libopencv}.
  10993. It accepts the following parameters:
  10994. @table @option
  10995. @item filter_name
  10996. The name of the libopencv filter to apply.
  10997. @item filter_params
  10998. The parameters to pass to the libopencv filter. If not specified, the default
  10999. values are assumed.
  11000. @end table
  11001. Refer to the official libopencv documentation for more precise
  11002. information:
  11003. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  11004. Several libopencv filters are supported; see the following subsections.
  11005. @anchor{dilate}
  11006. @subsection dilate
  11007. Dilate an image by using a specific structuring element.
  11008. It corresponds to the libopencv function @code{cvDilate}.
  11009. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  11010. @var{struct_el} represents a structuring element, and has the syntax:
  11011. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  11012. @var{cols} and @var{rows} represent the number of columns and rows of
  11013. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  11014. point, and @var{shape} the shape for the structuring element. @var{shape}
  11015. must be "rect", "cross", "ellipse", or "custom".
  11016. If the value for @var{shape} is "custom", it must be followed by a
  11017. string of the form "=@var{filename}". The file with name
  11018. @var{filename} is assumed to represent a binary image, with each
  11019. printable character corresponding to a bright pixel. When a custom
  11020. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  11021. or columns and rows of the read file are assumed instead.
  11022. The default value for @var{struct_el} is "3x3+0x0/rect".
  11023. @var{nb_iterations} specifies the number of times the transform is
  11024. applied to the image, and defaults to 1.
  11025. Some examples:
  11026. @example
  11027. # Use the default values
  11028. ocv=dilate
  11029. # Dilate using a structuring element with a 5x5 cross, iterating two times
  11030. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  11031. # Read the shape from the file diamond.shape, iterating two times.
  11032. # The file diamond.shape may contain a pattern of characters like this
  11033. # *
  11034. # ***
  11035. # *****
  11036. # ***
  11037. # *
  11038. # The specified columns and rows are ignored
  11039. # but the anchor point coordinates are not
  11040. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  11041. @end example
  11042. @subsection erode
  11043. Erode an image by using a specific structuring element.
  11044. It corresponds to the libopencv function @code{cvErode}.
  11045. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  11046. with the same syntax and semantics as the @ref{dilate} filter.
  11047. @subsection smooth
  11048. Smooth the input video.
  11049. The filter takes the following parameters:
  11050. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  11051. @var{type} is the type of smooth filter to apply, and must be one of
  11052. the following values: "blur", "blur_no_scale", "median", "gaussian",
  11053. or "bilateral". The default value is "gaussian".
  11054. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  11055. depends on the smooth type. @var{param1} and
  11056. @var{param2} accept integer positive values or 0. @var{param3} and
  11057. @var{param4} accept floating point values.
  11058. The default value for @var{param1} is 3. The default value for the
  11059. other parameters is 0.
  11060. These parameters correspond to the parameters assigned to the
  11061. libopencv function @code{cvSmooth}.
  11062. @section oscilloscope
  11063. 2D Video Oscilloscope.
  11064. Useful to measure spatial impulse, step responses, chroma delays, etc.
  11065. It accepts the following parameters:
  11066. @table @option
  11067. @item x
  11068. Set scope center x position.
  11069. @item y
  11070. Set scope center y position.
  11071. @item s
  11072. Set scope size, relative to frame diagonal.
  11073. @item t
  11074. Set scope tilt/rotation.
  11075. @item o
  11076. Set trace opacity.
  11077. @item tx
  11078. Set trace center x position.
  11079. @item ty
  11080. Set trace center y position.
  11081. @item tw
  11082. Set trace width, relative to width of frame.
  11083. @item th
  11084. Set trace height, relative to height of frame.
  11085. @item c
  11086. Set which components to trace. By default it traces first three components.
  11087. @item g
  11088. Draw trace grid. By default is enabled.
  11089. @item st
  11090. Draw some statistics. By default is enabled.
  11091. @item sc
  11092. Draw scope. By default is enabled.
  11093. @end table
  11094. @subsection Commands
  11095. This filter supports same @ref{commands} as options.
  11096. The command accepts the same syntax of the corresponding option.
  11097. If the specified expression is not valid, it is kept at its current
  11098. value.
  11099. @subsection Examples
  11100. @itemize
  11101. @item
  11102. Inspect full first row of video frame.
  11103. @example
  11104. oscilloscope=x=0.5:y=0:s=1
  11105. @end example
  11106. @item
  11107. Inspect full last row of video frame.
  11108. @example
  11109. oscilloscope=x=0.5:y=1:s=1
  11110. @end example
  11111. @item
  11112. Inspect full 5th line of video frame of height 1080.
  11113. @example
  11114. oscilloscope=x=0.5:y=5/1080:s=1
  11115. @end example
  11116. @item
  11117. Inspect full last column of video frame.
  11118. @example
  11119. oscilloscope=x=1:y=0.5:s=1:t=1
  11120. @end example
  11121. @end itemize
  11122. @anchor{overlay}
  11123. @section overlay
  11124. Overlay one video on top of another.
  11125. It takes two inputs and has one output. The first input is the "main"
  11126. video on which the second input is overlaid.
  11127. It accepts the following parameters:
  11128. A description of the accepted options follows.
  11129. @table @option
  11130. @item x
  11131. @item y
  11132. Set the expression for the x and y coordinates of the overlaid video
  11133. on the main video. Default value is "0" for both expressions. In case
  11134. the expression is invalid, it is set to a huge value (meaning that the
  11135. overlay will not be displayed within the output visible area).
  11136. @item eof_action
  11137. See @ref{framesync}.
  11138. @item eval
  11139. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11140. It accepts the following values:
  11141. @table @samp
  11142. @item init
  11143. only evaluate expressions once during the filter initialization or
  11144. when a command is processed
  11145. @item frame
  11146. evaluate expressions for each incoming frame
  11147. @end table
  11148. Default value is @samp{frame}.
  11149. @item shortest
  11150. See @ref{framesync}.
  11151. @item format
  11152. Set the format for the output video.
  11153. It accepts the following values:
  11154. @table @samp
  11155. @item yuv420
  11156. force YUV420 output
  11157. @item yuv420p10
  11158. force YUV420p10 output
  11159. @item yuv422
  11160. force YUV422 output
  11161. @item yuv422p10
  11162. force YUV422p10 output
  11163. @item yuv444
  11164. force YUV444 output
  11165. @item rgb
  11166. force packed RGB output
  11167. @item gbrp
  11168. force planar RGB output
  11169. @item auto
  11170. automatically pick format
  11171. @end table
  11172. Default value is @samp{yuv420}.
  11173. @item repeatlast
  11174. See @ref{framesync}.
  11175. @item alpha
  11176. Set format of alpha of the overlaid video, it can be @var{straight} or
  11177. @var{premultiplied}. Default is @var{straight}.
  11178. @end table
  11179. The @option{x}, and @option{y} expressions can contain the following
  11180. parameters.
  11181. @table @option
  11182. @item main_w, W
  11183. @item main_h, H
  11184. The main input width and height.
  11185. @item overlay_w, w
  11186. @item overlay_h, h
  11187. The overlay input width and height.
  11188. @item x
  11189. @item y
  11190. The computed values for @var{x} and @var{y}. They are evaluated for
  11191. each new frame.
  11192. @item hsub
  11193. @item vsub
  11194. horizontal and vertical chroma subsample values of the output
  11195. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11196. @var{vsub} is 1.
  11197. @item n
  11198. the number of input frame, starting from 0
  11199. @item pos
  11200. the position in the file of the input frame, NAN if unknown
  11201. @item t
  11202. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11203. @end table
  11204. This filter also supports the @ref{framesync} options.
  11205. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11206. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11207. when @option{eval} is set to @samp{init}.
  11208. Be aware that frames are taken from each input video in timestamp
  11209. order, hence, if their initial timestamps differ, it is a good idea
  11210. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11211. have them begin in the same zero timestamp, as the example for
  11212. the @var{movie} filter does.
  11213. You can chain together more overlays but you should test the
  11214. efficiency of such approach.
  11215. @subsection Commands
  11216. This filter supports the following commands:
  11217. @table @option
  11218. @item x
  11219. @item y
  11220. Modify the x and y of the overlay input.
  11221. The command accepts the same syntax of the corresponding option.
  11222. If the specified expression is not valid, it is kept at its current
  11223. value.
  11224. @end table
  11225. @subsection Examples
  11226. @itemize
  11227. @item
  11228. Draw the overlay at 10 pixels from the bottom right corner of the main
  11229. video:
  11230. @example
  11231. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11232. @end example
  11233. Using named options the example above becomes:
  11234. @example
  11235. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11236. @end example
  11237. @item
  11238. Insert a transparent PNG logo in the bottom left corner of the input,
  11239. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11240. @example
  11241. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11242. @end example
  11243. @item
  11244. Insert 2 different transparent PNG logos (second logo on bottom
  11245. right corner) using the @command{ffmpeg} tool:
  11246. @example
  11247. 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
  11248. @end example
  11249. @item
  11250. Add a transparent color layer on top of the main video; @code{WxH}
  11251. must specify the size of the main input to the overlay filter:
  11252. @example
  11253. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11254. @end example
  11255. @item
  11256. Play an original video and a filtered version (here with the deshake
  11257. filter) side by side using the @command{ffplay} tool:
  11258. @example
  11259. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11260. @end example
  11261. The above command is the same as:
  11262. @example
  11263. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11264. @end example
  11265. @item
  11266. Make a sliding overlay appearing from the left to the right top part of the
  11267. screen starting since time 2:
  11268. @example
  11269. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11270. @end example
  11271. @item
  11272. Compose output by putting two input videos side to side:
  11273. @example
  11274. ffmpeg -i left.avi -i right.avi -filter_complex "
  11275. nullsrc=size=200x100 [background];
  11276. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11277. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11278. [background][left] overlay=shortest=1 [background+left];
  11279. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11280. "
  11281. @end example
  11282. @item
  11283. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11284. @example
  11285. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11286. -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]'
  11287. masked.avi
  11288. @end example
  11289. @item
  11290. Chain several overlays in cascade:
  11291. @example
  11292. nullsrc=s=200x200 [bg];
  11293. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11294. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11295. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11296. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11297. [in3] null, [mid2] overlay=100:100 [out0]
  11298. @end example
  11299. @end itemize
  11300. @anchor{overlay_cuda}
  11301. @section overlay_cuda
  11302. Overlay one video on top of another.
  11303. This is the CUDA cariant of the @ref{overlay} filter.
  11304. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11305. It takes two inputs and has one output. The first input is the "main"
  11306. video on which the second input is overlaid.
  11307. It accepts the following parameters:
  11308. @table @option
  11309. @item x
  11310. @item y
  11311. Set the x and y coordinates of the overlaid video on the main video.
  11312. Default value is "0" for both expressions.
  11313. @item eof_action
  11314. See @ref{framesync}.
  11315. @item shortest
  11316. See @ref{framesync}.
  11317. @item repeatlast
  11318. See @ref{framesync}.
  11319. @end table
  11320. This filter also supports the @ref{framesync} options.
  11321. @section owdenoise
  11322. Apply Overcomplete Wavelet denoiser.
  11323. The filter accepts the following options:
  11324. @table @option
  11325. @item depth
  11326. Set depth.
  11327. Larger depth values will denoise lower frequency components more, but
  11328. slow down filtering.
  11329. Must be an int in the range 8-16, default is @code{8}.
  11330. @item luma_strength, ls
  11331. Set luma strength.
  11332. Must be a double value in the range 0-1000, default is @code{1.0}.
  11333. @item chroma_strength, cs
  11334. Set chroma strength.
  11335. Must be a double value in the range 0-1000, default is @code{1.0}.
  11336. @end table
  11337. @anchor{pad}
  11338. @section pad
  11339. Add paddings to the input image, and place the original input at the
  11340. provided @var{x}, @var{y} coordinates.
  11341. It accepts the following parameters:
  11342. @table @option
  11343. @item width, w
  11344. @item height, h
  11345. Specify an expression for the size of the output image with the
  11346. paddings added. If the value for @var{width} or @var{height} is 0, the
  11347. corresponding input size is used for the output.
  11348. The @var{width} expression can reference the value set by the
  11349. @var{height} expression, and vice versa.
  11350. The default value of @var{width} and @var{height} is 0.
  11351. @item x
  11352. @item y
  11353. Specify the offsets to place the input image at within the padded area,
  11354. with respect to the top/left border of the output image.
  11355. The @var{x} expression can reference the value set by the @var{y}
  11356. expression, and vice versa.
  11357. The default value of @var{x} and @var{y} is 0.
  11358. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11359. so the input image is centered on the padded area.
  11360. @item color
  11361. Specify the color of the padded area. For the syntax of this option,
  11362. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11363. manual,ffmpeg-utils}.
  11364. The default value of @var{color} is "black".
  11365. @item eval
  11366. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11367. It accepts the following values:
  11368. @table @samp
  11369. @item init
  11370. Only evaluate expressions once during the filter initialization or when
  11371. a command is processed.
  11372. @item frame
  11373. Evaluate expressions for each incoming frame.
  11374. @end table
  11375. Default value is @samp{init}.
  11376. @item aspect
  11377. Pad to aspect instead to a resolution.
  11378. @end table
  11379. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11380. options are expressions containing the following constants:
  11381. @table @option
  11382. @item in_w
  11383. @item in_h
  11384. The input video width and height.
  11385. @item iw
  11386. @item ih
  11387. These are the same as @var{in_w} and @var{in_h}.
  11388. @item out_w
  11389. @item out_h
  11390. The output width and height (the size of the padded area), as
  11391. specified by the @var{width} and @var{height} expressions.
  11392. @item ow
  11393. @item oh
  11394. These are the same as @var{out_w} and @var{out_h}.
  11395. @item x
  11396. @item y
  11397. The x and y offsets as specified by the @var{x} and @var{y}
  11398. expressions, or NAN if not yet specified.
  11399. @item a
  11400. same as @var{iw} / @var{ih}
  11401. @item sar
  11402. input sample aspect ratio
  11403. @item dar
  11404. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11405. @item hsub
  11406. @item vsub
  11407. The horizontal and vertical chroma subsample values. For example for the
  11408. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11409. @end table
  11410. @subsection Examples
  11411. @itemize
  11412. @item
  11413. Add paddings with the color "violet" to the input video. The output video
  11414. size is 640x480, and the top-left corner of the input video is placed at
  11415. column 0, row 40
  11416. @example
  11417. pad=640:480:0:40:violet
  11418. @end example
  11419. The example above is equivalent to the following command:
  11420. @example
  11421. pad=width=640:height=480:x=0:y=40:color=violet
  11422. @end example
  11423. @item
  11424. Pad the input to get an output with dimensions increased by 3/2,
  11425. and put the input video at the center of the padded area:
  11426. @example
  11427. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11428. @end example
  11429. @item
  11430. Pad the input to get a squared output with size equal to the maximum
  11431. value between the input width and height, and put the input video at
  11432. the center of the padded area:
  11433. @example
  11434. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11435. @end example
  11436. @item
  11437. Pad the input to get a final w/h ratio of 16:9:
  11438. @example
  11439. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11440. @end example
  11441. @item
  11442. In case of anamorphic video, in order to set the output display aspect
  11443. correctly, it is necessary to use @var{sar} in the expression,
  11444. according to the relation:
  11445. @example
  11446. (ih * X / ih) * sar = output_dar
  11447. X = output_dar / sar
  11448. @end example
  11449. Thus the previous example needs to be modified to:
  11450. @example
  11451. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11452. @end example
  11453. @item
  11454. Double the output size and put the input video in the bottom-right
  11455. corner of the output padded area:
  11456. @example
  11457. pad="2*iw:2*ih:ow-iw:oh-ih"
  11458. @end example
  11459. @end itemize
  11460. @anchor{palettegen}
  11461. @section palettegen
  11462. Generate one palette for a whole video stream.
  11463. It accepts the following options:
  11464. @table @option
  11465. @item max_colors
  11466. Set the maximum number of colors to quantize in the palette.
  11467. Note: the palette will still contain 256 colors; the unused palette entries
  11468. will be black.
  11469. @item reserve_transparent
  11470. Create a palette of 255 colors maximum and reserve the last one for
  11471. transparency. Reserving the transparency color is useful for GIF optimization.
  11472. If not set, the maximum of colors in the palette will be 256. You probably want
  11473. to disable this option for a standalone image.
  11474. Set by default.
  11475. @item transparency_color
  11476. Set the color that will be used as background for transparency.
  11477. @item stats_mode
  11478. Set statistics mode.
  11479. It accepts the following values:
  11480. @table @samp
  11481. @item full
  11482. Compute full frame histograms.
  11483. @item diff
  11484. Compute histograms only for the part that differs from previous frame. This
  11485. might be relevant to give more importance to the moving part of your input if
  11486. the background is static.
  11487. @item single
  11488. Compute new histogram for each frame.
  11489. @end table
  11490. Default value is @var{full}.
  11491. @end table
  11492. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11493. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11494. color quantization of the palette. This information is also visible at
  11495. @var{info} logging level.
  11496. @subsection Examples
  11497. @itemize
  11498. @item
  11499. Generate a representative palette of a given video using @command{ffmpeg}:
  11500. @example
  11501. ffmpeg -i input.mkv -vf palettegen palette.png
  11502. @end example
  11503. @end itemize
  11504. @section paletteuse
  11505. Use a palette to downsample an input video stream.
  11506. The filter takes two inputs: one video stream and a palette. The palette must
  11507. be a 256 pixels image.
  11508. It accepts the following options:
  11509. @table @option
  11510. @item dither
  11511. Select dithering mode. Available algorithms are:
  11512. @table @samp
  11513. @item bayer
  11514. Ordered 8x8 bayer dithering (deterministic)
  11515. @item heckbert
  11516. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11517. Note: this dithering is sometimes considered "wrong" and is included as a
  11518. reference.
  11519. @item floyd_steinberg
  11520. Floyd and Steingberg dithering (error diffusion)
  11521. @item sierra2
  11522. Frankie Sierra dithering v2 (error diffusion)
  11523. @item sierra2_4a
  11524. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11525. @end table
  11526. Default is @var{sierra2_4a}.
  11527. @item bayer_scale
  11528. When @var{bayer} dithering is selected, this option defines the scale of the
  11529. pattern (how much the crosshatch pattern is visible). A low value means more
  11530. visible pattern for less banding, and higher value means less visible pattern
  11531. at the cost of more banding.
  11532. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11533. @item diff_mode
  11534. If set, define the zone to process
  11535. @table @samp
  11536. @item rectangle
  11537. Only the changing rectangle will be reprocessed. This is similar to GIF
  11538. cropping/offsetting compression mechanism. This option can be useful for speed
  11539. if only a part of the image is changing, and has use cases such as limiting the
  11540. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11541. moving scene (it leads to more deterministic output if the scene doesn't change
  11542. much, and as a result less moving noise and better GIF compression).
  11543. @end table
  11544. Default is @var{none}.
  11545. @item new
  11546. Take new palette for each output frame.
  11547. @item alpha_threshold
  11548. Sets the alpha threshold for transparency. Alpha values above this threshold
  11549. will be treated as completely opaque, and values below this threshold will be
  11550. treated as completely transparent.
  11551. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11552. @end table
  11553. @subsection Examples
  11554. @itemize
  11555. @item
  11556. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11557. using @command{ffmpeg}:
  11558. @example
  11559. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11560. @end example
  11561. @end itemize
  11562. @section perspective
  11563. Correct perspective of video not recorded perpendicular to the screen.
  11564. A description of the accepted parameters follows.
  11565. @table @option
  11566. @item x0
  11567. @item y0
  11568. @item x1
  11569. @item y1
  11570. @item x2
  11571. @item y2
  11572. @item x3
  11573. @item y3
  11574. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11575. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11576. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11577. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11578. then the corners of the source will be sent to the specified coordinates.
  11579. The expressions can use the following variables:
  11580. @table @option
  11581. @item W
  11582. @item H
  11583. the width and height of video frame.
  11584. @item in
  11585. Input frame count.
  11586. @item on
  11587. Output frame count.
  11588. @end table
  11589. @item interpolation
  11590. Set interpolation for perspective correction.
  11591. It accepts the following values:
  11592. @table @samp
  11593. @item linear
  11594. @item cubic
  11595. @end table
  11596. Default value is @samp{linear}.
  11597. @item sense
  11598. Set interpretation of coordinate options.
  11599. It accepts the following values:
  11600. @table @samp
  11601. @item 0, source
  11602. Send point in the source specified by the given coordinates to
  11603. the corners of the destination.
  11604. @item 1, destination
  11605. Send the corners of the source to the point in the destination specified
  11606. by the given coordinates.
  11607. Default value is @samp{source}.
  11608. @end table
  11609. @item eval
  11610. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11611. It accepts the following values:
  11612. @table @samp
  11613. @item init
  11614. only evaluate expressions once during the filter initialization or
  11615. when a command is processed
  11616. @item frame
  11617. evaluate expressions for each incoming frame
  11618. @end table
  11619. Default value is @samp{init}.
  11620. @end table
  11621. @section phase
  11622. Delay interlaced video by one field time so that the field order changes.
  11623. The intended use is to fix PAL movies that have been captured with the
  11624. opposite field order to the film-to-video transfer.
  11625. A description of the accepted parameters follows.
  11626. @table @option
  11627. @item mode
  11628. Set phase mode.
  11629. It accepts the following values:
  11630. @table @samp
  11631. @item t
  11632. Capture field order top-first, transfer bottom-first.
  11633. Filter will delay the bottom field.
  11634. @item b
  11635. Capture field order bottom-first, transfer top-first.
  11636. Filter will delay the top field.
  11637. @item p
  11638. Capture and transfer with the same field order. This mode only exists
  11639. for the documentation of the other options to refer to, but if you
  11640. actually select it, the filter will faithfully do nothing.
  11641. @item a
  11642. Capture field order determined automatically by field flags, transfer
  11643. opposite.
  11644. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11645. basis using field flags. If no field information is available,
  11646. then this works just like @samp{u}.
  11647. @item u
  11648. Capture unknown or varying, transfer opposite.
  11649. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11650. analyzing the images and selecting the alternative that produces best
  11651. match between the fields.
  11652. @item T
  11653. Capture top-first, transfer unknown or varying.
  11654. Filter selects among @samp{t} and @samp{p} using image analysis.
  11655. @item B
  11656. Capture bottom-first, transfer unknown or varying.
  11657. Filter selects among @samp{b} and @samp{p} using image analysis.
  11658. @item A
  11659. Capture determined by field flags, transfer unknown or varying.
  11660. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11661. image analysis. If no field information is available, then this works just
  11662. like @samp{U}. This is the default mode.
  11663. @item U
  11664. Both capture and transfer unknown or varying.
  11665. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11666. @end table
  11667. @end table
  11668. @section photosensitivity
  11669. Reduce various flashes in video, so to help users with epilepsy.
  11670. It accepts the following options:
  11671. @table @option
  11672. @item frames, f
  11673. Set how many frames to use when filtering. Default is 30.
  11674. @item threshold, t
  11675. Set detection threshold factor. Default is 1.
  11676. Lower is stricter.
  11677. @item skip
  11678. Set how many pixels to skip when sampling frames. Default is 1.
  11679. Allowed range is from 1 to 1024.
  11680. @item bypass
  11681. Leave frames unchanged. Default is disabled.
  11682. @end table
  11683. @section pixdesctest
  11684. Pixel format descriptor test filter, mainly useful for internal
  11685. testing. The output video should be equal to the input video.
  11686. For example:
  11687. @example
  11688. format=monow, pixdesctest
  11689. @end example
  11690. can be used to test the monowhite pixel format descriptor definition.
  11691. @section pixscope
  11692. Display sample values of color channels. Mainly useful for checking color
  11693. and levels. Minimum supported resolution is 640x480.
  11694. The filters accept the following options:
  11695. @table @option
  11696. @item x
  11697. Set scope X position, relative offset on X axis.
  11698. @item y
  11699. Set scope Y position, relative offset on Y axis.
  11700. @item w
  11701. Set scope width.
  11702. @item h
  11703. Set scope height.
  11704. @item o
  11705. Set window opacity. This window also holds statistics about pixel area.
  11706. @item wx
  11707. Set window X position, relative offset on X axis.
  11708. @item wy
  11709. Set window Y position, relative offset on Y axis.
  11710. @end table
  11711. @section pp
  11712. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11713. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11714. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11715. Each subfilter and some options have a short and a long name that can be used
  11716. interchangeably, i.e. dr/dering are the same.
  11717. The filters accept the following options:
  11718. @table @option
  11719. @item subfilters
  11720. Set postprocessing subfilters string.
  11721. @end table
  11722. All subfilters share common options to determine their scope:
  11723. @table @option
  11724. @item a/autoq
  11725. Honor the quality commands for this subfilter.
  11726. @item c/chrom
  11727. Do chrominance filtering, too (default).
  11728. @item y/nochrom
  11729. Do luminance filtering only (no chrominance).
  11730. @item n/noluma
  11731. Do chrominance filtering only (no luminance).
  11732. @end table
  11733. These options can be appended after the subfilter name, separated by a '|'.
  11734. Available subfilters are:
  11735. @table @option
  11736. @item hb/hdeblock[|difference[|flatness]]
  11737. Horizontal deblocking filter
  11738. @table @option
  11739. @item difference
  11740. Difference factor where higher values mean more deblocking (default: @code{32}).
  11741. @item flatness
  11742. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11743. @end table
  11744. @item vb/vdeblock[|difference[|flatness]]
  11745. Vertical deblocking filter
  11746. @table @option
  11747. @item difference
  11748. Difference factor where higher values mean more deblocking (default: @code{32}).
  11749. @item flatness
  11750. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11751. @end table
  11752. @item ha/hadeblock[|difference[|flatness]]
  11753. Accurate horizontal deblocking filter
  11754. @table @option
  11755. @item difference
  11756. Difference factor where higher values mean more deblocking (default: @code{32}).
  11757. @item flatness
  11758. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11759. @end table
  11760. @item va/vadeblock[|difference[|flatness]]
  11761. Accurate vertical deblocking filter
  11762. @table @option
  11763. @item difference
  11764. Difference factor where higher values mean more deblocking (default: @code{32}).
  11765. @item flatness
  11766. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11767. @end table
  11768. @end table
  11769. The horizontal and vertical deblocking filters share the difference and
  11770. flatness values so you cannot set different horizontal and vertical
  11771. thresholds.
  11772. @table @option
  11773. @item h1/x1hdeblock
  11774. Experimental horizontal deblocking filter
  11775. @item v1/x1vdeblock
  11776. Experimental vertical deblocking filter
  11777. @item dr/dering
  11778. Deringing filter
  11779. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11780. @table @option
  11781. @item threshold1
  11782. larger -> stronger filtering
  11783. @item threshold2
  11784. larger -> stronger filtering
  11785. @item threshold3
  11786. larger -> stronger filtering
  11787. @end table
  11788. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11789. @table @option
  11790. @item f/fullyrange
  11791. Stretch luminance to @code{0-255}.
  11792. @end table
  11793. @item lb/linblenddeint
  11794. Linear blend deinterlacing filter that deinterlaces the given block by
  11795. filtering all lines with a @code{(1 2 1)} filter.
  11796. @item li/linipoldeint
  11797. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11798. linearly interpolating every second line.
  11799. @item ci/cubicipoldeint
  11800. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11801. cubically interpolating every second line.
  11802. @item md/mediandeint
  11803. Median deinterlacing filter that deinterlaces the given block by applying a
  11804. median filter to every second line.
  11805. @item fd/ffmpegdeint
  11806. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11807. second line with a @code{(-1 4 2 4 -1)} filter.
  11808. @item l5/lowpass5
  11809. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11810. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11811. @item fq/forceQuant[|quantizer]
  11812. Overrides the quantizer table from the input with the constant quantizer you
  11813. specify.
  11814. @table @option
  11815. @item quantizer
  11816. Quantizer to use
  11817. @end table
  11818. @item de/default
  11819. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11820. @item fa/fast
  11821. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11822. @item ac
  11823. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11824. @end table
  11825. @subsection Examples
  11826. @itemize
  11827. @item
  11828. Apply horizontal and vertical deblocking, deringing and automatic
  11829. brightness/contrast:
  11830. @example
  11831. pp=hb/vb/dr/al
  11832. @end example
  11833. @item
  11834. Apply default filters without brightness/contrast correction:
  11835. @example
  11836. pp=de/-al
  11837. @end example
  11838. @item
  11839. Apply default filters and temporal denoiser:
  11840. @example
  11841. pp=default/tmpnoise|1|2|3
  11842. @end example
  11843. @item
  11844. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11845. automatically depending on available CPU time:
  11846. @example
  11847. pp=hb|y/vb|a
  11848. @end example
  11849. @end itemize
  11850. @section pp7
  11851. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11852. similar to spp = 6 with 7 point DCT, where only the center sample is
  11853. used after IDCT.
  11854. The filter accepts the following options:
  11855. @table @option
  11856. @item qp
  11857. Force a constant quantization parameter. It accepts an integer in range
  11858. 0 to 63. If not set, the filter will use the QP from the video stream
  11859. (if available).
  11860. @item mode
  11861. Set thresholding mode. Available modes are:
  11862. @table @samp
  11863. @item hard
  11864. Set hard thresholding.
  11865. @item soft
  11866. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11867. @item medium
  11868. Set medium thresholding (good results, default).
  11869. @end table
  11870. @end table
  11871. @section premultiply
  11872. Apply alpha premultiply effect to input video stream using first plane
  11873. of second stream as alpha.
  11874. Both streams must have same dimensions and same pixel format.
  11875. The filter accepts the following option:
  11876. @table @option
  11877. @item planes
  11878. Set which planes will be processed, unprocessed planes will be copied.
  11879. By default value 0xf, all planes will be processed.
  11880. @item inplace
  11881. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11882. @end table
  11883. @section prewitt
  11884. Apply prewitt operator to input video stream.
  11885. The filter accepts the following option:
  11886. @table @option
  11887. @item planes
  11888. Set which planes will be processed, unprocessed planes will be copied.
  11889. By default value 0xf, all planes will be processed.
  11890. @item scale
  11891. Set value which will be multiplied with filtered result.
  11892. @item delta
  11893. Set value which will be added to filtered result.
  11894. @end table
  11895. @section pseudocolor
  11896. Alter frame colors in video with pseudocolors.
  11897. This filter accepts the following options:
  11898. @table @option
  11899. @item c0
  11900. set pixel first component expression
  11901. @item c1
  11902. set pixel second component expression
  11903. @item c2
  11904. set pixel third component expression
  11905. @item c3
  11906. set pixel fourth component expression, corresponds to the alpha component
  11907. @item i
  11908. set component to use as base for altering colors
  11909. @end table
  11910. Each of them specifies the expression to use for computing the lookup table for
  11911. the corresponding pixel component values.
  11912. The expressions can contain the following constants and functions:
  11913. @table @option
  11914. @item w
  11915. @item h
  11916. The input width and height.
  11917. @item val
  11918. The input value for the pixel component.
  11919. @item ymin, umin, vmin, amin
  11920. The minimum allowed component value.
  11921. @item ymax, umax, vmax, amax
  11922. The maximum allowed component value.
  11923. @end table
  11924. All expressions default to "val".
  11925. @subsection Examples
  11926. @itemize
  11927. @item
  11928. Change too high luma values to gradient:
  11929. @example
  11930. 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'"
  11931. @end example
  11932. @end itemize
  11933. @section psnr
  11934. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11935. Ratio) between two input videos.
  11936. This filter takes in input two input videos, the first input is
  11937. considered the "main" source and is passed unchanged to the
  11938. output. The second input is used as a "reference" video for computing
  11939. the PSNR.
  11940. Both video inputs must have the same resolution and pixel format for
  11941. this filter to work correctly. Also it assumes that both inputs
  11942. have the same number of frames, which are compared one by one.
  11943. The obtained average PSNR is printed through the logging system.
  11944. The filter stores the accumulated MSE (mean squared error) of each
  11945. frame, and at the end of the processing it is averaged across all frames
  11946. equally, and the following formula is applied to obtain the PSNR:
  11947. @example
  11948. PSNR = 10*log10(MAX^2/MSE)
  11949. @end example
  11950. Where MAX is the average of the maximum values of each component of the
  11951. image.
  11952. The description of the accepted parameters follows.
  11953. @table @option
  11954. @item stats_file, f
  11955. If specified the filter will use the named file to save the PSNR of
  11956. each individual frame. When filename equals "-" the data is sent to
  11957. standard output.
  11958. @item stats_version
  11959. Specifies which version of the stats file format to use. Details of
  11960. each format are written below.
  11961. Default value is 1.
  11962. @item stats_add_max
  11963. Determines whether the max value is output to the stats log.
  11964. Default value is 0.
  11965. Requires stats_version >= 2. If this is set and stats_version < 2,
  11966. the filter will return an error.
  11967. @end table
  11968. This filter also supports the @ref{framesync} options.
  11969. The file printed if @var{stats_file} is selected, contains a sequence of
  11970. key/value pairs of the form @var{key}:@var{value} for each compared
  11971. couple of frames.
  11972. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11973. the list of per-frame-pair stats, with key value pairs following the frame
  11974. format with the following parameters:
  11975. @table @option
  11976. @item psnr_log_version
  11977. The version of the log file format. Will match @var{stats_version}.
  11978. @item fields
  11979. A comma separated list of the per-frame-pair parameters included in
  11980. the log.
  11981. @end table
  11982. A description of each shown per-frame-pair parameter follows:
  11983. @table @option
  11984. @item n
  11985. sequential number of the input frame, starting from 1
  11986. @item mse_avg
  11987. Mean Square Error pixel-by-pixel average difference of the compared
  11988. frames, averaged over all the image components.
  11989. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11990. Mean Square Error pixel-by-pixel average difference of the compared
  11991. frames for the component specified by the suffix.
  11992. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11993. Peak Signal to Noise ratio of the compared frames for the component
  11994. specified by the suffix.
  11995. @item max_avg, max_y, max_u, max_v
  11996. Maximum allowed value for each channel, and average over all
  11997. channels.
  11998. @end table
  11999. @subsection Examples
  12000. @itemize
  12001. @item
  12002. For example:
  12003. @example
  12004. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12005. [main][ref] psnr="stats_file=stats.log" [out]
  12006. @end example
  12007. On this example the input file being processed is compared with the
  12008. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  12009. is stored in @file{stats.log}.
  12010. @item
  12011. Another example with different containers:
  12012. @example
  12013. 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 -
  12014. @end example
  12015. @end itemize
  12016. @anchor{pullup}
  12017. @section pullup
  12018. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  12019. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  12020. content.
  12021. The pullup filter is designed to take advantage of future context in making
  12022. its decisions. This filter is stateless in the sense that it does not lock
  12023. onto a pattern to follow, but it instead looks forward to the following
  12024. fields in order to identify matches and rebuild progressive frames.
  12025. To produce content with an even framerate, insert the fps filter after
  12026. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  12027. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  12028. The filter accepts the following options:
  12029. @table @option
  12030. @item jl
  12031. @item jr
  12032. @item jt
  12033. @item jb
  12034. These options set the amount of "junk" to ignore at the left, right, top, and
  12035. bottom of the image, respectively. Left and right are in units of 8 pixels,
  12036. while top and bottom are in units of 2 lines.
  12037. The default is 8 pixels on each side.
  12038. @item sb
  12039. Set the strict breaks. Setting this option to 1 will reduce the chances of
  12040. filter generating an occasional mismatched frame, but it may also cause an
  12041. excessive number of frames to be dropped during high motion sequences.
  12042. Conversely, setting it to -1 will make filter match fields more easily.
  12043. This may help processing of video where there is slight blurring between
  12044. the fields, but may also cause there to be interlaced frames in the output.
  12045. Default value is @code{0}.
  12046. @item mp
  12047. Set the metric plane to use. It accepts the following values:
  12048. @table @samp
  12049. @item l
  12050. Use luma plane.
  12051. @item u
  12052. Use chroma blue plane.
  12053. @item v
  12054. Use chroma red plane.
  12055. @end table
  12056. This option may be set to use chroma plane instead of the default luma plane
  12057. for doing filter's computations. This may improve accuracy on very clean
  12058. source material, but more likely will decrease accuracy, especially if there
  12059. is chroma noise (rainbow effect) or any grayscale video.
  12060. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  12061. load and make pullup usable in realtime on slow machines.
  12062. @end table
  12063. For best results (without duplicated frames in the output file) it is
  12064. necessary to change the output frame rate. For example, to inverse
  12065. telecine NTSC input:
  12066. @example
  12067. ffmpeg -i input -vf pullup -r 24000/1001 ...
  12068. @end example
  12069. @section qp
  12070. Change video quantization parameters (QP).
  12071. The filter accepts the following option:
  12072. @table @option
  12073. @item qp
  12074. Set expression for quantization parameter.
  12075. @end table
  12076. The expression is evaluated through the eval API and can contain, among others,
  12077. the following constants:
  12078. @table @var
  12079. @item known
  12080. 1 if index is not 129, 0 otherwise.
  12081. @item qp
  12082. Sequential index starting from -129 to 128.
  12083. @end table
  12084. @subsection Examples
  12085. @itemize
  12086. @item
  12087. Some equation like:
  12088. @example
  12089. qp=2+2*sin(PI*qp)
  12090. @end example
  12091. @end itemize
  12092. @section random
  12093. Flush video frames from internal cache of frames into a random order.
  12094. No frame is discarded.
  12095. Inspired by @ref{frei0r} nervous filter.
  12096. @table @option
  12097. @item frames
  12098. Set size in number of frames of internal cache, in range from @code{2} to
  12099. @code{512}. Default is @code{30}.
  12100. @item seed
  12101. Set seed for random number generator, must be an integer included between
  12102. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12103. less than @code{0}, the filter will try to use a good random seed on a
  12104. best effort basis.
  12105. @end table
  12106. @section readeia608
  12107. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12108. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12109. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12110. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12111. @table @option
  12112. @item lavfi.readeia608.X.cc
  12113. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12114. @item lavfi.readeia608.X.line
  12115. The number of the line on which the EIA-608 data was identified and read.
  12116. @end table
  12117. This filter accepts the following options:
  12118. @table @option
  12119. @item scan_min
  12120. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12121. @item scan_max
  12122. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12123. @item spw
  12124. Set the ratio of width reserved for sync code detection.
  12125. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12126. @item chp
  12127. Enable checking the parity bit. In the event of a parity error, the filter will output
  12128. @code{0x00} for that character. Default is false.
  12129. @item lp
  12130. Lowpass lines prior to further processing. Default is enabled.
  12131. @end table
  12132. @subsection Examples
  12133. @itemize
  12134. @item
  12135. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12136. @example
  12137. 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
  12138. @end example
  12139. @end itemize
  12140. @section readvitc
  12141. Read vertical interval timecode (VITC) information from the top lines of a
  12142. video frame.
  12143. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12144. timecode value, if a valid timecode has been detected. Further metadata key
  12145. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12146. timecode data has been found or not.
  12147. This filter accepts the following options:
  12148. @table @option
  12149. @item scan_max
  12150. Set the maximum number of lines to scan for VITC data. If the value is set to
  12151. @code{-1} the full video frame is scanned. Default is @code{45}.
  12152. @item thr_b
  12153. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12154. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12155. @item thr_w
  12156. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12157. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12158. @end table
  12159. @subsection Examples
  12160. @itemize
  12161. @item
  12162. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12163. draw @code{--:--:--:--} as a placeholder:
  12164. @example
  12165. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12166. @end example
  12167. @end itemize
  12168. @section remap
  12169. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12170. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12171. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12172. value for pixel will be used for destination pixel.
  12173. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12174. will have Xmap/Ymap video stream dimensions.
  12175. Xmap and Ymap input video streams are 16bit depth, single channel.
  12176. @table @option
  12177. @item format
  12178. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12179. Default is @code{color}.
  12180. @item fill
  12181. Specify the color of the unmapped pixels. For the syntax of this option,
  12182. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12183. manual,ffmpeg-utils}. Default color is @code{black}.
  12184. @end table
  12185. @section removegrain
  12186. The removegrain filter is a spatial denoiser for progressive video.
  12187. @table @option
  12188. @item m0
  12189. Set mode for the first plane.
  12190. @item m1
  12191. Set mode for the second plane.
  12192. @item m2
  12193. Set mode for the third plane.
  12194. @item m3
  12195. Set mode for the fourth plane.
  12196. @end table
  12197. Range of mode is from 0 to 24. Description of each mode follows:
  12198. @table @var
  12199. @item 0
  12200. Leave input plane unchanged. Default.
  12201. @item 1
  12202. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12203. @item 2
  12204. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12205. @item 3
  12206. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12207. @item 4
  12208. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12209. This is equivalent to a median filter.
  12210. @item 5
  12211. Line-sensitive clipping giving the minimal change.
  12212. @item 6
  12213. Line-sensitive clipping, intermediate.
  12214. @item 7
  12215. Line-sensitive clipping, intermediate.
  12216. @item 8
  12217. Line-sensitive clipping, intermediate.
  12218. @item 9
  12219. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12220. @item 10
  12221. Replaces the target pixel with the closest neighbour.
  12222. @item 11
  12223. [1 2 1] horizontal and vertical kernel blur.
  12224. @item 12
  12225. Same as mode 11.
  12226. @item 13
  12227. Bob mode, interpolates top field from the line where the neighbours
  12228. pixels are the closest.
  12229. @item 14
  12230. Bob mode, interpolates bottom field from the line where the neighbours
  12231. pixels are the closest.
  12232. @item 15
  12233. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12234. interpolation formula.
  12235. @item 16
  12236. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12237. interpolation formula.
  12238. @item 17
  12239. Clips the pixel with the minimum and maximum of respectively the maximum and
  12240. minimum of each pair of opposite neighbour pixels.
  12241. @item 18
  12242. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12243. the current pixel is minimal.
  12244. @item 19
  12245. Replaces the pixel with the average of its 8 neighbours.
  12246. @item 20
  12247. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12248. @item 21
  12249. Clips pixels using the averages of opposite neighbour.
  12250. @item 22
  12251. Same as mode 21 but simpler and faster.
  12252. @item 23
  12253. Small edge and halo removal, but reputed useless.
  12254. @item 24
  12255. Similar as 23.
  12256. @end table
  12257. @section removelogo
  12258. Suppress a TV station logo, using an image file to determine which
  12259. pixels comprise the logo. It works by filling in the pixels that
  12260. comprise the logo with neighboring pixels.
  12261. The filter accepts the following options:
  12262. @table @option
  12263. @item filename, f
  12264. Set the filter bitmap file, which can be any image format supported by
  12265. libavformat. The width and height of the image file must match those of the
  12266. video stream being processed.
  12267. @end table
  12268. Pixels in the provided bitmap image with a value of zero are not
  12269. considered part of the logo, non-zero pixels are considered part of
  12270. the logo. If you use white (255) for the logo and black (0) for the
  12271. rest, you will be safe. For making the filter bitmap, it is
  12272. recommended to take a screen capture of a black frame with the logo
  12273. visible, and then using a threshold filter followed by the erode
  12274. filter once or twice.
  12275. If needed, little splotches can be fixed manually. Remember that if
  12276. logo pixels are not covered, the filter quality will be much
  12277. reduced. Marking too many pixels as part of the logo does not hurt as
  12278. much, but it will increase the amount of blurring needed to cover over
  12279. the image and will destroy more information than necessary, and extra
  12280. pixels will slow things down on a large logo.
  12281. @section repeatfields
  12282. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12283. fields based on its value.
  12284. @section reverse
  12285. Reverse a video clip.
  12286. Warning: This filter requires memory to buffer the entire clip, so trimming
  12287. is suggested.
  12288. @subsection Examples
  12289. @itemize
  12290. @item
  12291. Take the first 5 seconds of a clip, and reverse it.
  12292. @example
  12293. trim=end=5,reverse
  12294. @end example
  12295. @end itemize
  12296. @section rgbashift
  12297. Shift R/G/B/A pixels horizontally and/or vertically.
  12298. The filter accepts the following options:
  12299. @table @option
  12300. @item rh
  12301. Set amount to shift red horizontally.
  12302. @item rv
  12303. Set amount to shift red vertically.
  12304. @item gh
  12305. Set amount to shift green horizontally.
  12306. @item gv
  12307. Set amount to shift green vertically.
  12308. @item bh
  12309. Set amount to shift blue horizontally.
  12310. @item bv
  12311. Set amount to shift blue vertically.
  12312. @item ah
  12313. Set amount to shift alpha horizontally.
  12314. @item av
  12315. Set amount to shift alpha vertically.
  12316. @item edge
  12317. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12318. @end table
  12319. @subsection Commands
  12320. This filter supports the all above options as @ref{commands}.
  12321. @section roberts
  12322. Apply roberts cross operator to input video stream.
  12323. The filter accepts the following option:
  12324. @table @option
  12325. @item planes
  12326. Set which planes will be processed, unprocessed planes will be copied.
  12327. By default value 0xf, all planes will be processed.
  12328. @item scale
  12329. Set value which will be multiplied with filtered result.
  12330. @item delta
  12331. Set value which will be added to filtered result.
  12332. @end table
  12333. @section rotate
  12334. Rotate video by an arbitrary angle expressed in radians.
  12335. The filter accepts the following options:
  12336. A description of the optional parameters follows.
  12337. @table @option
  12338. @item angle, a
  12339. Set an expression for the angle by which to rotate the input video
  12340. clockwise, expressed as a number of radians. A negative value will
  12341. result in a counter-clockwise rotation. By default it is set to "0".
  12342. This expression is evaluated for each frame.
  12343. @item out_w, ow
  12344. Set the output width expression, default value is "iw".
  12345. This expression is evaluated just once during configuration.
  12346. @item out_h, oh
  12347. Set the output height expression, default value is "ih".
  12348. This expression is evaluated just once during configuration.
  12349. @item bilinear
  12350. Enable bilinear interpolation if set to 1, a value of 0 disables
  12351. it. Default value is 1.
  12352. @item fillcolor, c
  12353. Set the color used to fill the output area not covered by the rotated
  12354. image. For the general syntax of this option, check the
  12355. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12356. If the special value "none" is selected then no
  12357. background is printed (useful for example if the background is never shown).
  12358. Default value is "black".
  12359. @end table
  12360. The expressions for the angle and the output size can contain the
  12361. following constants and functions:
  12362. @table @option
  12363. @item n
  12364. sequential number of the input frame, starting from 0. It is always NAN
  12365. before the first frame is filtered.
  12366. @item t
  12367. time in seconds of the input frame, it is set to 0 when the filter is
  12368. configured. It is always NAN before the first frame is filtered.
  12369. @item hsub
  12370. @item vsub
  12371. horizontal and vertical chroma subsample values. For example for the
  12372. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12373. @item in_w, iw
  12374. @item in_h, ih
  12375. the input video width and height
  12376. @item out_w, ow
  12377. @item out_h, oh
  12378. the output width and height, that is the size of the padded area as
  12379. specified by the @var{width} and @var{height} expressions
  12380. @item rotw(a)
  12381. @item roth(a)
  12382. the minimal width/height required for completely containing the input
  12383. video rotated by @var{a} radians.
  12384. These are only available when computing the @option{out_w} and
  12385. @option{out_h} expressions.
  12386. @end table
  12387. @subsection Examples
  12388. @itemize
  12389. @item
  12390. Rotate the input by PI/6 radians clockwise:
  12391. @example
  12392. rotate=PI/6
  12393. @end example
  12394. @item
  12395. Rotate the input by PI/6 radians counter-clockwise:
  12396. @example
  12397. rotate=-PI/6
  12398. @end example
  12399. @item
  12400. Rotate the input by 45 degrees clockwise:
  12401. @example
  12402. rotate=45*PI/180
  12403. @end example
  12404. @item
  12405. Apply a constant rotation with period T, starting from an angle of PI/3:
  12406. @example
  12407. rotate=PI/3+2*PI*t/T
  12408. @end example
  12409. @item
  12410. Make the input video rotation oscillating with a period of T
  12411. seconds and an amplitude of A radians:
  12412. @example
  12413. rotate=A*sin(2*PI/T*t)
  12414. @end example
  12415. @item
  12416. Rotate the video, output size is chosen so that the whole rotating
  12417. input video is always completely contained in the output:
  12418. @example
  12419. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12420. @end example
  12421. @item
  12422. Rotate the video, reduce the output size so that no background is ever
  12423. shown:
  12424. @example
  12425. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12426. @end example
  12427. @end itemize
  12428. @subsection Commands
  12429. The filter supports the following commands:
  12430. @table @option
  12431. @item a, angle
  12432. Set the angle expression.
  12433. The command accepts the same syntax of the corresponding option.
  12434. If the specified expression is not valid, it is kept at its current
  12435. value.
  12436. @end table
  12437. @section sab
  12438. Apply Shape Adaptive Blur.
  12439. The filter accepts the following options:
  12440. @table @option
  12441. @item luma_radius, lr
  12442. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12443. value is 1.0. A greater value will result in a more blurred image, and
  12444. in slower processing.
  12445. @item luma_pre_filter_radius, lpfr
  12446. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12447. value is 1.0.
  12448. @item luma_strength, ls
  12449. Set luma maximum difference between pixels to still be considered, must
  12450. be a value in the 0.1-100.0 range, default value is 1.0.
  12451. @item chroma_radius, cr
  12452. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12453. greater value will result in a more blurred image, and in slower
  12454. processing.
  12455. @item chroma_pre_filter_radius, cpfr
  12456. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12457. @item chroma_strength, cs
  12458. Set chroma maximum difference between pixels to still be considered,
  12459. must be a value in the -0.9-100.0 range.
  12460. @end table
  12461. Each chroma option value, if not explicitly specified, is set to the
  12462. corresponding luma option value.
  12463. @anchor{scale}
  12464. @section scale
  12465. Scale (resize) the input video, using the libswscale library.
  12466. The scale filter forces the output display aspect ratio to be the same
  12467. of the input, by changing the output sample aspect ratio.
  12468. If the input image format is different from the format requested by
  12469. the next filter, the scale filter will convert the input to the
  12470. requested format.
  12471. @subsection Options
  12472. The filter accepts the following options, or any of the options
  12473. supported by the libswscale scaler.
  12474. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12475. the complete list of scaler options.
  12476. @table @option
  12477. @item width, w
  12478. @item height, h
  12479. Set the output video dimension expression. Default value is the input
  12480. dimension.
  12481. If the @var{width} or @var{w} value is 0, the input width is used for
  12482. the output. If the @var{height} or @var{h} value is 0, the input height
  12483. is used for the output.
  12484. If one and only one of the values is -n with n >= 1, the scale filter
  12485. will use a value that maintains the aspect ratio of the input image,
  12486. calculated from the other specified dimension. After that it will,
  12487. however, make sure that the calculated dimension is divisible by n and
  12488. adjust the value if necessary.
  12489. If both values are -n with n >= 1, the behavior will be identical to
  12490. both values being set to 0 as previously detailed.
  12491. See below for the list of accepted constants for use in the dimension
  12492. expression.
  12493. @item eval
  12494. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12495. @table @samp
  12496. @item init
  12497. Only evaluate expressions once during the filter initialization or when a command is processed.
  12498. @item frame
  12499. Evaluate expressions for each incoming frame.
  12500. @end table
  12501. Default value is @samp{init}.
  12502. @item interl
  12503. Set the interlacing mode. It accepts the following values:
  12504. @table @samp
  12505. @item 1
  12506. Force interlaced aware scaling.
  12507. @item 0
  12508. Do not apply interlaced scaling.
  12509. @item -1
  12510. Select interlaced aware scaling depending on whether the source frames
  12511. are flagged as interlaced or not.
  12512. @end table
  12513. Default value is @samp{0}.
  12514. @item flags
  12515. Set libswscale scaling flags. See
  12516. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12517. complete list of values. If not explicitly specified the filter applies
  12518. the default flags.
  12519. @item param0, param1
  12520. Set libswscale input parameters for scaling algorithms that need them. See
  12521. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12522. complete documentation. If not explicitly specified the filter applies
  12523. empty parameters.
  12524. @item size, s
  12525. Set the video size. For the syntax of this option, check the
  12526. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12527. @item in_color_matrix
  12528. @item out_color_matrix
  12529. Set in/output YCbCr color space type.
  12530. This allows the autodetected value to be overridden as well as allows forcing
  12531. a specific value used for the output and encoder.
  12532. If not specified, the color space type depends on the pixel format.
  12533. Possible values:
  12534. @table @samp
  12535. @item auto
  12536. Choose automatically.
  12537. @item bt709
  12538. Format conforming to International Telecommunication Union (ITU)
  12539. Recommendation BT.709.
  12540. @item fcc
  12541. Set color space conforming to the United States Federal Communications
  12542. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12543. @item bt601
  12544. @item bt470
  12545. @item smpte170m
  12546. Set color space conforming to:
  12547. @itemize
  12548. @item
  12549. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12550. @item
  12551. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12552. @item
  12553. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12554. @end itemize
  12555. @item smpte240m
  12556. Set color space conforming to SMPTE ST 240:1999.
  12557. @item bt2020
  12558. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12559. @end table
  12560. @item in_range
  12561. @item out_range
  12562. Set in/output YCbCr sample range.
  12563. This allows the autodetected value to be overridden as well as allows forcing
  12564. a specific value used for the output and encoder. If not specified, the
  12565. range depends on the pixel format. Possible values:
  12566. @table @samp
  12567. @item auto/unknown
  12568. Choose automatically.
  12569. @item jpeg/full/pc
  12570. Set full range (0-255 in case of 8-bit luma).
  12571. @item mpeg/limited/tv
  12572. Set "MPEG" range (16-235 in case of 8-bit luma).
  12573. @end table
  12574. @item force_original_aspect_ratio
  12575. Enable decreasing or increasing output video width or height if necessary to
  12576. keep the original aspect ratio. Possible values:
  12577. @table @samp
  12578. @item disable
  12579. Scale the video as specified and disable this feature.
  12580. @item decrease
  12581. The output video dimensions will automatically be decreased if needed.
  12582. @item increase
  12583. The output video dimensions will automatically be increased if needed.
  12584. @end table
  12585. One useful instance of this option is that when you know a specific device's
  12586. maximum allowed resolution, you can use this to limit the output video to
  12587. that, while retaining the aspect ratio. For example, device A allows
  12588. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12589. decrease) and specifying 1280x720 to the command line makes the output
  12590. 1280x533.
  12591. Please note that this is a different thing than specifying -1 for @option{w}
  12592. or @option{h}, you still need to specify the output resolution for this option
  12593. to work.
  12594. @item force_divisible_by
  12595. Ensures that both the output dimensions, width and height, are divisible by the
  12596. given integer when used together with @option{force_original_aspect_ratio}. This
  12597. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12598. This option respects the value set for @option{force_original_aspect_ratio},
  12599. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12600. may be slightly modified.
  12601. This option can be handy if you need to have a video fit within or exceed
  12602. a defined resolution using @option{force_original_aspect_ratio} but also have
  12603. encoder restrictions on width or height divisibility.
  12604. @end table
  12605. The values of the @option{w} and @option{h} options are expressions
  12606. containing the following constants:
  12607. @table @var
  12608. @item in_w
  12609. @item in_h
  12610. The input width and height
  12611. @item iw
  12612. @item ih
  12613. These are the same as @var{in_w} and @var{in_h}.
  12614. @item out_w
  12615. @item out_h
  12616. The output (scaled) width and height
  12617. @item ow
  12618. @item oh
  12619. These are the same as @var{out_w} and @var{out_h}
  12620. @item a
  12621. The same as @var{iw} / @var{ih}
  12622. @item sar
  12623. input sample aspect ratio
  12624. @item dar
  12625. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12626. @item hsub
  12627. @item vsub
  12628. horizontal and vertical input chroma subsample values. For example for the
  12629. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12630. @item ohsub
  12631. @item ovsub
  12632. horizontal and vertical output chroma subsample values. For example for the
  12633. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12634. @item n
  12635. The (sequential) number of the input frame, starting from 0.
  12636. Only available with @code{eval=frame}.
  12637. @item t
  12638. The presentation timestamp of the input frame, expressed as a number of
  12639. seconds. Only available with @code{eval=frame}.
  12640. @item pos
  12641. The position (byte offset) of the frame in the input stream, or NaN if
  12642. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12643. Only available with @code{eval=frame}.
  12644. @end table
  12645. @subsection Examples
  12646. @itemize
  12647. @item
  12648. Scale the input video to a size of 200x100
  12649. @example
  12650. scale=w=200:h=100
  12651. @end example
  12652. This is equivalent to:
  12653. @example
  12654. scale=200:100
  12655. @end example
  12656. or:
  12657. @example
  12658. scale=200x100
  12659. @end example
  12660. @item
  12661. Specify a size abbreviation for the output size:
  12662. @example
  12663. scale=qcif
  12664. @end example
  12665. which can also be written as:
  12666. @example
  12667. scale=size=qcif
  12668. @end example
  12669. @item
  12670. Scale the input to 2x:
  12671. @example
  12672. scale=w=2*iw:h=2*ih
  12673. @end example
  12674. @item
  12675. The above is the same as:
  12676. @example
  12677. scale=2*in_w:2*in_h
  12678. @end example
  12679. @item
  12680. Scale the input to 2x with forced interlaced scaling:
  12681. @example
  12682. scale=2*iw:2*ih:interl=1
  12683. @end example
  12684. @item
  12685. Scale the input to half size:
  12686. @example
  12687. scale=w=iw/2:h=ih/2
  12688. @end example
  12689. @item
  12690. Increase the width, and set the height to the same size:
  12691. @example
  12692. scale=3/2*iw:ow
  12693. @end example
  12694. @item
  12695. Seek Greek harmony:
  12696. @example
  12697. scale=iw:1/PHI*iw
  12698. scale=ih*PHI:ih
  12699. @end example
  12700. @item
  12701. Increase the height, and set the width to 3/2 of the height:
  12702. @example
  12703. scale=w=3/2*oh:h=3/5*ih
  12704. @end example
  12705. @item
  12706. Increase the size, making the size a multiple of the chroma
  12707. subsample values:
  12708. @example
  12709. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12710. @end example
  12711. @item
  12712. Increase the width to a maximum of 500 pixels,
  12713. keeping the same aspect ratio as the input:
  12714. @example
  12715. scale=w='min(500\, iw*3/2):h=-1'
  12716. @end example
  12717. @item
  12718. Make pixels square by combining scale and setsar:
  12719. @example
  12720. scale='trunc(ih*dar):ih',setsar=1/1
  12721. @end example
  12722. @item
  12723. Make pixels square by combining scale and setsar,
  12724. making sure the resulting resolution is even (required by some codecs):
  12725. @example
  12726. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12727. @end example
  12728. @end itemize
  12729. @subsection Commands
  12730. This filter supports the following commands:
  12731. @table @option
  12732. @item width, w
  12733. @item height, h
  12734. Set the output video dimension expression.
  12735. The command accepts the same syntax of the corresponding option.
  12736. If the specified expression is not valid, it is kept at its current
  12737. value.
  12738. @end table
  12739. @section scale_npp
  12740. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12741. format conversion on CUDA video frames. Setting the output width and height
  12742. works in the same way as for the @var{scale} filter.
  12743. The following additional options are accepted:
  12744. @table @option
  12745. @item format
  12746. The pixel format of the output CUDA frames. If set to the string "same" (the
  12747. default), the input format will be kept. Note that automatic format negotiation
  12748. and conversion is not yet supported for hardware frames
  12749. @item interp_algo
  12750. The interpolation algorithm used for resizing. One of the following:
  12751. @table @option
  12752. @item nn
  12753. Nearest neighbour.
  12754. @item linear
  12755. @item cubic
  12756. @item cubic2p_bspline
  12757. 2-parameter cubic (B=1, C=0)
  12758. @item cubic2p_catmullrom
  12759. 2-parameter cubic (B=0, C=1/2)
  12760. @item cubic2p_b05c03
  12761. 2-parameter cubic (B=1/2, C=3/10)
  12762. @item super
  12763. Supersampling
  12764. @item lanczos
  12765. @end table
  12766. @item force_original_aspect_ratio
  12767. Enable decreasing or increasing output video width or height if necessary to
  12768. keep the original aspect ratio. Possible values:
  12769. @table @samp
  12770. @item disable
  12771. Scale the video as specified and disable this feature.
  12772. @item decrease
  12773. The output video dimensions will automatically be decreased if needed.
  12774. @item increase
  12775. The output video dimensions will automatically be increased if needed.
  12776. @end table
  12777. One useful instance of this option is that when you know a specific device's
  12778. maximum allowed resolution, you can use this to limit the output video to
  12779. that, while retaining the aspect ratio. For example, device A allows
  12780. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12781. decrease) and specifying 1280x720 to the command line makes the output
  12782. 1280x533.
  12783. Please note that this is a different thing than specifying -1 for @option{w}
  12784. or @option{h}, you still need to specify the output resolution for this option
  12785. to work.
  12786. @item force_divisible_by
  12787. Ensures that both the output dimensions, width and height, are divisible by the
  12788. given integer when used together with @option{force_original_aspect_ratio}. This
  12789. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12790. This option respects the value set for @option{force_original_aspect_ratio},
  12791. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12792. may be slightly modified.
  12793. This option can be handy if you need to have a video fit within or exceed
  12794. a defined resolution using @option{force_original_aspect_ratio} but also have
  12795. encoder restrictions on width or height divisibility.
  12796. @end table
  12797. @section scale2ref
  12798. Scale (resize) the input video, based on a reference video.
  12799. See the scale filter for available options, scale2ref supports the same but
  12800. uses the reference video instead of the main input as basis. scale2ref also
  12801. supports the following additional constants for the @option{w} and
  12802. @option{h} options:
  12803. @table @var
  12804. @item main_w
  12805. @item main_h
  12806. The main input video's width and height
  12807. @item main_a
  12808. The same as @var{main_w} / @var{main_h}
  12809. @item main_sar
  12810. The main input video's sample aspect ratio
  12811. @item main_dar, mdar
  12812. The main input video's display aspect ratio. Calculated from
  12813. @code{(main_w / main_h) * main_sar}.
  12814. @item main_hsub
  12815. @item main_vsub
  12816. The main input video's horizontal and vertical chroma subsample values.
  12817. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12818. is 1.
  12819. @item main_n
  12820. The (sequential) number of the main input frame, starting from 0.
  12821. Only available with @code{eval=frame}.
  12822. @item main_t
  12823. The presentation timestamp of the main input frame, expressed as a number of
  12824. seconds. Only available with @code{eval=frame}.
  12825. @item main_pos
  12826. The position (byte offset) of the frame in the main input stream, or NaN if
  12827. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12828. Only available with @code{eval=frame}.
  12829. @end table
  12830. @subsection Examples
  12831. @itemize
  12832. @item
  12833. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12834. @example
  12835. 'scale2ref[b][a];[a][b]overlay'
  12836. @end example
  12837. @item
  12838. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12839. @example
  12840. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12841. @end example
  12842. @end itemize
  12843. @subsection Commands
  12844. This filter supports the following commands:
  12845. @table @option
  12846. @item width, w
  12847. @item height, h
  12848. Set the output video dimension expression.
  12849. The command accepts the same syntax of the corresponding option.
  12850. If the specified expression is not valid, it is kept at its current
  12851. value.
  12852. @end table
  12853. @section scroll
  12854. Scroll input video horizontally and/or vertically by constant speed.
  12855. The filter accepts the following options:
  12856. @table @option
  12857. @item horizontal, h
  12858. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12859. Negative values changes scrolling direction.
  12860. @item vertical, v
  12861. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12862. Negative values changes scrolling direction.
  12863. @item hpos
  12864. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12865. @item vpos
  12866. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12867. @end table
  12868. @subsection Commands
  12869. This filter supports the following @ref{commands}:
  12870. @table @option
  12871. @item horizontal, h
  12872. Set the horizontal scrolling speed.
  12873. @item vertical, v
  12874. Set the vertical scrolling speed.
  12875. @end table
  12876. @anchor{scdet}
  12877. @section scdet
  12878. Detect video scene change.
  12879. This filter sets frame metadata with mafd between frame, the scene score, and
  12880. forward the frame to the next filter, so they can use these metadata to detect
  12881. scene change or others.
  12882. In addition, this filter logs a message and sets frame metadata when it detects
  12883. a scene change by @option{threshold}.
  12884. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  12885. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  12886. to detect scene change.
  12887. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  12888. detect scene change with @option{threshold}.
  12889. The filter accepts the following options:
  12890. @table @option
  12891. @item threshold, t
  12892. Set the scene change detection threshold as a percentage of maximum change. Good
  12893. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  12894. @code{[0., 100.]}.
  12895. Default value is @code{10.}.
  12896. @item sc_pass, s
  12897. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  12898. You can enable it if you want to get snapshot of scene change frames only.
  12899. @end table
  12900. @anchor{selectivecolor}
  12901. @section selectivecolor
  12902. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12903. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12904. by the "purity" of the color (that is, how saturated it already is).
  12905. This filter is similar to the Adobe Photoshop Selective Color tool.
  12906. The filter accepts the following options:
  12907. @table @option
  12908. @item correction_method
  12909. Select color correction method.
  12910. Available values are:
  12911. @table @samp
  12912. @item absolute
  12913. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12914. component value).
  12915. @item relative
  12916. Specified adjustments are relative to the original component value.
  12917. @end table
  12918. Default is @code{absolute}.
  12919. @item reds
  12920. Adjustments for red pixels (pixels where the red component is the maximum)
  12921. @item yellows
  12922. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12923. @item greens
  12924. Adjustments for green pixels (pixels where the green component is the maximum)
  12925. @item cyans
  12926. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12927. @item blues
  12928. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12929. @item magentas
  12930. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12931. @item whites
  12932. Adjustments for white pixels (pixels where all components are greater than 128)
  12933. @item neutrals
  12934. Adjustments for all pixels except pure black and pure white
  12935. @item blacks
  12936. Adjustments for black pixels (pixels where all components are lesser than 128)
  12937. @item psfile
  12938. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12939. @end table
  12940. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12941. 4 space separated floating point adjustment values in the [-1,1] range,
  12942. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12943. pixels of its range.
  12944. @subsection Examples
  12945. @itemize
  12946. @item
  12947. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12948. increase magenta by 27% in blue areas:
  12949. @example
  12950. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12951. @end example
  12952. @item
  12953. Use a Photoshop selective color preset:
  12954. @example
  12955. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12956. @end example
  12957. @end itemize
  12958. @anchor{separatefields}
  12959. @section separatefields
  12960. The @code{separatefields} takes a frame-based video input and splits
  12961. each frame into its components fields, producing a new half height clip
  12962. with twice the frame rate and twice the frame count.
  12963. This filter use field-dominance information in frame to decide which
  12964. of each pair of fields to place first in the output.
  12965. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12966. @section setdar, setsar
  12967. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12968. output video.
  12969. This is done by changing the specified Sample (aka Pixel) Aspect
  12970. Ratio, according to the following equation:
  12971. @example
  12972. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12973. @end example
  12974. Keep in mind that the @code{setdar} filter does not modify the pixel
  12975. dimensions of the video frame. Also, the display aspect ratio set by
  12976. this filter may be changed by later filters in the filterchain,
  12977. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12978. applied.
  12979. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12980. the filter output video.
  12981. Note that as a consequence of the application of this filter, the
  12982. output display aspect ratio will change according to the equation
  12983. above.
  12984. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12985. filter may be changed by later filters in the filterchain, e.g. if
  12986. another "setsar" or a "setdar" filter is applied.
  12987. It accepts the following parameters:
  12988. @table @option
  12989. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12990. Set the aspect ratio used by the filter.
  12991. The parameter can be a floating point number string, an expression, or
  12992. a string of the form @var{num}:@var{den}, where @var{num} and
  12993. @var{den} are the numerator and denominator of the aspect ratio. If
  12994. the parameter is not specified, it is assumed the value "0".
  12995. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12996. should be escaped.
  12997. @item max
  12998. Set the maximum integer value to use for expressing numerator and
  12999. denominator when reducing the expressed aspect ratio to a rational.
  13000. Default value is @code{100}.
  13001. @end table
  13002. The parameter @var{sar} is an expression containing
  13003. the following constants:
  13004. @table @option
  13005. @item E, PI, PHI
  13006. These are approximated values for the mathematical constants e
  13007. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  13008. @item w, h
  13009. The input width and height.
  13010. @item a
  13011. These are the same as @var{w} / @var{h}.
  13012. @item sar
  13013. The input sample aspect ratio.
  13014. @item dar
  13015. The input display aspect ratio. It is the same as
  13016. (@var{w} / @var{h}) * @var{sar}.
  13017. @item hsub, vsub
  13018. Horizontal and vertical chroma subsample values. For example, for the
  13019. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13020. @end table
  13021. @subsection Examples
  13022. @itemize
  13023. @item
  13024. To change the display aspect ratio to 16:9, specify one of the following:
  13025. @example
  13026. setdar=dar=1.77777
  13027. setdar=dar=16/9
  13028. @end example
  13029. @item
  13030. To change the sample aspect ratio to 10:11, specify:
  13031. @example
  13032. setsar=sar=10/11
  13033. @end example
  13034. @item
  13035. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  13036. 1000 in the aspect ratio reduction, use the command:
  13037. @example
  13038. setdar=ratio=16/9:max=1000
  13039. @end example
  13040. @end itemize
  13041. @anchor{setfield}
  13042. @section setfield
  13043. Force field for the output video frame.
  13044. The @code{setfield} filter marks the interlace type field for the
  13045. output frames. It does not change the input frame, but only sets the
  13046. corresponding property, which affects how the frame is treated by
  13047. following filters (e.g. @code{fieldorder} or @code{yadif}).
  13048. The filter accepts the following options:
  13049. @table @option
  13050. @item mode
  13051. Available values are:
  13052. @table @samp
  13053. @item auto
  13054. Keep the same field property.
  13055. @item bff
  13056. Mark the frame as bottom-field-first.
  13057. @item tff
  13058. Mark the frame as top-field-first.
  13059. @item prog
  13060. Mark the frame as progressive.
  13061. @end table
  13062. @end table
  13063. @anchor{setparams}
  13064. @section setparams
  13065. Force frame parameter for the output video frame.
  13066. The @code{setparams} filter marks interlace and color range for the
  13067. output frames. It does not change the input frame, but only sets the
  13068. corresponding property, which affects how the frame is treated by
  13069. filters/encoders.
  13070. @table @option
  13071. @item field_mode
  13072. Available values are:
  13073. @table @samp
  13074. @item auto
  13075. Keep the same field property (default).
  13076. @item bff
  13077. Mark the frame as bottom-field-first.
  13078. @item tff
  13079. Mark the frame as top-field-first.
  13080. @item prog
  13081. Mark the frame as progressive.
  13082. @end table
  13083. @item range
  13084. Available values are:
  13085. @table @samp
  13086. @item auto
  13087. Keep the same color range property (default).
  13088. @item unspecified, unknown
  13089. Mark the frame as unspecified color range.
  13090. @item limited, tv, mpeg
  13091. Mark the frame as limited range.
  13092. @item full, pc, jpeg
  13093. Mark the frame as full range.
  13094. @end table
  13095. @item color_primaries
  13096. Set the color primaries.
  13097. Available values are:
  13098. @table @samp
  13099. @item auto
  13100. Keep the same color primaries property (default).
  13101. @item bt709
  13102. @item unknown
  13103. @item bt470m
  13104. @item bt470bg
  13105. @item smpte170m
  13106. @item smpte240m
  13107. @item film
  13108. @item bt2020
  13109. @item smpte428
  13110. @item smpte431
  13111. @item smpte432
  13112. @item jedec-p22
  13113. @end table
  13114. @item color_trc
  13115. Set the color transfer.
  13116. Available values are:
  13117. @table @samp
  13118. @item auto
  13119. Keep the same color trc property (default).
  13120. @item bt709
  13121. @item unknown
  13122. @item bt470m
  13123. @item bt470bg
  13124. @item smpte170m
  13125. @item smpte240m
  13126. @item linear
  13127. @item log100
  13128. @item log316
  13129. @item iec61966-2-4
  13130. @item bt1361e
  13131. @item iec61966-2-1
  13132. @item bt2020-10
  13133. @item bt2020-12
  13134. @item smpte2084
  13135. @item smpte428
  13136. @item arib-std-b67
  13137. @end table
  13138. @item colorspace
  13139. Set the colorspace.
  13140. Available values are:
  13141. @table @samp
  13142. @item auto
  13143. Keep the same colorspace property (default).
  13144. @item gbr
  13145. @item bt709
  13146. @item unknown
  13147. @item fcc
  13148. @item bt470bg
  13149. @item smpte170m
  13150. @item smpte240m
  13151. @item ycgco
  13152. @item bt2020nc
  13153. @item bt2020c
  13154. @item smpte2085
  13155. @item chroma-derived-nc
  13156. @item chroma-derived-c
  13157. @item ictcp
  13158. @end table
  13159. @end table
  13160. @section showinfo
  13161. Show a line containing various information for each input video frame.
  13162. The input video is not modified.
  13163. This filter supports the following options:
  13164. @table @option
  13165. @item checksum
  13166. Calculate checksums of each plane. By default enabled.
  13167. @end table
  13168. The shown line contains a sequence of key/value pairs of the form
  13169. @var{key}:@var{value}.
  13170. The following values are shown in the output:
  13171. @table @option
  13172. @item n
  13173. The (sequential) number of the input frame, starting from 0.
  13174. @item pts
  13175. The Presentation TimeStamp of the input frame, expressed as a number of
  13176. time base units. The time base unit depends on the filter input pad.
  13177. @item pts_time
  13178. The Presentation TimeStamp of the input frame, expressed as a number of
  13179. seconds.
  13180. @item pos
  13181. The position of the frame in the input stream, or -1 if this information is
  13182. unavailable and/or meaningless (for example in case of synthetic video).
  13183. @item fmt
  13184. The pixel format name.
  13185. @item sar
  13186. The sample aspect ratio of the input frame, expressed in the form
  13187. @var{num}/@var{den}.
  13188. @item s
  13189. The size of the input frame. For the syntax of this option, check the
  13190. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13191. @item i
  13192. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13193. for bottom field first).
  13194. @item iskey
  13195. This is 1 if the frame is a key frame, 0 otherwise.
  13196. @item type
  13197. The picture type of the input frame ("I" for an I-frame, "P" for a
  13198. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13199. Also refer to the documentation of the @code{AVPictureType} enum and of
  13200. the @code{av_get_picture_type_char} function defined in
  13201. @file{libavutil/avutil.h}.
  13202. @item checksum
  13203. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13204. @item plane_checksum
  13205. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13206. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13207. @item mean
  13208. The mean value of pixels in each plane of the input frame, expressed in the form
  13209. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13210. @item stdev
  13211. The standard deviation of pixel values in each plane of the input frame, expressed
  13212. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13213. @end table
  13214. @section showpalette
  13215. Displays the 256 colors palette of each frame. This filter is only relevant for
  13216. @var{pal8} pixel format frames.
  13217. It accepts the following option:
  13218. @table @option
  13219. @item s
  13220. Set the size of the box used to represent one palette color entry. Default is
  13221. @code{30} (for a @code{30x30} pixel box).
  13222. @end table
  13223. @section shuffleframes
  13224. Reorder and/or duplicate and/or drop video frames.
  13225. It accepts the following parameters:
  13226. @table @option
  13227. @item mapping
  13228. Set the destination indexes of input frames.
  13229. This is space or '|' separated list of indexes that maps input frames to output
  13230. frames. Number of indexes also sets maximal value that each index may have.
  13231. '-1' index have special meaning and that is to drop frame.
  13232. @end table
  13233. The first frame has the index 0. The default is to keep the input unchanged.
  13234. @subsection Examples
  13235. @itemize
  13236. @item
  13237. Swap second and third frame of every three frames of the input:
  13238. @example
  13239. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13240. @end example
  13241. @item
  13242. Swap 10th and 1st frame of every ten frames of the input:
  13243. @example
  13244. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13245. @end example
  13246. @end itemize
  13247. @section shuffleplanes
  13248. Reorder and/or duplicate video planes.
  13249. It accepts the following parameters:
  13250. @table @option
  13251. @item map0
  13252. The index of the input plane to be used as the first output plane.
  13253. @item map1
  13254. The index of the input plane to be used as the second output plane.
  13255. @item map2
  13256. The index of the input plane to be used as the third output plane.
  13257. @item map3
  13258. The index of the input plane to be used as the fourth output plane.
  13259. @end table
  13260. The first plane has the index 0. The default is to keep the input unchanged.
  13261. @subsection Examples
  13262. @itemize
  13263. @item
  13264. Swap the second and third planes of the input:
  13265. @example
  13266. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13267. @end example
  13268. @end itemize
  13269. @anchor{signalstats}
  13270. @section signalstats
  13271. Evaluate various visual metrics that assist in determining issues associated
  13272. with the digitization of analog video media.
  13273. By default the filter will log these metadata values:
  13274. @table @option
  13275. @item YMIN
  13276. Display the minimal Y value contained within the input frame. Expressed in
  13277. range of [0-255].
  13278. @item YLOW
  13279. Display the Y value at the 10% percentile within the input frame. Expressed in
  13280. range of [0-255].
  13281. @item YAVG
  13282. Display the average Y value within the input frame. Expressed in range of
  13283. [0-255].
  13284. @item YHIGH
  13285. Display the Y value at the 90% percentile within the input frame. Expressed in
  13286. range of [0-255].
  13287. @item YMAX
  13288. Display the maximum Y value contained within the input frame. Expressed in
  13289. range of [0-255].
  13290. @item UMIN
  13291. Display the minimal U value contained within the input frame. Expressed in
  13292. range of [0-255].
  13293. @item ULOW
  13294. Display the U value at the 10% percentile within the input frame. Expressed in
  13295. range of [0-255].
  13296. @item UAVG
  13297. Display the average U value within the input frame. Expressed in range of
  13298. [0-255].
  13299. @item UHIGH
  13300. Display the U value at the 90% percentile within the input frame. Expressed in
  13301. range of [0-255].
  13302. @item UMAX
  13303. Display the maximum U value contained within the input frame. Expressed in
  13304. range of [0-255].
  13305. @item VMIN
  13306. Display the minimal V value contained within the input frame. Expressed in
  13307. range of [0-255].
  13308. @item VLOW
  13309. Display the V value at the 10% percentile within the input frame. Expressed in
  13310. range of [0-255].
  13311. @item VAVG
  13312. Display the average V value within the input frame. Expressed in range of
  13313. [0-255].
  13314. @item VHIGH
  13315. Display the V value at the 90% percentile within the input frame. Expressed in
  13316. range of [0-255].
  13317. @item VMAX
  13318. Display the maximum V value contained within the input frame. Expressed in
  13319. range of [0-255].
  13320. @item SATMIN
  13321. Display the minimal saturation value contained within the input frame.
  13322. Expressed in range of [0-~181.02].
  13323. @item SATLOW
  13324. Display the saturation value at the 10% percentile within the input frame.
  13325. Expressed in range of [0-~181.02].
  13326. @item SATAVG
  13327. Display the average saturation value within the input frame. Expressed in range
  13328. of [0-~181.02].
  13329. @item SATHIGH
  13330. Display the saturation value at the 90% percentile within the input frame.
  13331. Expressed in range of [0-~181.02].
  13332. @item SATMAX
  13333. Display the maximum saturation value contained within the input frame.
  13334. Expressed in range of [0-~181.02].
  13335. @item HUEMED
  13336. Display the median value for hue within the input frame. Expressed in range of
  13337. [0-360].
  13338. @item HUEAVG
  13339. Display the average value for hue within the input frame. Expressed in range of
  13340. [0-360].
  13341. @item YDIF
  13342. Display the average of sample value difference between all values of the Y
  13343. plane in the current frame and corresponding values of the previous input frame.
  13344. Expressed in range of [0-255].
  13345. @item UDIF
  13346. Display the average of sample value difference between all values of the U
  13347. plane in the current frame and corresponding values of the previous input frame.
  13348. Expressed in range of [0-255].
  13349. @item VDIF
  13350. Display the average of sample value difference between all values of the V
  13351. plane in the current frame and corresponding values of the previous input frame.
  13352. Expressed in range of [0-255].
  13353. @item YBITDEPTH
  13354. Display bit depth of Y plane in current frame.
  13355. Expressed in range of [0-16].
  13356. @item UBITDEPTH
  13357. Display bit depth of U plane in current frame.
  13358. Expressed in range of [0-16].
  13359. @item VBITDEPTH
  13360. Display bit depth of V plane in current frame.
  13361. Expressed in range of [0-16].
  13362. @end table
  13363. The filter accepts the following options:
  13364. @table @option
  13365. @item stat
  13366. @item out
  13367. @option{stat} specify an additional form of image analysis.
  13368. @option{out} output video with the specified type of pixel highlighted.
  13369. Both options accept the following values:
  13370. @table @samp
  13371. @item tout
  13372. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13373. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13374. include the results of video dropouts, head clogs, or tape tracking issues.
  13375. @item vrep
  13376. Identify @var{vertical line repetition}. Vertical line repetition includes
  13377. similar rows of pixels within a frame. In born-digital video vertical line
  13378. repetition is common, but this pattern is uncommon in video digitized from an
  13379. analog source. When it occurs in video that results from the digitization of an
  13380. analog source it can indicate concealment from a dropout compensator.
  13381. @item brng
  13382. Identify pixels that fall outside of legal broadcast range.
  13383. @end table
  13384. @item color, c
  13385. Set the highlight color for the @option{out} option. The default color is
  13386. yellow.
  13387. @end table
  13388. @subsection Examples
  13389. @itemize
  13390. @item
  13391. Output data of various video metrics:
  13392. @example
  13393. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13394. @end example
  13395. @item
  13396. Output specific data about the minimum and maximum values of the Y plane per frame:
  13397. @example
  13398. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13399. @end example
  13400. @item
  13401. Playback video while highlighting pixels that are outside of broadcast range in red.
  13402. @example
  13403. ffplay example.mov -vf signalstats="out=brng:color=red"
  13404. @end example
  13405. @item
  13406. Playback video with signalstats metadata drawn over the frame.
  13407. @example
  13408. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13409. @end example
  13410. The contents of signalstat_drawtext.txt used in the command are:
  13411. @example
  13412. time %@{pts:hms@}
  13413. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13414. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13415. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13416. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13417. @end example
  13418. @end itemize
  13419. @anchor{signature}
  13420. @section signature
  13421. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13422. input. In this case the matching between the inputs can be calculated additionally.
  13423. The filter always passes through the first input. The signature of each stream can
  13424. be written into a file.
  13425. It accepts the following options:
  13426. @table @option
  13427. @item detectmode
  13428. Enable or disable the matching process.
  13429. Available values are:
  13430. @table @samp
  13431. @item off
  13432. Disable the calculation of a matching (default).
  13433. @item full
  13434. Calculate the matching for the whole video and output whether the whole video
  13435. matches or only parts.
  13436. @item fast
  13437. Calculate only until a matching is found or the video ends. Should be faster in
  13438. some cases.
  13439. @end table
  13440. @item nb_inputs
  13441. Set the number of inputs. The option value must be a non negative integer.
  13442. Default value is 1.
  13443. @item filename
  13444. Set the path to which the output is written. If there is more than one input,
  13445. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13446. integer), that will be replaced with the input number. If no filename is
  13447. specified, no output will be written. This is the default.
  13448. @item format
  13449. Choose the output format.
  13450. Available values are:
  13451. @table @samp
  13452. @item binary
  13453. Use the specified binary representation (default).
  13454. @item xml
  13455. Use the specified xml representation.
  13456. @end table
  13457. @item th_d
  13458. Set threshold to detect one word as similar. The option value must be an integer
  13459. greater than zero. The default value is 9000.
  13460. @item th_dc
  13461. Set threshold to detect all words as similar. The option value must be an integer
  13462. greater than zero. The default value is 60000.
  13463. @item th_xh
  13464. Set threshold to detect frames as similar. The option value must be an integer
  13465. greater than zero. The default value is 116.
  13466. @item th_di
  13467. Set the minimum length of a sequence in frames to recognize it as matching
  13468. sequence. The option value must be a non negative integer value.
  13469. The default value is 0.
  13470. @item th_it
  13471. Set the minimum relation, that matching frames to all frames must have.
  13472. The option value must be a double value between 0 and 1. The default value is 0.5.
  13473. @end table
  13474. @subsection Examples
  13475. @itemize
  13476. @item
  13477. To calculate the signature of an input video and store it in signature.bin:
  13478. @example
  13479. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13480. @end example
  13481. @item
  13482. To detect whether two videos match and store the signatures in XML format in
  13483. signature0.xml and signature1.xml:
  13484. @example
  13485. 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 -
  13486. @end example
  13487. @end itemize
  13488. @anchor{smartblur}
  13489. @section smartblur
  13490. Blur the input video without impacting the outlines.
  13491. It accepts the following options:
  13492. @table @option
  13493. @item luma_radius, lr
  13494. Set the luma radius. The option value must be a float number in
  13495. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13496. used to blur the image (slower if larger). Default value is 1.0.
  13497. @item luma_strength, ls
  13498. Set the luma strength. The option value must be a float number
  13499. in the range [-1.0,1.0] that configures the blurring. A value included
  13500. in [0.0,1.0] will blur the image whereas a value included in
  13501. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13502. @item luma_threshold, lt
  13503. Set the luma threshold used as a coefficient to determine
  13504. whether a pixel should be blurred or not. The option value must be an
  13505. integer in the range [-30,30]. A value of 0 will filter all the image,
  13506. a value included in [0,30] will filter flat areas and a value included
  13507. in [-30,0] will filter edges. Default value is 0.
  13508. @item chroma_radius, cr
  13509. Set the chroma radius. The option value must be a float number in
  13510. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13511. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13512. @item chroma_strength, cs
  13513. Set the chroma strength. The option value must be a float number
  13514. in the range [-1.0,1.0] that configures the blurring. A value included
  13515. in [0.0,1.0] will blur the image whereas a value included in
  13516. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13517. @item chroma_threshold, ct
  13518. Set the chroma threshold used as a coefficient to determine
  13519. whether a pixel should be blurred or not. The option value must be an
  13520. integer in the range [-30,30]. A value of 0 will filter all the image,
  13521. a value included in [0,30] will filter flat areas and a value included
  13522. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13523. @end table
  13524. If a chroma option is not explicitly set, the corresponding luma value
  13525. is set.
  13526. @section sobel
  13527. Apply sobel operator to input video stream.
  13528. The filter accepts the following option:
  13529. @table @option
  13530. @item planes
  13531. Set which planes will be processed, unprocessed planes will be copied.
  13532. By default value 0xf, all planes will be processed.
  13533. @item scale
  13534. Set value which will be multiplied with filtered result.
  13535. @item delta
  13536. Set value which will be added to filtered result.
  13537. @end table
  13538. @anchor{spp}
  13539. @section spp
  13540. Apply a simple postprocessing filter that compresses and decompresses the image
  13541. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13542. and average the results.
  13543. The filter accepts the following options:
  13544. @table @option
  13545. @item quality
  13546. Set quality. This option defines the number of levels for averaging. It accepts
  13547. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13548. effect. A value of @code{6} means the higher quality. For each increment of
  13549. that value the speed drops by a factor of approximately 2. Default value is
  13550. @code{3}.
  13551. @item qp
  13552. Force a constant quantization parameter. If not set, the filter will use the QP
  13553. from the video stream (if available).
  13554. @item mode
  13555. Set thresholding mode. Available modes are:
  13556. @table @samp
  13557. @item hard
  13558. Set hard thresholding (default).
  13559. @item soft
  13560. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13561. @end table
  13562. @item use_bframe_qp
  13563. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13564. option may cause flicker since the B-Frames have often larger QP. Default is
  13565. @code{0} (not enabled).
  13566. @end table
  13567. @subsection Commands
  13568. This filter supports the following commands:
  13569. @table @option
  13570. @item quality, level
  13571. Set quality level. The value @code{max} can be used to set the maximum level,
  13572. currently @code{6}.
  13573. @end table
  13574. @anchor{sr}
  13575. @section sr
  13576. Scale the input by applying one of the super-resolution methods based on
  13577. convolutional neural networks. Supported models:
  13578. @itemize
  13579. @item
  13580. Super-Resolution Convolutional Neural Network model (SRCNN).
  13581. See @url{https://arxiv.org/abs/1501.00092}.
  13582. @item
  13583. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13584. See @url{https://arxiv.org/abs/1609.05158}.
  13585. @end itemize
  13586. Training scripts as well as scripts for model file (.pb) saving can be found at
  13587. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13588. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13589. Native model files (.model) can be generated from TensorFlow model
  13590. files (.pb) by using tools/python/convert.py
  13591. The filter accepts the following options:
  13592. @table @option
  13593. @item dnn_backend
  13594. Specify which DNN backend to use for model loading and execution. This option accepts
  13595. the following values:
  13596. @table @samp
  13597. @item native
  13598. Native implementation of DNN loading and execution.
  13599. @item tensorflow
  13600. TensorFlow backend. To enable this backend you
  13601. need to install the TensorFlow for C library (see
  13602. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13603. @code{--enable-libtensorflow}
  13604. @end table
  13605. Default value is @samp{native}.
  13606. @item model
  13607. Set path to model file specifying network architecture and its parameters.
  13608. Note that different backends use different file formats. TensorFlow backend
  13609. can load files for both formats, while native backend can load files for only
  13610. its format.
  13611. @item scale_factor
  13612. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13613. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13614. input upscaled using bicubic upscaling with proper scale factor.
  13615. @end table
  13616. This feature can also be finished with @ref{dnn_processing} filter.
  13617. @section ssim
  13618. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13619. This filter takes in input two input videos, the first input is
  13620. considered the "main" source and is passed unchanged to the
  13621. output. The second input is used as a "reference" video for computing
  13622. the SSIM.
  13623. Both video inputs must have the same resolution and pixel format for
  13624. this filter to work correctly. Also it assumes that both inputs
  13625. have the same number of frames, which are compared one by one.
  13626. The filter stores the calculated SSIM of each frame.
  13627. The description of the accepted parameters follows.
  13628. @table @option
  13629. @item stats_file, f
  13630. If specified the filter will use the named file to save the SSIM of
  13631. each individual frame. When filename equals "-" the data is sent to
  13632. standard output.
  13633. @end table
  13634. The file printed if @var{stats_file} is selected, contains a sequence of
  13635. key/value pairs of the form @var{key}:@var{value} for each compared
  13636. couple of frames.
  13637. A description of each shown parameter follows:
  13638. @table @option
  13639. @item n
  13640. sequential number of the input frame, starting from 1
  13641. @item Y, U, V, R, G, B
  13642. SSIM of the compared frames for the component specified by the suffix.
  13643. @item All
  13644. SSIM of the compared frames for the whole frame.
  13645. @item dB
  13646. Same as above but in dB representation.
  13647. @end table
  13648. This filter also supports the @ref{framesync} options.
  13649. @subsection Examples
  13650. @itemize
  13651. @item
  13652. For example:
  13653. @example
  13654. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13655. [main][ref] ssim="stats_file=stats.log" [out]
  13656. @end example
  13657. On this example the input file being processed is compared with the
  13658. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13659. is stored in @file{stats.log}.
  13660. @item
  13661. Another example with both psnr and ssim at same time:
  13662. @example
  13663. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13664. @end example
  13665. @item
  13666. Another example with different containers:
  13667. @example
  13668. 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 -
  13669. @end example
  13670. @end itemize
  13671. @section stereo3d
  13672. Convert between different stereoscopic image formats.
  13673. The filters accept the following options:
  13674. @table @option
  13675. @item in
  13676. Set stereoscopic image format of input.
  13677. Available values for input image formats are:
  13678. @table @samp
  13679. @item sbsl
  13680. side by side parallel (left eye left, right eye right)
  13681. @item sbsr
  13682. side by side crosseye (right eye left, left eye right)
  13683. @item sbs2l
  13684. side by side parallel with half width resolution
  13685. (left eye left, right eye right)
  13686. @item sbs2r
  13687. side by side crosseye with half width resolution
  13688. (right eye left, left eye right)
  13689. @item abl
  13690. @item tbl
  13691. above-below (left eye above, right eye below)
  13692. @item abr
  13693. @item tbr
  13694. above-below (right eye above, left eye below)
  13695. @item ab2l
  13696. @item tb2l
  13697. above-below with half height resolution
  13698. (left eye above, right eye below)
  13699. @item ab2r
  13700. @item tb2r
  13701. above-below with half height resolution
  13702. (right eye above, left eye below)
  13703. @item al
  13704. alternating frames (left eye first, right eye second)
  13705. @item ar
  13706. alternating frames (right eye first, left eye second)
  13707. @item irl
  13708. interleaved rows (left eye has top row, right eye starts on next row)
  13709. @item irr
  13710. interleaved rows (right eye has top row, left eye starts on next row)
  13711. @item icl
  13712. interleaved columns, left eye first
  13713. @item icr
  13714. interleaved columns, right eye first
  13715. Default value is @samp{sbsl}.
  13716. @end table
  13717. @item out
  13718. Set stereoscopic image format of output.
  13719. @table @samp
  13720. @item sbsl
  13721. side by side parallel (left eye left, right eye right)
  13722. @item sbsr
  13723. side by side crosseye (right eye left, left eye right)
  13724. @item sbs2l
  13725. side by side parallel with half width resolution
  13726. (left eye left, right eye right)
  13727. @item sbs2r
  13728. side by side crosseye with half width resolution
  13729. (right eye left, left eye right)
  13730. @item abl
  13731. @item tbl
  13732. above-below (left eye above, right eye below)
  13733. @item abr
  13734. @item tbr
  13735. above-below (right eye above, left eye below)
  13736. @item ab2l
  13737. @item tb2l
  13738. above-below with half height resolution
  13739. (left eye above, right eye below)
  13740. @item ab2r
  13741. @item tb2r
  13742. above-below with half height resolution
  13743. (right eye above, left eye below)
  13744. @item al
  13745. alternating frames (left eye first, right eye second)
  13746. @item ar
  13747. alternating frames (right eye first, left eye second)
  13748. @item irl
  13749. interleaved rows (left eye has top row, right eye starts on next row)
  13750. @item irr
  13751. interleaved rows (right eye has top row, left eye starts on next row)
  13752. @item arbg
  13753. anaglyph red/blue gray
  13754. (red filter on left eye, blue filter on right eye)
  13755. @item argg
  13756. anaglyph red/green gray
  13757. (red filter on left eye, green filter on right eye)
  13758. @item arcg
  13759. anaglyph red/cyan gray
  13760. (red filter on left eye, cyan filter on right eye)
  13761. @item arch
  13762. anaglyph red/cyan half colored
  13763. (red filter on left eye, cyan filter on right eye)
  13764. @item arcc
  13765. anaglyph red/cyan color
  13766. (red filter on left eye, cyan filter on right eye)
  13767. @item arcd
  13768. anaglyph red/cyan color optimized with the least squares projection of dubois
  13769. (red filter on left eye, cyan filter on right eye)
  13770. @item agmg
  13771. anaglyph green/magenta gray
  13772. (green filter on left eye, magenta filter on right eye)
  13773. @item agmh
  13774. anaglyph green/magenta half colored
  13775. (green filter on left eye, magenta filter on right eye)
  13776. @item agmc
  13777. anaglyph green/magenta colored
  13778. (green filter on left eye, magenta filter on right eye)
  13779. @item agmd
  13780. anaglyph green/magenta color optimized with the least squares projection of dubois
  13781. (green filter on left eye, magenta filter on right eye)
  13782. @item aybg
  13783. anaglyph yellow/blue gray
  13784. (yellow filter on left eye, blue filter on right eye)
  13785. @item aybh
  13786. anaglyph yellow/blue half colored
  13787. (yellow filter on left eye, blue filter on right eye)
  13788. @item aybc
  13789. anaglyph yellow/blue colored
  13790. (yellow filter on left eye, blue filter on right eye)
  13791. @item aybd
  13792. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13793. (yellow filter on left eye, blue filter on right eye)
  13794. @item ml
  13795. mono output (left eye only)
  13796. @item mr
  13797. mono output (right eye only)
  13798. @item chl
  13799. checkerboard, left eye first
  13800. @item chr
  13801. checkerboard, right eye first
  13802. @item icl
  13803. interleaved columns, left eye first
  13804. @item icr
  13805. interleaved columns, right eye first
  13806. @item hdmi
  13807. HDMI frame pack
  13808. @end table
  13809. Default value is @samp{arcd}.
  13810. @end table
  13811. @subsection Examples
  13812. @itemize
  13813. @item
  13814. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13815. @example
  13816. stereo3d=sbsl:aybd
  13817. @end example
  13818. @item
  13819. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13820. @example
  13821. stereo3d=abl:sbsr
  13822. @end example
  13823. @end itemize
  13824. @section streamselect, astreamselect
  13825. Select video or audio streams.
  13826. The filter accepts the following options:
  13827. @table @option
  13828. @item inputs
  13829. Set number of inputs. Default is 2.
  13830. @item map
  13831. Set input indexes to remap to outputs.
  13832. @end table
  13833. @subsection Commands
  13834. The @code{streamselect} and @code{astreamselect} filter supports the following
  13835. commands:
  13836. @table @option
  13837. @item map
  13838. Set input indexes to remap to outputs.
  13839. @end table
  13840. @subsection Examples
  13841. @itemize
  13842. @item
  13843. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13844. @example
  13845. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13846. @end example
  13847. @item
  13848. Same as above, but for audio:
  13849. @example
  13850. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13851. @end example
  13852. @end itemize
  13853. @anchor{subtitles}
  13854. @section subtitles
  13855. Draw subtitles on top of input video using the libass library.
  13856. To enable compilation of this filter you need to configure FFmpeg with
  13857. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13858. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13859. Alpha) subtitles format.
  13860. The filter accepts the following options:
  13861. @table @option
  13862. @item filename, f
  13863. Set the filename of the subtitle file to read. It must be specified.
  13864. @item original_size
  13865. Specify the size of the original video, the video for which the ASS file
  13866. was composed. For the syntax of this option, check the
  13867. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13868. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13869. correctly scale the fonts if the aspect ratio has been changed.
  13870. @item fontsdir
  13871. Set a directory path containing fonts that can be used by the filter.
  13872. These fonts will be used in addition to whatever the font provider uses.
  13873. @item alpha
  13874. Process alpha channel, by default alpha channel is untouched.
  13875. @item charenc
  13876. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13877. useful if not UTF-8.
  13878. @item stream_index, si
  13879. Set subtitles stream index. @code{subtitles} filter only.
  13880. @item force_style
  13881. Override default style or script info parameters of the subtitles. It accepts a
  13882. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13883. @end table
  13884. If the first key is not specified, it is assumed that the first value
  13885. specifies the @option{filename}.
  13886. For example, to render the file @file{sub.srt} on top of the input
  13887. video, use the command:
  13888. @example
  13889. subtitles=sub.srt
  13890. @end example
  13891. which is equivalent to:
  13892. @example
  13893. subtitles=filename=sub.srt
  13894. @end example
  13895. To render the default subtitles stream from file @file{video.mkv}, use:
  13896. @example
  13897. subtitles=video.mkv
  13898. @end example
  13899. To render the second subtitles stream from that file, use:
  13900. @example
  13901. subtitles=video.mkv:si=1
  13902. @end example
  13903. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13904. @code{DejaVu Serif}, use:
  13905. @example
  13906. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13907. @end example
  13908. @section super2xsai
  13909. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13910. Interpolate) pixel art scaling algorithm.
  13911. Useful for enlarging pixel art images without reducing sharpness.
  13912. @section swaprect
  13913. Swap two rectangular objects in video.
  13914. This filter accepts the following options:
  13915. @table @option
  13916. @item w
  13917. Set object width.
  13918. @item h
  13919. Set object height.
  13920. @item x1
  13921. Set 1st rect x coordinate.
  13922. @item y1
  13923. Set 1st rect y coordinate.
  13924. @item x2
  13925. Set 2nd rect x coordinate.
  13926. @item y2
  13927. Set 2nd rect y coordinate.
  13928. All expressions are evaluated once for each frame.
  13929. @end table
  13930. The all options are expressions containing the following constants:
  13931. @table @option
  13932. @item w
  13933. @item h
  13934. The input width and height.
  13935. @item a
  13936. same as @var{w} / @var{h}
  13937. @item sar
  13938. input sample aspect ratio
  13939. @item dar
  13940. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13941. @item n
  13942. The number of the input frame, starting from 0.
  13943. @item t
  13944. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13945. @item pos
  13946. the position in the file of the input frame, NAN if unknown
  13947. @end table
  13948. @section swapuv
  13949. Swap U & V plane.
  13950. @section tblend
  13951. Blend successive video frames.
  13952. See @ref{blend}
  13953. @section telecine
  13954. Apply telecine process to the video.
  13955. This filter accepts the following options:
  13956. @table @option
  13957. @item first_field
  13958. @table @samp
  13959. @item top, t
  13960. top field first
  13961. @item bottom, b
  13962. bottom field first
  13963. The default value is @code{top}.
  13964. @end table
  13965. @item pattern
  13966. A string of numbers representing the pulldown pattern you wish to apply.
  13967. The default value is @code{23}.
  13968. @end table
  13969. @example
  13970. Some typical patterns:
  13971. NTSC output (30i):
  13972. 27.5p: 32222
  13973. 24p: 23 (classic)
  13974. 24p: 2332 (preferred)
  13975. 20p: 33
  13976. 18p: 334
  13977. 16p: 3444
  13978. PAL output (25i):
  13979. 27.5p: 12222
  13980. 24p: 222222222223 ("Euro pulldown")
  13981. 16.67p: 33
  13982. 16p: 33333334
  13983. @end example
  13984. @section thistogram
  13985. Compute and draw a color distribution histogram for the input video across time.
  13986. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13987. at certain time, this filter shows also past histograms of number of frames defined
  13988. by @code{width} option.
  13989. The computed histogram is a representation of the color component
  13990. distribution in an image.
  13991. The filter accepts the following options:
  13992. @table @option
  13993. @item width, w
  13994. Set width of single color component output. Default value is @code{0}.
  13995. Value of @code{0} means width will be picked from input video.
  13996. This also set number of passed histograms to keep.
  13997. Allowed range is [0, 8192].
  13998. @item display_mode, d
  13999. Set display mode.
  14000. It accepts the following values:
  14001. @table @samp
  14002. @item stack
  14003. Per color component graphs are placed below each other.
  14004. @item parade
  14005. Per color component graphs are placed side by side.
  14006. @item overlay
  14007. Presents information identical to that in the @code{parade}, except
  14008. that the graphs representing color components are superimposed directly
  14009. over one another.
  14010. @end table
  14011. Default is @code{stack}.
  14012. @item levels_mode, m
  14013. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  14014. Default is @code{linear}.
  14015. @item components, c
  14016. Set what color components to display.
  14017. Default is @code{7}.
  14018. @item bgopacity, b
  14019. Set background opacity. Default is @code{0.9}.
  14020. @item envelope, e
  14021. Show envelope. Default is disabled.
  14022. @item ecolor, ec
  14023. Set envelope color. Default is @code{gold}.
  14024. @item slide
  14025. Set slide mode.
  14026. Available values for slide is:
  14027. @table @samp
  14028. @item frame
  14029. Draw new frame when right border is reached.
  14030. @item replace
  14031. Replace old columns with new ones.
  14032. @item scroll
  14033. Scroll from right to left.
  14034. @item rscroll
  14035. Scroll from left to right.
  14036. @item picture
  14037. Draw single picture.
  14038. @end table
  14039. Default is @code{replace}.
  14040. @end table
  14041. @section threshold
  14042. Apply threshold effect to video stream.
  14043. This filter needs four video streams to perform thresholding.
  14044. First stream is stream we are filtering.
  14045. Second stream is holding threshold values, third stream is holding min values,
  14046. and last, fourth stream is holding max values.
  14047. The filter accepts the following option:
  14048. @table @option
  14049. @item planes
  14050. Set which planes will be processed, unprocessed planes will be copied.
  14051. By default value 0xf, all planes will be processed.
  14052. @end table
  14053. For example if first stream pixel's component value is less then threshold value
  14054. of pixel component from 2nd threshold stream, third stream value will picked,
  14055. otherwise fourth stream pixel component value will be picked.
  14056. Using color source filter one can perform various types of thresholding:
  14057. @subsection Examples
  14058. @itemize
  14059. @item
  14060. Binary threshold, using gray color as threshold:
  14061. @example
  14062. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  14063. @end example
  14064. @item
  14065. Inverted binary threshold, using gray color as threshold:
  14066. @example
  14067. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  14068. @end example
  14069. @item
  14070. Truncate binary threshold, using gray color as threshold:
  14071. @example
  14072. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14073. @end example
  14074. @item
  14075. Threshold to zero, using gray color as threshold:
  14076. @example
  14077. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14078. @end example
  14079. @item
  14080. Inverted threshold to zero, using gray color as threshold:
  14081. @example
  14082. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14083. @end example
  14084. @end itemize
  14085. @section thumbnail
  14086. Select the most representative frame in a given sequence of consecutive frames.
  14087. The filter accepts the following options:
  14088. @table @option
  14089. @item n
  14090. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14091. will pick one of them, and then handle the next batch of @var{n} frames until
  14092. the end. Default is @code{100}.
  14093. @end table
  14094. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14095. value will result in a higher memory usage, so a high value is not recommended.
  14096. @subsection Examples
  14097. @itemize
  14098. @item
  14099. Extract one picture each 50 frames:
  14100. @example
  14101. thumbnail=50
  14102. @end example
  14103. @item
  14104. Complete example of a thumbnail creation with @command{ffmpeg}:
  14105. @example
  14106. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14107. @end example
  14108. @end itemize
  14109. @anchor{tile}
  14110. @section tile
  14111. Tile several successive frames together.
  14112. The @ref{untile} filter can do the reverse.
  14113. The filter accepts the following options:
  14114. @table @option
  14115. @item layout
  14116. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14117. this option, check the
  14118. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14119. @item nb_frames
  14120. Set the maximum number of frames to render in the given area. It must be less
  14121. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14122. the area will be used.
  14123. @item margin
  14124. Set the outer border margin in pixels.
  14125. @item padding
  14126. Set the inner border thickness (i.e. the number of pixels between frames). For
  14127. more advanced padding options (such as having different values for the edges),
  14128. refer to the pad video filter.
  14129. @item color
  14130. Specify the color of the unused area. For the syntax of this option, check the
  14131. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14132. The default value of @var{color} is "black".
  14133. @item overlap
  14134. Set the number of frames to overlap when tiling several successive frames together.
  14135. The value must be between @code{0} and @var{nb_frames - 1}.
  14136. @item init_padding
  14137. Set the number of frames to initially be empty before displaying first output frame.
  14138. This controls how soon will one get first output frame.
  14139. The value must be between @code{0} and @var{nb_frames - 1}.
  14140. @end table
  14141. @subsection Examples
  14142. @itemize
  14143. @item
  14144. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14145. @example
  14146. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14147. @end example
  14148. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14149. duplicating each output frame to accommodate the originally detected frame
  14150. rate.
  14151. @item
  14152. Display @code{5} pictures in an area of @code{3x2} frames,
  14153. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14154. mixed flat and named options:
  14155. @example
  14156. tile=3x2:nb_frames=5:padding=7:margin=2
  14157. @end example
  14158. @end itemize
  14159. @section tinterlace
  14160. Perform various types of temporal field interlacing.
  14161. Frames are counted starting from 1, so the first input frame is
  14162. considered odd.
  14163. The filter accepts the following options:
  14164. @table @option
  14165. @item mode
  14166. Specify the mode of the interlacing. This option can also be specified
  14167. as a value alone. See below for a list of values for this option.
  14168. Available values are:
  14169. @table @samp
  14170. @item merge, 0
  14171. Move odd frames into the upper field, even into the lower field,
  14172. generating a double height frame at half frame rate.
  14173. @example
  14174. ------> time
  14175. Input:
  14176. Frame 1 Frame 2 Frame 3 Frame 4
  14177. 11111 22222 33333 44444
  14178. 11111 22222 33333 44444
  14179. 11111 22222 33333 44444
  14180. 11111 22222 33333 44444
  14181. Output:
  14182. 11111 33333
  14183. 22222 44444
  14184. 11111 33333
  14185. 22222 44444
  14186. 11111 33333
  14187. 22222 44444
  14188. 11111 33333
  14189. 22222 44444
  14190. @end example
  14191. @item drop_even, 1
  14192. Only output odd frames, even frames are dropped, generating a frame with
  14193. unchanged height at half frame rate.
  14194. @example
  14195. ------> time
  14196. Input:
  14197. Frame 1 Frame 2 Frame 3 Frame 4
  14198. 11111 22222 33333 44444
  14199. 11111 22222 33333 44444
  14200. 11111 22222 33333 44444
  14201. 11111 22222 33333 44444
  14202. Output:
  14203. 11111 33333
  14204. 11111 33333
  14205. 11111 33333
  14206. 11111 33333
  14207. @end example
  14208. @item drop_odd, 2
  14209. Only output even frames, odd frames are dropped, generating a frame with
  14210. unchanged height at half frame rate.
  14211. @example
  14212. ------> time
  14213. Input:
  14214. Frame 1 Frame 2 Frame 3 Frame 4
  14215. 11111 22222 33333 44444
  14216. 11111 22222 33333 44444
  14217. 11111 22222 33333 44444
  14218. 11111 22222 33333 44444
  14219. Output:
  14220. 22222 44444
  14221. 22222 44444
  14222. 22222 44444
  14223. 22222 44444
  14224. @end example
  14225. @item pad, 3
  14226. Expand each frame to full height, but pad alternate lines with black,
  14227. generating a frame with double height at the same input frame rate.
  14228. @example
  14229. ------> time
  14230. Input:
  14231. Frame 1 Frame 2 Frame 3 Frame 4
  14232. 11111 22222 33333 44444
  14233. 11111 22222 33333 44444
  14234. 11111 22222 33333 44444
  14235. 11111 22222 33333 44444
  14236. Output:
  14237. 11111 ..... 33333 .....
  14238. ..... 22222 ..... 44444
  14239. 11111 ..... 33333 .....
  14240. ..... 22222 ..... 44444
  14241. 11111 ..... 33333 .....
  14242. ..... 22222 ..... 44444
  14243. 11111 ..... 33333 .....
  14244. ..... 22222 ..... 44444
  14245. @end example
  14246. @item interleave_top, 4
  14247. Interleave the upper field from odd frames with the lower field from
  14248. even frames, generating a frame with unchanged height at half frame rate.
  14249. @example
  14250. ------> time
  14251. Input:
  14252. Frame 1 Frame 2 Frame 3 Frame 4
  14253. 11111<- 22222 33333<- 44444
  14254. 11111 22222<- 33333 44444<-
  14255. 11111<- 22222 33333<- 44444
  14256. 11111 22222<- 33333 44444<-
  14257. Output:
  14258. 11111 33333
  14259. 22222 44444
  14260. 11111 33333
  14261. 22222 44444
  14262. @end example
  14263. @item interleave_bottom, 5
  14264. Interleave the lower field from odd frames with the upper field from
  14265. even frames, generating a frame with unchanged height at half frame rate.
  14266. @example
  14267. ------> time
  14268. Input:
  14269. Frame 1 Frame 2 Frame 3 Frame 4
  14270. 11111 22222<- 33333 44444<-
  14271. 11111<- 22222 33333<- 44444
  14272. 11111 22222<- 33333 44444<-
  14273. 11111<- 22222 33333<- 44444
  14274. Output:
  14275. 22222 44444
  14276. 11111 33333
  14277. 22222 44444
  14278. 11111 33333
  14279. @end example
  14280. @item interlacex2, 6
  14281. Double frame rate with unchanged height. Frames are inserted each
  14282. containing the second temporal field from the previous input frame and
  14283. the first temporal field from the next input frame. This mode relies on
  14284. the top_field_first flag. Useful for interlaced video displays with no
  14285. field synchronisation.
  14286. @example
  14287. ------> time
  14288. Input:
  14289. Frame 1 Frame 2 Frame 3 Frame 4
  14290. 11111 22222 33333 44444
  14291. 11111 22222 33333 44444
  14292. 11111 22222 33333 44444
  14293. 11111 22222 33333 44444
  14294. Output:
  14295. 11111 22222 22222 33333 33333 44444 44444
  14296. 11111 11111 22222 22222 33333 33333 44444
  14297. 11111 22222 22222 33333 33333 44444 44444
  14298. 11111 11111 22222 22222 33333 33333 44444
  14299. @end example
  14300. @item mergex2, 7
  14301. Move odd frames into the upper field, even into the lower field,
  14302. generating a double height frame at same frame rate.
  14303. @example
  14304. ------> time
  14305. Input:
  14306. Frame 1 Frame 2 Frame 3 Frame 4
  14307. 11111 22222 33333 44444
  14308. 11111 22222 33333 44444
  14309. 11111 22222 33333 44444
  14310. 11111 22222 33333 44444
  14311. Output:
  14312. 11111 33333 33333 55555
  14313. 22222 22222 44444 44444
  14314. 11111 33333 33333 55555
  14315. 22222 22222 44444 44444
  14316. 11111 33333 33333 55555
  14317. 22222 22222 44444 44444
  14318. 11111 33333 33333 55555
  14319. 22222 22222 44444 44444
  14320. @end example
  14321. @end table
  14322. Numeric values are deprecated but are accepted for backward
  14323. compatibility reasons.
  14324. Default mode is @code{merge}.
  14325. @item flags
  14326. Specify flags influencing the filter process.
  14327. Available value for @var{flags} is:
  14328. @table @option
  14329. @item low_pass_filter, vlpf
  14330. Enable linear vertical low-pass filtering in the filter.
  14331. Vertical low-pass filtering is required when creating an interlaced
  14332. destination from a progressive source which contains high-frequency
  14333. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14334. patterning.
  14335. @item complex_filter, cvlpf
  14336. Enable complex vertical low-pass filtering.
  14337. This will slightly less reduce interlace 'twitter' and Moire
  14338. patterning but better retain detail and subjective sharpness impression.
  14339. @item bypass_il
  14340. Bypass already interlaced frames, only adjust the frame rate.
  14341. @end table
  14342. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14343. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14344. @end table
  14345. @section tmedian
  14346. Pick median pixels from several successive input video frames.
  14347. The filter accepts the following options:
  14348. @table @option
  14349. @item radius
  14350. Set radius of median filter.
  14351. Default is 1. Allowed range is from 1 to 127.
  14352. @item planes
  14353. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14354. @item percentile
  14355. Set median percentile. Default value is @code{0.5}.
  14356. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14357. minimum values, and @code{1} maximum values.
  14358. @end table
  14359. @section tmix
  14360. Mix successive video frames.
  14361. A description of the accepted options follows.
  14362. @table @option
  14363. @item frames
  14364. The number of successive frames to mix. If unspecified, it defaults to 3.
  14365. @item weights
  14366. Specify weight of each input video frame.
  14367. Each weight is separated by space. If number of weights is smaller than
  14368. number of @var{frames} last specified weight will be used for all remaining
  14369. unset weights.
  14370. @item scale
  14371. Specify scale, if it is set it will be multiplied with sum
  14372. of each weight multiplied with pixel values to give final destination
  14373. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14374. @end table
  14375. @subsection Examples
  14376. @itemize
  14377. @item
  14378. Average 7 successive frames:
  14379. @example
  14380. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14381. @end example
  14382. @item
  14383. Apply simple temporal convolution:
  14384. @example
  14385. tmix=frames=3:weights="-1 3 -1"
  14386. @end example
  14387. @item
  14388. Similar as above but only showing temporal differences:
  14389. @example
  14390. tmix=frames=3:weights="-1 2 -1":scale=1
  14391. @end example
  14392. @end itemize
  14393. @anchor{tonemap}
  14394. @section tonemap
  14395. Tone map colors from different dynamic ranges.
  14396. This filter expects data in single precision floating point, as it needs to
  14397. operate on (and can output) out-of-range values. Another filter, such as
  14398. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14399. The tonemapping algorithms implemented only work on linear light, so input
  14400. data should be linearized beforehand (and possibly correctly tagged).
  14401. @example
  14402. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14403. @end example
  14404. @subsection Options
  14405. The filter accepts the following options.
  14406. @table @option
  14407. @item tonemap
  14408. Set the tone map algorithm to use.
  14409. Possible values are:
  14410. @table @var
  14411. @item none
  14412. Do not apply any tone map, only desaturate overbright pixels.
  14413. @item clip
  14414. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14415. in-range values, while distorting out-of-range values.
  14416. @item linear
  14417. Stretch the entire reference gamut to a linear multiple of the display.
  14418. @item gamma
  14419. Fit a logarithmic transfer between the tone curves.
  14420. @item reinhard
  14421. Preserve overall image brightness with a simple curve, using nonlinear
  14422. contrast, which results in flattening details and degrading color accuracy.
  14423. @item hable
  14424. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14425. of slightly darkening everything. Use it when detail preservation is more
  14426. important than color and brightness accuracy.
  14427. @item mobius
  14428. Smoothly map out-of-range values, while retaining contrast and colors for
  14429. in-range material as much as possible. Use it when color accuracy is more
  14430. important than detail preservation.
  14431. @end table
  14432. Default is none.
  14433. @item param
  14434. Tune the tone mapping algorithm.
  14435. This affects the following algorithms:
  14436. @table @var
  14437. @item none
  14438. Ignored.
  14439. @item linear
  14440. Specifies the scale factor to use while stretching.
  14441. Default to 1.0.
  14442. @item gamma
  14443. Specifies the exponent of the function.
  14444. Default to 1.8.
  14445. @item clip
  14446. Specify an extra linear coefficient to multiply into the signal before clipping.
  14447. Default to 1.0.
  14448. @item reinhard
  14449. Specify the local contrast coefficient at the display peak.
  14450. Default to 0.5, which means that in-gamut values will be about half as bright
  14451. as when clipping.
  14452. @item hable
  14453. Ignored.
  14454. @item mobius
  14455. Specify the transition point from linear to mobius transform. Every value
  14456. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14457. more accurate the result will be, at the cost of losing bright details.
  14458. Default to 0.3, which due to the steep initial slope still preserves in-range
  14459. colors fairly accurately.
  14460. @end table
  14461. @item desat
  14462. Apply desaturation for highlights that exceed this level of brightness. The
  14463. higher the parameter, the more color information will be preserved. This
  14464. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14465. (smoothly) turning into white instead. This makes images feel more natural,
  14466. at the cost of reducing information about out-of-range colors.
  14467. The default of 2.0 is somewhat conservative and will mostly just apply to
  14468. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14469. This option works only if the input frame has a supported color tag.
  14470. @item peak
  14471. Override signal/nominal/reference peak with this value. Useful when the
  14472. embedded peak information in display metadata is not reliable or when tone
  14473. mapping from a lower range to a higher range.
  14474. @end table
  14475. @section tpad
  14476. Temporarily pad video frames.
  14477. The filter accepts the following options:
  14478. @table @option
  14479. @item start
  14480. Specify number of delay frames before input video stream. Default is 0.
  14481. @item stop
  14482. Specify number of padding frames after input video stream.
  14483. Set to -1 to pad indefinitely. Default is 0.
  14484. @item start_mode
  14485. Set kind of frames added to beginning of stream.
  14486. Can be either @var{add} or @var{clone}.
  14487. With @var{add} frames of solid-color are added.
  14488. With @var{clone} frames are clones of first frame.
  14489. Default is @var{add}.
  14490. @item stop_mode
  14491. Set kind of frames added to end of stream.
  14492. Can be either @var{add} or @var{clone}.
  14493. With @var{add} frames of solid-color are added.
  14494. With @var{clone} frames are clones of last frame.
  14495. Default is @var{add}.
  14496. @item start_duration, stop_duration
  14497. Specify the duration of the start/stop delay. See
  14498. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14499. for the accepted syntax.
  14500. These options override @var{start} and @var{stop}. Default is 0.
  14501. @item color
  14502. Specify the color of the padded area. For the syntax of this option,
  14503. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14504. manual,ffmpeg-utils}.
  14505. The default value of @var{color} is "black".
  14506. @end table
  14507. @anchor{transpose}
  14508. @section transpose
  14509. Transpose rows with columns in the input video and optionally flip it.
  14510. It accepts the following parameters:
  14511. @table @option
  14512. @item dir
  14513. Specify the transposition direction.
  14514. Can assume the following values:
  14515. @table @samp
  14516. @item 0, 4, cclock_flip
  14517. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14518. @example
  14519. L.R L.l
  14520. . . -> . .
  14521. l.r R.r
  14522. @end example
  14523. @item 1, 5, clock
  14524. Rotate by 90 degrees clockwise, that is:
  14525. @example
  14526. L.R l.L
  14527. . . -> . .
  14528. l.r r.R
  14529. @end example
  14530. @item 2, 6, cclock
  14531. Rotate by 90 degrees counterclockwise, that is:
  14532. @example
  14533. L.R R.r
  14534. . . -> . .
  14535. l.r L.l
  14536. @end example
  14537. @item 3, 7, clock_flip
  14538. Rotate by 90 degrees clockwise and vertically flip, that is:
  14539. @example
  14540. L.R r.R
  14541. . . -> . .
  14542. l.r l.L
  14543. @end example
  14544. @end table
  14545. For values between 4-7, the transposition is only done if the input
  14546. video geometry is portrait and not landscape. These values are
  14547. deprecated, the @code{passthrough} option should be used instead.
  14548. Numerical values are deprecated, and should be dropped in favor of
  14549. symbolic constants.
  14550. @item passthrough
  14551. Do not apply the transposition if the input geometry matches the one
  14552. specified by the specified value. It accepts the following values:
  14553. @table @samp
  14554. @item none
  14555. Always apply transposition.
  14556. @item portrait
  14557. Preserve portrait geometry (when @var{height} >= @var{width}).
  14558. @item landscape
  14559. Preserve landscape geometry (when @var{width} >= @var{height}).
  14560. @end table
  14561. Default value is @code{none}.
  14562. @end table
  14563. For example to rotate by 90 degrees clockwise and preserve portrait
  14564. layout:
  14565. @example
  14566. transpose=dir=1:passthrough=portrait
  14567. @end example
  14568. The command above can also be specified as:
  14569. @example
  14570. transpose=1:portrait
  14571. @end example
  14572. @section transpose_npp
  14573. Transpose rows with columns in the input video and optionally flip it.
  14574. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14575. It accepts the following parameters:
  14576. @table @option
  14577. @item dir
  14578. Specify the transposition direction.
  14579. Can assume the following values:
  14580. @table @samp
  14581. @item cclock_flip
  14582. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14583. @item clock
  14584. Rotate by 90 degrees clockwise.
  14585. @item cclock
  14586. Rotate by 90 degrees counterclockwise.
  14587. @item clock_flip
  14588. Rotate by 90 degrees clockwise and vertically flip.
  14589. @end table
  14590. @item passthrough
  14591. Do not apply the transposition if the input geometry matches the one
  14592. specified by the specified value. It accepts the following values:
  14593. @table @samp
  14594. @item none
  14595. Always apply transposition. (default)
  14596. @item portrait
  14597. Preserve portrait geometry (when @var{height} >= @var{width}).
  14598. @item landscape
  14599. Preserve landscape geometry (when @var{width} >= @var{height}).
  14600. @end table
  14601. @end table
  14602. @section trim
  14603. Trim the input so that the output contains one continuous subpart of the input.
  14604. It accepts the following parameters:
  14605. @table @option
  14606. @item start
  14607. Specify the time of the start of the kept section, i.e. the frame with the
  14608. timestamp @var{start} will be the first frame in the output.
  14609. @item end
  14610. Specify the time of the first frame that will be dropped, i.e. the frame
  14611. immediately preceding the one with the timestamp @var{end} will be the last
  14612. frame in the output.
  14613. @item start_pts
  14614. This is the same as @var{start}, except this option sets the start timestamp
  14615. in timebase units instead of seconds.
  14616. @item end_pts
  14617. This is the same as @var{end}, except this option sets the end timestamp
  14618. in timebase units instead of seconds.
  14619. @item duration
  14620. The maximum duration of the output in seconds.
  14621. @item start_frame
  14622. The number of the first frame that should be passed to the output.
  14623. @item end_frame
  14624. The number of the first frame that should be dropped.
  14625. @end table
  14626. @option{start}, @option{end}, and @option{duration} are expressed as time
  14627. duration specifications; see
  14628. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14629. for the accepted syntax.
  14630. Note that the first two sets of the start/end options and the @option{duration}
  14631. option look at the frame timestamp, while the _frame variants simply count the
  14632. frames that pass through the filter. Also note that this filter does not modify
  14633. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14634. setpts filter after the trim filter.
  14635. If multiple start or end options are set, this filter tries to be greedy and
  14636. keep all the frames that match at least one of the specified constraints. To keep
  14637. only the part that matches all the constraints at once, chain multiple trim
  14638. filters.
  14639. The defaults are such that all the input is kept. So it is possible to set e.g.
  14640. just the end values to keep everything before the specified time.
  14641. Examples:
  14642. @itemize
  14643. @item
  14644. Drop everything except the second minute of input:
  14645. @example
  14646. ffmpeg -i INPUT -vf trim=60:120
  14647. @end example
  14648. @item
  14649. Keep only the first second:
  14650. @example
  14651. ffmpeg -i INPUT -vf trim=duration=1
  14652. @end example
  14653. @end itemize
  14654. @section unpremultiply
  14655. Apply alpha unpremultiply effect to input video stream using first plane
  14656. of second stream as alpha.
  14657. Both streams must have same dimensions and same pixel format.
  14658. The filter accepts the following option:
  14659. @table @option
  14660. @item planes
  14661. Set which planes will be processed, unprocessed planes will be copied.
  14662. By default value 0xf, all planes will be processed.
  14663. If the format has 1 or 2 components, then luma is bit 0.
  14664. If the format has 3 or 4 components:
  14665. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14666. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14667. If present, the alpha channel is always the last bit.
  14668. @item inplace
  14669. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14670. @end table
  14671. @anchor{unsharp}
  14672. @section unsharp
  14673. Sharpen or blur the input video.
  14674. It accepts the following parameters:
  14675. @table @option
  14676. @item luma_msize_x, lx
  14677. Set the luma matrix horizontal size. It must be an odd integer between
  14678. 3 and 23. The default value is 5.
  14679. @item luma_msize_y, ly
  14680. Set the luma matrix vertical size. It must be an odd integer between 3
  14681. and 23. The default value is 5.
  14682. @item luma_amount, la
  14683. Set the luma effect strength. It must be a floating point number, reasonable
  14684. values lay between -1.5 and 1.5.
  14685. Negative values will blur the input video, while positive values will
  14686. sharpen it, a value of zero will disable the effect.
  14687. Default value is 1.0.
  14688. @item chroma_msize_x, cx
  14689. Set the chroma matrix horizontal size. It must be an odd integer
  14690. between 3 and 23. The default value is 5.
  14691. @item chroma_msize_y, cy
  14692. Set the chroma matrix vertical size. It must be an odd integer
  14693. between 3 and 23. The default value is 5.
  14694. @item chroma_amount, ca
  14695. Set the chroma effect strength. It must be a floating point number, reasonable
  14696. values lay between -1.5 and 1.5.
  14697. Negative values will blur the input video, while positive values will
  14698. sharpen it, a value of zero will disable the effect.
  14699. Default value is 0.0.
  14700. @end table
  14701. All parameters are optional and default to the equivalent of the
  14702. string '5:5:1.0:5:5:0.0'.
  14703. @subsection Examples
  14704. @itemize
  14705. @item
  14706. Apply strong luma sharpen effect:
  14707. @example
  14708. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14709. @end example
  14710. @item
  14711. Apply a strong blur of both luma and chroma parameters:
  14712. @example
  14713. unsharp=7:7:-2:7:7:-2
  14714. @end example
  14715. @end itemize
  14716. @anchor{untile}
  14717. @section untile
  14718. Decompose a video made of tiled images into the individual images.
  14719. The frame rate of the output video is the frame rate of the input video
  14720. multiplied by the number of tiles.
  14721. This filter does the reverse of @ref{tile}.
  14722. The filter accepts the following options:
  14723. @table @option
  14724. @item layout
  14725. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14726. this option, check the
  14727. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14728. @end table
  14729. @subsection Examples
  14730. @itemize
  14731. @item
  14732. Produce a 1-second video from a still image file made of 25 frames stacked
  14733. vertically, like an analogic film reel:
  14734. @example
  14735. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  14736. @end example
  14737. @end itemize
  14738. @section uspp
  14739. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14740. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14741. shifts and average the results.
  14742. The way this differs from the behavior of spp is that uspp actually encodes &
  14743. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14744. DCT similar to MJPEG.
  14745. The filter accepts the following options:
  14746. @table @option
  14747. @item quality
  14748. Set quality. This option defines the number of levels for averaging. It accepts
  14749. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14750. effect. A value of @code{8} means the higher quality. For each increment of
  14751. that value the speed drops by a factor of approximately 2. Default value is
  14752. @code{3}.
  14753. @item qp
  14754. Force a constant quantization parameter. If not set, the filter will use the QP
  14755. from the video stream (if available).
  14756. @end table
  14757. @section v360
  14758. Convert 360 videos between various formats.
  14759. The filter accepts the following options:
  14760. @table @option
  14761. @item input
  14762. @item output
  14763. Set format of the input/output video.
  14764. Available formats:
  14765. @table @samp
  14766. @item e
  14767. @item equirect
  14768. Equirectangular projection.
  14769. @item c3x2
  14770. @item c6x1
  14771. @item c1x6
  14772. Cubemap with 3x2/6x1/1x6 layout.
  14773. Format specific options:
  14774. @table @option
  14775. @item in_pad
  14776. @item out_pad
  14777. Set padding proportion for the input/output cubemap. Values in decimals.
  14778. Example values:
  14779. @table @samp
  14780. @item 0
  14781. No padding.
  14782. @item 0.01
  14783. 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)
  14784. @end table
  14785. Default value is @b{@samp{0}}.
  14786. Maximum value is @b{@samp{0.1}}.
  14787. @item fin_pad
  14788. @item fout_pad
  14789. Set fixed padding for the input/output cubemap. Values in pixels.
  14790. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14791. @item in_forder
  14792. @item out_forder
  14793. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14794. Designation of directions:
  14795. @table @samp
  14796. @item r
  14797. right
  14798. @item l
  14799. left
  14800. @item u
  14801. up
  14802. @item d
  14803. down
  14804. @item f
  14805. forward
  14806. @item b
  14807. back
  14808. @end table
  14809. Default value is @b{@samp{rludfb}}.
  14810. @item in_frot
  14811. @item out_frot
  14812. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14813. Designation of angles:
  14814. @table @samp
  14815. @item 0
  14816. 0 degrees clockwise
  14817. @item 1
  14818. 90 degrees clockwise
  14819. @item 2
  14820. 180 degrees clockwise
  14821. @item 3
  14822. 270 degrees clockwise
  14823. @end table
  14824. Default value is @b{@samp{000000}}.
  14825. @end table
  14826. @item eac
  14827. Equi-Angular Cubemap.
  14828. @item flat
  14829. @item gnomonic
  14830. @item rectilinear
  14831. Regular video.
  14832. Format specific options:
  14833. @table @option
  14834. @item h_fov
  14835. @item v_fov
  14836. @item d_fov
  14837. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14838. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14839. @item ih_fov
  14840. @item iv_fov
  14841. @item id_fov
  14842. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14843. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14844. @end table
  14845. @item dfisheye
  14846. Dual fisheye.
  14847. Format specific options:
  14848. @table @option
  14849. @item h_fov
  14850. @item v_fov
  14851. @item d_fov
  14852. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14853. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14854. @item ih_fov
  14855. @item iv_fov
  14856. @item id_fov
  14857. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14858. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14859. @end table
  14860. @item barrel
  14861. @item fb
  14862. @item barrelsplit
  14863. Facebook's 360 formats.
  14864. @item sg
  14865. Stereographic format.
  14866. Format specific options:
  14867. @table @option
  14868. @item h_fov
  14869. @item v_fov
  14870. @item d_fov
  14871. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14872. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14873. @item ih_fov
  14874. @item iv_fov
  14875. @item id_fov
  14876. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14877. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14878. @end table
  14879. @item mercator
  14880. Mercator format.
  14881. @item ball
  14882. Ball format, gives significant distortion toward the back.
  14883. @item hammer
  14884. Hammer-Aitoff map projection format.
  14885. @item sinusoidal
  14886. Sinusoidal map projection format.
  14887. @item fisheye
  14888. Fisheye projection.
  14889. Format specific options:
  14890. @table @option
  14891. @item h_fov
  14892. @item v_fov
  14893. @item d_fov
  14894. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14895. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14896. @item ih_fov
  14897. @item iv_fov
  14898. @item id_fov
  14899. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14900. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14901. @end table
  14902. @item pannini
  14903. Pannini projection.
  14904. Format specific options:
  14905. @table @option
  14906. @item h_fov
  14907. Set output pannini parameter.
  14908. @item ih_fov
  14909. Set input pannini parameter.
  14910. @end table
  14911. @item cylindrical
  14912. Cylindrical projection.
  14913. Format specific options:
  14914. @table @option
  14915. @item h_fov
  14916. @item v_fov
  14917. @item d_fov
  14918. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14919. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14920. @item ih_fov
  14921. @item iv_fov
  14922. @item id_fov
  14923. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14924. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14925. @end table
  14926. @item perspective
  14927. Perspective projection. @i{(output only)}
  14928. Format specific options:
  14929. @table @option
  14930. @item v_fov
  14931. Set perspective parameter.
  14932. @end table
  14933. @item tetrahedron
  14934. Tetrahedron projection.
  14935. @item tsp
  14936. Truncated square pyramid projection.
  14937. @item he
  14938. @item hequirect
  14939. Half equirectangular projection.
  14940. @item equisolid
  14941. Equisolid format.
  14942. Format specific options:
  14943. @table @option
  14944. @item h_fov
  14945. @item v_fov
  14946. @item d_fov
  14947. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14948. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14949. @item ih_fov
  14950. @item iv_fov
  14951. @item id_fov
  14952. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14953. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14954. @end table
  14955. @item og
  14956. Orthographic format.
  14957. Format specific options:
  14958. @table @option
  14959. @item h_fov
  14960. @item v_fov
  14961. @item d_fov
  14962. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14963. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14964. @item ih_fov
  14965. @item iv_fov
  14966. @item id_fov
  14967. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14968. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14969. @end table
  14970. @item octahedron
  14971. Octahedron projection.
  14972. @end table
  14973. @item interp
  14974. Set interpolation method.@*
  14975. @i{Note: more complex interpolation methods require much more memory to run.}
  14976. Available methods:
  14977. @table @samp
  14978. @item near
  14979. @item nearest
  14980. Nearest neighbour.
  14981. @item line
  14982. @item linear
  14983. Bilinear interpolation.
  14984. @item lagrange9
  14985. Lagrange9 interpolation.
  14986. @item cube
  14987. @item cubic
  14988. Bicubic interpolation.
  14989. @item lanc
  14990. @item lanczos
  14991. Lanczos interpolation.
  14992. @item sp16
  14993. @item spline16
  14994. Spline16 interpolation.
  14995. @item gauss
  14996. @item gaussian
  14997. Gaussian interpolation.
  14998. @item mitchell
  14999. Mitchell interpolation.
  15000. @end table
  15001. Default value is @b{@samp{line}}.
  15002. @item w
  15003. @item h
  15004. Set the output video resolution.
  15005. Default resolution depends on formats.
  15006. @item in_stereo
  15007. @item out_stereo
  15008. Set the input/output stereo format.
  15009. @table @samp
  15010. @item 2d
  15011. 2D mono
  15012. @item sbs
  15013. Side by side
  15014. @item tb
  15015. Top bottom
  15016. @end table
  15017. Default value is @b{@samp{2d}} for input and output format.
  15018. @item yaw
  15019. @item pitch
  15020. @item roll
  15021. Set rotation for the output video. Values in degrees.
  15022. @item rorder
  15023. Set rotation order for the output video. Choose one item for each position.
  15024. @table @samp
  15025. @item y, Y
  15026. yaw
  15027. @item p, P
  15028. pitch
  15029. @item r, R
  15030. roll
  15031. @end table
  15032. Default value is @b{@samp{ypr}}.
  15033. @item h_flip
  15034. @item v_flip
  15035. @item d_flip
  15036. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  15037. @item ih_flip
  15038. @item iv_flip
  15039. Set if input video is flipped horizontally/vertically. Boolean values.
  15040. @item in_trans
  15041. Set if input video is transposed. Boolean value, by default disabled.
  15042. @item out_trans
  15043. Set if output video needs to be transposed. Boolean value, by default disabled.
  15044. @item alpha_mask
  15045. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  15046. @end table
  15047. @subsection Examples
  15048. @itemize
  15049. @item
  15050. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  15051. @example
  15052. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  15053. @end example
  15054. @item
  15055. Extract back view of Equi-Angular Cubemap:
  15056. @example
  15057. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  15058. @end example
  15059. @item
  15060. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  15061. @example
  15062. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  15063. @end example
  15064. @end itemize
  15065. @subsection Commands
  15066. This filter supports subset of above options as @ref{commands}.
  15067. @section vaguedenoiser
  15068. Apply a wavelet based denoiser.
  15069. It transforms each frame from the video input into the wavelet domain,
  15070. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15071. the obtained coefficients. It does an inverse wavelet transform after.
  15072. Due to wavelet properties, it should give a nice smoothed result, and
  15073. reduced noise, without blurring picture features.
  15074. This filter accepts the following options:
  15075. @table @option
  15076. @item threshold
  15077. The filtering strength. The higher, the more filtered the video will be.
  15078. Hard thresholding can use a higher threshold than soft thresholding
  15079. before the video looks overfiltered. Default value is 2.
  15080. @item method
  15081. The filtering method the filter will use.
  15082. It accepts the following values:
  15083. @table @samp
  15084. @item hard
  15085. All values under the threshold will be zeroed.
  15086. @item soft
  15087. All values under the threshold will be zeroed. All values above will be
  15088. reduced by the threshold.
  15089. @item garrote
  15090. Scales or nullifies coefficients - intermediary between (more) soft and
  15091. (less) hard thresholding.
  15092. @end table
  15093. Default is garrote.
  15094. @item nsteps
  15095. Number of times, the wavelet will decompose the picture. Picture can't
  15096. be decomposed beyond a particular point (typically, 8 for a 640x480
  15097. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15098. @item percent
  15099. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15100. @item planes
  15101. A list of the planes to process. By default all planes are processed.
  15102. @item type
  15103. The threshold type the filter will use.
  15104. It accepts the following values:
  15105. @table @samp
  15106. @item universal
  15107. Threshold used is same for all decompositions.
  15108. @item bayes
  15109. Threshold used depends also on each decomposition coefficients.
  15110. @end table
  15111. Default is universal.
  15112. @end table
  15113. @section vectorscope
  15114. Display 2 color component values in the two dimensional graph (which is called
  15115. a vectorscope).
  15116. This filter accepts the following options:
  15117. @table @option
  15118. @item mode, m
  15119. Set vectorscope mode.
  15120. It accepts the following values:
  15121. @table @samp
  15122. @item gray
  15123. @item tint
  15124. Gray values are displayed on graph, higher brightness means more pixels have
  15125. same component color value on location in graph. This is the default mode.
  15126. @item color
  15127. Gray values are displayed on graph. Surrounding pixels values which are not
  15128. present in video frame are drawn in gradient of 2 color components which are
  15129. set by option @code{x} and @code{y}. The 3rd color component is static.
  15130. @item color2
  15131. Actual color components values present in video frame are displayed on graph.
  15132. @item color3
  15133. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15134. on graph increases value of another color component, which is luminance by
  15135. default values of @code{x} and @code{y}.
  15136. @item color4
  15137. Actual colors present in video frame are displayed on graph. If two different
  15138. colors map to same position on graph then color with higher value of component
  15139. not present in graph is picked.
  15140. @item color5
  15141. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15142. component picked from radial gradient.
  15143. @end table
  15144. @item x
  15145. Set which color component will be represented on X-axis. Default is @code{1}.
  15146. @item y
  15147. Set which color component will be represented on Y-axis. Default is @code{2}.
  15148. @item intensity, i
  15149. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15150. of color component which represents frequency of (X, Y) location in graph.
  15151. @item envelope, e
  15152. @table @samp
  15153. @item none
  15154. No envelope, this is default.
  15155. @item instant
  15156. Instant envelope, even darkest single pixel will be clearly highlighted.
  15157. @item peak
  15158. Hold maximum and minimum values presented in graph over time. This way you
  15159. can still spot out of range values without constantly looking at vectorscope.
  15160. @item peak+instant
  15161. Peak and instant envelope combined together.
  15162. @end table
  15163. @item graticule, g
  15164. Set what kind of graticule to draw.
  15165. @table @samp
  15166. @item none
  15167. @item green
  15168. @item color
  15169. @item invert
  15170. @end table
  15171. @item opacity, o
  15172. Set graticule opacity.
  15173. @item flags, f
  15174. Set graticule flags.
  15175. @table @samp
  15176. @item white
  15177. Draw graticule for white point.
  15178. @item black
  15179. Draw graticule for black point.
  15180. @item name
  15181. Draw color points short names.
  15182. @end table
  15183. @item bgopacity, b
  15184. Set background opacity.
  15185. @item lthreshold, l
  15186. Set low threshold for color component not represented on X or Y axis.
  15187. Values lower than this value will be ignored. Default is 0.
  15188. Note this value is multiplied with actual max possible value one pixel component
  15189. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15190. is 0.1 * 255 = 25.
  15191. @item hthreshold, h
  15192. Set high threshold for color component not represented on X or Y axis.
  15193. Values higher than this value will be ignored. Default is 1.
  15194. Note this value is multiplied with actual max possible value one pixel component
  15195. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15196. is 0.9 * 255 = 230.
  15197. @item colorspace, c
  15198. Set what kind of colorspace to use when drawing graticule.
  15199. @table @samp
  15200. @item auto
  15201. @item 601
  15202. @item 709
  15203. @end table
  15204. Default is auto.
  15205. @item tint0, t0
  15206. @item tint1, t1
  15207. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15208. This means no tint, and output will remain gray.
  15209. @end table
  15210. @anchor{vidstabdetect}
  15211. @section vidstabdetect
  15212. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15213. @ref{vidstabtransform} for pass 2.
  15214. This filter generates a file with relative translation and rotation
  15215. transform information about subsequent frames, which is then used by
  15216. the @ref{vidstabtransform} filter.
  15217. To enable compilation of this filter you need to configure FFmpeg with
  15218. @code{--enable-libvidstab}.
  15219. This filter accepts the following options:
  15220. @table @option
  15221. @item result
  15222. Set the path to the file used to write the transforms information.
  15223. Default value is @file{transforms.trf}.
  15224. @item shakiness
  15225. Set how shaky the video is and how quick the camera is. It accepts an
  15226. integer in the range 1-10, a value of 1 means little shakiness, a
  15227. value of 10 means strong shakiness. Default value is 5.
  15228. @item accuracy
  15229. Set the accuracy of the detection process. It must be a value in the
  15230. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15231. accuracy. Default value is 15.
  15232. @item stepsize
  15233. Set stepsize of the search process. The region around minimum is
  15234. scanned with 1 pixel resolution. Default value is 6.
  15235. @item mincontrast
  15236. Set minimum contrast. Below this value a local measurement field is
  15237. discarded. Must be a floating point value in the range 0-1. Default
  15238. value is 0.3.
  15239. @item tripod
  15240. Set reference frame number for tripod mode.
  15241. If enabled, the motion of the frames is compared to a reference frame
  15242. in the filtered stream, identified by the specified number. The idea
  15243. is to compensate all movements in a more-or-less static scene and keep
  15244. the camera view absolutely still.
  15245. If set to 0, it is disabled. The frames are counted starting from 1.
  15246. @item show
  15247. Show fields and transforms in the resulting frames. It accepts an
  15248. integer in the range 0-2. Default value is 0, which disables any
  15249. visualization.
  15250. @end table
  15251. @subsection Examples
  15252. @itemize
  15253. @item
  15254. Use default values:
  15255. @example
  15256. vidstabdetect
  15257. @end example
  15258. @item
  15259. Analyze strongly shaky movie and put the results in file
  15260. @file{mytransforms.trf}:
  15261. @example
  15262. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15263. @end example
  15264. @item
  15265. Visualize the result of internal transformations in the resulting
  15266. video:
  15267. @example
  15268. vidstabdetect=show=1
  15269. @end example
  15270. @item
  15271. Analyze a video with medium shakiness using @command{ffmpeg}:
  15272. @example
  15273. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15274. @end example
  15275. @end itemize
  15276. @anchor{vidstabtransform}
  15277. @section vidstabtransform
  15278. Video stabilization/deshaking: pass 2 of 2,
  15279. see @ref{vidstabdetect} for pass 1.
  15280. Read a file with transform information for each frame and
  15281. apply/compensate them. Together with the @ref{vidstabdetect}
  15282. filter this can be used to deshake videos. See also
  15283. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15284. the @ref{unsharp} filter, see below.
  15285. To enable compilation of this filter you need to configure FFmpeg with
  15286. @code{--enable-libvidstab}.
  15287. @subsection Options
  15288. @table @option
  15289. @item input
  15290. Set path to the file used to read the transforms. Default value is
  15291. @file{transforms.trf}.
  15292. @item smoothing
  15293. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15294. camera movements. Default value is 10.
  15295. For example a number of 10 means that 21 frames are used (10 in the
  15296. past and 10 in the future) to smoothen the motion in the video. A
  15297. larger value leads to a smoother video, but limits the acceleration of
  15298. the camera (pan/tilt movements). 0 is a special case where a static
  15299. camera is simulated.
  15300. @item optalgo
  15301. Set the camera path optimization algorithm.
  15302. Accepted values are:
  15303. @table @samp
  15304. @item gauss
  15305. gaussian kernel low-pass filter on camera motion (default)
  15306. @item avg
  15307. averaging on transformations
  15308. @end table
  15309. @item maxshift
  15310. Set maximal number of pixels to translate frames. Default value is -1,
  15311. meaning no limit.
  15312. @item maxangle
  15313. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15314. value is -1, meaning no limit.
  15315. @item crop
  15316. Specify how to deal with borders that may be visible due to movement
  15317. compensation.
  15318. Available values are:
  15319. @table @samp
  15320. @item keep
  15321. keep image information from previous frame (default)
  15322. @item black
  15323. fill the border black
  15324. @end table
  15325. @item invert
  15326. Invert transforms if set to 1. Default value is 0.
  15327. @item relative
  15328. Consider transforms as relative to previous frame if set to 1,
  15329. absolute if set to 0. Default value is 0.
  15330. @item zoom
  15331. Set percentage to zoom. A positive value will result in a zoom-in
  15332. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15333. zoom).
  15334. @item optzoom
  15335. Set optimal zooming to avoid borders.
  15336. Accepted values are:
  15337. @table @samp
  15338. @item 0
  15339. disabled
  15340. @item 1
  15341. optimal static zoom value is determined (only very strong movements
  15342. will lead to visible borders) (default)
  15343. @item 2
  15344. optimal adaptive zoom value is determined (no borders will be
  15345. visible), see @option{zoomspeed}
  15346. @end table
  15347. Note that the value given at zoom is added to the one calculated here.
  15348. @item zoomspeed
  15349. Set percent to zoom maximally each frame (enabled when
  15350. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15351. 0.25.
  15352. @item interpol
  15353. Specify type of interpolation.
  15354. Available values are:
  15355. @table @samp
  15356. @item no
  15357. no interpolation
  15358. @item linear
  15359. linear only horizontal
  15360. @item bilinear
  15361. linear in both directions (default)
  15362. @item bicubic
  15363. cubic in both directions (slow)
  15364. @end table
  15365. @item tripod
  15366. Enable virtual tripod mode if set to 1, which is equivalent to
  15367. @code{relative=0:smoothing=0}. Default value is 0.
  15368. Use also @code{tripod} option of @ref{vidstabdetect}.
  15369. @item debug
  15370. Increase log verbosity if set to 1. Also the detected global motions
  15371. are written to the temporary file @file{global_motions.trf}. Default
  15372. value is 0.
  15373. @end table
  15374. @subsection Examples
  15375. @itemize
  15376. @item
  15377. Use @command{ffmpeg} for a typical stabilization with default values:
  15378. @example
  15379. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15380. @end example
  15381. Note the use of the @ref{unsharp} filter which is always recommended.
  15382. @item
  15383. Zoom in a bit more and load transform data from a given file:
  15384. @example
  15385. vidstabtransform=zoom=5:input="mytransforms.trf"
  15386. @end example
  15387. @item
  15388. Smoothen the video even more:
  15389. @example
  15390. vidstabtransform=smoothing=30
  15391. @end example
  15392. @end itemize
  15393. @section vflip
  15394. Flip the input video vertically.
  15395. For example, to vertically flip a video with @command{ffmpeg}:
  15396. @example
  15397. ffmpeg -i in.avi -vf "vflip" out.avi
  15398. @end example
  15399. @section vfrdet
  15400. Detect variable frame rate video.
  15401. This filter tries to detect if the input is variable or constant frame rate.
  15402. At end it will output number of frames detected as having variable delta pts,
  15403. and ones with constant delta pts.
  15404. If there was frames with variable delta, than it will also show min, max and
  15405. average delta encountered.
  15406. @section vibrance
  15407. Boost or alter saturation.
  15408. The filter accepts the following options:
  15409. @table @option
  15410. @item intensity
  15411. Set strength of boost if positive value or strength of alter if negative value.
  15412. Default is 0. Allowed range is from -2 to 2.
  15413. @item rbal
  15414. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15415. @item gbal
  15416. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15417. @item bbal
  15418. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15419. @item rlum
  15420. Set the red luma coefficient.
  15421. @item glum
  15422. Set the green luma coefficient.
  15423. @item blum
  15424. Set the blue luma coefficient.
  15425. @item alternate
  15426. If @code{intensity} is negative and this is set to 1, colors will change,
  15427. otherwise colors will be less saturated, more towards gray.
  15428. @end table
  15429. @subsection Commands
  15430. This filter supports the all above options as @ref{commands}.
  15431. @anchor{vignette}
  15432. @section vignette
  15433. Make or reverse a natural vignetting effect.
  15434. The filter accepts the following options:
  15435. @table @option
  15436. @item angle, a
  15437. Set lens angle expression as a number of radians.
  15438. The value is clipped in the @code{[0,PI/2]} range.
  15439. Default value: @code{"PI/5"}
  15440. @item x0
  15441. @item y0
  15442. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15443. by default.
  15444. @item mode
  15445. Set forward/backward mode.
  15446. Available modes are:
  15447. @table @samp
  15448. @item forward
  15449. The larger the distance from the central point, the darker the image becomes.
  15450. @item backward
  15451. The larger the distance from the central point, the brighter the image becomes.
  15452. This can be used to reverse a vignette effect, though there is no automatic
  15453. detection to extract the lens @option{angle} and other settings (yet). It can
  15454. also be used to create a burning effect.
  15455. @end table
  15456. Default value is @samp{forward}.
  15457. @item eval
  15458. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15459. It accepts the following values:
  15460. @table @samp
  15461. @item init
  15462. Evaluate expressions only once during the filter initialization.
  15463. @item frame
  15464. Evaluate expressions for each incoming frame. This is way slower than the
  15465. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15466. allows advanced dynamic expressions.
  15467. @end table
  15468. Default value is @samp{init}.
  15469. @item dither
  15470. Set dithering to reduce the circular banding effects. Default is @code{1}
  15471. (enabled).
  15472. @item aspect
  15473. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15474. Setting this value to the SAR of the input will make a rectangular vignetting
  15475. following the dimensions of the video.
  15476. Default is @code{1/1}.
  15477. @end table
  15478. @subsection Expressions
  15479. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15480. following parameters.
  15481. @table @option
  15482. @item w
  15483. @item h
  15484. input width and height
  15485. @item n
  15486. the number of input frame, starting from 0
  15487. @item pts
  15488. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15489. @var{TB} units, NAN if undefined
  15490. @item r
  15491. frame rate of the input video, NAN if the input frame rate is unknown
  15492. @item t
  15493. the PTS (Presentation TimeStamp) of the filtered video frame,
  15494. expressed in seconds, NAN if undefined
  15495. @item tb
  15496. time base of the input video
  15497. @end table
  15498. @subsection Examples
  15499. @itemize
  15500. @item
  15501. Apply simple strong vignetting effect:
  15502. @example
  15503. vignette=PI/4
  15504. @end example
  15505. @item
  15506. Make a flickering vignetting:
  15507. @example
  15508. vignette='PI/4+random(1)*PI/50':eval=frame
  15509. @end example
  15510. @end itemize
  15511. @section vmafmotion
  15512. Obtain the average VMAF motion score of a video.
  15513. It is one of the component metrics of VMAF.
  15514. The obtained average motion score is printed through the logging system.
  15515. The filter accepts the following options:
  15516. @table @option
  15517. @item stats_file
  15518. If specified, the filter will use the named file to save the motion score of
  15519. each frame with respect to the previous frame.
  15520. When filename equals "-" the data is sent to standard output.
  15521. @end table
  15522. Example:
  15523. @example
  15524. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15525. @end example
  15526. @section vstack
  15527. Stack input videos vertically.
  15528. All streams must be of same pixel format and of same width.
  15529. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15530. to create same output.
  15531. The filter accepts the following options:
  15532. @table @option
  15533. @item inputs
  15534. Set number of input streams. Default is 2.
  15535. @item shortest
  15536. If set to 1, force the output to terminate when the shortest input
  15537. terminates. Default value is 0.
  15538. @end table
  15539. @section w3fdif
  15540. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15541. Deinterlacing Filter").
  15542. Based on the process described by Martin Weston for BBC R&D, and
  15543. implemented based on the de-interlace algorithm written by Jim
  15544. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15545. uses filter coefficients calculated by BBC R&D.
  15546. This filter uses field-dominance information in frame to decide which
  15547. of each pair of fields to place first in the output.
  15548. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15549. There are two sets of filter coefficients, so called "simple"
  15550. and "complex". Which set of filter coefficients is used can
  15551. be set by passing an optional parameter:
  15552. @table @option
  15553. @item filter
  15554. Set the interlacing filter coefficients. Accepts one of the following values:
  15555. @table @samp
  15556. @item simple
  15557. Simple filter coefficient set.
  15558. @item complex
  15559. More-complex filter coefficient set.
  15560. @end table
  15561. Default value is @samp{complex}.
  15562. @item deint
  15563. Specify which frames to deinterlace. Accepts one of the following values:
  15564. @table @samp
  15565. @item all
  15566. Deinterlace all frames,
  15567. @item interlaced
  15568. Only deinterlace frames marked as interlaced.
  15569. @end table
  15570. Default value is @samp{all}.
  15571. @end table
  15572. @section waveform
  15573. Video waveform monitor.
  15574. The waveform monitor plots color component intensity. By default luminance
  15575. only. Each column of the waveform corresponds to a column of pixels in the
  15576. source video.
  15577. It accepts the following options:
  15578. @table @option
  15579. @item mode, m
  15580. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15581. In row mode, the graph on the left side represents color component value 0 and
  15582. the right side represents value = 255. In column mode, the top side represents
  15583. color component value = 0 and bottom side represents value = 255.
  15584. @item intensity, i
  15585. Set intensity. Smaller values are useful to find out how many values of the same
  15586. luminance are distributed across input rows/columns.
  15587. Default value is @code{0.04}. Allowed range is [0, 1].
  15588. @item mirror, r
  15589. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15590. In mirrored mode, higher values will be represented on the left
  15591. side for @code{row} mode and at the top for @code{column} mode. Default is
  15592. @code{1} (mirrored).
  15593. @item display, d
  15594. Set display mode.
  15595. It accepts the following values:
  15596. @table @samp
  15597. @item overlay
  15598. Presents information identical to that in the @code{parade}, except
  15599. that the graphs representing color components are superimposed directly
  15600. over one another.
  15601. This display mode makes it easier to spot relative differences or similarities
  15602. in overlapping areas of the color components that are supposed to be identical,
  15603. such as neutral whites, grays, or blacks.
  15604. @item stack
  15605. Display separate graph for the color components side by side in
  15606. @code{row} mode or one below the other in @code{column} mode.
  15607. @item parade
  15608. Display separate graph for the color components side by side in
  15609. @code{column} mode or one below the other in @code{row} mode.
  15610. Using this display mode makes it easy to spot color casts in the highlights
  15611. and shadows of an image, by comparing the contours of the top and the bottom
  15612. graphs of each waveform. Since whites, grays, and blacks are characterized
  15613. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15614. should display three waveforms of roughly equal width/height. If not, the
  15615. correction is easy to perform by making level adjustments the three waveforms.
  15616. @end table
  15617. Default is @code{stack}.
  15618. @item components, c
  15619. Set which color components to display. Default is 1, which means only luminance
  15620. or red color component if input is in RGB colorspace. If is set for example to
  15621. 7 it will display all 3 (if) available color components.
  15622. @item envelope, e
  15623. @table @samp
  15624. @item none
  15625. No envelope, this is default.
  15626. @item instant
  15627. Instant envelope, minimum and maximum values presented in graph will be easily
  15628. visible even with small @code{step} value.
  15629. @item peak
  15630. Hold minimum and maximum values presented in graph across time. This way you
  15631. can still spot out of range values without constantly looking at waveforms.
  15632. @item peak+instant
  15633. Peak and instant envelope combined together.
  15634. @end table
  15635. @item filter, f
  15636. @table @samp
  15637. @item lowpass
  15638. No filtering, this is default.
  15639. @item flat
  15640. Luma and chroma combined together.
  15641. @item aflat
  15642. Similar as above, but shows difference between blue and red chroma.
  15643. @item xflat
  15644. Similar as above, but use different colors.
  15645. @item yflat
  15646. Similar as above, but again with different colors.
  15647. @item chroma
  15648. Displays only chroma.
  15649. @item color
  15650. Displays actual color value on waveform.
  15651. @item acolor
  15652. Similar as above, but with luma showing frequency of chroma values.
  15653. @end table
  15654. @item graticule, g
  15655. Set which graticule to display.
  15656. @table @samp
  15657. @item none
  15658. Do not display graticule.
  15659. @item green
  15660. Display green graticule showing legal broadcast ranges.
  15661. @item orange
  15662. Display orange graticule showing legal broadcast ranges.
  15663. @item invert
  15664. Display invert graticule showing legal broadcast ranges.
  15665. @end table
  15666. @item opacity, o
  15667. Set graticule opacity.
  15668. @item flags, fl
  15669. Set graticule flags.
  15670. @table @samp
  15671. @item numbers
  15672. Draw numbers above lines. By default enabled.
  15673. @item dots
  15674. Draw dots instead of lines.
  15675. @end table
  15676. @item scale, s
  15677. Set scale used for displaying graticule.
  15678. @table @samp
  15679. @item digital
  15680. @item millivolts
  15681. @item ire
  15682. @end table
  15683. Default is digital.
  15684. @item bgopacity, b
  15685. Set background opacity.
  15686. @item tint0, t0
  15687. @item tint1, t1
  15688. Set tint for output.
  15689. Only used with lowpass filter and when display is not overlay and input
  15690. pixel formats are not RGB.
  15691. @end table
  15692. @section weave, doubleweave
  15693. The @code{weave} takes a field-based video input and join
  15694. each two sequential fields into single frame, producing a new double
  15695. height clip with half the frame rate and half the frame count.
  15696. The @code{doubleweave} works same as @code{weave} but without
  15697. halving frame rate and frame count.
  15698. It accepts the following option:
  15699. @table @option
  15700. @item first_field
  15701. Set first field. Available values are:
  15702. @table @samp
  15703. @item top, t
  15704. Set the frame as top-field-first.
  15705. @item bottom, b
  15706. Set the frame as bottom-field-first.
  15707. @end table
  15708. @end table
  15709. @subsection Examples
  15710. @itemize
  15711. @item
  15712. Interlace video using @ref{select} and @ref{separatefields} filter:
  15713. @example
  15714. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15715. @end example
  15716. @end itemize
  15717. @section xbr
  15718. Apply the xBR high-quality magnification filter which is designed for pixel
  15719. art. It follows a set of edge-detection rules, see
  15720. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15721. It accepts the following option:
  15722. @table @option
  15723. @item n
  15724. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15725. @code{3xBR} and @code{4} for @code{4xBR}.
  15726. Default is @code{3}.
  15727. @end table
  15728. @section xfade
  15729. Apply cross fade from one input video stream to another input video stream.
  15730. The cross fade is applied for specified duration.
  15731. The filter accepts the following options:
  15732. @table @option
  15733. @item transition
  15734. Set one of available transition effects:
  15735. @table @samp
  15736. @item custom
  15737. @item fade
  15738. @item wipeleft
  15739. @item wiperight
  15740. @item wipeup
  15741. @item wipedown
  15742. @item slideleft
  15743. @item slideright
  15744. @item slideup
  15745. @item slidedown
  15746. @item circlecrop
  15747. @item rectcrop
  15748. @item distance
  15749. @item fadeblack
  15750. @item fadewhite
  15751. @item radial
  15752. @item smoothleft
  15753. @item smoothright
  15754. @item smoothup
  15755. @item smoothdown
  15756. @item circleopen
  15757. @item circleclose
  15758. @item vertopen
  15759. @item vertclose
  15760. @item horzopen
  15761. @item horzclose
  15762. @item dissolve
  15763. @item pixelize
  15764. @item diagtl
  15765. @item diagtr
  15766. @item diagbl
  15767. @item diagbr
  15768. @item hlslice
  15769. @item hrslice
  15770. @item vuslice
  15771. @item vdslice
  15772. @item hblur
  15773. @item fadegrays
  15774. @item wipetl
  15775. @item wipetr
  15776. @item wipebl
  15777. @item wipebr
  15778. @end table
  15779. Default transition effect is fade.
  15780. @item duration
  15781. Set cross fade duration in seconds.
  15782. Default duration is 1 second.
  15783. @item offset
  15784. Set cross fade start relative to first input stream in seconds.
  15785. Default offset is 0.
  15786. @item expr
  15787. Set expression for custom transition effect.
  15788. The expressions can use the following variables and functions:
  15789. @table @option
  15790. @item X
  15791. @item Y
  15792. The coordinates of the current sample.
  15793. @item W
  15794. @item H
  15795. The width and height of the image.
  15796. @item P
  15797. Progress of transition effect.
  15798. @item PLANE
  15799. Currently processed plane.
  15800. @item A
  15801. Return value of first input at current location and plane.
  15802. @item B
  15803. Return value of second input at current location and plane.
  15804. @item a0(x, y)
  15805. @item a1(x, y)
  15806. @item a2(x, y)
  15807. @item a3(x, y)
  15808. Return the value of the pixel at location (@var{x},@var{y}) of the
  15809. first/second/third/fourth component of first input.
  15810. @item b0(x, y)
  15811. @item b1(x, y)
  15812. @item b2(x, y)
  15813. @item b3(x, y)
  15814. Return the value of the pixel at location (@var{x},@var{y}) of the
  15815. first/second/third/fourth component of second input.
  15816. @end table
  15817. @end table
  15818. @subsection Examples
  15819. @itemize
  15820. @item
  15821. Cross fade from one input video to another input video, with fade transition and duration of transition
  15822. of 2 seconds starting at offset of 5 seconds:
  15823. @example
  15824. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15825. @end example
  15826. @end itemize
  15827. @section xmedian
  15828. Pick median pixels from several input videos.
  15829. The filter accepts the following options:
  15830. @table @option
  15831. @item inputs
  15832. Set number of inputs.
  15833. Default is 3. Allowed range is from 3 to 255.
  15834. If number of inputs is even number, than result will be mean value between two median values.
  15835. @item planes
  15836. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15837. @item percentile
  15838. Set median percentile. Default value is @code{0.5}.
  15839. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15840. minimum values, and @code{1} maximum values.
  15841. @end table
  15842. @section xstack
  15843. Stack video inputs into custom layout.
  15844. All streams must be of same pixel format.
  15845. The filter accepts the following options:
  15846. @table @option
  15847. @item inputs
  15848. Set number of input streams. Default is 2.
  15849. @item layout
  15850. Specify layout of inputs.
  15851. This option requires the desired layout configuration to be explicitly set by the user.
  15852. This sets position of each video input in output. Each input
  15853. is separated by '|'.
  15854. The first number represents the column, and the second number represents the row.
  15855. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15856. where X is video input from which to take width or height.
  15857. Multiple values can be used when separated by '+'. In such
  15858. case values are summed together.
  15859. Note that if inputs are of different sizes gaps may appear, as not all of
  15860. the output video frame will be filled. Similarly, videos can overlap each
  15861. other if their position doesn't leave enough space for the full frame of
  15862. adjoining videos.
  15863. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15864. a layout must be set by the user.
  15865. @item shortest
  15866. If set to 1, force the output to terminate when the shortest input
  15867. terminates. Default value is 0.
  15868. @item fill
  15869. If set to valid color, all unused pixels will be filled with that color.
  15870. By default fill is set to none, so it is disabled.
  15871. @end table
  15872. @subsection Examples
  15873. @itemize
  15874. @item
  15875. Display 4 inputs into 2x2 grid.
  15876. Layout:
  15877. @example
  15878. input1(0, 0) | input3(w0, 0)
  15879. input2(0, h0) | input4(w0, h0)
  15880. @end example
  15881. @example
  15882. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15883. @end example
  15884. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15885. @item
  15886. Display 4 inputs into 1x4 grid.
  15887. Layout:
  15888. @example
  15889. input1(0, 0)
  15890. input2(0, h0)
  15891. input3(0, h0+h1)
  15892. input4(0, h0+h1+h2)
  15893. @end example
  15894. @example
  15895. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15896. @end example
  15897. Note that if inputs are of different widths, unused space will appear.
  15898. @item
  15899. Display 9 inputs into 3x3 grid.
  15900. Layout:
  15901. @example
  15902. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15903. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15904. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15905. @end example
  15906. @example
  15907. 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
  15908. @end example
  15909. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15910. @item
  15911. Display 16 inputs into 4x4 grid.
  15912. Layout:
  15913. @example
  15914. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15915. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15916. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15917. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15918. @end example
  15919. @example
  15920. 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|
  15921. 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
  15922. @end example
  15923. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15924. @end itemize
  15925. @anchor{yadif}
  15926. @section yadif
  15927. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15928. filter").
  15929. It accepts the following parameters:
  15930. @table @option
  15931. @item mode
  15932. The interlacing mode to adopt. It accepts one of the following values:
  15933. @table @option
  15934. @item 0, send_frame
  15935. Output one frame for each frame.
  15936. @item 1, send_field
  15937. Output one frame for each field.
  15938. @item 2, send_frame_nospatial
  15939. Like @code{send_frame}, but it skips the spatial interlacing check.
  15940. @item 3, send_field_nospatial
  15941. Like @code{send_field}, but it skips the spatial interlacing check.
  15942. @end table
  15943. The default value is @code{send_frame}.
  15944. @item parity
  15945. The picture field parity assumed for the input interlaced video. It accepts one
  15946. of the following values:
  15947. @table @option
  15948. @item 0, tff
  15949. Assume the top field is first.
  15950. @item 1, bff
  15951. Assume the bottom field is first.
  15952. @item -1, auto
  15953. Enable automatic detection of field parity.
  15954. @end table
  15955. The default value is @code{auto}.
  15956. If the interlacing is unknown or the decoder does not export this information,
  15957. top field first will be assumed.
  15958. @item deint
  15959. Specify which frames to deinterlace. Accepts one of the following
  15960. values:
  15961. @table @option
  15962. @item 0, all
  15963. Deinterlace all frames.
  15964. @item 1, interlaced
  15965. Only deinterlace frames marked as interlaced.
  15966. @end table
  15967. The default value is @code{all}.
  15968. @end table
  15969. @section yadif_cuda
  15970. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15971. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15972. and/or nvenc.
  15973. It accepts the following parameters:
  15974. @table @option
  15975. @item mode
  15976. The interlacing mode to adopt. It accepts one of the following values:
  15977. @table @option
  15978. @item 0, send_frame
  15979. Output one frame for each frame.
  15980. @item 1, send_field
  15981. Output one frame for each field.
  15982. @item 2, send_frame_nospatial
  15983. Like @code{send_frame}, but it skips the spatial interlacing check.
  15984. @item 3, send_field_nospatial
  15985. Like @code{send_field}, but it skips the spatial interlacing check.
  15986. @end table
  15987. The default value is @code{send_frame}.
  15988. @item parity
  15989. The picture field parity assumed for the input interlaced video. It accepts one
  15990. of the following values:
  15991. @table @option
  15992. @item 0, tff
  15993. Assume the top field is first.
  15994. @item 1, bff
  15995. Assume the bottom field is first.
  15996. @item -1, auto
  15997. Enable automatic detection of field parity.
  15998. @end table
  15999. The default value is @code{auto}.
  16000. If the interlacing is unknown or the decoder does not export this information,
  16001. top field first will be assumed.
  16002. @item deint
  16003. Specify which frames to deinterlace. Accepts one of the following
  16004. values:
  16005. @table @option
  16006. @item 0, all
  16007. Deinterlace all frames.
  16008. @item 1, interlaced
  16009. Only deinterlace frames marked as interlaced.
  16010. @end table
  16011. The default value is @code{all}.
  16012. @end table
  16013. @section yaepblur
  16014. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  16015. The algorithm is described in
  16016. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  16017. It accepts the following parameters:
  16018. @table @option
  16019. @item radius, r
  16020. Set the window radius. Default value is 3.
  16021. @item planes, p
  16022. Set which planes to filter. Default is only the first plane.
  16023. @item sigma, s
  16024. Set blur strength. Default value is 128.
  16025. @end table
  16026. @subsection Commands
  16027. This filter supports same @ref{commands} as options.
  16028. @section zoompan
  16029. Apply Zoom & Pan effect.
  16030. This filter accepts the following options:
  16031. @table @option
  16032. @item zoom, z
  16033. Set the zoom expression. Range is 1-10. Default is 1.
  16034. @item x
  16035. @item y
  16036. Set the x and y expression. Default is 0.
  16037. @item d
  16038. Set the duration expression in number of frames.
  16039. This sets for how many number of frames effect will last for
  16040. single input image.
  16041. @item s
  16042. Set the output image size, default is 'hd720'.
  16043. @item fps
  16044. Set the output frame rate, default is '25'.
  16045. @end table
  16046. Each expression can contain the following constants:
  16047. @table @option
  16048. @item in_w, iw
  16049. Input width.
  16050. @item in_h, ih
  16051. Input height.
  16052. @item out_w, ow
  16053. Output width.
  16054. @item out_h, oh
  16055. Output height.
  16056. @item in
  16057. Input frame count.
  16058. @item on
  16059. Output frame count.
  16060. @item in_time, it
  16061. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16062. @item out_time, time, ot
  16063. The output timestamp expressed in seconds.
  16064. @item x
  16065. @item y
  16066. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  16067. for current input frame.
  16068. @item px
  16069. @item py
  16070. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16071. not yet such frame (first input frame).
  16072. @item zoom
  16073. Last calculated zoom from 'z' expression for current input frame.
  16074. @item pzoom
  16075. Last calculated zoom of last output frame of previous input frame.
  16076. @item duration
  16077. Number of output frames for current input frame. Calculated from 'd' expression
  16078. for each input frame.
  16079. @item pduration
  16080. number of output frames created for previous input frame
  16081. @item a
  16082. Rational number: input width / input height
  16083. @item sar
  16084. sample aspect ratio
  16085. @item dar
  16086. display aspect ratio
  16087. @end table
  16088. @subsection Examples
  16089. @itemize
  16090. @item
  16091. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16092. @example
  16093. 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
  16094. @end example
  16095. @item
  16096. Zoom in up to 1.5x and pan always at center of picture:
  16097. @example
  16098. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16099. @end example
  16100. @item
  16101. Same as above but without pausing:
  16102. @example
  16103. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16104. @end example
  16105. @item
  16106. Zoom in 2x into center of picture only for the first second of the input video:
  16107. @example
  16108. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16109. @end example
  16110. @end itemize
  16111. @anchor{zscale}
  16112. @section zscale
  16113. Scale (resize) the input video, using the z.lib library:
  16114. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16115. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16116. The zscale filter forces the output display aspect ratio to be the same
  16117. as the input, by changing the output sample aspect ratio.
  16118. If the input image format is different from the format requested by
  16119. the next filter, the zscale filter will convert the input to the
  16120. requested format.
  16121. @subsection Options
  16122. The filter accepts the following options.
  16123. @table @option
  16124. @item width, w
  16125. @item height, h
  16126. Set the output video dimension expression. Default value is the input
  16127. dimension.
  16128. If the @var{width} or @var{w} value is 0, the input width is used for
  16129. the output. If the @var{height} or @var{h} value is 0, the input height
  16130. is used for the output.
  16131. If one and only one of the values is -n with n >= 1, the zscale filter
  16132. will use a value that maintains the aspect ratio of the input image,
  16133. calculated from the other specified dimension. After that it will,
  16134. however, make sure that the calculated dimension is divisible by n and
  16135. adjust the value if necessary.
  16136. If both values are -n with n >= 1, the behavior will be identical to
  16137. both values being set to 0 as previously detailed.
  16138. See below for the list of accepted constants for use in the dimension
  16139. expression.
  16140. @item size, s
  16141. Set the video size. For the syntax of this option, check the
  16142. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16143. @item dither, d
  16144. Set the dither type.
  16145. Possible values are:
  16146. @table @var
  16147. @item none
  16148. @item ordered
  16149. @item random
  16150. @item error_diffusion
  16151. @end table
  16152. Default is none.
  16153. @item filter, f
  16154. Set the resize filter type.
  16155. Possible values are:
  16156. @table @var
  16157. @item point
  16158. @item bilinear
  16159. @item bicubic
  16160. @item spline16
  16161. @item spline36
  16162. @item lanczos
  16163. @end table
  16164. Default is bilinear.
  16165. @item range, r
  16166. Set the color range.
  16167. Possible values are:
  16168. @table @var
  16169. @item input
  16170. @item limited
  16171. @item full
  16172. @end table
  16173. Default is same as input.
  16174. @item primaries, p
  16175. Set the color primaries.
  16176. Possible values are:
  16177. @table @var
  16178. @item input
  16179. @item 709
  16180. @item unspecified
  16181. @item 170m
  16182. @item 240m
  16183. @item 2020
  16184. @end table
  16185. Default is same as input.
  16186. @item transfer, t
  16187. Set the transfer characteristics.
  16188. Possible values are:
  16189. @table @var
  16190. @item input
  16191. @item 709
  16192. @item unspecified
  16193. @item 601
  16194. @item linear
  16195. @item 2020_10
  16196. @item 2020_12
  16197. @item smpte2084
  16198. @item iec61966-2-1
  16199. @item arib-std-b67
  16200. @end table
  16201. Default is same as input.
  16202. @item matrix, m
  16203. Set the colorspace matrix.
  16204. Possible value are:
  16205. @table @var
  16206. @item input
  16207. @item 709
  16208. @item unspecified
  16209. @item 470bg
  16210. @item 170m
  16211. @item 2020_ncl
  16212. @item 2020_cl
  16213. @end table
  16214. Default is same as input.
  16215. @item rangein, rin
  16216. Set the input color range.
  16217. Possible values are:
  16218. @table @var
  16219. @item input
  16220. @item limited
  16221. @item full
  16222. @end table
  16223. Default is same as input.
  16224. @item primariesin, pin
  16225. Set the input color primaries.
  16226. Possible values are:
  16227. @table @var
  16228. @item input
  16229. @item 709
  16230. @item unspecified
  16231. @item 170m
  16232. @item 240m
  16233. @item 2020
  16234. @end table
  16235. Default is same as input.
  16236. @item transferin, tin
  16237. Set the input transfer characteristics.
  16238. Possible values are:
  16239. @table @var
  16240. @item input
  16241. @item 709
  16242. @item unspecified
  16243. @item 601
  16244. @item linear
  16245. @item 2020_10
  16246. @item 2020_12
  16247. @end table
  16248. Default is same as input.
  16249. @item matrixin, min
  16250. Set the input colorspace matrix.
  16251. Possible value are:
  16252. @table @var
  16253. @item input
  16254. @item 709
  16255. @item unspecified
  16256. @item 470bg
  16257. @item 170m
  16258. @item 2020_ncl
  16259. @item 2020_cl
  16260. @end table
  16261. @item chromal, c
  16262. Set the output chroma location.
  16263. Possible values are:
  16264. @table @var
  16265. @item input
  16266. @item left
  16267. @item center
  16268. @item topleft
  16269. @item top
  16270. @item bottomleft
  16271. @item bottom
  16272. @end table
  16273. @item chromalin, cin
  16274. Set the input chroma location.
  16275. Possible values are:
  16276. @table @var
  16277. @item input
  16278. @item left
  16279. @item center
  16280. @item topleft
  16281. @item top
  16282. @item bottomleft
  16283. @item bottom
  16284. @end table
  16285. @item npl
  16286. Set the nominal peak luminance.
  16287. @end table
  16288. The values of the @option{w} and @option{h} options are expressions
  16289. containing the following constants:
  16290. @table @var
  16291. @item in_w
  16292. @item in_h
  16293. The input width and height
  16294. @item iw
  16295. @item ih
  16296. These are the same as @var{in_w} and @var{in_h}.
  16297. @item out_w
  16298. @item out_h
  16299. The output (scaled) width and height
  16300. @item ow
  16301. @item oh
  16302. These are the same as @var{out_w} and @var{out_h}
  16303. @item a
  16304. The same as @var{iw} / @var{ih}
  16305. @item sar
  16306. input sample aspect ratio
  16307. @item dar
  16308. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16309. @item hsub
  16310. @item vsub
  16311. horizontal and vertical input chroma subsample values. For example for the
  16312. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16313. @item ohsub
  16314. @item ovsub
  16315. horizontal and vertical output chroma subsample values. For example for the
  16316. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16317. @end table
  16318. @subsection Commands
  16319. This filter supports the following commands:
  16320. @table @option
  16321. @item width, w
  16322. @item height, h
  16323. Set the output video dimension expression.
  16324. The command accepts the same syntax of the corresponding option.
  16325. If the specified expression is not valid, it is kept at its current
  16326. value.
  16327. @end table
  16328. @c man end VIDEO FILTERS
  16329. @chapter OpenCL Video Filters
  16330. @c man begin OPENCL VIDEO FILTERS
  16331. Below is a description of the currently available OpenCL video filters.
  16332. To enable compilation of these filters you need to configure FFmpeg with
  16333. @code{--enable-opencl}.
  16334. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16335. @table @option
  16336. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16337. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16338. given device parameters.
  16339. @item -filter_hw_device @var{name}
  16340. Pass the hardware device called @var{name} to all filters in any filter graph.
  16341. @end table
  16342. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16343. @itemize
  16344. @item
  16345. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16346. @example
  16347. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16348. @end example
  16349. @end itemize
  16350. 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.
  16351. @section avgblur_opencl
  16352. Apply average blur filter.
  16353. The filter accepts the following options:
  16354. @table @option
  16355. @item sizeX
  16356. Set horizontal radius size.
  16357. Range is @code{[1, 1024]} and default value is @code{1}.
  16358. @item planes
  16359. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16360. @item sizeY
  16361. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16362. @end table
  16363. @subsection Example
  16364. @itemize
  16365. @item
  16366. 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.
  16367. @example
  16368. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16369. @end example
  16370. @end itemize
  16371. @section boxblur_opencl
  16372. Apply a boxblur algorithm to the input video.
  16373. It accepts the following parameters:
  16374. @table @option
  16375. @item luma_radius, lr
  16376. @item luma_power, lp
  16377. @item chroma_radius, cr
  16378. @item chroma_power, cp
  16379. @item alpha_radius, ar
  16380. @item alpha_power, ap
  16381. @end table
  16382. A description of the accepted options follows.
  16383. @table @option
  16384. @item luma_radius, lr
  16385. @item chroma_radius, cr
  16386. @item alpha_radius, ar
  16387. Set an expression for the box radius in pixels used for blurring the
  16388. corresponding input plane.
  16389. The radius value must be a non-negative number, and must not be
  16390. greater than the value of the expression @code{min(w,h)/2} for the
  16391. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16392. planes.
  16393. Default value for @option{luma_radius} is "2". If not specified,
  16394. @option{chroma_radius} and @option{alpha_radius} default to the
  16395. corresponding value set for @option{luma_radius}.
  16396. The expressions can contain the following constants:
  16397. @table @option
  16398. @item w
  16399. @item h
  16400. The input width and height in pixels.
  16401. @item cw
  16402. @item ch
  16403. The input chroma image width and height in pixels.
  16404. @item hsub
  16405. @item vsub
  16406. The horizontal and vertical chroma subsample values. For example, for the
  16407. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16408. @end table
  16409. @item luma_power, lp
  16410. @item chroma_power, cp
  16411. @item alpha_power, ap
  16412. Specify how many times the boxblur filter is applied to the
  16413. corresponding plane.
  16414. Default value for @option{luma_power} is 2. If not specified,
  16415. @option{chroma_power} and @option{alpha_power} default to the
  16416. corresponding value set for @option{luma_power}.
  16417. A value of 0 will disable the effect.
  16418. @end table
  16419. @subsection Examples
  16420. 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.
  16421. @itemize
  16422. @item
  16423. Apply a boxblur filter with the luma, chroma, and alpha radius
  16424. 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.
  16425. @example
  16426. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16427. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16428. @end example
  16429. @item
  16430. 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.
  16431. For the luma plane, a 2x2 box radius will be run once.
  16432. For the chroma plane, a 4x4 box radius will be run 5 times.
  16433. For the alpha plane, a 3x3 box radius will be run 7 times.
  16434. @example
  16435. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16436. @end example
  16437. @end itemize
  16438. @section colorkey_opencl
  16439. RGB colorspace color keying.
  16440. The filter accepts the following options:
  16441. @table @option
  16442. @item color
  16443. The color which will be replaced with transparency.
  16444. @item similarity
  16445. Similarity percentage with the key color.
  16446. 0.01 matches only the exact key color, while 1.0 matches everything.
  16447. @item blend
  16448. Blend percentage.
  16449. 0.0 makes pixels either fully transparent, or not transparent at all.
  16450. Higher values result in semi-transparent pixels, with a higher transparency
  16451. the more similar the pixels color is to the key color.
  16452. @end table
  16453. @subsection Examples
  16454. @itemize
  16455. @item
  16456. Make every semi-green pixel in the input transparent with some slight blending:
  16457. @example
  16458. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16459. @end example
  16460. @end itemize
  16461. @section convolution_opencl
  16462. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16463. The filter accepts the following options:
  16464. @table @option
  16465. @item 0m
  16466. @item 1m
  16467. @item 2m
  16468. @item 3m
  16469. Set matrix for each plane.
  16470. Matrix is sequence of 9, 25 or 49 signed numbers.
  16471. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16472. @item 0rdiv
  16473. @item 1rdiv
  16474. @item 2rdiv
  16475. @item 3rdiv
  16476. Set multiplier for calculated value for each plane.
  16477. If unset or 0, it will be sum of all matrix elements.
  16478. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16479. @item 0bias
  16480. @item 1bias
  16481. @item 2bias
  16482. @item 3bias
  16483. Set bias for each plane. This value is added to the result of the multiplication.
  16484. Useful for making the overall image brighter or darker.
  16485. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16486. @end table
  16487. @subsection Examples
  16488. @itemize
  16489. @item
  16490. Apply sharpen:
  16491. @example
  16492. -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
  16493. @end example
  16494. @item
  16495. Apply blur:
  16496. @example
  16497. -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
  16498. @end example
  16499. @item
  16500. Apply edge enhance:
  16501. @example
  16502. -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
  16503. @end example
  16504. @item
  16505. Apply edge detect:
  16506. @example
  16507. -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
  16508. @end example
  16509. @item
  16510. Apply laplacian edge detector which includes diagonals:
  16511. @example
  16512. -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
  16513. @end example
  16514. @item
  16515. Apply emboss:
  16516. @example
  16517. -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
  16518. @end example
  16519. @end itemize
  16520. @section erosion_opencl
  16521. Apply erosion effect to the video.
  16522. This filter replaces the pixel by the local(3x3) minimum.
  16523. It accepts the following options:
  16524. @table @option
  16525. @item threshold0
  16526. @item threshold1
  16527. @item threshold2
  16528. @item threshold3
  16529. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16530. If @code{0}, plane will remain unchanged.
  16531. @item coordinates
  16532. Flag which specifies the pixel to refer to.
  16533. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16534. Flags to local 3x3 coordinates region centered on @code{x}:
  16535. 1 2 3
  16536. 4 x 5
  16537. 6 7 8
  16538. @end table
  16539. @subsection Example
  16540. @itemize
  16541. @item
  16542. 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.
  16543. @example
  16544. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16545. @end example
  16546. @end itemize
  16547. @section deshake_opencl
  16548. Feature-point based video stabilization filter.
  16549. The filter accepts the following options:
  16550. @table @option
  16551. @item tripod
  16552. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16553. @item debug
  16554. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16555. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16556. Viewing point matches in the output video is only supported for RGB input.
  16557. Defaults to @code{0}.
  16558. @item adaptive_crop
  16559. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16560. Defaults to @code{1}.
  16561. @item refine_features
  16562. Whether or not feature points should be refined at a sub-pixel level.
  16563. This can be turned off for a slight performance gain at the cost of precision.
  16564. Defaults to @code{1}.
  16565. @item smooth_strength
  16566. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16567. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16568. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16569. Defaults to @code{0.0}.
  16570. @item smooth_window_multiplier
  16571. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16572. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16573. Acceptable values range from @code{0.1} to @code{10.0}.
  16574. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16575. potentially improving smoothness, but also increase latency and memory usage.
  16576. Defaults to @code{2.0}.
  16577. @end table
  16578. @subsection Examples
  16579. @itemize
  16580. @item
  16581. Stabilize a video with a fixed, medium smoothing strength:
  16582. @example
  16583. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16584. @end example
  16585. @item
  16586. Stabilize a video with debugging (both in console and in rendered video):
  16587. @example
  16588. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16589. @end example
  16590. @end itemize
  16591. @section dilation_opencl
  16592. Apply dilation effect to the video.
  16593. This filter replaces the pixel by the local(3x3) maximum.
  16594. It accepts the following options:
  16595. @table @option
  16596. @item threshold0
  16597. @item threshold1
  16598. @item threshold2
  16599. @item threshold3
  16600. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16601. If @code{0}, plane will remain unchanged.
  16602. @item coordinates
  16603. Flag which specifies the pixel to refer to.
  16604. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16605. Flags to local 3x3 coordinates region centered on @code{x}:
  16606. 1 2 3
  16607. 4 x 5
  16608. 6 7 8
  16609. @end table
  16610. @subsection Example
  16611. @itemize
  16612. @item
  16613. 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.
  16614. @example
  16615. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16616. @end example
  16617. @end itemize
  16618. @section nlmeans_opencl
  16619. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16620. @section overlay_opencl
  16621. Overlay one video on top of another.
  16622. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16623. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16624. The filter accepts the following options:
  16625. @table @option
  16626. @item x
  16627. Set the x coordinate of the overlaid video on the main video.
  16628. Default value is @code{0}.
  16629. @item y
  16630. Set the y coordinate of the overlaid video on the main video.
  16631. Default value is @code{0}.
  16632. @end table
  16633. @subsection Examples
  16634. @itemize
  16635. @item
  16636. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16637. @example
  16638. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16639. @end example
  16640. @item
  16641. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16642. @example
  16643. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16644. @end example
  16645. @end itemize
  16646. @section pad_opencl
  16647. Add paddings to the input image, and place the original input at the
  16648. provided @var{x}, @var{y} coordinates.
  16649. It accepts the following options:
  16650. @table @option
  16651. @item width, w
  16652. @item height, h
  16653. Specify an expression for the size of the output image with the
  16654. paddings added. If the value for @var{width} or @var{height} is 0, the
  16655. corresponding input size is used for the output.
  16656. The @var{width} expression can reference the value set by the
  16657. @var{height} expression, and vice versa.
  16658. The default value of @var{width} and @var{height} is 0.
  16659. @item x
  16660. @item y
  16661. Specify the offsets to place the input image at within the padded area,
  16662. with respect to the top/left border of the output image.
  16663. The @var{x} expression can reference the value set by the @var{y}
  16664. expression, and vice versa.
  16665. The default value of @var{x} and @var{y} is 0.
  16666. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16667. so the input image is centered on the padded area.
  16668. @item color
  16669. Specify the color of the padded area. For the syntax of this option,
  16670. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16671. manual,ffmpeg-utils}.
  16672. @item aspect
  16673. Pad to an aspect instead to a resolution.
  16674. @end table
  16675. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16676. options are expressions containing the following constants:
  16677. @table @option
  16678. @item in_w
  16679. @item in_h
  16680. The input video width and height.
  16681. @item iw
  16682. @item ih
  16683. These are the same as @var{in_w} and @var{in_h}.
  16684. @item out_w
  16685. @item out_h
  16686. The output width and height (the size of the padded area), as
  16687. specified by the @var{width} and @var{height} expressions.
  16688. @item ow
  16689. @item oh
  16690. These are the same as @var{out_w} and @var{out_h}.
  16691. @item x
  16692. @item y
  16693. The x and y offsets as specified by the @var{x} and @var{y}
  16694. expressions, or NAN if not yet specified.
  16695. @item a
  16696. same as @var{iw} / @var{ih}
  16697. @item sar
  16698. input sample aspect ratio
  16699. @item dar
  16700. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16701. @end table
  16702. @section prewitt_opencl
  16703. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16704. The filter accepts the following option:
  16705. @table @option
  16706. @item planes
  16707. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16708. @item scale
  16709. Set value which will be multiplied with filtered result.
  16710. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16711. @item delta
  16712. Set value which will be added to filtered result.
  16713. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16714. @end table
  16715. @subsection Example
  16716. @itemize
  16717. @item
  16718. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16719. @example
  16720. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16721. @end example
  16722. @end itemize
  16723. @anchor{program_opencl}
  16724. @section program_opencl
  16725. Filter video using an OpenCL program.
  16726. @table @option
  16727. @item source
  16728. OpenCL program source file.
  16729. @item kernel
  16730. Kernel name in program.
  16731. @item inputs
  16732. Number of inputs to the filter. Defaults to 1.
  16733. @item size, s
  16734. Size of output frames. Defaults to the same as the first input.
  16735. @end table
  16736. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16737. The program source file must contain a kernel function with the given name,
  16738. which will be run once for each plane of the output. Each run on a plane
  16739. gets enqueued as a separate 2D global NDRange with one work-item for each
  16740. pixel to be generated. The global ID offset for each work-item is therefore
  16741. the coordinates of a pixel in the destination image.
  16742. The kernel function needs to take the following arguments:
  16743. @itemize
  16744. @item
  16745. Destination image, @var{__write_only image2d_t}.
  16746. This image will become the output; the kernel should write all of it.
  16747. @item
  16748. Frame index, @var{unsigned int}.
  16749. This is a counter starting from zero and increasing by one for each frame.
  16750. @item
  16751. Source images, @var{__read_only image2d_t}.
  16752. These are the most recent images on each input. The kernel may read from
  16753. them to generate the output, but they can't be written to.
  16754. @end itemize
  16755. Example programs:
  16756. @itemize
  16757. @item
  16758. Copy the input to the output (output must be the same size as the input).
  16759. @verbatim
  16760. __kernel void copy(__write_only image2d_t destination,
  16761. unsigned int index,
  16762. __read_only image2d_t source)
  16763. {
  16764. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16765. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16766. float4 value = read_imagef(source, sampler, location);
  16767. write_imagef(destination, location, value);
  16768. }
  16769. @end verbatim
  16770. @item
  16771. Apply a simple transformation, rotating the input by an amount increasing
  16772. with the index counter. Pixel values are linearly interpolated by the
  16773. sampler, and the output need not have the same dimensions as the input.
  16774. @verbatim
  16775. __kernel void rotate_image(__write_only image2d_t dst,
  16776. unsigned int index,
  16777. __read_only image2d_t src)
  16778. {
  16779. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16780. CLK_FILTER_LINEAR);
  16781. float angle = (float)index / 100.0f;
  16782. float2 dst_dim = convert_float2(get_image_dim(dst));
  16783. float2 src_dim = convert_float2(get_image_dim(src));
  16784. float2 dst_cen = dst_dim / 2.0f;
  16785. float2 src_cen = src_dim / 2.0f;
  16786. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16787. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16788. float2 src_pos = {
  16789. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16790. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16791. };
  16792. src_pos = src_pos * src_dim / dst_dim;
  16793. float2 src_loc = src_pos + src_cen;
  16794. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16795. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16796. write_imagef(dst, dst_loc, 0.5f);
  16797. else
  16798. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16799. }
  16800. @end verbatim
  16801. @item
  16802. Blend two inputs together, with the amount of each input used varying
  16803. with the index counter.
  16804. @verbatim
  16805. __kernel void blend_images(__write_only image2d_t dst,
  16806. unsigned int index,
  16807. __read_only image2d_t src1,
  16808. __read_only image2d_t src2)
  16809. {
  16810. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16811. CLK_FILTER_LINEAR);
  16812. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16813. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16814. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16815. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16816. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16817. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16818. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16819. }
  16820. @end verbatim
  16821. @end itemize
  16822. @section roberts_opencl
  16823. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16824. The filter accepts the following option:
  16825. @table @option
  16826. @item planes
  16827. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16828. @item scale
  16829. Set value which will be multiplied with filtered result.
  16830. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16831. @item delta
  16832. Set value which will be added to filtered result.
  16833. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16834. @end table
  16835. @subsection Example
  16836. @itemize
  16837. @item
  16838. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16839. @example
  16840. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16841. @end example
  16842. @end itemize
  16843. @section sobel_opencl
  16844. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16845. The filter accepts the following option:
  16846. @table @option
  16847. @item planes
  16848. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16849. @item scale
  16850. Set value which will be multiplied with filtered result.
  16851. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16852. @item delta
  16853. Set value which will be added to filtered result.
  16854. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16855. @end table
  16856. @subsection Example
  16857. @itemize
  16858. @item
  16859. Apply sobel operator with scale set to 2 and delta set to 10
  16860. @example
  16861. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16862. @end example
  16863. @end itemize
  16864. @section tonemap_opencl
  16865. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16866. It accepts the following parameters:
  16867. @table @option
  16868. @item tonemap
  16869. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16870. @item param
  16871. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16872. @item desat
  16873. Apply desaturation for highlights that exceed this level of brightness. The
  16874. higher the parameter, the more color information will be preserved. This
  16875. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16876. (smoothly) turning into white instead. This makes images feel more natural,
  16877. at the cost of reducing information about out-of-range colors.
  16878. The default value is 0.5, and the algorithm here is a little different from
  16879. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16880. @item threshold
  16881. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16882. is used to detect whether the scene has changed or not. If the distance between
  16883. the current frame average brightness and the current running average exceeds
  16884. a threshold value, we would re-calculate scene average and peak brightness.
  16885. The default value is 0.2.
  16886. @item format
  16887. Specify the output pixel format.
  16888. Currently supported formats are:
  16889. @table @var
  16890. @item p010
  16891. @item nv12
  16892. @end table
  16893. @item range, r
  16894. Set the output color range.
  16895. Possible values are:
  16896. @table @var
  16897. @item tv/mpeg
  16898. @item pc/jpeg
  16899. @end table
  16900. Default is same as input.
  16901. @item primaries, p
  16902. Set the output color primaries.
  16903. Possible values are:
  16904. @table @var
  16905. @item bt709
  16906. @item bt2020
  16907. @end table
  16908. Default is same as input.
  16909. @item transfer, t
  16910. Set the output transfer characteristics.
  16911. Possible values are:
  16912. @table @var
  16913. @item bt709
  16914. @item bt2020
  16915. @end table
  16916. Default is bt709.
  16917. @item matrix, m
  16918. Set the output colorspace matrix.
  16919. Possible value are:
  16920. @table @var
  16921. @item bt709
  16922. @item bt2020
  16923. @end table
  16924. Default is same as input.
  16925. @end table
  16926. @subsection Example
  16927. @itemize
  16928. @item
  16929. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16930. @example
  16931. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16932. @end example
  16933. @end itemize
  16934. @section unsharp_opencl
  16935. Sharpen or blur the input video.
  16936. It accepts the following parameters:
  16937. @table @option
  16938. @item luma_msize_x, lx
  16939. Set the luma matrix horizontal size.
  16940. Range is @code{[1, 23]} and default value is @code{5}.
  16941. @item luma_msize_y, ly
  16942. Set the luma matrix vertical size.
  16943. Range is @code{[1, 23]} and default value is @code{5}.
  16944. @item luma_amount, la
  16945. Set the luma effect strength.
  16946. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16947. Negative values will blur the input video, while positive values will
  16948. sharpen it, a value of zero will disable the effect.
  16949. @item chroma_msize_x, cx
  16950. Set the chroma matrix horizontal size.
  16951. Range is @code{[1, 23]} and default value is @code{5}.
  16952. @item chroma_msize_y, cy
  16953. Set the chroma matrix vertical size.
  16954. Range is @code{[1, 23]} and default value is @code{5}.
  16955. @item chroma_amount, ca
  16956. Set the chroma effect strength.
  16957. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16958. Negative values will blur the input video, while positive values will
  16959. sharpen it, a value of zero will disable the effect.
  16960. @end table
  16961. All parameters are optional and default to the equivalent of the
  16962. string '5:5:1.0:5:5:0.0'.
  16963. @subsection Examples
  16964. @itemize
  16965. @item
  16966. Apply strong luma sharpen effect:
  16967. @example
  16968. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16969. @end example
  16970. @item
  16971. Apply a strong blur of both luma and chroma parameters:
  16972. @example
  16973. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16974. @end example
  16975. @end itemize
  16976. @section xfade_opencl
  16977. Cross fade two videos with custom transition effect by using OpenCL.
  16978. It accepts the following options:
  16979. @table @option
  16980. @item transition
  16981. Set one of possible transition effects.
  16982. @table @option
  16983. @item custom
  16984. Select custom transition effect, the actual transition description
  16985. will be picked from source and kernel options.
  16986. @item fade
  16987. @item wipeleft
  16988. @item wiperight
  16989. @item wipeup
  16990. @item wipedown
  16991. @item slideleft
  16992. @item slideright
  16993. @item slideup
  16994. @item slidedown
  16995. Default transition is fade.
  16996. @end table
  16997. @item source
  16998. OpenCL program source file for custom transition.
  16999. @item kernel
  17000. Set name of kernel to use for custom transition from program source file.
  17001. @item duration
  17002. Set duration of video transition.
  17003. @item offset
  17004. Set time of start of transition relative to first video.
  17005. @end table
  17006. The program source file must contain a kernel function with the given name,
  17007. which will be run once for each plane of the output. Each run on a plane
  17008. gets enqueued as a separate 2D global NDRange with one work-item for each
  17009. pixel to be generated. The global ID offset for each work-item is therefore
  17010. the coordinates of a pixel in the destination image.
  17011. The kernel function needs to take the following arguments:
  17012. @itemize
  17013. @item
  17014. Destination image, @var{__write_only image2d_t}.
  17015. This image will become the output; the kernel should write all of it.
  17016. @item
  17017. First Source image, @var{__read_only image2d_t}.
  17018. Second Source image, @var{__read_only image2d_t}.
  17019. These are the most recent images on each input. The kernel may read from
  17020. them to generate the output, but they can't be written to.
  17021. @item
  17022. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  17023. @end itemize
  17024. Example programs:
  17025. @itemize
  17026. @item
  17027. Apply dots curtain transition effect:
  17028. @verbatim
  17029. __kernel void blend_images(__write_only image2d_t dst,
  17030. __read_only image2d_t src1,
  17031. __read_only image2d_t src2,
  17032. float progress)
  17033. {
  17034. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17035. CLK_FILTER_LINEAR);
  17036. int2 p = (int2)(get_global_id(0), get_global_id(1));
  17037. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  17038. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  17039. rp = rp / dim;
  17040. float2 dots = (float2)(20.0, 20.0);
  17041. float2 center = (float2)(0,0);
  17042. float2 unused;
  17043. float4 val1 = read_imagef(src1, sampler, p);
  17044. float4 val2 = read_imagef(src2, sampler, p);
  17045. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  17046. write_imagef(dst, p, next ? val1 : val2);
  17047. }
  17048. @end verbatim
  17049. @end itemize
  17050. @c man end OPENCL VIDEO FILTERS
  17051. @chapter VAAPI Video Filters
  17052. @c man begin VAAPI VIDEO FILTERS
  17053. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  17054. To enable compilation of these filters you need to configure FFmpeg with
  17055. @code{--enable-vaapi}.
  17056. 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}
  17057. @section tonemap_vaapi
  17058. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  17059. It maps the dynamic range of HDR10 content to the SDR content.
  17060. It currently only accepts HDR10 as input.
  17061. It accepts the following parameters:
  17062. @table @option
  17063. @item format
  17064. Specify the output pixel format.
  17065. Currently supported formats are:
  17066. @table @var
  17067. @item p010
  17068. @item nv12
  17069. @end table
  17070. Default is nv12.
  17071. @item primaries, p
  17072. Set the output color primaries.
  17073. Default is same as input.
  17074. @item transfer, t
  17075. Set the output transfer characteristics.
  17076. Default is bt709.
  17077. @item matrix, m
  17078. Set the output colorspace matrix.
  17079. Default is same as input.
  17080. @end table
  17081. @subsection Example
  17082. @itemize
  17083. @item
  17084. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17085. @example
  17086. tonemap_vaapi=format=p010:t=bt2020-10
  17087. @end example
  17088. @end itemize
  17089. @c man end VAAPI VIDEO FILTERS
  17090. @chapter Video Sources
  17091. @c man begin VIDEO SOURCES
  17092. Below is a description of the currently available video sources.
  17093. @section buffer
  17094. Buffer video frames, and make them available to the filter chain.
  17095. This source is mainly intended for a programmatic use, in particular
  17096. through the interface defined in @file{libavfilter/buffersrc.h}.
  17097. It accepts the following parameters:
  17098. @table @option
  17099. @item video_size
  17100. Specify the size (width and height) of the buffered video frames. For the
  17101. syntax of this option, check the
  17102. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17103. @item width
  17104. The input video width.
  17105. @item height
  17106. The input video height.
  17107. @item pix_fmt
  17108. A string representing the pixel format of the buffered video frames.
  17109. It may be a number corresponding to a pixel format, or a pixel format
  17110. name.
  17111. @item time_base
  17112. Specify the timebase assumed by the timestamps of the buffered frames.
  17113. @item frame_rate
  17114. Specify the frame rate expected for the video stream.
  17115. @item pixel_aspect, sar
  17116. The sample (pixel) aspect ratio of the input video.
  17117. @item sws_param
  17118. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17119. to the filtergraph description to specify swscale flags for automatically
  17120. inserted scalers. See @ref{Filtergraph syntax}.
  17121. @item hw_frames_ctx
  17122. When using a hardware pixel format, this should be a reference to an
  17123. AVHWFramesContext describing input frames.
  17124. @end table
  17125. For example:
  17126. @example
  17127. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17128. @end example
  17129. will instruct the source to accept video frames with size 320x240 and
  17130. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17131. square pixels (1:1 sample aspect ratio).
  17132. Since the pixel format with name "yuv410p" corresponds to the number 6
  17133. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17134. this example corresponds to:
  17135. @example
  17136. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17137. @end example
  17138. Alternatively, the options can be specified as a flat string, but this
  17139. syntax is deprecated:
  17140. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17141. @section cellauto
  17142. Create a pattern generated by an elementary cellular automaton.
  17143. The initial state of the cellular automaton can be defined through the
  17144. @option{filename} and @option{pattern} options. If such options are
  17145. not specified an initial state is created randomly.
  17146. At each new frame a new row in the video is filled with the result of
  17147. the cellular automaton next generation. The behavior when the whole
  17148. frame is filled is defined by the @option{scroll} option.
  17149. This source accepts the following options:
  17150. @table @option
  17151. @item filename, f
  17152. Read the initial cellular automaton state, i.e. the starting row, from
  17153. the specified file.
  17154. In the file, each non-whitespace character is considered an alive
  17155. cell, a newline will terminate the row, and further characters in the
  17156. file will be ignored.
  17157. @item pattern, p
  17158. Read the initial cellular automaton state, i.e. the starting row, from
  17159. the specified string.
  17160. Each non-whitespace character in the string is considered an alive
  17161. cell, a newline will terminate the row, and further characters in the
  17162. string will be ignored.
  17163. @item rate, r
  17164. Set the video rate, that is the number of frames generated per second.
  17165. Default is 25.
  17166. @item random_fill_ratio, ratio
  17167. Set the random fill ratio for the initial cellular automaton row. It
  17168. is a floating point number value ranging from 0 to 1, defaults to
  17169. 1/PHI.
  17170. This option is ignored when a file or a pattern is specified.
  17171. @item random_seed, seed
  17172. Set the seed for filling randomly the initial row, must be an integer
  17173. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17174. set to -1, the filter will try to use a good random seed on a best
  17175. effort basis.
  17176. @item rule
  17177. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17178. Default value is 110.
  17179. @item size, s
  17180. Set the size of the output video. For the syntax of this option, check the
  17181. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17182. If @option{filename} or @option{pattern} is specified, the size is set
  17183. by default to the width of the specified initial state row, and the
  17184. height is set to @var{width} * PHI.
  17185. If @option{size} is set, it must contain the width of the specified
  17186. pattern string, and the specified pattern will be centered in the
  17187. larger row.
  17188. If a filename or a pattern string is not specified, the size value
  17189. defaults to "320x518" (used for a randomly generated initial state).
  17190. @item scroll
  17191. If set to 1, scroll the output upward when all the rows in the output
  17192. have been already filled. If set to 0, the new generated row will be
  17193. written over the top row just after the bottom row is filled.
  17194. Defaults to 1.
  17195. @item start_full, full
  17196. If set to 1, completely fill the output with generated rows before
  17197. outputting the first frame.
  17198. This is the default behavior, for disabling set the value to 0.
  17199. @item stitch
  17200. If set to 1, stitch the left and right row edges together.
  17201. This is the default behavior, for disabling set the value to 0.
  17202. @end table
  17203. @subsection Examples
  17204. @itemize
  17205. @item
  17206. Read the initial state from @file{pattern}, and specify an output of
  17207. size 200x400.
  17208. @example
  17209. cellauto=f=pattern:s=200x400
  17210. @end example
  17211. @item
  17212. Generate a random initial row with a width of 200 cells, with a fill
  17213. ratio of 2/3:
  17214. @example
  17215. cellauto=ratio=2/3:s=200x200
  17216. @end example
  17217. @item
  17218. Create a pattern generated by rule 18 starting by a single alive cell
  17219. centered on an initial row with width 100:
  17220. @example
  17221. cellauto=p=@@:s=100x400:full=0:rule=18
  17222. @end example
  17223. @item
  17224. Specify a more elaborated initial pattern:
  17225. @example
  17226. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17227. @end example
  17228. @end itemize
  17229. @anchor{coreimagesrc}
  17230. @section coreimagesrc
  17231. Video source generated on GPU using Apple's CoreImage API on OSX.
  17232. This video source is a specialized version of the @ref{coreimage} video filter.
  17233. Use a core image generator at the beginning of the applied filterchain to
  17234. generate the content.
  17235. The coreimagesrc video source accepts the following options:
  17236. @table @option
  17237. @item list_generators
  17238. List all available generators along with all their respective options as well as
  17239. possible minimum and maximum values along with the default values.
  17240. @example
  17241. list_generators=true
  17242. @end example
  17243. @item size, s
  17244. Specify the size of the sourced video. For the syntax of this option, check the
  17245. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17246. The default value is @code{320x240}.
  17247. @item rate, r
  17248. Specify the frame rate of the sourced video, as the number of frames
  17249. generated per second. It has to be a string in the format
  17250. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17251. number or a valid video frame rate abbreviation. The default value is
  17252. "25".
  17253. @item sar
  17254. Set the sample aspect ratio of the sourced video.
  17255. @item duration, d
  17256. Set the duration of the sourced video. See
  17257. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17258. for the accepted syntax.
  17259. If not specified, or the expressed duration is negative, the video is
  17260. supposed to be generated forever.
  17261. @end table
  17262. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17263. A complete filterchain can be used for further processing of the
  17264. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17265. and examples for details.
  17266. @subsection Examples
  17267. @itemize
  17268. @item
  17269. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17270. given as complete and escaped command-line for Apple's standard bash shell:
  17271. @example
  17272. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17273. @end example
  17274. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17275. need for a nullsrc video source.
  17276. @end itemize
  17277. @section gradients
  17278. Generate several gradients.
  17279. @table @option
  17280. @item size, s
  17281. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17282. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17283. @item rate, r
  17284. Set frame rate, expressed as number of frames per second. Default
  17285. value is "25".
  17286. @item c0, c1, c2, c3, c4, c5, c6, c7
  17287. Set 8 colors. Default values for colors is to pick random one.
  17288. @item x0, y0, y0, y1
  17289. Set gradient line source and destination points. If negative or out of range, random ones
  17290. are picked.
  17291. @item nb_colors, n
  17292. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17293. @item seed
  17294. Set seed for picking gradient line points.
  17295. @item duration, d
  17296. Set the duration of the sourced video. See
  17297. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17298. for the accepted syntax.
  17299. If not specified, or the expressed duration is negative, the video is
  17300. supposed to be generated forever.
  17301. @item speed
  17302. Set speed of gradients rotation.
  17303. @end table
  17304. @section mandelbrot
  17305. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17306. point specified with @var{start_x} and @var{start_y}.
  17307. This source accepts the following options:
  17308. @table @option
  17309. @item end_pts
  17310. Set the terminal pts value. Default value is 400.
  17311. @item end_scale
  17312. Set the terminal scale value.
  17313. Must be a floating point value. Default value is 0.3.
  17314. @item inner
  17315. Set the inner coloring mode, that is the algorithm used to draw the
  17316. Mandelbrot fractal internal region.
  17317. It shall assume one of the following values:
  17318. @table @option
  17319. @item black
  17320. Set black mode.
  17321. @item convergence
  17322. Show time until convergence.
  17323. @item mincol
  17324. Set color based on point closest to the origin of the iterations.
  17325. @item period
  17326. Set period mode.
  17327. @end table
  17328. Default value is @var{mincol}.
  17329. @item bailout
  17330. Set the bailout value. Default value is 10.0.
  17331. @item maxiter
  17332. Set the maximum of iterations performed by the rendering
  17333. algorithm. Default value is 7189.
  17334. @item outer
  17335. Set outer coloring mode.
  17336. It shall assume one of following values:
  17337. @table @option
  17338. @item iteration_count
  17339. Set iteration count mode.
  17340. @item normalized_iteration_count
  17341. set normalized iteration count mode.
  17342. @end table
  17343. Default value is @var{normalized_iteration_count}.
  17344. @item rate, r
  17345. Set frame rate, expressed as number of frames per second. Default
  17346. value is "25".
  17347. @item size, s
  17348. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17349. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17350. @item start_scale
  17351. Set the initial scale value. Default value is 3.0.
  17352. @item start_x
  17353. Set the initial x position. Must be a floating point value between
  17354. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17355. @item start_y
  17356. Set the initial y position. Must be a floating point value between
  17357. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17358. @end table
  17359. @section mptestsrc
  17360. Generate various test patterns, as generated by the MPlayer test filter.
  17361. The size of the generated video is fixed, and is 256x256.
  17362. This source is useful in particular for testing encoding features.
  17363. This source accepts the following options:
  17364. @table @option
  17365. @item rate, r
  17366. Specify the frame rate of the sourced video, as the number of frames
  17367. generated per second. It has to be a string in the format
  17368. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17369. number or a valid video frame rate abbreviation. The default value is
  17370. "25".
  17371. @item duration, d
  17372. Set the duration of the sourced video. See
  17373. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17374. for the accepted syntax.
  17375. If not specified, or the expressed duration is negative, the video is
  17376. supposed to be generated forever.
  17377. @item test, t
  17378. Set the number or the name of the test to perform. Supported tests are:
  17379. @table @option
  17380. @item dc_luma
  17381. @item dc_chroma
  17382. @item freq_luma
  17383. @item freq_chroma
  17384. @item amp_luma
  17385. @item amp_chroma
  17386. @item cbp
  17387. @item mv
  17388. @item ring1
  17389. @item ring2
  17390. @item all
  17391. @item max_frames, m
  17392. Set the maximum number of frames generated for each test, default value is 30.
  17393. @end table
  17394. Default value is "all", which will cycle through the list of all tests.
  17395. @end table
  17396. Some examples:
  17397. @example
  17398. mptestsrc=t=dc_luma
  17399. @end example
  17400. will generate a "dc_luma" test pattern.
  17401. @section frei0r_src
  17402. Provide a frei0r source.
  17403. To enable compilation of this filter you need to install the frei0r
  17404. header and configure FFmpeg with @code{--enable-frei0r}.
  17405. This source accepts the following parameters:
  17406. @table @option
  17407. @item size
  17408. The size of the video to generate. For the syntax of this option, check the
  17409. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17410. @item framerate
  17411. The framerate of the generated video. It may be a string of the form
  17412. @var{num}/@var{den} or a frame rate abbreviation.
  17413. @item filter_name
  17414. The name to the frei0r source to load. For more information regarding frei0r and
  17415. how to set the parameters, read the @ref{frei0r} section in the video filters
  17416. documentation.
  17417. @item filter_params
  17418. A '|'-separated list of parameters to pass to the frei0r source.
  17419. @end table
  17420. For example, to generate a frei0r partik0l source with size 200x200
  17421. and frame rate 10 which is overlaid on the overlay filter main input:
  17422. @example
  17423. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17424. @end example
  17425. @section life
  17426. Generate a life pattern.
  17427. This source is based on a generalization of John Conway's life game.
  17428. The sourced input represents a life grid, each pixel represents a cell
  17429. which can be in one of two possible states, alive or dead. Every cell
  17430. interacts with its eight neighbours, which are the cells that are
  17431. horizontally, vertically, or diagonally adjacent.
  17432. At each interaction the grid evolves according to the adopted rule,
  17433. which specifies the number of neighbor alive cells which will make a
  17434. cell stay alive or born. The @option{rule} option allows one to specify
  17435. the rule to adopt.
  17436. This source accepts the following options:
  17437. @table @option
  17438. @item filename, f
  17439. Set the file from which to read the initial grid state. In the file,
  17440. each non-whitespace character is considered an alive cell, and newline
  17441. is used to delimit the end of each row.
  17442. If this option is not specified, the initial grid is generated
  17443. randomly.
  17444. @item rate, r
  17445. Set the video rate, that is the number of frames generated per second.
  17446. Default is 25.
  17447. @item random_fill_ratio, ratio
  17448. Set the random fill ratio for the initial random grid. It is a
  17449. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17450. It is ignored when a file is specified.
  17451. @item random_seed, seed
  17452. Set the seed for filling the initial random grid, must be an integer
  17453. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17454. set to -1, the filter will try to use a good random seed on a best
  17455. effort basis.
  17456. @item rule
  17457. Set the life rule.
  17458. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17459. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17460. @var{NS} specifies the number of alive neighbor cells which make a
  17461. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17462. which make a dead cell to become alive (i.e. to "born").
  17463. "s" and "b" can be used in place of "S" and "B", respectively.
  17464. Alternatively a rule can be specified by an 18-bits integer. The 9
  17465. high order bits are used to encode the next cell state if it is alive
  17466. for each number of neighbor alive cells, the low order bits specify
  17467. the rule for "borning" new cells. Higher order bits encode for an
  17468. higher number of neighbor cells.
  17469. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17470. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17471. Default value is "S23/B3", which is the original Conway's game of life
  17472. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17473. cells, and will born a new cell if there are three alive cells around
  17474. a dead cell.
  17475. @item size, s
  17476. Set the size of the output video. For the syntax of this option, check the
  17477. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17478. If @option{filename} is specified, the size is set by default to the
  17479. same size of the input file. If @option{size} is set, it must contain
  17480. the size specified in the input file, and the initial grid defined in
  17481. that file is centered in the larger resulting area.
  17482. If a filename is not specified, the size value defaults to "320x240"
  17483. (used for a randomly generated initial grid).
  17484. @item stitch
  17485. If set to 1, stitch the left and right grid edges together, and the
  17486. top and bottom edges also. Defaults to 1.
  17487. @item mold
  17488. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17489. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17490. value from 0 to 255.
  17491. @item life_color
  17492. Set the color of living (or new born) cells.
  17493. @item death_color
  17494. Set the color of dead cells. If @option{mold} is set, this is the first color
  17495. used to represent a dead cell.
  17496. @item mold_color
  17497. Set mold color, for definitely dead and moldy cells.
  17498. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17499. ffmpeg-utils manual,ffmpeg-utils}.
  17500. @end table
  17501. @subsection Examples
  17502. @itemize
  17503. @item
  17504. Read a grid from @file{pattern}, and center it on a grid of size
  17505. 300x300 pixels:
  17506. @example
  17507. life=f=pattern:s=300x300
  17508. @end example
  17509. @item
  17510. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17511. @example
  17512. life=ratio=2/3:s=200x200
  17513. @end example
  17514. @item
  17515. Specify a custom rule for evolving a randomly generated grid:
  17516. @example
  17517. life=rule=S14/B34
  17518. @end example
  17519. @item
  17520. Full example with slow death effect (mold) using @command{ffplay}:
  17521. @example
  17522. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17523. @end example
  17524. @end itemize
  17525. @anchor{allrgb}
  17526. @anchor{allyuv}
  17527. @anchor{color}
  17528. @anchor{haldclutsrc}
  17529. @anchor{nullsrc}
  17530. @anchor{pal75bars}
  17531. @anchor{pal100bars}
  17532. @anchor{rgbtestsrc}
  17533. @anchor{smptebars}
  17534. @anchor{smptehdbars}
  17535. @anchor{testsrc}
  17536. @anchor{testsrc2}
  17537. @anchor{yuvtestsrc}
  17538. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17539. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17540. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17541. The @code{color} source provides an uniformly colored input.
  17542. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17543. @ref{haldclut} filter.
  17544. The @code{nullsrc} source returns unprocessed video frames. It is
  17545. mainly useful to be employed in analysis / debugging tools, or as the
  17546. source for filters which ignore the input data.
  17547. The @code{pal75bars} source generates a color bars pattern, based on
  17548. EBU PAL recommendations with 75% color levels.
  17549. The @code{pal100bars} source generates a color bars pattern, based on
  17550. EBU PAL recommendations with 100% color levels.
  17551. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17552. detecting RGB vs BGR issues. You should see a red, green and blue
  17553. stripe from top to bottom.
  17554. The @code{smptebars} source generates a color bars pattern, based on
  17555. the SMPTE Engineering Guideline EG 1-1990.
  17556. The @code{smptehdbars} source generates a color bars pattern, based on
  17557. the SMPTE RP 219-2002.
  17558. The @code{testsrc} source generates a test video pattern, showing a
  17559. color pattern, a scrolling gradient and a timestamp. This is mainly
  17560. intended for testing purposes.
  17561. The @code{testsrc2} source is similar to testsrc, but supports more
  17562. pixel formats instead of just @code{rgb24}. This allows using it as an
  17563. input for other tests without requiring a format conversion.
  17564. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17565. see a y, cb and cr stripe from top to bottom.
  17566. The sources accept the following parameters:
  17567. @table @option
  17568. @item level
  17569. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17570. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17571. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17572. coded on a @code{1/(N*N)} scale.
  17573. @item color, c
  17574. Specify the color of the source, only available in the @code{color}
  17575. source. For the syntax of this option, check the
  17576. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17577. @item size, s
  17578. Specify the size of the sourced video. For the syntax of this option, check the
  17579. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17580. The default value is @code{320x240}.
  17581. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17582. @code{haldclutsrc} filters.
  17583. @item rate, r
  17584. Specify the frame rate of the sourced video, as the number of frames
  17585. generated per second. It has to be a string in the format
  17586. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17587. number or a valid video frame rate abbreviation. The default value is
  17588. "25".
  17589. @item duration, d
  17590. Set the duration of the sourced video. See
  17591. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17592. for the accepted syntax.
  17593. If not specified, or the expressed duration is negative, the video is
  17594. supposed to be generated forever.
  17595. Since the frame rate is used as time base, all frames including the last one
  17596. will have their full duration. If the specified duration is not a multiple
  17597. of the frame duration, it will be rounded up.
  17598. @item sar
  17599. Set the sample aspect ratio of the sourced video.
  17600. @item alpha
  17601. Specify the alpha (opacity) of the background, only available in the
  17602. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17603. 255 (fully opaque, the default).
  17604. @item decimals, n
  17605. Set the number of decimals to show in the timestamp, only available in the
  17606. @code{testsrc} source.
  17607. The displayed timestamp value will correspond to the original
  17608. timestamp value multiplied by the power of 10 of the specified
  17609. value. Default value is 0.
  17610. @end table
  17611. @subsection Examples
  17612. @itemize
  17613. @item
  17614. Generate a video with a duration of 5.3 seconds, with size
  17615. 176x144 and a frame rate of 10 frames per second:
  17616. @example
  17617. testsrc=duration=5.3:size=qcif:rate=10
  17618. @end example
  17619. @item
  17620. The following graph description will generate a red source
  17621. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17622. frames per second:
  17623. @example
  17624. color=c=red@@0.2:s=qcif:r=10
  17625. @end example
  17626. @item
  17627. If the input content is to be ignored, @code{nullsrc} can be used. The
  17628. following command generates noise in the luminance plane by employing
  17629. the @code{geq} filter:
  17630. @example
  17631. nullsrc=s=256x256, geq=random(1)*255:128:128
  17632. @end example
  17633. @end itemize
  17634. @subsection Commands
  17635. The @code{color} source supports the following commands:
  17636. @table @option
  17637. @item c, color
  17638. Set the color of the created image. Accepts the same syntax of the
  17639. corresponding @option{color} option.
  17640. @end table
  17641. @section openclsrc
  17642. Generate video using an OpenCL program.
  17643. @table @option
  17644. @item source
  17645. OpenCL program source file.
  17646. @item kernel
  17647. Kernel name in program.
  17648. @item size, s
  17649. Size of frames to generate. This must be set.
  17650. @item format
  17651. Pixel format to use for the generated frames. This must be set.
  17652. @item rate, r
  17653. Number of frames generated every second. Default value is '25'.
  17654. @end table
  17655. For details of how the program loading works, see the @ref{program_opencl}
  17656. filter.
  17657. Example programs:
  17658. @itemize
  17659. @item
  17660. Generate a colour ramp by setting pixel values from the position of the pixel
  17661. in the output image. (Note that this will work with all pixel formats, but
  17662. the generated output will not be the same.)
  17663. @verbatim
  17664. __kernel void ramp(__write_only image2d_t dst,
  17665. unsigned int index)
  17666. {
  17667. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17668. float4 val;
  17669. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17670. write_imagef(dst, loc, val);
  17671. }
  17672. @end verbatim
  17673. @item
  17674. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17675. @verbatim
  17676. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17677. unsigned int index)
  17678. {
  17679. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17680. float4 value = 0.0f;
  17681. int x = loc.x + index;
  17682. int y = loc.y + index;
  17683. while (x > 0 || y > 0) {
  17684. if (x % 3 == 1 && y % 3 == 1) {
  17685. value = 1.0f;
  17686. break;
  17687. }
  17688. x /= 3;
  17689. y /= 3;
  17690. }
  17691. write_imagef(dst, loc, value);
  17692. }
  17693. @end verbatim
  17694. @end itemize
  17695. @section sierpinski
  17696. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17697. This source accepts the following options:
  17698. @table @option
  17699. @item size, s
  17700. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17701. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17702. @item rate, r
  17703. Set frame rate, expressed as number of frames per second. Default
  17704. value is "25".
  17705. @item seed
  17706. Set seed which is used for random panning.
  17707. @item jump
  17708. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17709. @item type
  17710. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17711. @end table
  17712. @c man end VIDEO SOURCES
  17713. @chapter Video Sinks
  17714. @c man begin VIDEO SINKS
  17715. Below is a description of the currently available video sinks.
  17716. @section buffersink
  17717. Buffer video frames, and make them available to the end of the filter
  17718. graph.
  17719. This sink is mainly intended for programmatic use, in particular
  17720. through the interface defined in @file{libavfilter/buffersink.h}
  17721. or the options system.
  17722. It accepts a pointer to an AVBufferSinkContext structure, which
  17723. defines the incoming buffers' formats, to be passed as the opaque
  17724. parameter to @code{avfilter_init_filter} for initialization.
  17725. @section nullsink
  17726. Null video sink: do absolutely nothing with the input video. It is
  17727. mainly useful as a template and for use in analysis / debugging
  17728. tools.
  17729. @c man end VIDEO SINKS
  17730. @chapter Multimedia Filters
  17731. @c man begin MULTIMEDIA FILTERS
  17732. Below is a description of the currently available multimedia filters.
  17733. @section abitscope
  17734. Convert input audio to a video output, displaying the audio bit scope.
  17735. The filter accepts the following options:
  17736. @table @option
  17737. @item rate, r
  17738. Set frame rate, expressed as number of frames per second. Default
  17739. value is "25".
  17740. @item size, s
  17741. Specify the video size for the output. For the syntax of this option, check the
  17742. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17743. Default value is @code{1024x256}.
  17744. @item colors
  17745. Specify list of colors separated by space or by '|' which will be used to
  17746. draw channels. Unrecognized or missing colors will be replaced
  17747. by white color.
  17748. @end table
  17749. @section adrawgraph
  17750. Draw a graph using input audio metadata.
  17751. See @ref{drawgraph}
  17752. @section agraphmonitor
  17753. See @ref{graphmonitor}.
  17754. @section ahistogram
  17755. Convert input audio to a video output, displaying the volume histogram.
  17756. The filter accepts the following options:
  17757. @table @option
  17758. @item dmode
  17759. Specify how histogram is calculated.
  17760. It accepts the following values:
  17761. @table @samp
  17762. @item single
  17763. Use single histogram for all channels.
  17764. @item separate
  17765. Use separate histogram for each channel.
  17766. @end table
  17767. Default is @code{single}.
  17768. @item rate, r
  17769. Set frame rate, expressed as number of frames per second. Default
  17770. value is "25".
  17771. @item size, s
  17772. Specify the video size for the output. For the syntax of this option, check the
  17773. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17774. Default value is @code{hd720}.
  17775. @item scale
  17776. Set display scale.
  17777. It accepts the following values:
  17778. @table @samp
  17779. @item log
  17780. logarithmic
  17781. @item sqrt
  17782. square root
  17783. @item cbrt
  17784. cubic root
  17785. @item lin
  17786. linear
  17787. @item rlog
  17788. reverse logarithmic
  17789. @end table
  17790. Default is @code{log}.
  17791. @item ascale
  17792. Set amplitude scale.
  17793. It accepts the following values:
  17794. @table @samp
  17795. @item log
  17796. logarithmic
  17797. @item lin
  17798. linear
  17799. @end table
  17800. Default is @code{log}.
  17801. @item acount
  17802. Set how much frames to accumulate in histogram.
  17803. Default is 1. Setting this to -1 accumulates all frames.
  17804. @item rheight
  17805. Set histogram ratio of window height.
  17806. @item slide
  17807. Set sonogram sliding.
  17808. It accepts the following values:
  17809. @table @samp
  17810. @item replace
  17811. replace old rows with new ones.
  17812. @item scroll
  17813. scroll from top to bottom.
  17814. @end table
  17815. Default is @code{replace}.
  17816. @end table
  17817. @section aphasemeter
  17818. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17819. representing mean phase of current audio frame. A video output can also be produced and is
  17820. enabled by default. The audio is passed through as first output.
  17821. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17822. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17823. and @code{1} means channels are in phase.
  17824. The filter accepts the following options, all related to its video output:
  17825. @table @option
  17826. @item rate, r
  17827. Set the output frame rate. Default value is @code{25}.
  17828. @item size, s
  17829. Set the video size for the output. For the syntax of this option, check the
  17830. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17831. Default value is @code{800x400}.
  17832. @item rc
  17833. @item gc
  17834. @item bc
  17835. Specify the red, green, blue contrast. Default values are @code{2},
  17836. @code{7} and @code{1}.
  17837. Allowed range is @code{[0, 255]}.
  17838. @item mpc
  17839. Set color which will be used for drawing median phase. If color is
  17840. @code{none} which is default, no median phase value will be drawn.
  17841. @item video
  17842. Enable video output. Default is enabled.
  17843. @end table
  17844. @subsection phasing detection
  17845. The filter also detects out of phase and mono sequences in stereo streams.
  17846. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  17847. The filter accepts the following options for this detection:
  17848. @table @option
  17849. @item phasing
  17850. Enable mono and out of phase detection. Default is disabled.
  17851. @item tolerance, t
  17852. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  17853. Allowed range is @code{[0, 1]}.
  17854. @item angle, a
  17855. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  17856. Allowed range is @code{[90, 180]}.
  17857. @item duration, d
  17858. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  17859. @end table
  17860. @subsection Examples
  17861. @itemize
  17862. @item
  17863. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  17864. @example
  17865. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  17866. @end example
  17867. @end itemize
  17868. @section avectorscope
  17869. Convert input audio to a video output, representing the audio vector
  17870. scope.
  17871. The filter is used to measure the difference between channels of stereo
  17872. audio stream. A monaural signal, consisting of identical left and right
  17873. signal, results in straight vertical line. Any stereo separation is visible
  17874. as a deviation from this line, creating a Lissajous figure.
  17875. If the straight (or deviation from it) but horizontal line appears this
  17876. indicates that the left and right channels are out of phase.
  17877. The filter accepts the following options:
  17878. @table @option
  17879. @item mode, m
  17880. Set the vectorscope mode.
  17881. Available values are:
  17882. @table @samp
  17883. @item lissajous
  17884. Lissajous rotated by 45 degrees.
  17885. @item lissajous_xy
  17886. Same as above but not rotated.
  17887. @item polar
  17888. Shape resembling half of circle.
  17889. @end table
  17890. Default value is @samp{lissajous}.
  17891. @item size, s
  17892. Set the video size for the output. For the syntax of this option, check the
  17893. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17894. Default value is @code{400x400}.
  17895. @item rate, r
  17896. Set the output frame rate. Default value is @code{25}.
  17897. @item rc
  17898. @item gc
  17899. @item bc
  17900. @item ac
  17901. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17902. @code{160}, @code{80} and @code{255}.
  17903. Allowed range is @code{[0, 255]}.
  17904. @item rf
  17905. @item gf
  17906. @item bf
  17907. @item af
  17908. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17909. @code{10}, @code{5} and @code{5}.
  17910. Allowed range is @code{[0, 255]}.
  17911. @item zoom
  17912. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17913. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17914. @item draw
  17915. Set the vectorscope drawing mode.
  17916. Available values are:
  17917. @table @samp
  17918. @item dot
  17919. Draw dot for each sample.
  17920. @item line
  17921. Draw line between previous and current sample.
  17922. @end table
  17923. Default value is @samp{dot}.
  17924. @item scale
  17925. Specify amplitude scale of audio samples.
  17926. Available values are:
  17927. @table @samp
  17928. @item lin
  17929. Linear.
  17930. @item sqrt
  17931. Square root.
  17932. @item cbrt
  17933. Cubic root.
  17934. @item log
  17935. Logarithmic.
  17936. @end table
  17937. @item swap
  17938. Swap left channel axis with right channel axis.
  17939. @item mirror
  17940. Mirror axis.
  17941. @table @samp
  17942. @item none
  17943. No mirror.
  17944. @item x
  17945. Mirror only x axis.
  17946. @item y
  17947. Mirror only y axis.
  17948. @item xy
  17949. Mirror both axis.
  17950. @end table
  17951. @end table
  17952. @subsection Examples
  17953. @itemize
  17954. @item
  17955. Complete example using @command{ffplay}:
  17956. @example
  17957. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17958. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  17959. @end example
  17960. @end itemize
  17961. @section bench, abench
  17962. Benchmark part of a filtergraph.
  17963. The filter accepts the following options:
  17964. @table @option
  17965. @item action
  17966. Start or stop a timer.
  17967. Available values are:
  17968. @table @samp
  17969. @item start
  17970. Get the current time, set it as frame metadata (using the key
  17971. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  17972. @item stop
  17973. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  17974. the input frame metadata to get the time difference. Time difference, average,
  17975. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  17976. @code{min}) are then printed. The timestamps are expressed in seconds.
  17977. @end table
  17978. @end table
  17979. @subsection Examples
  17980. @itemize
  17981. @item
  17982. Benchmark @ref{selectivecolor} filter:
  17983. @example
  17984. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  17985. @end example
  17986. @end itemize
  17987. @section concat
  17988. Concatenate audio and video streams, joining them together one after the
  17989. other.
  17990. The filter works on segments of synchronized video and audio streams. All
  17991. segments must have the same number of streams of each type, and that will
  17992. also be the number of streams at output.
  17993. The filter accepts the following options:
  17994. @table @option
  17995. @item n
  17996. Set the number of segments. Default is 2.
  17997. @item v
  17998. Set the number of output video streams, that is also the number of video
  17999. streams in each segment. Default is 1.
  18000. @item a
  18001. Set the number of output audio streams, that is also the number of audio
  18002. streams in each segment. Default is 0.
  18003. @item unsafe
  18004. Activate unsafe mode: do not fail if segments have a different format.
  18005. @end table
  18006. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  18007. @var{a} audio outputs.
  18008. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  18009. segment, in the same order as the outputs, then the inputs for the second
  18010. segment, etc.
  18011. Related streams do not always have exactly the same duration, for various
  18012. reasons including codec frame size or sloppy authoring. For that reason,
  18013. related synchronized streams (e.g. a video and its audio track) should be
  18014. concatenated at once. The concat filter will use the duration of the longest
  18015. stream in each segment (except the last one), and if necessary pad shorter
  18016. audio streams with silence.
  18017. For this filter to work correctly, all segments must start at timestamp 0.
  18018. All corresponding streams must have the same parameters in all segments; the
  18019. filtering system will automatically select a common pixel format for video
  18020. streams, and a common sample format, sample rate and channel layout for
  18021. audio streams, but other settings, such as resolution, must be converted
  18022. explicitly by the user.
  18023. Different frame rates are acceptable but will result in variable frame rate
  18024. at output; be sure to configure the output file to handle it.
  18025. @subsection Examples
  18026. @itemize
  18027. @item
  18028. Concatenate an opening, an episode and an ending, all in bilingual version
  18029. (video in stream 0, audio in streams 1 and 2):
  18030. @example
  18031. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  18032. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  18033. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  18034. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  18035. @end example
  18036. @item
  18037. Concatenate two parts, handling audio and video separately, using the
  18038. (a)movie sources, and adjusting the resolution:
  18039. @example
  18040. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  18041. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  18042. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  18043. @end example
  18044. Note that a desync will happen at the stitch if the audio and video streams
  18045. do not have exactly the same duration in the first file.
  18046. @end itemize
  18047. @subsection Commands
  18048. This filter supports the following commands:
  18049. @table @option
  18050. @item next
  18051. Close the current segment and step to the next one
  18052. @end table
  18053. @anchor{ebur128}
  18054. @section ebur128
  18055. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  18056. level. By default, it logs a message at a frequency of 10Hz with the
  18057. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  18058. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  18059. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  18060. sample format is double-precision floating point. The input stream will be converted to
  18061. this specification, if needed. Users may need to insert aformat and/or aresample filters
  18062. after this filter to obtain the original parameters.
  18063. The filter also has a video output (see the @var{video} option) with a real
  18064. time graph to observe the loudness evolution. The graphic contains the logged
  18065. message mentioned above, so it is not printed anymore when this option is set,
  18066. unless the verbose logging is set. The main graphing area contains the
  18067. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  18068. the momentary loudness (400 milliseconds), but can optionally be configured
  18069. to instead display short-term loudness (see @var{gauge}).
  18070. The green area marks a +/- 1LU target range around the target loudness
  18071. (-23LUFS by default, unless modified through @var{target}).
  18072. More information about the Loudness Recommendation EBU R128 on
  18073. @url{http://tech.ebu.ch/loudness}.
  18074. The filter accepts the following options:
  18075. @table @option
  18076. @item video
  18077. Activate the video output. The audio stream is passed unchanged whether this
  18078. option is set or no. The video stream will be the first output stream if
  18079. activated. Default is @code{0}.
  18080. @item size
  18081. Set the video size. This option is for video only. For the syntax of this
  18082. option, check the
  18083. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18084. Default and minimum resolution is @code{640x480}.
  18085. @item meter
  18086. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18087. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18088. other integer value between this range is allowed.
  18089. @item metadata
  18090. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18091. into 100ms output frames, each of them containing various loudness information
  18092. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18093. Default is @code{0}.
  18094. @item framelog
  18095. Force the frame logging level.
  18096. Available values are:
  18097. @table @samp
  18098. @item info
  18099. information logging level
  18100. @item verbose
  18101. verbose logging level
  18102. @end table
  18103. By default, the logging level is set to @var{info}. If the @option{video} or
  18104. the @option{metadata} options are set, it switches to @var{verbose}.
  18105. @item peak
  18106. Set peak mode(s).
  18107. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18108. values are:
  18109. @table @samp
  18110. @item none
  18111. Disable any peak mode (default).
  18112. @item sample
  18113. Enable sample-peak mode.
  18114. Simple peak mode looking for the higher sample value. It logs a message
  18115. for sample-peak (identified by @code{SPK}).
  18116. @item true
  18117. Enable true-peak mode.
  18118. If enabled, the peak lookup is done on an over-sampled version of the input
  18119. stream for better peak accuracy. It logs a message for true-peak.
  18120. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18121. This mode requires a build with @code{libswresample}.
  18122. @end table
  18123. @item dualmono
  18124. Treat mono input files as "dual mono". If a mono file is intended for playback
  18125. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18126. If set to @code{true}, this option will compensate for this effect.
  18127. Multi-channel input files are not affected by this option.
  18128. @item panlaw
  18129. Set a specific pan law to be used for the measurement of dual mono files.
  18130. This parameter is optional, and has a default value of -3.01dB.
  18131. @item target
  18132. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18133. This parameter is optional and has a default value of -23LUFS as specified
  18134. by EBU R128. However, material published online may prefer a level of -16LUFS
  18135. (e.g. for use with podcasts or video platforms).
  18136. @item gauge
  18137. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18138. @code{shortterm}. By default the momentary value will be used, but in certain
  18139. scenarios it may be more useful to observe the short term value instead (e.g.
  18140. live mixing).
  18141. @item scale
  18142. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18143. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18144. video output, not the summary or continuous log output.
  18145. @end table
  18146. @subsection Examples
  18147. @itemize
  18148. @item
  18149. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18150. @example
  18151. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18152. @end example
  18153. @item
  18154. Run an analysis with @command{ffmpeg}:
  18155. @example
  18156. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18157. @end example
  18158. @end itemize
  18159. @section interleave, ainterleave
  18160. Temporally interleave frames from several inputs.
  18161. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18162. These filters read frames from several inputs and send the oldest
  18163. queued frame to the output.
  18164. Input streams must have well defined, monotonically increasing frame
  18165. timestamp values.
  18166. In order to submit one frame to output, these filters need to enqueue
  18167. at least one frame for each input, so they cannot work in case one
  18168. input is not yet terminated and will not receive incoming frames.
  18169. For example consider the case when one input is a @code{select} filter
  18170. which always drops input frames. The @code{interleave} filter will keep
  18171. reading from that input, but it will never be able to send new frames
  18172. to output until the input sends an end-of-stream signal.
  18173. Also, depending on inputs synchronization, the filters will drop
  18174. frames in case one input receives more frames than the other ones, and
  18175. the queue is already filled.
  18176. These filters accept the following options:
  18177. @table @option
  18178. @item nb_inputs, n
  18179. Set the number of different inputs, it is 2 by default.
  18180. @item duration
  18181. How to determine the end-of-stream.
  18182. @table @option
  18183. @item longest
  18184. The duration of the longest input. (default)
  18185. @item shortest
  18186. The duration of the shortest input.
  18187. @item first
  18188. The duration of the first input.
  18189. @end table
  18190. @end table
  18191. @subsection Examples
  18192. @itemize
  18193. @item
  18194. Interleave frames belonging to different streams using @command{ffmpeg}:
  18195. @example
  18196. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18197. @end example
  18198. @item
  18199. Add flickering blur effect:
  18200. @example
  18201. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18202. @end example
  18203. @end itemize
  18204. @section metadata, ametadata
  18205. Manipulate frame metadata.
  18206. This filter accepts the following options:
  18207. @table @option
  18208. @item mode
  18209. Set mode of operation of the filter.
  18210. Can be one of the following:
  18211. @table @samp
  18212. @item select
  18213. If both @code{value} and @code{key} is set, select frames
  18214. which have such metadata. If only @code{key} is set, select
  18215. every frame that has such key in metadata.
  18216. @item add
  18217. Add new metadata @code{key} and @code{value}. If key is already available
  18218. do nothing.
  18219. @item modify
  18220. Modify value of already present key.
  18221. @item delete
  18222. If @code{value} is set, delete only keys that have such value.
  18223. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18224. the frame.
  18225. @item print
  18226. Print key and its value if metadata was found. If @code{key} is not set print all
  18227. metadata values available in frame.
  18228. @end table
  18229. @item key
  18230. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18231. @item value
  18232. Set metadata value which will be used. This option is mandatory for
  18233. @code{modify} and @code{add} mode.
  18234. @item function
  18235. Which function to use when comparing metadata value and @code{value}.
  18236. Can be one of following:
  18237. @table @samp
  18238. @item same_str
  18239. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18240. @item starts_with
  18241. Values are interpreted as strings, returns true if metadata value starts with
  18242. the @code{value} option string.
  18243. @item less
  18244. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18245. @item equal
  18246. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18247. @item greater
  18248. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18249. @item expr
  18250. Values are interpreted as floats, returns true if expression from option @code{expr}
  18251. evaluates to true.
  18252. @item ends_with
  18253. Values are interpreted as strings, returns true if metadata value ends with
  18254. the @code{value} option string.
  18255. @end table
  18256. @item expr
  18257. Set expression which is used when @code{function} is set to @code{expr}.
  18258. The expression is evaluated through the eval API and can contain the following
  18259. constants:
  18260. @table @option
  18261. @item VALUE1
  18262. Float representation of @code{value} from metadata key.
  18263. @item VALUE2
  18264. Float representation of @code{value} as supplied by user in @code{value} option.
  18265. @end table
  18266. @item file
  18267. If specified in @code{print} mode, output is written to the named file. Instead of
  18268. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18269. for standard output. If @code{file} option is not set, output is written to the log
  18270. with AV_LOG_INFO loglevel.
  18271. @item direct
  18272. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18273. @end table
  18274. @subsection Examples
  18275. @itemize
  18276. @item
  18277. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18278. between 0 and 1.
  18279. @example
  18280. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18281. @end example
  18282. @item
  18283. Print silencedetect output to file @file{metadata.txt}.
  18284. @example
  18285. silencedetect,ametadata=mode=print:file=metadata.txt
  18286. @end example
  18287. @item
  18288. Direct all metadata to a pipe with file descriptor 4.
  18289. @example
  18290. metadata=mode=print:file='pipe\:4'
  18291. @end example
  18292. @end itemize
  18293. @section perms, aperms
  18294. Set read/write permissions for the output frames.
  18295. These filters are mainly aimed at developers to test direct path in the
  18296. following filter in the filtergraph.
  18297. The filters accept the following options:
  18298. @table @option
  18299. @item mode
  18300. Select the permissions mode.
  18301. It accepts the following values:
  18302. @table @samp
  18303. @item none
  18304. Do nothing. This is the default.
  18305. @item ro
  18306. Set all the output frames read-only.
  18307. @item rw
  18308. Set all the output frames directly writable.
  18309. @item toggle
  18310. Make the frame read-only if writable, and writable if read-only.
  18311. @item random
  18312. Set each output frame read-only or writable randomly.
  18313. @end table
  18314. @item seed
  18315. Set the seed for the @var{random} mode, must be an integer included between
  18316. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18317. @code{-1}, the filter will try to use a good random seed on a best effort
  18318. basis.
  18319. @end table
  18320. Note: in case of auto-inserted filter between the permission filter and the
  18321. following one, the permission might not be received as expected in that
  18322. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18323. perms/aperms filter can avoid this problem.
  18324. @section realtime, arealtime
  18325. Slow down filtering to match real time approximately.
  18326. These filters will pause the filtering for a variable amount of time to
  18327. match the output rate with the input timestamps.
  18328. They are similar to the @option{re} option to @code{ffmpeg}.
  18329. They accept the following options:
  18330. @table @option
  18331. @item limit
  18332. Time limit for the pauses. Any pause longer than that will be considered
  18333. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18334. @item speed
  18335. Speed factor for processing. The value must be a float larger than zero.
  18336. Values larger than 1.0 will result in faster than realtime processing,
  18337. smaller will slow processing down. The @var{limit} is automatically adapted
  18338. accordingly. Default is 1.0.
  18339. A processing speed faster than what is possible without these filters cannot
  18340. be achieved.
  18341. @end table
  18342. @anchor{select}
  18343. @section select, aselect
  18344. Select frames to pass in output.
  18345. This filter accepts the following options:
  18346. @table @option
  18347. @item expr, e
  18348. Set expression, which is evaluated for each input frame.
  18349. If the expression is evaluated to zero, the frame is discarded.
  18350. If the evaluation result is negative or NaN, the frame is sent to the
  18351. first output; otherwise it is sent to the output with index
  18352. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18353. For example a value of @code{1.2} corresponds to the output with index
  18354. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18355. @item outputs, n
  18356. Set the number of outputs. The output to which to send the selected
  18357. frame is based on the result of the evaluation. Default value is 1.
  18358. @end table
  18359. The expression can contain the following constants:
  18360. @table @option
  18361. @item n
  18362. The (sequential) number of the filtered frame, starting from 0.
  18363. @item selected_n
  18364. The (sequential) number of the selected frame, starting from 0.
  18365. @item prev_selected_n
  18366. The sequential number of the last selected frame. It's NAN if undefined.
  18367. @item TB
  18368. The timebase of the input timestamps.
  18369. @item pts
  18370. The PTS (Presentation TimeStamp) of the filtered video frame,
  18371. expressed in @var{TB} units. It's NAN if undefined.
  18372. @item t
  18373. The PTS of the filtered video frame,
  18374. expressed in seconds. It's NAN if undefined.
  18375. @item prev_pts
  18376. The PTS of the previously filtered video frame. It's NAN if undefined.
  18377. @item prev_selected_pts
  18378. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18379. @item prev_selected_t
  18380. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18381. @item start_pts
  18382. The PTS of the first video frame in the video. It's NAN if undefined.
  18383. @item start_t
  18384. The time of the first video frame in the video. It's NAN if undefined.
  18385. @item pict_type @emph{(video only)}
  18386. The type of the filtered frame. It can assume one of the following
  18387. values:
  18388. @table @option
  18389. @item I
  18390. @item P
  18391. @item B
  18392. @item S
  18393. @item SI
  18394. @item SP
  18395. @item BI
  18396. @end table
  18397. @item interlace_type @emph{(video only)}
  18398. The frame interlace type. It can assume one of the following values:
  18399. @table @option
  18400. @item PROGRESSIVE
  18401. The frame is progressive (not interlaced).
  18402. @item TOPFIRST
  18403. The frame is top-field-first.
  18404. @item BOTTOMFIRST
  18405. The frame is bottom-field-first.
  18406. @end table
  18407. @item consumed_sample_n @emph{(audio only)}
  18408. the number of selected samples before the current frame
  18409. @item samples_n @emph{(audio only)}
  18410. the number of samples in the current frame
  18411. @item sample_rate @emph{(audio only)}
  18412. the input sample rate
  18413. @item key
  18414. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18415. @item pos
  18416. the position in the file of the filtered frame, -1 if the information
  18417. is not available (e.g. for synthetic video)
  18418. @item scene @emph{(video only)}
  18419. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18420. probability for the current frame to introduce a new scene, while a higher
  18421. value means the current frame is more likely to be one (see the example below)
  18422. @item concatdec_select
  18423. The concat demuxer can select only part of a concat input file by setting an
  18424. inpoint and an outpoint, but the output packets may not be entirely contained
  18425. in the selected interval. By using this variable, it is possible to skip frames
  18426. generated by the concat demuxer which are not exactly contained in the selected
  18427. interval.
  18428. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18429. and the @var{lavf.concat.duration} packet metadata values which are also
  18430. present in the decoded frames.
  18431. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18432. start_time and either the duration metadata is missing or the frame pts is less
  18433. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18434. missing.
  18435. That basically means that an input frame is selected if its pts is within the
  18436. interval set by the concat demuxer.
  18437. @end table
  18438. The default value of the select expression is "1".
  18439. @subsection Examples
  18440. @itemize
  18441. @item
  18442. Select all frames in input:
  18443. @example
  18444. select
  18445. @end example
  18446. The example above is the same as:
  18447. @example
  18448. select=1
  18449. @end example
  18450. @item
  18451. Skip all frames:
  18452. @example
  18453. select=0
  18454. @end example
  18455. @item
  18456. Select only I-frames:
  18457. @example
  18458. select='eq(pict_type\,I)'
  18459. @end example
  18460. @item
  18461. Select one frame every 100:
  18462. @example
  18463. select='not(mod(n\,100))'
  18464. @end example
  18465. @item
  18466. Select only frames contained in the 10-20 time interval:
  18467. @example
  18468. select=between(t\,10\,20)
  18469. @end example
  18470. @item
  18471. Select only I-frames contained in the 10-20 time interval:
  18472. @example
  18473. select=between(t\,10\,20)*eq(pict_type\,I)
  18474. @end example
  18475. @item
  18476. Select frames with a minimum distance of 10 seconds:
  18477. @example
  18478. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18479. @end example
  18480. @item
  18481. Use aselect to select only audio frames with samples number > 100:
  18482. @example
  18483. aselect='gt(samples_n\,100)'
  18484. @end example
  18485. @item
  18486. Create a mosaic of the first scenes:
  18487. @example
  18488. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18489. @end example
  18490. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18491. choice.
  18492. @item
  18493. Send even and odd frames to separate outputs, and compose them:
  18494. @example
  18495. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18496. @end example
  18497. @item
  18498. Select useful frames from an ffconcat file which is using inpoints and
  18499. outpoints but where the source files are not intra frame only.
  18500. @example
  18501. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18502. @end example
  18503. @end itemize
  18504. @section sendcmd, asendcmd
  18505. Send commands to filters in the filtergraph.
  18506. These filters read commands to be sent to other filters in the
  18507. filtergraph.
  18508. @code{sendcmd} must be inserted between two video filters,
  18509. @code{asendcmd} must be inserted between two audio filters, but apart
  18510. from that they act the same way.
  18511. The specification of commands can be provided in the filter arguments
  18512. with the @var{commands} option, or in a file specified by the
  18513. @var{filename} option.
  18514. These filters accept the following options:
  18515. @table @option
  18516. @item commands, c
  18517. Set the commands to be read and sent to the other filters.
  18518. @item filename, f
  18519. Set the filename of the commands to be read and sent to the other
  18520. filters.
  18521. @end table
  18522. @subsection Commands syntax
  18523. A commands description consists of a sequence of interval
  18524. specifications, comprising a list of commands to be executed when a
  18525. particular event related to that interval occurs. The occurring event
  18526. is typically the current frame time entering or leaving a given time
  18527. interval.
  18528. An interval is specified by the following syntax:
  18529. @example
  18530. @var{START}[-@var{END}] @var{COMMANDS};
  18531. @end example
  18532. The time interval is specified by the @var{START} and @var{END} times.
  18533. @var{END} is optional and defaults to the maximum time.
  18534. The current frame time is considered within the specified interval if
  18535. it is included in the interval [@var{START}, @var{END}), that is when
  18536. the time is greater or equal to @var{START} and is lesser than
  18537. @var{END}.
  18538. @var{COMMANDS} consists of a sequence of one or more command
  18539. specifications, separated by ",", relating to that interval. The
  18540. syntax of a command specification is given by:
  18541. @example
  18542. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18543. @end example
  18544. @var{FLAGS} is optional and specifies the type of events relating to
  18545. the time interval which enable sending the specified command, and must
  18546. be a non-null sequence of identifier flags separated by "+" or "|" and
  18547. enclosed between "[" and "]".
  18548. The following flags are recognized:
  18549. @table @option
  18550. @item enter
  18551. The command is sent when the current frame timestamp enters the
  18552. specified interval. In other words, the command is sent when the
  18553. previous frame timestamp was not in the given interval, and the
  18554. current is.
  18555. @item leave
  18556. The command is sent when the current frame timestamp leaves the
  18557. specified interval. In other words, the command is sent when the
  18558. previous frame timestamp was in the given interval, and the
  18559. current is not.
  18560. @item expr
  18561. The command @var{ARG} is interpreted as expression and result of
  18562. expression is passed as @var{ARG}.
  18563. The expression is evaluated through the eval API and can contain the following
  18564. constants:
  18565. @table @option
  18566. @item POS
  18567. Original position in the file of the frame, or undefined if undefined
  18568. for the current frame.
  18569. @item PTS
  18570. The presentation timestamp in input.
  18571. @item N
  18572. The count of the input frame for video or audio, starting from 0.
  18573. @item T
  18574. The time in seconds of the current frame.
  18575. @item TS
  18576. The start time in seconds of the current command interval.
  18577. @item TE
  18578. The end time in seconds of the current command interval.
  18579. @item TI
  18580. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18581. @end table
  18582. @end table
  18583. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18584. assumed.
  18585. @var{TARGET} specifies the target of the command, usually the name of
  18586. the filter class or a specific filter instance name.
  18587. @var{COMMAND} specifies the name of the command for the target filter.
  18588. @var{ARG} is optional and specifies the optional list of argument for
  18589. the given @var{COMMAND}.
  18590. Between one interval specification and another, whitespaces, or
  18591. sequences of characters starting with @code{#} until the end of line,
  18592. are ignored and can be used to annotate comments.
  18593. A simplified BNF description of the commands specification syntax
  18594. follows:
  18595. @example
  18596. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18597. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18598. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18599. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18600. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18601. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18602. @end example
  18603. @subsection Examples
  18604. @itemize
  18605. @item
  18606. Specify audio tempo change at second 4:
  18607. @example
  18608. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18609. @end example
  18610. @item
  18611. Target a specific filter instance:
  18612. @example
  18613. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18614. @end example
  18615. @item
  18616. Specify a list of drawtext and hue commands in a file.
  18617. @example
  18618. # show text in the interval 5-10
  18619. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18620. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18621. # desaturate the image in the interval 15-20
  18622. 15.0-20.0 [enter] hue s 0,
  18623. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18624. [leave] hue s 1,
  18625. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18626. # apply an exponential saturation fade-out effect, starting from time 25
  18627. 25 [enter] hue s exp(25-t)
  18628. @end example
  18629. A filtergraph allowing to read and process the above command list
  18630. stored in a file @file{test.cmd}, can be specified with:
  18631. @example
  18632. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18633. @end example
  18634. @end itemize
  18635. @anchor{setpts}
  18636. @section setpts, asetpts
  18637. Change the PTS (presentation timestamp) of the input frames.
  18638. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18639. This filter accepts the following options:
  18640. @table @option
  18641. @item expr
  18642. The expression which is evaluated for each frame to construct its timestamp.
  18643. @end table
  18644. The expression is evaluated through the eval API and can contain the following
  18645. constants:
  18646. @table @option
  18647. @item FRAME_RATE, FR
  18648. frame rate, only defined for constant frame-rate video
  18649. @item PTS
  18650. The presentation timestamp in input
  18651. @item N
  18652. The count of the input frame for video or the number of consumed samples,
  18653. not including the current frame for audio, starting from 0.
  18654. @item NB_CONSUMED_SAMPLES
  18655. The number of consumed samples, not including the current frame (only
  18656. audio)
  18657. @item NB_SAMPLES, S
  18658. The number of samples in the current frame (only audio)
  18659. @item SAMPLE_RATE, SR
  18660. The audio sample rate.
  18661. @item STARTPTS
  18662. The PTS of the first frame.
  18663. @item STARTT
  18664. the time in seconds of the first frame
  18665. @item INTERLACED
  18666. State whether the current frame is interlaced.
  18667. @item T
  18668. the time in seconds of the current frame
  18669. @item POS
  18670. original position in the file of the frame, or undefined if undefined
  18671. for the current frame
  18672. @item PREV_INPTS
  18673. The previous input PTS.
  18674. @item PREV_INT
  18675. previous input time in seconds
  18676. @item PREV_OUTPTS
  18677. The previous output PTS.
  18678. @item PREV_OUTT
  18679. previous output time in seconds
  18680. @item RTCTIME
  18681. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18682. instead.
  18683. @item RTCSTART
  18684. The wallclock (RTC) time at the start of the movie in microseconds.
  18685. @item TB
  18686. The timebase of the input timestamps.
  18687. @end table
  18688. @subsection Examples
  18689. @itemize
  18690. @item
  18691. Start counting PTS from zero
  18692. @example
  18693. setpts=PTS-STARTPTS
  18694. @end example
  18695. @item
  18696. Apply fast motion effect:
  18697. @example
  18698. setpts=0.5*PTS
  18699. @end example
  18700. @item
  18701. Apply slow motion effect:
  18702. @example
  18703. setpts=2.0*PTS
  18704. @end example
  18705. @item
  18706. Set fixed rate of 25 frames per second:
  18707. @example
  18708. setpts=N/(25*TB)
  18709. @end example
  18710. @item
  18711. Set fixed rate 25 fps with some jitter:
  18712. @example
  18713. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18714. @end example
  18715. @item
  18716. Apply an offset of 10 seconds to the input PTS:
  18717. @example
  18718. setpts=PTS+10/TB
  18719. @end example
  18720. @item
  18721. Generate timestamps from a "live source" and rebase onto the current timebase:
  18722. @example
  18723. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18724. @end example
  18725. @item
  18726. Generate timestamps by counting samples:
  18727. @example
  18728. asetpts=N/SR/TB
  18729. @end example
  18730. @end itemize
  18731. @section setrange
  18732. Force color range for the output video frame.
  18733. The @code{setrange} filter marks the color range property for the
  18734. output frames. It does not change the input frame, but only sets the
  18735. corresponding property, which affects how the frame is treated by
  18736. following filters.
  18737. The filter accepts the following options:
  18738. @table @option
  18739. @item range
  18740. Available values are:
  18741. @table @samp
  18742. @item auto
  18743. Keep the same color range property.
  18744. @item unspecified, unknown
  18745. Set the color range as unspecified.
  18746. @item limited, tv, mpeg
  18747. Set the color range as limited.
  18748. @item full, pc, jpeg
  18749. Set the color range as full.
  18750. @end table
  18751. @end table
  18752. @section settb, asettb
  18753. Set the timebase to use for the output frames timestamps.
  18754. It is mainly useful for testing timebase configuration.
  18755. It accepts the following parameters:
  18756. @table @option
  18757. @item expr, tb
  18758. The expression which is evaluated into the output timebase.
  18759. @end table
  18760. The value for @option{tb} is an arithmetic expression representing a
  18761. rational. The expression can contain the constants "AVTB" (the default
  18762. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18763. audio only). Default value is "intb".
  18764. @subsection Examples
  18765. @itemize
  18766. @item
  18767. Set the timebase to 1/25:
  18768. @example
  18769. settb=expr=1/25
  18770. @end example
  18771. @item
  18772. Set the timebase to 1/10:
  18773. @example
  18774. settb=expr=0.1
  18775. @end example
  18776. @item
  18777. Set the timebase to 1001/1000:
  18778. @example
  18779. settb=1+0.001
  18780. @end example
  18781. @item
  18782. Set the timebase to 2*intb:
  18783. @example
  18784. settb=2*intb
  18785. @end example
  18786. @item
  18787. Set the default timebase value:
  18788. @example
  18789. settb=AVTB
  18790. @end example
  18791. @end itemize
  18792. @section showcqt
  18793. Convert input audio to a video output representing frequency spectrum
  18794. logarithmically using Brown-Puckette constant Q transform algorithm with
  18795. direct frequency domain coefficient calculation (but the transform itself
  18796. is not really constant Q, instead the Q factor is actually variable/clamped),
  18797. with musical tone scale, from E0 to D#10.
  18798. The filter accepts the following options:
  18799. @table @option
  18800. @item size, s
  18801. Specify the video size for the output. It must be even. For the syntax of this option,
  18802. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18803. Default value is @code{1920x1080}.
  18804. @item fps, rate, r
  18805. Set the output frame rate. Default value is @code{25}.
  18806. @item bar_h
  18807. Set the bargraph height. It must be even. Default value is @code{-1} which
  18808. computes the bargraph height automatically.
  18809. @item axis_h
  18810. Set the axis height. It must be even. Default value is @code{-1} which computes
  18811. the axis height automatically.
  18812. @item sono_h
  18813. Set the sonogram height. It must be even. Default value is @code{-1} which
  18814. computes the sonogram height automatically.
  18815. @item fullhd
  18816. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18817. instead. Default value is @code{1}.
  18818. @item sono_v, volume
  18819. Specify the sonogram volume expression. It can contain variables:
  18820. @table @option
  18821. @item bar_v
  18822. the @var{bar_v} evaluated expression
  18823. @item frequency, freq, f
  18824. the frequency where it is evaluated
  18825. @item timeclamp, tc
  18826. the value of @var{timeclamp} option
  18827. @end table
  18828. and functions:
  18829. @table @option
  18830. @item a_weighting(f)
  18831. A-weighting of equal loudness
  18832. @item b_weighting(f)
  18833. B-weighting of equal loudness
  18834. @item c_weighting(f)
  18835. C-weighting of equal loudness.
  18836. @end table
  18837. Default value is @code{16}.
  18838. @item bar_v, volume2
  18839. Specify the bargraph volume expression. It can contain variables:
  18840. @table @option
  18841. @item sono_v
  18842. the @var{sono_v} evaluated expression
  18843. @item frequency, freq, f
  18844. the frequency where it is evaluated
  18845. @item timeclamp, tc
  18846. the value of @var{timeclamp} option
  18847. @end table
  18848. and functions:
  18849. @table @option
  18850. @item a_weighting(f)
  18851. A-weighting of equal loudness
  18852. @item b_weighting(f)
  18853. B-weighting of equal loudness
  18854. @item c_weighting(f)
  18855. C-weighting of equal loudness.
  18856. @end table
  18857. Default value is @code{sono_v}.
  18858. @item sono_g, gamma
  18859. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18860. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18861. Acceptable range is @code{[1, 7]}.
  18862. @item bar_g, gamma2
  18863. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18864. @code{[1, 7]}.
  18865. @item bar_t
  18866. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18867. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18868. @item timeclamp, tc
  18869. Specify the transform timeclamp. At low frequency, there is trade-off between
  18870. accuracy in time domain and frequency domain. If timeclamp is lower,
  18871. event in time domain is represented more accurately (such as fast bass drum),
  18872. otherwise event in frequency domain is represented more accurately
  18873. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18874. @item attack
  18875. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18876. limits future samples by applying asymmetric windowing in time domain, useful
  18877. when low latency is required. Accepted range is @code{[0, 1]}.
  18878. @item basefreq
  18879. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18880. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18881. @item endfreq
  18882. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18883. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18884. @item coeffclamp
  18885. This option is deprecated and ignored.
  18886. @item tlength
  18887. Specify the transform length in time domain. Use this option to control accuracy
  18888. trade-off between time domain and frequency domain at every frequency sample.
  18889. It can contain variables:
  18890. @table @option
  18891. @item frequency, freq, f
  18892. the frequency where it is evaluated
  18893. @item timeclamp, tc
  18894. the value of @var{timeclamp} option.
  18895. @end table
  18896. Default value is @code{384*tc/(384+tc*f)}.
  18897. @item count
  18898. Specify the transform count for every video frame. Default value is @code{6}.
  18899. Acceptable range is @code{[1, 30]}.
  18900. @item fcount
  18901. Specify the transform count for every single pixel. Default value is @code{0},
  18902. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18903. @item fontfile
  18904. Specify font file for use with freetype to draw the axis. If not specified,
  18905. use embedded font. Note that drawing with font file or embedded font is not
  18906. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18907. option instead.
  18908. @item font
  18909. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18910. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18911. escaping.
  18912. @item fontcolor
  18913. Specify font color expression. This is arithmetic expression that should return
  18914. integer value 0xRRGGBB. It can contain variables:
  18915. @table @option
  18916. @item frequency, freq, f
  18917. the frequency where it is evaluated
  18918. @item timeclamp, tc
  18919. the value of @var{timeclamp} option
  18920. @end table
  18921. and functions:
  18922. @table @option
  18923. @item midi(f)
  18924. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  18925. @item r(x), g(x), b(x)
  18926. red, green, and blue value of intensity x.
  18927. @end table
  18928. Default value is @code{st(0, (midi(f)-59.5)/12);
  18929. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  18930. r(1-ld(1)) + b(ld(1))}.
  18931. @item axisfile
  18932. Specify image file to draw the axis. This option override @var{fontfile} and
  18933. @var{fontcolor} option.
  18934. @item axis, text
  18935. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  18936. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  18937. Default value is @code{1}.
  18938. @item csp
  18939. Set colorspace. The accepted values are:
  18940. @table @samp
  18941. @item unspecified
  18942. Unspecified (default)
  18943. @item bt709
  18944. BT.709
  18945. @item fcc
  18946. FCC
  18947. @item bt470bg
  18948. BT.470BG or BT.601-6 625
  18949. @item smpte170m
  18950. SMPTE-170M or BT.601-6 525
  18951. @item smpte240m
  18952. SMPTE-240M
  18953. @item bt2020ncl
  18954. BT.2020 with non-constant luminance
  18955. @end table
  18956. @item cscheme
  18957. Set spectrogram color scheme. This is list of floating point values with format
  18958. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  18959. The default is @code{1|0.5|0|0|0.5|1}.
  18960. @end table
  18961. @subsection Examples
  18962. @itemize
  18963. @item
  18964. Playing audio while showing the spectrum:
  18965. @example
  18966. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  18967. @end example
  18968. @item
  18969. Same as above, but with frame rate 30 fps:
  18970. @example
  18971. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  18972. @end example
  18973. @item
  18974. Playing at 1280x720:
  18975. @example
  18976. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  18977. @end example
  18978. @item
  18979. Disable sonogram display:
  18980. @example
  18981. sono_h=0
  18982. @end example
  18983. @item
  18984. A1 and its harmonics: A1, A2, (near)E3, A3:
  18985. @example
  18986. 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),
  18987. asplit[a][out1]; [a] showcqt [out0]'
  18988. @end example
  18989. @item
  18990. Same as above, but with more accuracy in frequency domain:
  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=timeclamp=0.5 [out0]'
  18994. @end example
  18995. @item
  18996. Custom volume:
  18997. @example
  18998. bar_v=10:sono_v=bar_v*a_weighting(f)
  18999. @end example
  19000. @item
  19001. Custom gamma, now spectrum is linear to the amplitude.
  19002. @example
  19003. bar_g=2:sono_g=2
  19004. @end example
  19005. @item
  19006. Custom tlength equation:
  19007. @example
  19008. 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)))'
  19009. @end example
  19010. @item
  19011. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  19012. @example
  19013. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  19014. @end example
  19015. @item
  19016. Custom font using fontconfig:
  19017. @example
  19018. font='Courier New,Monospace,mono|bold'
  19019. @end example
  19020. @item
  19021. Custom frequency range with custom axis using image file:
  19022. @example
  19023. axisfile=myaxis.png:basefreq=40:endfreq=10000
  19024. @end example
  19025. @end itemize
  19026. @section showfreqs
  19027. Convert input audio to video output representing the audio power spectrum.
  19028. Audio amplitude is on Y-axis while frequency is on X-axis.
  19029. The filter accepts the following options:
  19030. @table @option
  19031. @item size, s
  19032. Specify size of video. For the syntax of this option, check the
  19033. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19034. Default is @code{1024x512}.
  19035. @item mode
  19036. Set display mode.
  19037. This set how each frequency bin will be represented.
  19038. It accepts the following values:
  19039. @table @samp
  19040. @item line
  19041. @item bar
  19042. @item dot
  19043. @end table
  19044. Default is @code{bar}.
  19045. @item ascale
  19046. Set amplitude scale.
  19047. It accepts the following values:
  19048. @table @samp
  19049. @item lin
  19050. Linear scale.
  19051. @item sqrt
  19052. Square root scale.
  19053. @item cbrt
  19054. Cubic root scale.
  19055. @item log
  19056. Logarithmic scale.
  19057. @end table
  19058. Default is @code{log}.
  19059. @item fscale
  19060. Set frequency scale.
  19061. It accepts the following values:
  19062. @table @samp
  19063. @item lin
  19064. Linear scale.
  19065. @item log
  19066. Logarithmic scale.
  19067. @item rlog
  19068. Reverse logarithmic scale.
  19069. @end table
  19070. Default is @code{lin}.
  19071. @item win_size
  19072. Set window size. Allowed range is from 16 to 65536.
  19073. Default is @code{2048}
  19074. @item win_func
  19075. Set windowing function.
  19076. It accepts the following values:
  19077. @table @samp
  19078. @item rect
  19079. @item bartlett
  19080. @item hanning
  19081. @item hamming
  19082. @item blackman
  19083. @item welch
  19084. @item flattop
  19085. @item bharris
  19086. @item bnuttall
  19087. @item bhann
  19088. @item sine
  19089. @item nuttall
  19090. @item lanczos
  19091. @item gauss
  19092. @item tukey
  19093. @item dolph
  19094. @item cauchy
  19095. @item parzen
  19096. @item poisson
  19097. @item bohman
  19098. @end table
  19099. Default is @code{hanning}.
  19100. @item overlap
  19101. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19102. which means optimal overlap for selected window function will be picked.
  19103. @item averaging
  19104. Set time averaging. Setting this to 0 will display current maximal peaks.
  19105. Default is @code{1}, which means time averaging is disabled.
  19106. @item colors
  19107. Specify list of colors separated by space or by '|' which will be used to
  19108. draw channel frequencies. Unrecognized or missing colors will be replaced
  19109. by white color.
  19110. @item cmode
  19111. Set channel display mode.
  19112. It accepts the following values:
  19113. @table @samp
  19114. @item combined
  19115. @item separate
  19116. @end table
  19117. Default is @code{combined}.
  19118. @item minamp
  19119. Set minimum amplitude used in @code{log} amplitude scaler.
  19120. @end table
  19121. @section showspatial
  19122. Convert stereo input audio to a video output, representing the spatial relationship
  19123. between two channels.
  19124. The filter accepts the following options:
  19125. @table @option
  19126. @item size, s
  19127. Specify the video size for the output. For the syntax of this option, check the
  19128. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19129. Default value is @code{512x512}.
  19130. @item win_size
  19131. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19132. @item win_func
  19133. Set window function.
  19134. It accepts the following values:
  19135. @table @samp
  19136. @item rect
  19137. @item bartlett
  19138. @item hann
  19139. @item hanning
  19140. @item hamming
  19141. @item blackman
  19142. @item welch
  19143. @item flattop
  19144. @item bharris
  19145. @item bnuttall
  19146. @item bhann
  19147. @item sine
  19148. @item nuttall
  19149. @item lanczos
  19150. @item gauss
  19151. @item tukey
  19152. @item dolph
  19153. @item cauchy
  19154. @item parzen
  19155. @item poisson
  19156. @item bohman
  19157. @end table
  19158. Default value is @code{hann}.
  19159. @item overlap
  19160. Set ratio of overlap window. Default value is @code{0.5}.
  19161. When value is @code{1} overlap is set to recommended size for specific
  19162. window function currently used.
  19163. @end table
  19164. @anchor{showspectrum}
  19165. @section showspectrum
  19166. Convert input audio to a video output, representing the audio frequency
  19167. spectrum.
  19168. The filter accepts the following options:
  19169. @table @option
  19170. @item size, s
  19171. Specify the video size for the output. For the syntax of this option, check the
  19172. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19173. Default value is @code{640x512}.
  19174. @item slide
  19175. Specify how the spectrum should slide along the window.
  19176. It accepts the following values:
  19177. @table @samp
  19178. @item replace
  19179. the samples start again on the left when they reach the right
  19180. @item scroll
  19181. the samples scroll from right to left
  19182. @item fullframe
  19183. frames are only produced when the samples reach the right
  19184. @item rscroll
  19185. the samples scroll from left to right
  19186. @end table
  19187. Default value is @code{replace}.
  19188. @item mode
  19189. Specify display mode.
  19190. It accepts the following values:
  19191. @table @samp
  19192. @item combined
  19193. all channels are displayed in the same row
  19194. @item separate
  19195. all channels are displayed in separate rows
  19196. @end table
  19197. Default value is @samp{combined}.
  19198. @item color
  19199. Specify display color mode.
  19200. It accepts the following values:
  19201. @table @samp
  19202. @item channel
  19203. each channel is displayed in a separate color
  19204. @item intensity
  19205. each channel is displayed using the same color scheme
  19206. @item rainbow
  19207. each channel is displayed using the rainbow color scheme
  19208. @item moreland
  19209. each channel is displayed using the moreland color scheme
  19210. @item nebulae
  19211. each channel is displayed using the nebulae color scheme
  19212. @item fire
  19213. each channel is displayed using the fire color scheme
  19214. @item fiery
  19215. each channel is displayed using the fiery color scheme
  19216. @item fruit
  19217. each channel is displayed using the fruit color scheme
  19218. @item cool
  19219. each channel is displayed using the cool color scheme
  19220. @item magma
  19221. each channel is displayed using the magma color scheme
  19222. @item green
  19223. each channel is displayed using the green color scheme
  19224. @item viridis
  19225. each channel is displayed using the viridis color scheme
  19226. @item plasma
  19227. each channel is displayed using the plasma color scheme
  19228. @item cividis
  19229. each channel is displayed using the cividis color scheme
  19230. @item terrain
  19231. each channel is displayed using the terrain color scheme
  19232. @end table
  19233. Default value is @samp{channel}.
  19234. @item scale
  19235. Specify scale used for calculating intensity color values.
  19236. It accepts the following values:
  19237. @table @samp
  19238. @item lin
  19239. linear
  19240. @item sqrt
  19241. square root, default
  19242. @item cbrt
  19243. cubic root
  19244. @item log
  19245. logarithmic
  19246. @item 4thrt
  19247. 4th root
  19248. @item 5thrt
  19249. 5th root
  19250. @end table
  19251. Default value is @samp{sqrt}.
  19252. @item fscale
  19253. Specify frequency scale.
  19254. It accepts the following values:
  19255. @table @samp
  19256. @item lin
  19257. linear
  19258. @item log
  19259. logarithmic
  19260. @end table
  19261. Default value is @samp{lin}.
  19262. @item saturation
  19263. Set saturation modifier for displayed colors. Negative values provide
  19264. alternative color scheme. @code{0} is no saturation at all.
  19265. Saturation must be in [-10.0, 10.0] range.
  19266. Default value is @code{1}.
  19267. @item win_func
  19268. Set window function.
  19269. It accepts the following values:
  19270. @table @samp
  19271. @item rect
  19272. @item bartlett
  19273. @item hann
  19274. @item hanning
  19275. @item hamming
  19276. @item blackman
  19277. @item welch
  19278. @item flattop
  19279. @item bharris
  19280. @item bnuttall
  19281. @item bhann
  19282. @item sine
  19283. @item nuttall
  19284. @item lanczos
  19285. @item gauss
  19286. @item tukey
  19287. @item dolph
  19288. @item cauchy
  19289. @item parzen
  19290. @item poisson
  19291. @item bohman
  19292. @end table
  19293. Default value is @code{hann}.
  19294. @item orientation
  19295. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19296. @code{horizontal}. Default is @code{vertical}.
  19297. @item overlap
  19298. Set ratio of overlap window. Default value is @code{0}.
  19299. When value is @code{1} overlap is set to recommended size for specific
  19300. window function currently used.
  19301. @item gain
  19302. Set scale gain for calculating intensity color values.
  19303. Default value is @code{1}.
  19304. @item data
  19305. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19306. @item rotation
  19307. Set color rotation, must be in [-1.0, 1.0] range.
  19308. Default value is @code{0}.
  19309. @item start
  19310. Set start frequency from which to display spectrogram. Default is @code{0}.
  19311. @item stop
  19312. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19313. @item fps
  19314. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19315. @item legend
  19316. Draw time and frequency axes and legends. Default is disabled.
  19317. @end table
  19318. The usage is very similar to the showwaves filter; see the examples in that
  19319. section.
  19320. @subsection Examples
  19321. @itemize
  19322. @item
  19323. Large window with logarithmic color scaling:
  19324. @example
  19325. showspectrum=s=1280x480:scale=log
  19326. @end example
  19327. @item
  19328. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19329. @example
  19330. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19331. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19332. @end example
  19333. @end itemize
  19334. @section showspectrumpic
  19335. Convert input audio to a single video frame, representing the audio frequency
  19336. spectrum.
  19337. The filter accepts the following options:
  19338. @table @option
  19339. @item size, s
  19340. Specify the video size for the output. For the syntax of this option, check the
  19341. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19342. Default value is @code{4096x2048}.
  19343. @item mode
  19344. Specify display mode.
  19345. It accepts the following values:
  19346. @table @samp
  19347. @item combined
  19348. all channels are displayed in the same row
  19349. @item separate
  19350. all channels are displayed in separate rows
  19351. @end table
  19352. Default value is @samp{combined}.
  19353. @item color
  19354. Specify display color mode.
  19355. It accepts the following values:
  19356. @table @samp
  19357. @item channel
  19358. each channel is displayed in a separate color
  19359. @item intensity
  19360. each channel is displayed using the same color scheme
  19361. @item rainbow
  19362. each channel is displayed using the rainbow color scheme
  19363. @item moreland
  19364. each channel is displayed using the moreland color scheme
  19365. @item nebulae
  19366. each channel is displayed using the nebulae color scheme
  19367. @item fire
  19368. each channel is displayed using the fire color scheme
  19369. @item fiery
  19370. each channel is displayed using the fiery color scheme
  19371. @item fruit
  19372. each channel is displayed using the fruit color scheme
  19373. @item cool
  19374. each channel is displayed using the cool color scheme
  19375. @item magma
  19376. each channel is displayed using the magma color scheme
  19377. @item green
  19378. each channel is displayed using the green color scheme
  19379. @item viridis
  19380. each channel is displayed using the viridis color scheme
  19381. @item plasma
  19382. each channel is displayed using the plasma color scheme
  19383. @item cividis
  19384. each channel is displayed using the cividis color scheme
  19385. @item terrain
  19386. each channel is displayed using the terrain color scheme
  19387. @end table
  19388. Default value is @samp{intensity}.
  19389. @item scale
  19390. Specify scale used for calculating intensity color values.
  19391. It accepts the following values:
  19392. @table @samp
  19393. @item lin
  19394. linear
  19395. @item sqrt
  19396. square root, default
  19397. @item cbrt
  19398. cubic root
  19399. @item log
  19400. logarithmic
  19401. @item 4thrt
  19402. 4th root
  19403. @item 5thrt
  19404. 5th root
  19405. @end table
  19406. Default value is @samp{log}.
  19407. @item fscale
  19408. Specify frequency scale.
  19409. It accepts the following values:
  19410. @table @samp
  19411. @item lin
  19412. linear
  19413. @item log
  19414. logarithmic
  19415. @end table
  19416. Default value is @samp{lin}.
  19417. @item saturation
  19418. Set saturation modifier for displayed colors. Negative values provide
  19419. alternative color scheme. @code{0} is no saturation at all.
  19420. Saturation must be in [-10.0, 10.0] range.
  19421. Default value is @code{1}.
  19422. @item win_func
  19423. Set window function.
  19424. It accepts the following values:
  19425. @table @samp
  19426. @item rect
  19427. @item bartlett
  19428. @item hann
  19429. @item hanning
  19430. @item hamming
  19431. @item blackman
  19432. @item welch
  19433. @item flattop
  19434. @item bharris
  19435. @item bnuttall
  19436. @item bhann
  19437. @item sine
  19438. @item nuttall
  19439. @item lanczos
  19440. @item gauss
  19441. @item tukey
  19442. @item dolph
  19443. @item cauchy
  19444. @item parzen
  19445. @item poisson
  19446. @item bohman
  19447. @end table
  19448. Default value is @code{hann}.
  19449. @item orientation
  19450. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19451. @code{horizontal}. Default is @code{vertical}.
  19452. @item gain
  19453. Set scale gain for calculating intensity color values.
  19454. Default value is @code{1}.
  19455. @item legend
  19456. Draw time and frequency axes and legends. Default is enabled.
  19457. @item rotation
  19458. Set color rotation, must be in [-1.0, 1.0] range.
  19459. Default value is @code{0}.
  19460. @item start
  19461. Set start frequency from which to display spectrogram. Default is @code{0}.
  19462. @item stop
  19463. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19464. @end table
  19465. @subsection Examples
  19466. @itemize
  19467. @item
  19468. Extract an audio spectrogram of a whole audio track
  19469. in a 1024x1024 picture using @command{ffmpeg}:
  19470. @example
  19471. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19472. @end example
  19473. @end itemize
  19474. @section showvolume
  19475. Convert input audio volume to a video output.
  19476. The filter accepts the following options:
  19477. @table @option
  19478. @item rate, r
  19479. Set video rate.
  19480. @item b
  19481. Set border width, allowed range is [0, 5]. Default is 1.
  19482. @item w
  19483. Set channel width, allowed range is [80, 8192]. Default is 400.
  19484. @item h
  19485. Set channel height, allowed range is [1, 900]. Default is 20.
  19486. @item f
  19487. Set fade, allowed range is [0, 1]. Default is 0.95.
  19488. @item c
  19489. Set volume color expression.
  19490. The expression can use the following variables:
  19491. @table @option
  19492. @item VOLUME
  19493. Current max volume of channel in dB.
  19494. @item PEAK
  19495. Current peak.
  19496. @item CHANNEL
  19497. Current channel number, starting from 0.
  19498. @end table
  19499. @item t
  19500. If set, displays channel names. Default is enabled.
  19501. @item v
  19502. If set, displays volume values. Default is enabled.
  19503. @item o
  19504. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19505. default is @code{h}.
  19506. @item s
  19507. Set step size, allowed range is [0, 5]. Default is 0, which means
  19508. step is disabled.
  19509. @item p
  19510. Set background opacity, allowed range is [0, 1]. Default is 0.
  19511. @item m
  19512. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19513. default is @code{p}.
  19514. @item ds
  19515. Set display scale, can be linear: @code{lin} or log: @code{log},
  19516. default is @code{lin}.
  19517. @item dm
  19518. In second.
  19519. If set to > 0., display a line for the max level
  19520. in the previous seconds.
  19521. default is disabled: @code{0.}
  19522. @item dmc
  19523. The color of the max line. Use when @code{dm} option is set to > 0.
  19524. default is: @code{orange}
  19525. @end table
  19526. @section showwaves
  19527. Convert input audio to a video output, representing the samples waves.
  19528. The filter accepts the following options:
  19529. @table @option
  19530. @item size, s
  19531. Specify the video size for the output. For the syntax of this option, check the
  19532. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19533. Default value is @code{600x240}.
  19534. @item mode
  19535. Set display mode.
  19536. Available values are:
  19537. @table @samp
  19538. @item point
  19539. Draw a point for each sample.
  19540. @item line
  19541. Draw a vertical line for each sample.
  19542. @item p2p
  19543. Draw a point for each sample and a line between them.
  19544. @item cline
  19545. Draw a centered vertical line for each sample.
  19546. @end table
  19547. Default value is @code{point}.
  19548. @item n
  19549. Set the number of samples which are printed on the same column. A
  19550. larger value will decrease the frame rate. Must be a positive
  19551. integer. This option can be set only if the value for @var{rate}
  19552. is not explicitly specified.
  19553. @item rate, r
  19554. Set the (approximate) output frame rate. This is done by setting the
  19555. option @var{n}. Default value is "25".
  19556. @item split_channels
  19557. Set if channels should be drawn separately or overlap. Default value is 0.
  19558. @item colors
  19559. Set colors separated by '|' which are going to be used for drawing of each channel.
  19560. @item scale
  19561. Set amplitude scale.
  19562. Available values are:
  19563. @table @samp
  19564. @item lin
  19565. Linear.
  19566. @item log
  19567. Logarithmic.
  19568. @item sqrt
  19569. Square root.
  19570. @item cbrt
  19571. Cubic root.
  19572. @end table
  19573. Default is linear.
  19574. @item draw
  19575. Set the draw mode. This is mostly useful to set for high @var{n}.
  19576. Available values are:
  19577. @table @samp
  19578. @item scale
  19579. Scale pixel values for each drawn sample.
  19580. @item full
  19581. Draw every sample directly.
  19582. @end table
  19583. Default value is @code{scale}.
  19584. @end table
  19585. @subsection Examples
  19586. @itemize
  19587. @item
  19588. Output the input file audio and the corresponding video representation
  19589. at the same time:
  19590. @example
  19591. amovie=a.mp3,asplit[out0],showwaves[out1]
  19592. @end example
  19593. @item
  19594. Create a synthetic signal and show it with showwaves, forcing a
  19595. frame rate of 30 frames per second:
  19596. @example
  19597. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19598. @end example
  19599. @end itemize
  19600. @section showwavespic
  19601. Convert input audio to a single video frame, representing the samples waves.
  19602. The filter accepts the following options:
  19603. @table @option
  19604. @item size, s
  19605. Specify the video size for the output. For the syntax of this option, check the
  19606. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19607. Default value is @code{600x240}.
  19608. @item split_channels
  19609. Set if channels should be drawn separately or overlap. Default value is 0.
  19610. @item colors
  19611. Set colors separated by '|' which are going to be used for drawing of each channel.
  19612. @item scale
  19613. Set amplitude scale.
  19614. Available values are:
  19615. @table @samp
  19616. @item lin
  19617. Linear.
  19618. @item log
  19619. Logarithmic.
  19620. @item sqrt
  19621. Square root.
  19622. @item cbrt
  19623. Cubic root.
  19624. @end table
  19625. Default is linear.
  19626. @item draw
  19627. Set the draw mode.
  19628. Available values are:
  19629. @table @samp
  19630. @item scale
  19631. Scale pixel values for each drawn sample.
  19632. @item full
  19633. Draw every sample directly.
  19634. @end table
  19635. Default value is @code{scale}.
  19636. @item filter
  19637. Set the filter mode.
  19638. Available values are:
  19639. @table @samp
  19640. @item average
  19641. Use average samples values for each drawn sample.
  19642. @item peak
  19643. Use peak samples values for each drawn sample.
  19644. @end table
  19645. Default value is @code{average}.
  19646. @end table
  19647. @subsection Examples
  19648. @itemize
  19649. @item
  19650. Extract a channel split representation of the wave form of a whole audio track
  19651. in a 1024x800 picture using @command{ffmpeg}:
  19652. @example
  19653. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19654. @end example
  19655. @end itemize
  19656. @section sidedata, asidedata
  19657. Delete frame side data, or select frames based on it.
  19658. This filter accepts the following options:
  19659. @table @option
  19660. @item mode
  19661. Set mode of operation of the filter.
  19662. Can be one of the following:
  19663. @table @samp
  19664. @item select
  19665. Select every frame with side data of @code{type}.
  19666. @item delete
  19667. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19668. data in the frame.
  19669. @end table
  19670. @item type
  19671. Set side data type used with all modes. Must be set for @code{select} mode. For
  19672. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19673. in @file{libavutil/frame.h}. For example, to choose
  19674. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19675. @end table
  19676. @section spectrumsynth
  19677. Synthesize audio from 2 input video spectrums, first input stream represents
  19678. magnitude across time and second represents phase across time.
  19679. The filter will transform from frequency domain as displayed in videos back
  19680. to time domain as presented in audio output.
  19681. This filter is primarily created for reversing processed @ref{showspectrum}
  19682. filter outputs, but can synthesize sound from other spectrograms too.
  19683. But in such case results are going to be poor if the phase data is not
  19684. available, because in such cases phase data need to be recreated, usually
  19685. it's just recreated from random noise.
  19686. For best results use gray only output (@code{channel} color mode in
  19687. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19688. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19689. @code{data} option. Inputs videos should generally use @code{fullframe}
  19690. slide mode as that saves resources needed for decoding video.
  19691. The filter accepts the following options:
  19692. @table @option
  19693. @item sample_rate
  19694. Specify sample rate of output audio, the sample rate of audio from which
  19695. spectrum was generated may differ.
  19696. @item channels
  19697. Set number of channels represented in input video spectrums.
  19698. @item scale
  19699. Set scale which was used when generating magnitude input spectrum.
  19700. Can be @code{lin} or @code{log}. Default is @code{log}.
  19701. @item slide
  19702. Set slide which was used when generating inputs spectrums.
  19703. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19704. Default is @code{fullframe}.
  19705. @item win_func
  19706. Set window function used for resynthesis.
  19707. @item overlap
  19708. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19709. which means optimal overlap for selected window function will be picked.
  19710. @item orientation
  19711. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19712. Default is @code{vertical}.
  19713. @end table
  19714. @subsection Examples
  19715. @itemize
  19716. @item
  19717. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19718. then resynthesize videos back to audio with spectrumsynth:
  19719. @example
  19720. 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
  19721. 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
  19722. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19723. @end example
  19724. @end itemize
  19725. @section split, asplit
  19726. Split input into several identical outputs.
  19727. @code{asplit} works with audio input, @code{split} with video.
  19728. The filter accepts a single parameter which specifies the number of outputs. If
  19729. unspecified, it defaults to 2.
  19730. @subsection Examples
  19731. @itemize
  19732. @item
  19733. Create two separate outputs from the same input:
  19734. @example
  19735. [in] split [out0][out1]
  19736. @end example
  19737. @item
  19738. To create 3 or more outputs, you need to specify the number of
  19739. outputs, like in:
  19740. @example
  19741. [in] asplit=3 [out0][out1][out2]
  19742. @end example
  19743. @item
  19744. Create two separate outputs from the same input, one cropped and
  19745. one padded:
  19746. @example
  19747. [in] split [splitout1][splitout2];
  19748. [splitout1] crop=100:100:0:0 [cropout];
  19749. [splitout2] pad=200:200:100:100 [padout];
  19750. @end example
  19751. @item
  19752. Create 5 copies of the input audio with @command{ffmpeg}:
  19753. @example
  19754. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19755. @end example
  19756. @end itemize
  19757. @section zmq, azmq
  19758. Receive commands sent through a libzmq client, and forward them to
  19759. filters in the filtergraph.
  19760. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19761. must be inserted between two video filters, @code{azmq} between two
  19762. audio filters. Both are capable to send messages to any filter type.
  19763. To enable these filters you need to install the libzmq library and
  19764. headers and configure FFmpeg with @code{--enable-libzmq}.
  19765. For more information about libzmq see:
  19766. @url{http://www.zeromq.org/}
  19767. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19768. receives messages sent through a network interface defined by the
  19769. @option{bind_address} (or the abbreviation "@option{b}") option.
  19770. Default value of this option is @file{tcp://localhost:5555}. You may
  19771. want to alter this value to your needs, but do not forget to escape any
  19772. ':' signs (see @ref{filtergraph escaping}).
  19773. The received message must be in the form:
  19774. @example
  19775. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19776. @end example
  19777. @var{TARGET} specifies the target of the command, usually the name of
  19778. the filter class or a specific filter instance name. The default
  19779. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19780. but you can override this by using the @samp{filter_name@@id} syntax
  19781. (see @ref{Filtergraph syntax}).
  19782. @var{COMMAND} specifies the name of the command for the target filter.
  19783. @var{ARG} is optional and specifies the optional argument list for the
  19784. given @var{COMMAND}.
  19785. Upon reception, the message is processed and the corresponding command
  19786. is injected into the filtergraph. Depending on the result, the filter
  19787. will send a reply to the client, adopting the format:
  19788. @example
  19789. @var{ERROR_CODE} @var{ERROR_REASON}
  19790. @var{MESSAGE}
  19791. @end example
  19792. @var{MESSAGE} is optional.
  19793. @subsection Examples
  19794. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19795. be used to send commands processed by these filters.
  19796. Consider the following filtergraph generated by @command{ffplay}.
  19797. In this example the last overlay filter has an instance name. All other
  19798. filters will have default instance names.
  19799. @example
  19800. ffplay -dumpgraph 1 -f lavfi "
  19801. color=s=100x100:c=red [l];
  19802. color=s=100x100:c=blue [r];
  19803. nullsrc=s=200x100, zmq [bg];
  19804. [bg][l] overlay [bg+l];
  19805. [bg+l][r] overlay@@my=x=100 "
  19806. @end example
  19807. To change the color of the left side of the video, the following
  19808. command can be used:
  19809. @example
  19810. echo Parsed_color_0 c yellow | tools/zmqsend
  19811. @end example
  19812. To change the right side:
  19813. @example
  19814. echo Parsed_color_1 c pink | tools/zmqsend
  19815. @end example
  19816. To change the position of the right side:
  19817. @example
  19818. echo overlay@@my x 150 | tools/zmqsend
  19819. @end example
  19820. @c man end MULTIMEDIA FILTERS
  19821. @chapter Multimedia Sources
  19822. @c man begin MULTIMEDIA SOURCES
  19823. Below is a description of the currently available multimedia sources.
  19824. @section amovie
  19825. This is the same as @ref{movie} source, except it selects an audio
  19826. stream by default.
  19827. @anchor{movie}
  19828. @section movie
  19829. Read audio and/or video stream(s) from a movie container.
  19830. It accepts the following parameters:
  19831. @table @option
  19832. @item filename
  19833. The name of the resource to read (not necessarily a file; it can also be a
  19834. device or a stream accessed through some protocol).
  19835. @item format_name, f
  19836. Specifies the format assumed for the movie to read, and can be either
  19837. the name of a container or an input device. If not specified, the
  19838. format is guessed from @var{movie_name} or by probing.
  19839. @item seek_point, sp
  19840. Specifies the seek point in seconds. The frames will be output
  19841. starting from this seek point. The parameter is evaluated with
  19842. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19843. postfix. The default value is "0".
  19844. @item streams, s
  19845. Specifies the streams to read. Several streams can be specified,
  19846. separated by "+". The source will then have as many outputs, in the
  19847. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19848. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19849. respectively the default (best suited) video and audio stream. Default
  19850. is "dv", or "da" if the filter is called as "amovie".
  19851. @item stream_index, si
  19852. Specifies the index of the video stream to read. If the value is -1,
  19853. the most suitable video stream will be automatically selected. The default
  19854. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19855. audio instead of video.
  19856. @item loop
  19857. Specifies how many times to read the stream in sequence.
  19858. If the value is 0, the stream will be looped infinitely.
  19859. Default value is "1".
  19860. Note that when the movie is looped the source timestamps are not
  19861. changed, so it will generate non monotonically increasing timestamps.
  19862. @item discontinuity
  19863. Specifies the time difference between frames above which the point is
  19864. considered a timestamp discontinuity which is removed by adjusting the later
  19865. timestamps.
  19866. @end table
  19867. It allows overlaying a second video on top of the main input of
  19868. a filtergraph, as shown in this graph:
  19869. @example
  19870. input -----------> deltapts0 --> overlay --> output
  19871. ^
  19872. |
  19873. movie --> scale--> deltapts1 -------+
  19874. @end example
  19875. @subsection Examples
  19876. @itemize
  19877. @item
  19878. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19879. on top of the input labelled "in":
  19880. @example
  19881. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19882. [in] setpts=PTS-STARTPTS [main];
  19883. [main][over] overlay=16:16 [out]
  19884. @end example
  19885. @item
  19886. Read from a video4linux2 device, and overlay it on top of the input
  19887. labelled "in":
  19888. @example
  19889. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19890. [in] setpts=PTS-STARTPTS [main];
  19891. [main][over] overlay=16:16 [out]
  19892. @end example
  19893. @item
  19894. Read the first video stream and the audio stream with id 0x81 from
  19895. dvd.vob; the video is connected to the pad named "video" and the audio is
  19896. connected to the pad named "audio":
  19897. @example
  19898. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19899. @end example
  19900. @end itemize
  19901. @subsection Commands
  19902. Both movie and amovie support the following commands:
  19903. @table @option
  19904. @item seek
  19905. Perform seek using "av_seek_frame".
  19906. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19907. @itemize
  19908. @item
  19909. @var{stream_index}: If stream_index is -1, a default
  19910. stream is selected, and @var{timestamp} is automatically converted
  19911. from AV_TIME_BASE units to the stream specific time_base.
  19912. @item
  19913. @var{timestamp}: Timestamp in AVStream.time_base units
  19914. or, if no stream is specified, in AV_TIME_BASE units.
  19915. @item
  19916. @var{flags}: Flags which select direction and seeking mode.
  19917. @end itemize
  19918. @item get_duration
  19919. Get movie duration in AV_TIME_BASE units.
  19920. @end table
  19921. @c man end MULTIMEDIA SOURCES