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.

27006 lines
715KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order for each band split. This controls filter roll-off or steepness
  413. of filter transfer function.
  414. Available values are:
  415. @table @samp
  416. @item 2nd
  417. 12 dB per octave.
  418. @item 4th
  419. 24 dB per octave.
  420. @item 6th
  421. 36 dB per octave.
  422. @item 8th
  423. 48 dB per octave.
  424. @item 10th
  425. 60 dB per octave.
  426. @item 12th
  427. 72 dB per octave.
  428. @item 14th
  429. 84 dB per octave.
  430. @item 16th
  431. 96 dB per octave.
  432. @item 18th
  433. 108 dB per octave.
  434. @item 20th
  435. 120 dB per octave.
  436. @end table
  437. Default is @var{4th}.
  438. @item level
  439. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  440. @item gains
  441. Set output gain for each band. Default value is 1 for all bands.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  447. each band will be in separate stream:
  448. @example
  449. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  450. @end example
  451. @item
  452. Same as above, but with higher filter order:
  453. @example
  454. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  455. @end example
  456. @item
  457. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  458. @example
  459. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500 8000:order=8th[LOW][MID][HIGH]' -map '[LOW]' low.wav -map '[MID]' mid.wav -map '[HIGH]' high.wav
  460. @end example
  461. @end itemize
  462. @section acrusher
  463. Reduce audio bit resolution.
  464. This filter is bit crusher with enhanced functionality. A bit crusher
  465. is used to audibly reduce number of bits an audio signal is sampled
  466. with. This doesn't change the bit depth at all, it just produces the
  467. effect. Material reduced in bit depth sounds more harsh and "digital".
  468. This filter is able to even round to continuous values instead of discrete
  469. bit depths.
  470. Additionally it has a D/C offset which results in different crushing of
  471. the lower and the upper half of the signal.
  472. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  473. Another feature of this filter is the logarithmic mode.
  474. This setting switches from linear distances between bits to logarithmic ones.
  475. The result is a much more "natural" sounding crusher which doesn't gate low
  476. signals for example. The human ear has a logarithmic perception,
  477. so this kind of crushing is much more pleasant.
  478. Logarithmic crushing is also able to get anti-aliased.
  479. The filter accepts the following options:
  480. @table @option
  481. @item level_in
  482. Set level in.
  483. @item level_out
  484. Set level out.
  485. @item bits
  486. Set bit reduction.
  487. @item mix
  488. Set mixing amount.
  489. @item mode
  490. Can be linear: @code{lin} or logarithmic: @code{log}.
  491. @item dc
  492. Set DC.
  493. @item aa
  494. Set anti-aliasing.
  495. @item samples
  496. Set sample reduction.
  497. @item lfo
  498. Enable LFO. By default disabled.
  499. @item lforange
  500. Set LFO range.
  501. @item lforate
  502. Set LFO rate.
  503. @end table
  504. @subsection Commands
  505. This filter supports the all above options as @ref{commands}.
  506. @section acue
  507. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  508. filter.
  509. @section adeclick
  510. Remove impulsive noise from input audio.
  511. Samples detected as impulsive noise are replaced by interpolated samples using
  512. autoregressive modelling.
  513. @table @option
  514. @item w
  515. Set window size, in milliseconds. Allowed range is from @code{10} to
  516. @code{100}. Default value is @code{55} milliseconds.
  517. This sets size of window which will be processed at once.
  518. @item o
  519. Set window overlap, in percentage of window size. Allowed range is from
  520. @code{50} to @code{95}. Default value is @code{75} percent.
  521. Setting this to a very high value increases impulsive noise removal but makes
  522. whole process much slower.
  523. @item a
  524. Set autoregression order, in percentage of window size. Allowed range is from
  525. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  526. controls quality of interpolated samples using neighbour good samples.
  527. @item t
  528. Set threshold value. Allowed range is from @code{1} to @code{100}.
  529. Default value is @code{2}.
  530. This controls the strength of impulsive noise which is going to be removed.
  531. The lower value, the more samples will be detected as impulsive noise.
  532. @item b
  533. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  534. @code{10}. Default value is @code{2}.
  535. If any two samples detected as noise are spaced less than this value then any
  536. sample between those two samples will be also detected as noise.
  537. @item m
  538. Set overlap method.
  539. It accepts the following values:
  540. @table @option
  541. @item a
  542. Select overlap-add method. Even not interpolated samples are slightly
  543. changed with this method.
  544. @item s
  545. Select overlap-save method. Not interpolated samples remain unchanged.
  546. @end table
  547. Default value is @code{a}.
  548. @end table
  549. @section adeclip
  550. Remove clipped samples from input audio.
  551. Samples detected as clipped are replaced by interpolated samples using
  552. autoregressive modelling.
  553. @table @option
  554. @item w
  555. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  556. Default value is @code{55} milliseconds.
  557. This sets size of window which will be processed at once.
  558. @item o
  559. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  560. to @code{95}. Default value is @code{75} percent.
  561. @item a
  562. Set autoregression order, in percentage of window size. Allowed range is from
  563. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  564. quality of interpolated samples using neighbour good samples.
  565. @item t
  566. Set threshold value. Allowed range is from @code{1} to @code{100}.
  567. Default value is @code{10}. Higher values make clip detection less aggressive.
  568. @item n
  569. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  570. Default value is @code{1000}. Higher values make clip detection less aggressive.
  571. @item m
  572. Set overlap method.
  573. It accepts the following values:
  574. @table @option
  575. @item a
  576. Select overlap-add method. Even not interpolated samples are slightly changed
  577. with this method.
  578. @item s
  579. Select overlap-save method. Not interpolated samples remain unchanged.
  580. @end table
  581. Default value is @code{a}.
  582. @end table
  583. @section adelay
  584. Delay one or more audio channels.
  585. Samples in delayed channel are filled with silence.
  586. The filter accepts the following option:
  587. @table @option
  588. @item delays
  589. Set list of delays in milliseconds for each channel separated by '|'.
  590. Unused delays will be silently ignored. If number of given delays is
  591. smaller than number of channels all remaining channels will not be delayed.
  592. If you want to delay exact number of samples, append 'S' to number.
  593. If you want instead to delay in seconds, append 's' to number.
  594. @item all
  595. Use last set delay for all remaining channels. By default is disabled.
  596. This option if enabled changes how option @code{delays} is interpreted.
  597. @end table
  598. @subsection Examples
  599. @itemize
  600. @item
  601. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  602. the second channel (and any other channels that may be present) unchanged.
  603. @example
  604. adelay=1500|0|500
  605. @end example
  606. @item
  607. Delay second channel by 500 samples, the third channel by 700 samples and leave
  608. the first channel (and any other channels that may be present) unchanged.
  609. @example
  610. adelay=0|500S|700S
  611. @end example
  612. @item
  613. Delay all channels by same number of samples:
  614. @example
  615. adelay=delays=64S:all=1
  616. @end example
  617. @end itemize
  618. @section adenorm
  619. Remedy denormals in audio by adding extremely low-level noise.
  620. This filter shall be placed before any filter that can produce denormals.
  621. A description of the accepted parameters follows.
  622. @table @option
  623. @item level
  624. Set level of added noise in dB. Default is @code{-351}.
  625. Allowed range is from -451 to -90.
  626. @item type
  627. Set type of added noise.
  628. @table @option
  629. @item dc
  630. Add DC signal.
  631. @item ac
  632. Add AC signal.
  633. @item square
  634. Add square signal.
  635. @item pulse
  636. Add pulse signal.
  637. @end table
  638. Default is @code{dc}.
  639. @end table
  640. @subsection Commands
  641. This filter supports the all above options as @ref{commands}.
  642. @section aderivative, aintegral
  643. Compute derivative/integral of audio stream.
  644. Applying both filters one after another produces original audio.
  645. @section aecho
  646. Apply echoing to the input audio.
  647. Echoes are reflected sound and can occur naturally amongst mountains
  648. (and sometimes large buildings) when talking or shouting; digital echo
  649. effects emulate this behaviour and are often used to help fill out the
  650. sound of a single instrument or vocal. The time difference between the
  651. original signal and the reflection is the @code{delay}, and the
  652. loudness of the reflected signal is the @code{decay}.
  653. Multiple echoes can have different delays and decays.
  654. A description of the accepted parameters follows.
  655. @table @option
  656. @item in_gain
  657. Set input gain of reflected signal. Default is @code{0.6}.
  658. @item out_gain
  659. Set output gain of reflected signal. Default is @code{0.3}.
  660. @item delays
  661. Set list of time intervals in milliseconds between original signal and reflections
  662. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  663. Default is @code{1000}.
  664. @item decays
  665. Set list of loudness of reflected signals separated by '|'.
  666. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  667. Default is @code{0.5}.
  668. @end table
  669. @subsection Examples
  670. @itemize
  671. @item
  672. Make it sound as if there are twice as many instruments as are actually playing:
  673. @example
  674. aecho=0.8:0.88:60:0.4
  675. @end example
  676. @item
  677. If delay is very short, then it sounds like a (metallic) robot playing music:
  678. @example
  679. aecho=0.8:0.88:6:0.4
  680. @end example
  681. @item
  682. A longer delay will sound like an open air concert in the mountains:
  683. @example
  684. aecho=0.8:0.9:1000:0.3
  685. @end example
  686. @item
  687. Same as above but with one more mountain:
  688. @example
  689. aecho=0.8:0.9:1000|1800:0.3|0.25
  690. @end example
  691. @end itemize
  692. @section aemphasis
  693. Audio emphasis filter creates or restores material directly taken from LPs or
  694. emphased CDs with different filter curves. E.g. to store music on vinyl the
  695. signal has to be altered by a filter first to even out the disadvantages of
  696. this recording medium.
  697. Once the material is played back the inverse filter has to be applied to
  698. restore the distortion of the frequency response.
  699. The filter accepts the following options:
  700. @table @option
  701. @item level_in
  702. Set input gain.
  703. @item level_out
  704. Set output gain.
  705. @item mode
  706. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  707. use @code{production} mode. Default is @code{reproduction} mode.
  708. @item type
  709. Set filter type. Selects medium. Can be one of the following:
  710. @table @option
  711. @item col
  712. select Columbia.
  713. @item emi
  714. select EMI.
  715. @item bsi
  716. select BSI (78RPM).
  717. @item riaa
  718. select RIAA.
  719. @item cd
  720. select Compact Disc (CD).
  721. @item 50fm
  722. select 50µs (FM).
  723. @item 75fm
  724. select 75µs (FM).
  725. @item 50kf
  726. select 50µs (FM-KF).
  727. @item 75kf
  728. select 75µs (FM-KF).
  729. @end table
  730. @end table
  731. @subsection Commands
  732. This filter supports the all above options as @ref{commands}.
  733. @section aeval
  734. Modify an audio signal according to the specified expressions.
  735. This filter accepts one or more expressions (one for each channel),
  736. which are evaluated and used to modify a corresponding audio signal.
  737. It accepts the following parameters:
  738. @table @option
  739. @item exprs
  740. Set the '|'-separated expressions list for each separate channel. If
  741. the number of input channels is greater than the number of
  742. expressions, the last specified expression is used for the remaining
  743. output channels.
  744. @item channel_layout, c
  745. Set output channel layout. If not specified, the channel layout is
  746. specified by the number of expressions. If set to @samp{same}, it will
  747. use by default the same input channel layout.
  748. @end table
  749. Each expression in @var{exprs} can contain the following constants and functions:
  750. @table @option
  751. @item ch
  752. channel number of the current expression
  753. @item n
  754. number of the evaluated sample, starting from 0
  755. @item s
  756. sample rate
  757. @item t
  758. time of the evaluated sample expressed in seconds
  759. @item nb_in_channels
  760. @item nb_out_channels
  761. input and output number of channels
  762. @item val(CH)
  763. the value of input channel with number @var{CH}
  764. @end table
  765. Note: this filter is slow. For faster processing you should use a
  766. dedicated filter.
  767. @subsection Examples
  768. @itemize
  769. @item
  770. Half volume:
  771. @example
  772. aeval=val(ch)/2:c=same
  773. @end example
  774. @item
  775. Invert phase of the second channel:
  776. @example
  777. aeval=val(0)|-val(1)
  778. @end example
  779. @end itemize
  780. @anchor{afade}
  781. @section afade
  782. Apply fade-in/out effect to input audio.
  783. A description of the accepted parameters follows.
  784. @table @option
  785. @item type, t
  786. Specify the effect type, can be either @code{in} for fade-in, or
  787. @code{out} for a fade-out effect. Default is @code{in}.
  788. @item start_sample, ss
  789. Specify the number of the start sample for starting to apply the fade
  790. effect. Default is 0.
  791. @item nb_samples, ns
  792. Specify the number of samples for which the fade effect has to last. At
  793. the end of the fade-in effect the output audio will have the same
  794. volume as the input audio, at the end of the fade-out transition
  795. the output audio will be silence. Default is 44100.
  796. @item start_time, st
  797. Specify the start time of the fade effect. Default is 0.
  798. The value must be specified as a time duration; see
  799. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  800. for the accepted syntax.
  801. If set this option is used instead of @var{start_sample}.
  802. @item duration, d
  803. Specify the duration of the fade effect. See
  804. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  805. for the accepted syntax.
  806. At the end of the fade-in effect the output audio will have the same
  807. volume as the input audio, at the end of the fade-out transition
  808. the output audio will be silence.
  809. By default the duration is determined by @var{nb_samples}.
  810. If set this option is used instead of @var{nb_samples}.
  811. @item curve
  812. Set curve for fade transition.
  813. It accepts the following values:
  814. @table @option
  815. @item tri
  816. select triangular, linear slope (default)
  817. @item qsin
  818. select quarter of sine wave
  819. @item hsin
  820. select half of sine wave
  821. @item esin
  822. select exponential sine wave
  823. @item log
  824. select logarithmic
  825. @item ipar
  826. select inverted parabola
  827. @item qua
  828. select quadratic
  829. @item cub
  830. select cubic
  831. @item squ
  832. select square root
  833. @item cbr
  834. select cubic root
  835. @item par
  836. select parabola
  837. @item exp
  838. select exponential
  839. @item iqsin
  840. select inverted quarter of sine wave
  841. @item ihsin
  842. select inverted half of sine wave
  843. @item dese
  844. select double-exponential seat
  845. @item desi
  846. select double-exponential sigmoid
  847. @item losi
  848. select logistic sigmoid
  849. @item sinc
  850. select sine cardinal function
  851. @item isinc
  852. select inverted sine cardinal function
  853. @item nofade
  854. no fade applied
  855. @end table
  856. @end table
  857. @subsection Commands
  858. This filter supports the all above options as @ref{commands}.
  859. @subsection Examples
  860. @itemize
  861. @item
  862. Fade in first 15 seconds of audio:
  863. @example
  864. afade=t=in:ss=0:d=15
  865. @end example
  866. @item
  867. Fade out last 25 seconds of a 900 seconds audio:
  868. @example
  869. afade=t=out:st=875:d=25
  870. @end example
  871. @end itemize
  872. @section afftdn
  873. Denoise audio samples with FFT.
  874. A description of the accepted parameters follows.
  875. @table @option
  876. @item nr
  877. Set the noise reduction in dB, allowed range is 0.01 to 97.
  878. Default value is 12 dB.
  879. @item nf
  880. Set the noise floor in dB, allowed range is -80 to -20.
  881. Default value is -50 dB.
  882. @item nt
  883. Set the noise type.
  884. It accepts the following values:
  885. @table @option
  886. @item w
  887. Select white noise.
  888. @item v
  889. Select vinyl noise.
  890. @item s
  891. Select shellac noise.
  892. @item c
  893. Select custom noise, defined in @code{bn} option.
  894. Default value is white noise.
  895. @end table
  896. @item bn
  897. Set custom band noise for every one of 15 bands.
  898. Bands are separated by ' ' or '|'.
  899. @item rf
  900. Set the residual floor in dB, allowed range is -80 to -20.
  901. Default value is -38 dB.
  902. @item tn
  903. Enable noise tracking. By default is disabled.
  904. With this enabled, noise floor is automatically adjusted.
  905. @item tr
  906. Enable residual tracking. By default is disabled.
  907. @item om
  908. Set the output mode.
  909. It accepts the following values:
  910. @table @option
  911. @item i
  912. Pass input unchanged.
  913. @item o
  914. Pass noise filtered out.
  915. @item n
  916. Pass only noise.
  917. Default value is @var{o}.
  918. @end table
  919. @end table
  920. @subsection Commands
  921. This filter supports the following commands:
  922. @table @option
  923. @item sample_noise, sn
  924. Start or stop measuring noise profile.
  925. Syntax for the command is : "start" or "stop" string.
  926. After measuring noise profile is stopped it will be
  927. automatically applied in filtering.
  928. @item noise_reduction, nr
  929. Change noise reduction. Argument is single float number.
  930. Syntax for the command is : "@var{noise_reduction}"
  931. @item noise_floor, nf
  932. Change noise floor. Argument is single float number.
  933. Syntax for the command is : "@var{noise_floor}"
  934. @item output_mode, om
  935. Change output mode operation.
  936. Syntax for the command is : "i", "o" or "n" string.
  937. @end table
  938. @section afftfilt
  939. Apply arbitrary expressions to samples in frequency domain.
  940. @table @option
  941. @item real
  942. Set frequency domain real expression for each separate channel separated
  943. by '|'. Default is "re".
  944. If the number of input channels is greater than the number of
  945. expressions, the last specified expression is used for the remaining
  946. output channels.
  947. @item imag
  948. Set frequency domain imaginary expression for each separate channel
  949. separated by '|'. Default is "im".
  950. Each expression in @var{real} and @var{imag} can contain the following
  951. constants and functions:
  952. @table @option
  953. @item sr
  954. sample rate
  955. @item b
  956. current frequency bin number
  957. @item nb
  958. number of available bins
  959. @item ch
  960. channel number of the current expression
  961. @item chs
  962. number of channels
  963. @item pts
  964. current frame pts
  965. @item re
  966. current real part of frequency bin of current channel
  967. @item im
  968. current imaginary part of frequency bin of current channel
  969. @item real(b, ch)
  970. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  971. @item imag(b, ch)
  972. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  973. @end table
  974. @item win_size
  975. Set window size. Allowed range is from 16 to 131072.
  976. Default is @code{4096}
  977. @item win_func
  978. Set window function. Default is @code{hann}.
  979. @item overlap
  980. Set window overlap. If set to 1, the recommended overlap for selected
  981. window function will be picked. Default is @code{0.75}.
  982. @end table
  983. @subsection Examples
  984. @itemize
  985. @item
  986. Leave almost only low frequencies in audio:
  987. @example
  988. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  989. @end example
  990. @item
  991. Apply robotize effect:
  992. @example
  993. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  994. @end example
  995. @item
  996. Apply whisper effect:
  997. @example
  998. 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"
  999. @end example
  1000. @end itemize
  1001. @anchor{afir}
  1002. @section afir
  1003. Apply an arbitrary Finite Impulse Response filter.
  1004. This filter is designed for applying long FIR filters,
  1005. up to 60 seconds long.
  1006. It can be used as component for digital crossover filters,
  1007. room equalization, cross talk cancellation, wavefield synthesis,
  1008. auralization, ambiophonics, ambisonics and spatialization.
  1009. This filter uses the streams higher than first one as FIR coefficients.
  1010. If the non-first stream holds a single channel, it will be used
  1011. for all input channels in the first stream, otherwise
  1012. the number of channels in the non-first stream must be same as
  1013. the number of channels in the first stream.
  1014. It accepts the following parameters:
  1015. @table @option
  1016. @item dry
  1017. Set dry gain. This sets input gain.
  1018. @item wet
  1019. Set wet gain. This sets final output gain.
  1020. @item length
  1021. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1022. @item gtype
  1023. Enable applying gain measured from power of IR.
  1024. Set which approach to use for auto gain measurement.
  1025. @table @option
  1026. @item none
  1027. Do not apply any gain.
  1028. @item peak
  1029. select peak gain, very conservative approach. This is default value.
  1030. @item dc
  1031. select DC gain, limited application.
  1032. @item gn
  1033. select gain to noise approach, this is most popular one.
  1034. @end table
  1035. @item irgain
  1036. Set gain to be applied to IR coefficients before filtering.
  1037. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1038. @item irfmt
  1039. Set format of IR stream. Can be @code{mono} or @code{input}.
  1040. Default is @code{input}.
  1041. @item maxir
  1042. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1043. Allowed range is 0.1 to 60 seconds.
  1044. @item response
  1045. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1046. By default it is disabled.
  1047. @item channel
  1048. Set for which IR channel to display frequency response. By default is first channel
  1049. displayed. This option is used only when @var{response} is enabled.
  1050. @item size
  1051. Set video stream size. This option is used only when @var{response} is enabled.
  1052. @item rate
  1053. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1054. @item minp
  1055. Set minimal partition size used for convolution. Default is @var{8192}.
  1056. Allowed range is from @var{1} to @var{32768}.
  1057. Lower values decreases latency at cost of higher CPU usage.
  1058. @item maxp
  1059. Set maximal partition size used for convolution. Default is @var{8192}.
  1060. Allowed range is from @var{8} to @var{32768}.
  1061. Lower values may increase CPU usage.
  1062. @item nbirs
  1063. Set number of input impulse responses streams which will be switchable at runtime.
  1064. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1065. @item ir
  1066. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1067. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1068. This option can be changed at runtime via @ref{commands}.
  1069. @end table
  1070. @subsection Examples
  1071. @itemize
  1072. @item
  1073. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1074. @example
  1075. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1076. @end example
  1077. @end itemize
  1078. @anchor{aformat}
  1079. @section aformat
  1080. Set output format constraints for the input audio. The framework will
  1081. negotiate the most appropriate format to minimize conversions.
  1082. It accepts the following parameters:
  1083. @table @option
  1084. @item sample_fmts, f
  1085. A '|'-separated list of requested sample formats.
  1086. @item sample_rates, r
  1087. A '|'-separated list of requested sample rates.
  1088. @item channel_layouts, cl
  1089. A '|'-separated list of requested channel layouts.
  1090. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1091. for the required syntax.
  1092. @end table
  1093. If a parameter is omitted, all values are allowed.
  1094. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1095. @example
  1096. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1097. @end example
  1098. @section afreqshift
  1099. Apply frequency shift to input audio samples.
  1100. The filter accepts the following options:
  1101. @table @option
  1102. @item shift
  1103. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1104. Default value is 0.0.
  1105. @item level
  1106. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1107. Default value is 1.0.
  1108. @end table
  1109. @subsection Commands
  1110. This filter supports the all above options as @ref{commands}.
  1111. @section agate
  1112. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1113. processing reduces disturbing noise between useful signals.
  1114. Gating is done by detecting the volume below a chosen level @var{threshold}
  1115. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1116. floor is set via @var{range}. Because an exact manipulation of the signal
  1117. would cause distortion of the waveform the reduction can be levelled over
  1118. time. This is done by setting @var{attack} and @var{release}.
  1119. @var{attack} determines how long the signal has to fall below the threshold
  1120. before any reduction will occur and @var{release} sets the time the signal
  1121. has to rise above the threshold to reduce the reduction again.
  1122. Shorter signals than the chosen attack time will be left untouched.
  1123. @table @option
  1124. @item level_in
  1125. Set input level before filtering.
  1126. Default is 1. Allowed range is from 0.015625 to 64.
  1127. @item mode
  1128. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1129. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1130. will be amplified, expanding dynamic range in upward direction.
  1131. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1132. @item range
  1133. Set the level of gain reduction when the signal is below the threshold.
  1134. Default is 0.06125. Allowed range is from 0 to 1.
  1135. Setting this to 0 disables reduction and then filter behaves like expander.
  1136. @item threshold
  1137. If a signal rises above this level the gain reduction is released.
  1138. Default is 0.125. Allowed range is from 0 to 1.
  1139. @item ratio
  1140. Set a ratio by which the signal is reduced.
  1141. Default is 2. Allowed range is from 1 to 9000.
  1142. @item attack
  1143. Amount of milliseconds the signal has to rise above the threshold before gain
  1144. reduction stops.
  1145. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1146. @item release
  1147. Amount of milliseconds the signal has to fall below the threshold before the
  1148. reduction is increased again. Default is 250 milliseconds.
  1149. Allowed range is from 0.01 to 9000.
  1150. @item makeup
  1151. Set amount of amplification of signal after processing.
  1152. Default is 1. Allowed range is from 1 to 64.
  1153. @item knee
  1154. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1155. Default is 2.828427125. Allowed range is from 1 to 8.
  1156. @item detection
  1157. Choose if exact signal should be taken for detection or an RMS like one.
  1158. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1159. @item link
  1160. Choose if the average level between all channels or the louder channel affects
  1161. the reduction.
  1162. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1163. @end table
  1164. @subsection Commands
  1165. This filter supports the all above options as @ref{commands}.
  1166. @section aiir
  1167. Apply an arbitrary Infinite Impulse Response filter.
  1168. It accepts the following parameters:
  1169. @table @option
  1170. @item zeros, z
  1171. Set B/numerator/zeros/reflection coefficients.
  1172. @item poles, p
  1173. Set A/denominator/poles/ladder coefficients.
  1174. @item gains, k
  1175. Set channels gains.
  1176. @item dry_gain
  1177. Set input gain.
  1178. @item wet_gain
  1179. Set output gain.
  1180. @item format, f
  1181. Set coefficients format.
  1182. @table @samp
  1183. @item ll
  1184. lattice-ladder function
  1185. @item sf
  1186. analog transfer function
  1187. @item tf
  1188. digital transfer function
  1189. @item zp
  1190. Z-plane zeros/poles, cartesian (default)
  1191. @item pr
  1192. Z-plane zeros/poles, polar radians
  1193. @item pd
  1194. Z-plane zeros/poles, polar degrees
  1195. @item sp
  1196. S-plane zeros/poles
  1197. @end table
  1198. @item process, r
  1199. Set type of processing.
  1200. @table @samp
  1201. @item d
  1202. direct processing
  1203. @item s
  1204. serial processing
  1205. @item p
  1206. parallel processing
  1207. @end table
  1208. @item precision, e
  1209. Set filtering precision.
  1210. @table @samp
  1211. @item dbl
  1212. double-precision floating-point (default)
  1213. @item flt
  1214. single-precision floating-point
  1215. @item i32
  1216. 32-bit integers
  1217. @item i16
  1218. 16-bit integers
  1219. @end table
  1220. @item normalize, n
  1221. Normalize filter coefficients, by default is enabled.
  1222. Enabling it will normalize magnitude response at DC to 0dB.
  1223. @item mix
  1224. How much to use filtered signal in output. Default is 1.
  1225. Range is between 0 and 1.
  1226. @item response
  1227. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1228. By default it is disabled.
  1229. @item channel
  1230. Set for which IR channel to display frequency response. By default is first channel
  1231. displayed. This option is used only when @var{response} is enabled.
  1232. @item size
  1233. Set video stream size. This option is used only when @var{response} is enabled.
  1234. @end table
  1235. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1236. order.
  1237. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1238. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1239. imaginary unit.
  1240. Different coefficients and gains can be provided for every channel, in such case
  1241. use '|' to separate coefficients or gains. Last provided coefficients will be
  1242. used for all remaining channels.
  1243. @subsection Examples
  1244. @itemize
  1245. @item
  1246. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1247. @example
  1248. 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
  1249. @end example
  1250. @item
  1251. Same as above but in @code{zp} format:
  1252. @example
  1253. 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
  1254. @end example
  1255. @item
  1256. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1257. @example
  1258. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1259. @end example
  1260. @end itemize
  1261. @section alimiter
  1262. The limiter prevents an input signal from rising over a desired threshold.
  1263. This limiter uses lookahead technology to prevent your signal from distorting.
  1264. It means that there is a small delay after the signal is processed. Keep in mind
  1265. that the delay it produces is the attack time you set.
  1266. The filter accepts the following options:
  1267. @table @option
  1268. @item level_in
  1269. Set input gain. Default is 1.
  1270. @item level_out
  1271. Set output gain. Default is 1.
  1272. @item limit
  1273. Don't let signals above this level pass the limiter. Default is 1.
  1274. @item attack
  1275. The limiter will reach its attenuation level in this amount of time in
  1276. milliseconds. Default is 5 milliseconds.
  1277. @item release
  1278. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1279. Default is 50 milliseconds.
  1280. @item asc
  1281. When gain reduction is always needed ASC takes care of releasing to an
  1282. average reduction level rather than reaching a reduction of 0 in the release
  1283. time.
  1284. @item asc_level
  1285. Select how much the release time is affected by ASC, 0 means nearly no changes
  1286. in release time while 1 produces higher release times.
  1287. @item level
  1288. Auto level output signal. Default is enabled.
  1289. This normalizes audio back to 0dB if enabled.
  1290. @end table
  1291. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1292. with @ref{aresample} before applying this filter.
  1293. @section allpass
  1294. Apply a two-pole all-pass filter with central frequency (in Hz)
  1295. @var{frequency}, and filter-width @var{width}.
  1296. An all-pass filter changes the audio's frequency to phase relationship
  1297. without changing its frequency to amplitude relationship.
  1298. The filter accepts the following options:
  1299. @table @option
  1300. @item frequency, f
  1301. Set frequency in Hz.
  1302. @item width_type, t
  1303. Set method to specify band-width of filter.
  1304. @table @option
  1305. @item h
  1306. Hz
  1307. @item q
  1308. Q-Factor
  1309. @item o
  1310. octave
  1311. @item s
  1312. slope
  1313. @item k
  1314. kHz
  1315. @end table
  1316. @item width, w
  1317. Specify the band-width of a filter in width_type units.
  1318. @item mix, m
  1319. How much to use filtered signal in output. Default is 1.
  1320. Range is between 0 and 1.
  1321. @item channels, c
  1322. Specify which channels to filter, by default all available are filtered.
  1323. @item normalize, n
  1324. Normalize biquad coefficients, by default is disabled.
  1325. Enabling it will normalize magnitude response at DC to 0dB.
  1326. @item order, o
  1327. Set the filter order, can be 1 or 2. Default is 2.
  1328. @item transform, a
  1329. Set transform type of IIR filter.
  1330. @table @option
  1331. @item di
  1332. @item dii
  1333. @item tdii
  1334. @item latt
  1335. @end table
  1336. @item precision, r
  1337. Set precison of filtering.
  1338. @table @option
  1339. @item auto
  1340. Pick automatic sample format depending on surround filters.
  1341. @item s16
  1342. Always use signed 16-bit.
  1343. @item s32
  1344. Always use signed 32-bit.
  1345. @item f32
  1346. Always use float 32-bit.
  1347. @item f64
  1348. Always use float 64-bit.
  1349. @end table
  1350. @end table
  1351. @subsection Commands
  1352. This filter supports the following commands:
  1353. @table @option
  1354. @item frequency, f
  1355. Change allpass frequency.
  1356. Syntax for the command is : "@var{frequency}"
  1357. @item width_type, t
  1358. Change allpass width_type.
  1359. Syntax for the command is : "@var{width_type}"
  1360. @item width, w
  1361. Change allpass width.
  1362. Syntax for the command is : "@var{width}"
  1363. @item mix, m
  1364. Change allpass mix.
  1365. Syntax for the command is : "@var{mix}"
  1366. @end table
  1367. @section aloop
  1368. Loop audio samples.
  1369. The filter accepts the following options:
  1370. @table @option
  1371. @item loop
  1372. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1373. Default is 0.
  1374. @item size
  1375. Set maximal number of samples. Default is 0.
  1376. @item start
  1377. Set first sample of loop. Default is 0.
  1378. @end table
  1379. @anchor{amerge}
  1380. @section amerge
  1381. Merge two or more audio streams into a single multi-channel stream.
  1382. The filter accepts the following options:
  1383. @table @option
  1384. @item inputs
  1385. Set the number of inputs. Default is 2.
  1386. @end table
  1387. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1388. the channel layout of the output will be set accordingly and the channels
  1389. will be reordered as necessary. If the channel layouts of the inputs are not
  1390. disjoint, the output will have all the channels of the first input then all
  1391. the channels of the second input, in that order, and the channel layout of
  1392. the output will be the default value corresponding to the total number of
  1393. channels.
  1394. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1395. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1396. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1397. first input, b1 is the first channel of the second input).
  1398. On the other hand, if both input are in stereo, the output channels will be
  1399. in the default order: a1, a2, b1, b2, and the channel layout will be
  1400. arbitrarily set to 4.0, which may or may not be the expected value.
  1401. All inputs must have the same sample rate, and format.
  1402. If inputs do not have the same duration, the output will stop with the
  1403. shortest.
  1404. @subsection Examples
  1405. @itemize
  1406. @item
  1407. Merge two mono files into a stereo stream:
  1408. @example
  1409. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1410. @end example
  1411. @item
  1412. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1413. @example
  1414. 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
  1415. @end example
  1416. @end itemize
  1417. @section amix
  1418. Mixes multiple audio inputs into a single output.
  1419. Note that this filter only supports float samples (the @var{amerge}
  1420. and @var{pan} audio filters support many formats). If the @var{amix}
  1421. input has integer samples then @ref{aresample} will be automatically
  1422. inserted to perform the conversion to float samples.
  1423. For example
  1424. @example
  1425. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1426. @end example
  1427. will mix 3 input audio streams to a single output with the same duration as the
  1428. first input and a dropout transition time of 3 seconds.
  1429. It accepts the following parameters:
  1430. @table @option
  1431. @item inputs
  1432. The number of inputs. If unspecified, it defaults to 2.
  1433. @item duration
  1434. How to determine the end-of-stream.
  1435. @table @option
  1436. @item longest
  1437. The duration of the longest input. (default)
  1438. @item shortest
  1439. The duration of the shortest input.
  1440. @item first
  1441. The duration of the first input.
  1442. @end table
  1443. @item dropout_transition
  1444. The transition time, in seconds, for volume renormalization when an input
  1445. stream ends. The default value is 2 seconds.
  1446. @item weights
  1447. Specify weight of each input audio stream as sequence.
  1448. Each weight is separated by space. By default all inputs have same weight.
  1449. @end table
  1450. @subsection Commands
  1451. This filter supports the following commands:
  1452. @table @option
  1453. @item weights
  1454. Syntax is same as option with same name.
  1455. @end table
  1456. @section amultiply
  1457. Multiply first audio stream with second audio stream and store result
  1458. in output audio stream. Multiplication is done by multiplying each
  1459. sample from first stream with sample at same position from second stream.
  1460. With this element-wise multiplication one can create amplitude fades and
  1461. amplitude modulations.
  1462. @section anequalizer
  1463. High-order parametric multiband equalizer for each channel.
  1464. It accepts the following parameters:
  1465. @table @option
  1466. @item params
  1467. This option string is in format:
  1468. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1469. Each equalizer band is separated by '|'.
  1470. @table @option
  1471. @item chn
  1472. Set channel number to which equalization will be applied.
  1473. If input doesn't have that channel the entry is ignored.
  1474. @item f
  1475. Set central frequency for band.
  1476. If input doesn't have that frequency the entry is ignored.
  1477. @item w
  1478. Set band width in Hertz.
  1479. @item g
  1480. Set band gain in dB.
  1481. @item t
  1482. Set filter type for band, optional, can be:
  1483. @table @samp
  1484. @item 0
  1485. Butterworth, this is default.
  1486. @item 1
  1487. Chebyshev type 1.
  1488. @item 2
  1489. Chebyshev type 2.
  1490. @end table
  1491. @end table
  1492. @item curves
  1493. With this option activated frequency response of anequalizer is displayed
  1494. in video stream.
  1495. @item size
  1496. Set video stream size. Only useful if curves option is activated.
  1497. @item mgain
  1498. Set max gain that will be displayed. Only useful if curves option is activated.
  1499. Setting this to a reasonable value makes it possible to display gain which is derived from
  1500. neighbour bands which are too close to each other and thus produce higher gain
  1501. when both are activated.
  1502. @item fscale
  1503. Set frequency scale used to draw frequency response in video output.
  1504. Can be linear or logarithmic. Default is logarithmic.
  1505. @item colors
  1506. Set color for each channel curve which is going to be displayed in video stream.
  1507. This is list of color names separated by space or by '|'.
  1508. Unrecognised or missing colors will be replaced by white color.
  1509. @end table
  1510. @subsection Examples
  1511. @itemize
  1512. @item
  1513. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1514. for first 2 channels using Chebyshev type 1 filter:
  1515. @example
  1516. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1517. @end example
  1518. @end itemize
  1519. @subsection Commands
  1520. This filter supports the following commands:
  1521. @table @option
  1522. @item change
  1523. Alter existing filter parameters.
  1524. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1525. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1526. error is returned.
  1527. @var{freq} set new frequency parameter.
  1528. @var{width} set new width parameter in Hertz.
  1529. @var{gain} set new gain parameter in dB.
  1530. Full filter invocation with asendcmd may look like this:
  1531. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1532. @end table
  1533. @section anlmdn
  1534. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1535. Each sample is adjusted by looking for other samples with similar contexts. This
  1536. context similarity is defined by comparing their surrounding patches of size
  1537. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1538. The filter accepts the following options:
  1539. @table @option
  1540. @item s
  1541. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1542. @item p
  1543. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1544. Default value is 2 milliseconds.
  1545. @item r
  1546. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1547. Default value is 6 milliseconds.
  1548. @item o
  1549. Set the output mode.
  1550. It accepts the following values:
  1551. @table @option
  1552. @item i
  1553. Pass input unchanged.
  1554. @item o
  1555. Pass noise filtered out.
  1556. @item n
  1557. Pass only noise.
  1558. Default value is @var{o}.
  1559. @end table
  1560. @item m
  1561. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1562. @end table
  1563. @subsection Commands
  1564. This filter supports the all above options as @ref{commands}.
  1565. @section anlms
  1566. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1567. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1568. relate to producing the least mean square of the error signal (difference between the desired,
  1569. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1570. A description of the accepted options follows.
  1571. @table @option
  1572. @item order
  1573. Set filter order.
  1574. @item mu
  1575. Set filter mu.
  1576. @item eps
  1577. Set the filter eps.
  1578. @item leakage
  1579. Set the filter leakage.
  1580. @item out_mode
  1581. It accepts the following values:
  1582. @table @option
  1583. @item i
  1584. Pass the 1st input.
  1585. @item d
  1586. Pass the 2nd input.
  1587. @item o
  1588. Pass filtered samples.
  1589. @item n
  1590. Pass difference between desired and filtered samples.
  1591. Default value is @var{o}.
  1592. @end table
  1593. @end table
  1594. @subsection Examples
  1595. @itemize
  1596. @item
  1597. One of many usages of this filter is noise reduction, input audio is filtered
  1598. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1599. @example
  1600. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1601. @end example
  1602. @end itemize
  1603. @subsection Commands
  1604. This filter supports the same commands as options, excluding option @code{order}.
  1605. @section anull
  1606. Pass the audio source unchanged to the output.
  1607. @section apad
  1608. Pad the end of an audio stream with silence.
  1609. This can be used together with @command{ffmpeg} @option{-shortest} to
  1610. extend audio streams to the same length as the video stream.
  1611. A description of the accepted options follows.
  1612. @table @option
  1613. @item packet_size
  1614. Set silence packet size. Default value is 4096.
  1615. @item pad_len
  1616. Set the number of samples of silence to add to the end. After the
  1617. value is reached, the stream is terminated. This option is mutually
  1618. exclusive with @option{whole_len}.
  1619. @item whole_len
  1620. Set the minimum total number of samples in the output audio stream. If
  1621. the value is longer than the input audio length, silence is added to
  1622. the end, until the value is reached. This option is mutually exclusive
  1623. with @option{pad_len}.
  1624. @item pad_dur
  1625. Specify the duration of samples of silence to add. See
  1626. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1627. for the accepted syntax. Used only if set to non-zero value.
  1628. @item whole_dur
  1629. Specify the minimum total duration in the output audio stream. See
  1630. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1631. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1632. the input audio length, silence is added to the end, until the value is reached.
  1633. This option is mutually exclusive with @option{pad_dur}
  1634. @end table
  1635. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1636. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1637. the input stream indefinitely.
  1638. @subsection Examples
  1639. @itemize
  1640. @item
  1641. Add 1024 samples of silence to the end of the input:
  1642. @example
  1643. apad=pad_len=1024
  1644. @end example
  1645. @item
  1646. Make sure the audio output will contain at least 10000 samples, pad
  1647. the input with silence if required:
  1648. @example
  1649. apad=whole_len=10000
  1650. @end example
  1651. @item
  1652. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1653. video stream will always result the shortest and will be converted
  1654. until the end in the output file when using the @option{shortest}
  1655. option:
  1656. @example
  1657. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1658. @end example
  1659. @end itemize
  1660. @section aphaser
  1661. Add a phasing effect to the input audio.
  1662. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1663. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1664. A description of the accepted parameters follows.
  1665. @table @option
  1666. @item in_gain
  1667. Set input gain. Default is 0.4.
  1668. @item out_gain
  1669. Set output gain. Default is 0.74
  1670. @item delay
  1671. Set delay in milliseconds. Default is 3.0.
  1672. @item decay
  1673. Set decay. Default is 0.4.
  1674. @item speed
  1675. Set modulation speed in Hz. Default is 0.5.
  1676. @item type
  1677. Set modulation type. Default is triangular.
  1678. It accepts the following values:
  1679. @table @samp
  1680. @item triangular, t
  1681. @item sinusoidal, s
  1682. @end table
  1683. @end table
  1684. @section aphaseshift
  1685. Apply phase shift to input audio samples.
  1686. The filter accepts the following options:
  1687. @table @option
  1688. @item shift
  1689. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1690. Default value is 0.0.
  1691. @item level
  1692. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1693. Default value is 1.0.
  1694. @end table
  1695. @subsection Commands
  1696. This filter supports the all above options as @ref{commands}.
  1697. @section apulsator
  1698. Audio pulsator is something between an autopanner and a tremolo.
  1699. But it can produce funny stereo effects as well. Pulsator changes the volume
  1700. of the left and right channel based on a LFO (low frequency oscillator) with
  1701. different waveforms and shifted phases.
  1702. This filter have the ability to define an offset between left and right
  1703. channel. An offset of 0 means that both LFO shapes match each other.
  1704. The left and right channel are altered equally - a conventional tremolo.
  1705. An offset of 50% means that the shape of the right channel is exactly shifted
  1706. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1707. an autopanner. At 1 both curves match again. Every setting in between moves the
  1708. phase shift gapless between all stages and produces some "bypassing" sounds with
  1709. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1710. the 0.5) the faster the signal passes from the left to the right speaker.
  1711. The filter accepts the following options:
  1712. @table @option
  1713. @item level_in
  1714. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1715. @item level_out
  1716. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1717. @item mode
  1718. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1719. sawup or sawdown. Default is sine.
  1720. @item amount
  1721. Set modulation. Define how much of original signal is affected by the LFO.
  1722. @item offset_l
  1723. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1724. @item offset_r
  1725. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1726. @item width
  1727. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1728. @item timing
  1729. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1730. @item bpm
  1731. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1732. is set to bpm.
  1733. @item ms
  1734. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1735. is set to ms.
  1736. @item hz
  1737. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1738. if timing is set to hz.
  1739. @end table
  1740. @anchor{aresample}
  1741. @section aresample
  1742. Resample the input audio to the specified parameters, using the
  1743. libswresample library. If none are specified then the filter will
  1744. automatically convert between its input and output.
  1745. This filter is also able to stretch/squeeze the audio data to make it match
  1746. the timestamps or to inject silence / cut out audio to make it match the
  1747. timestamps, do a combination of both or do neither.
  1748. The filter accepts the syntax
  1749. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1750. expresses a sample rate and @var{resampler_options} is a list of
  1751. @var{key}=@var{value} pairs, separated by ":". See the
  1752. @ref{Resampler Options,,"Resampler Options" section in the
  1753. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1754. for the complete list of supported options.
  1755. @subsection Examples
  1756. @itemize
  1757. @item
  1758. Resample the input audio to 44100Hz:
  1759. @example
  1760. aresample=44100
  1761. @end example
  1762. @item
  1763. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1764. samples per second compensation:
  1765. @example
  1766. aresample=async=1000
  1767. @end example
  1768. @end itemize
  1769. @section areverse
  1770. Reverse an audio clip.
  1771. Warning: This filter requires memory to buffer the entire clip, so trimming
  1772. is suggested.
  1773. @subsection Examples
  1774. @itemize
  1775. @item
  1776. Take the first 5 seconds of a clip, and reverse it.
  1777. @example
  1778. atrim=end=5,areverse
  1779. @end example
  1780. @end itemize
  1781. @section arnndn
  1782. Reduce noise from speech using Recurrent Neural Networks.
  1783. This filter accepts the following options:
  1784. @table @option
  1785. @item model, m
  1786. Set train model file to load. This option is always required.
  1787. @item mix
  1788. Set how much to mix filtered samples into final output.
  1789. Allowed range is from -1 to 1. Default value is 1.
  1790. Negative values are special, they set how much to keep filtered noise
  1791. in the final filter output. Set this option to -1 to hear actual
  1792. noise removed from input signal.
  1793. @end table
  1794. @section asetnsamples
  1795. Set the number of samples per each output audio frame.
  1796. The last output packet may contain a different number of samples, as
  1797. the filter will flush all the remaining samples when the input audio
  1798. signals its end.
  1799. The filter accepts the following options:
  1800. @table @option
  1801. @item nb_out_samples, n
  1802. Set the number of frames per each output audio frame. The number is
  1803. intended as the number of samples @emph{per each channel}.
  1804. Default value is 1024.
  1805. @item pad, p
  1806. If set to 1, the filter will pad the last audio frame with zeroes, so
  1807. that the last frame will contain the same number of samples as the
  1808. previous ones. Default value is 1.
  1809. @end table
  1810. For example, to set the number of per-frame samples to 1234 and
  1811. disable padding for the last frame, use:
  1812. @example
  1813. asetnsamples=n=1234:p=0
  1814. @end example
  1815. @section asetrate
  1816. Set the sample rate without altering the PCM data.
  1817. This will result in a change of speed and pitch.
  1818. The filter accepts the following options:
  1819. @table @option
  1820. @item sample_rate, r
  1821. Set the output sample rate. Default is 44100 Hz.
  1822. @end table
  1823. @section ashowinfo
  1824. Show a line containing various information for each input audio frame.
  1825. The input audio is not modified.
  1826. The shown line contains a sequence of key/value pairs of the form
  1827. @var{key}:@var{value}.
  1828. The following values are shown in the output:
  1829. @table @option
  1830. @item n
  1831. The (sequential) number of the input frame, starting from 0.
  1832. @item pts
  1833. The presentation timestamp of the input frame, in time base units; the time base
  1834. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1835. @item pts_time
  1836. The presentation timestamp of the input frame in seconds.
  1837. @item pos
  1838. position of the frame in the input stream, -1 if this information in
  1839. unavailable and/or meaningless (for example in case of synthetic audio)
  1840. @item fmt
  1841. The sample format.
  1842. @item chlayout
  1843. The channel layout.
  1844. @item rate
  1845. The sample rate for the audio frame.
  1846. @item nb_samples
  1847. The number of samples (per channel) in the frame.
  1848. @item checksum
  1849. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1850. audio, the data is treated as if all the planes were concatenated.
  1851. @item plane_checksums
  1852. A list of Adler-32 checksums for each data plane.
  1853. @end table
  1854. @section asoftclip
  1855. Apply audio soft clipping.
  1856. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1857. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1858. This filter accepts the following options:
  1859. @table @option
  1860. @item type
  1861. Set type of soft-clipping.
  1862. It accepts the following values:
  1863. @table @option
  1864. @item hard
  1865. @item tanh
  1866. @item atan
  1867. @item cubic
  1868. @item exp
  1869. @item alg
  1870. @item quintic
  1871. @item sin
  1872. @item erf
  1873. @end table
  1874. @item threshold
  1875. Set threshold from where to start clipping. Default value is 0dB or 1.
  1876. @item output
  1877. Set gain applied to output. Default value is 0dB or 1.
  1878. @item param
  1879. Set additional parameter which controls sigmoid function.
  1880. @item oversample
  1881. Set oversampling factor.
  1882. @end table
  1883. @subsection Commands
  1884. This filter supports the all above options as @ref{commands}.
  1885. @section asr
  1886. Automatic Speech Recognition
  1887. This filter uses PocketSphinx for speech recognition. To enable
  1888. compilation of this filter, you need to configure FFmpeg with
  1889. @code{--enable-pocketsphinx}.
  1890. It accepts the following options:
  1891. @table @option
  1892. @item rate
  1893. Set sampling rate of input audio. Defaults is @code{16000}.
  1894. This need to match speech models, otherwise one will get poor results.
  1895. @item hmm
  1896. Set dictionary containing acoustic model files.
  1897. @item dict
  1898. Set pronunciation dictionary.
  1899. @item lm
  1900. Set language model file.
  1901. @item lmctl
  1902. Set language model set.
  1903. @item lmname
  1904. Set which language model to use.
  1905. @item logfn
  1906. Set output for log messages.
  1907. @end table
  1908. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1909. @anchor{astats}
  1910. @section astats
  1911. Display time domain statistical information about the audio channels.
  1912. Statistics are calculated and displayed for each audio channel and,
  1913. where applicable, an overall figure is also given.
  1914. It accepts the following option:
  1915. @table @option
  1916. @item length
  1917. Short window length in seconds, used for peak and trough RMS measurement.
  1918. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1919. @item metadata
  1920. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1921. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1922. disabled.
  1923. Available keys for each channel are:
  1924. DC_offset
  1925. Min_level
  1926. Max_level
  1927. Min_difference
  1928. Max_difference
  1929. Mean_difference
  1930. RMS_difference
  1931. Peak_level
  1932. RMS_peak
  1933. RMS_trough
  1934. Crest_factor
  1935. Flat_factor
  1936. Peak_count
  1937. Noise_floor
  1938. Noise_floor_count
  1939. Bit_depth
  1940. Dynamic_range
  1941. Zero_crossings
  1942. Zero_crossings_rate
  1943. Number_of_NaNs
  1944. Number_of_Infs
  1945. Number_of_denormals
  1946. and for Overall:
  1947. DC_offset
  1948. Min_level
  1949. Max_level
  1950. Min_difference
  1951. Max_difference
  1952. Mean_difference
  1953. RMS_difference
  1954. Peak_level
  1955. RMS_level
  1956. RMS_peak
  1957. RMS_trough
  1958. Flat_factor
  1959. Peak_count
  1960. Noise_floor
  1961. Noise_floor_count
  1962. Bit_depth
  1963. Number_of_samples
  1964. Number_of_NaNs
  1965. Number_of_Infs
  1966. Number_of_denormals
  1967. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1968. this @code{lavfi.astats.Overall.Peak_count}.
  1969. For description what each key means read below.
  1970. @item reset
  1971. Set number of frame after which stats are going to be recalculated.
  1972. Default is disabled.
  1973. @item measure_perchannel
  1974. Select the entries which need to be measured per channel. The metadata keys can
  1975. be used as flags, default is @option{all} which measures everything.
  1976. @option{none} disables all per channel measurement.
  1977. @item measure_overall
  1978. Select the entries which need to be measured overall. The metadata keys can
  1979. be used as flags, default is @option{all} which measures everything.
  1980. @option{none} disables all overall measurement.
  1981. @end table
  1982. A description of each shown parameter follows:
  1983. @table @option
  1984. @item DC offset
  1985. Mean amplitude displacement from zero.
  1986. @item Min level
  1987. Minimal sample level.
  1988. @item Max level
  1989. Maximal sample level.
  1990. @item Min difference
  1991. Minimal difference between two consecutive samples.
  1992. @item Max difference
  1993. Maximal difference between two consecutive samples.
  1994. @item Mean difference
  1995. Mean difference between two consecutive samples.
  1996. The average of each difference between two consecutive samples.
  1997. @item RMS difference
  1998. Root Mean Square difference between two consecutive samples.
  1999. @item Peak level dB
  2000. @item RMS level dB
  2001. Standard peak and RMS level measured in dBFS.
  2002. @item RMS peak dB
  2003. @item RMS trough dB
  2004. Peak and trough values for RMS level measured over a short window.
  2005. @item Crest factor
  2006. Standard ratio of peak to RMS level (note: not in dB).
  2007. @item Flat factor
  2008. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2009. (i.e. either @var{Min level} or @var{Max level}).
  2010. @item Peak count
  2011. Number of occasions (not the number of samples) that the signal attained either
  2012. @var{Min level} or @var{Max level}.
  2013. @item Noise floor dB
  2014. Minimum local peak measured in dBFS over a short window.
  2015. @item Noise floor count
  2016. Number of occasions (not the number of samples) that the signal attained
  2017. @var{Noise floor}.
  2018. @item Bit depth
  2019. Overall bit depth of audio. Number of bits used for each sample.
  2020. @item Dynamic range
  2021. Measured dynamic range of audio in dB.
  2022. @item Zero crossings
  2023. Number of points where the waveform crosses the zero level axis.
  2024. @item Zero crossings rate
  2025. Rate of Zero crossings and number of audio samples.
  2026. @end table
  2027. @section asubboost
  2028. Boost subwoofer frequencies.
  2029. The filter accepts the following options:
  2030. @table @option
  2031. @item dry
  2032. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2033. Default value is 0.7.
  2034. @item wet
  2035. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2036. Default value is 0.7.
  2037. @item decay
  2038. Set delay line decay gain value. Allowed range is from 0 to 1.
  2039. Default value is 0.7.
  2040. @item feedback
  2041. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2042. Default value is 0.9.
  2043. @item cutoff
  2044. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2045. Default value is 100.
  2046. @item slope
  2047. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2048. Default value is 0.5.
  2049. @item delay
  2050. Set delay. Allowed range is from 1 to 100.
  2051. Default value is 20.
  2052. @end table
  2053. @subsection Commands
  2054. This filter supports the all above options as @ref{commands}.
  2055. @section asubcut
  2056. Cut subwoofer frequencies.
  2057. This filter allows to set custom, steeper
  2058. roll off than highpass filter, and thus is able to more attenuate
  2059. frequency content in stop-band.
  2060. The filter accepts the following options:
  2061. @table @option
  2062. @item cutoff
  2063. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2064. Default value is 20.
  2065. @item order
  2066. Set filter order. Available values are from 3 to 20.
  2067. Default value is 10.
  2068. @item level
  2069. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2070. @end table
  2071. @subsection Commands
  2072. This filter supports the all above options as @ref{commands}.
  2073. @section asupercut
  2074. Cut super frequencies.
  2075. The filter accepts the following options:
  2076. @table @option
  2077. @item cutoff
  2078. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2079. Default value is 20000.
  2080. @item order
  2081. Set filter order. Available values are from 3 to 20.
  2082. Default value is 10.
  2083. @item level
  2084. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2085. @end table
  2086. @subsection Commands
  2087. This filter supports the all above options as @ref{commands}.
  2088. @section asuperpass
  2089. Apply high order Butterworth band-pass filter.
  2090. The filter accepts the following options:
  2091. @table @option
  2092. @item centerf
  2093. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2094. Default value is 1000.
  2095. @item order
  2096. Set filter order. Available values are from 4 to 20.
  2097. Default value is 4.
  2098. @item qfactor
  2099. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2100. @item level
  2101. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2102. @end table
  2103. @subsection Commands
  2104. This filter supports the all above options as @ref{commands}.
  2105. @section asuperstop
  2106. Apply high order Butterworth band-stop filter.
  2107. The filter accepts the following options:
  2108. @table @option
  2109. @item centerf
  2110. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2111. Default value is 1000.
  2112. @item order
  2113. Set filter order. Available values are from 4 to 20.
  2114. Default value is 4.
  2115. @item qfactor
  2116. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2117. @item level
  2118. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2119. @end table
  2120. @subsection Commands
  2121. This filter supports the all above options as @ref{commands}.
  2122. @section atempo
  2123. Adjust audio tempo.
  2124. The filter accepts exactly one parameter, the audio tempo. If not
  2125. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2126. be in the [0.5, 100.0] range.
  2127. Note that tempo greater than 2 will skip some samples rather than
  2128. blend them in. If for any reason this is a concern it is always
  2129. possible to daisy-chain several instances of atempo to achieve the
  2130. desired product tempo.
  2131. @subsection Examples
  2132. @itemize
  2133. @item
  2134. Slow down audio to 80% tempo:
  2135. @example
  2136. atempo=0.8
  2137. @end example
  2138. @item
  2139. To speed up audio to 300% tempo:
  2140. @example
  2141. atempo=3
  2142. @end example
  2143. @item
  2144. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2145. @example
  2146. atempo=sqrt(3),atempo=sqrt(3)
  2147. @end example
  2148. @end itemize
  2149. @subsection Commands
  2150. This filter supports the following commands:
  2151. @table @option
  2152. @item tempo
  2153. Change filter tempo scale factor.
  2154. Syntax for the command is : "@var{tempo}"
  2155. @end table
  2156. @section atrim
  2157. Trim the input so that the output contains one continuous subpart of the input.
  2158. It accepts the following parameters:
  2159. @table @option
  2160. @item start
  2161. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2162. sample with the timestamp @var{start} will be the first sample in the output.
  2163. @item end
  2164. Specify time of the first audio sample that will be dropped, i.e. the
  2165. audio sample immediately preceding the one with the timestamp @var{end} will be
  2166. the last sample in the output.
  2167. @item start_pts
  2168. Same as @var{start}, except this option sets the start timestamp in samples
  2169. instead of seconds.
  2170. @item end_pts
  2171. Same as @var{end}, except this option sets the end timestamp in samples instead
  2172. of seconds.
  2173. @item duration
  2174. The maximum duration of the output in seconds.
  2175. @item start_sample
  2176. The number of the first sample that should be output.
  2177. @item end_sample
  2178. The number of the first sample that should be dropped.
  2179. @end table
  2180. @option{start}, @option{end}, and @option{duration} are expressed as time
  2181. duration specifications; see
  2182. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2183. Note that the first two sets of the start/end options and the @option{duration}
  2184. option look at the frame timestamp, while the _sample options simply count the
  2185. samples that pass through the filter. So start/end_pts and start/end_sample will
  2186. give different results when the timestamps are wrong, inexact or do not start at
  2187. zero. Also note that this filter does not modify the timestamps. If you wish
  2188. to have the output timestamps start at zero, insert the asetpts filter after the
  2189. atrim filter.
  2190. If multiple start or end options are set, this filter tries to be greedy and
  2191. keep all samples that match at least one of the specified constraints. To keep
  2192. only the part that matches all the constraints at once, chain multiple atrim
  2193. filters.
  2194. The defaults are such that all the input is kept. So it is possible to set e.g.
  2195. just the end values to keep everything before the specified time.
  2196. Examples:
  2197. @itemize
  2198. @item
  2199. Drop everything except the second minute of input:
  2200. @example
  2201. ffmpeg -i INPUT -af atrim=60:120
  2202. @end example
  2203. @item
  2204. Keep only the first 1000 samples:
  2205. @example
  2206. ffmpeg -i INPUT -af atrim=end_sample=1000
  2207. @end example
  2208. @end itemize
  2209. @section axcorrelate
  2210. Calculate normalized cross-correlation between two input audio streams.
  2211. Resulted samples are always between -1 and 1 inclusive.
  2212. If result is 1 it means two input samples are highly correlated in that selected segment.
  2213. Result 0 means they are not correlated at all.
  2214. If result is -1 it means two input samples are out of phase, which means they cancel each
  2215. other.
  2216. The filter accepts the following options:
  2217. @table @option
  2218. @item size
  2219. Set size of segment over which cross-correlation is calculated.
  2220. Default is 256. Allowed range is from 2 to 131072.
  2221. @item algo
  2222. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2223. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2224. are always zero and thus need much less calculations to make.
  2225. This is generally not true, but is valid for typical audio streams.
  2226. @end table
  2227. @subsection Examples
  2228. @itemize
  2229. @item
  2230. Calculate correlation between channels in stereo audio stream:
  2231. @example
  2232. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2233. @end example
  2234. @end itemize
  2235. @section bandpass
  2236. Apply a two-pole Butterworth band-pass filter with central
  2237. frequency @var{frequency}, and (3dB-point) band-width width.
  2238. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2239. instead of the default: constant 0dB peak gain.
  2240. The filter roll off at 6dB per octave (20dB per decade).
  2241. The filter accepts the following options:
  2242. @table @option
  2243. @item frequency, f
  2244. Set the filter's central frequency. Default is @code{3000}.
  2245. @item csg
  2246. Constant skirt gain if set to 1. Defaults to 0.
  2247. @item width_type, t
  2248. Set method to specify band-width of filter.
  2249. @table @option
  2250. @item h
  2251. Hz
  2252. @item q
  2253. Q-Factor
  2254. @item o
  2255. octave
  2256. @item s
  2257. slope
  2258. @item k
  2259. kHz
  2260. @end table
  2261. @item width, w
  2262. Specify the band-width of a filter in width_type units.
  2263. @item mix, m
  2264. How much to use filtered signal in output. Default is 1.
  2265. Range is between 0 and 1.
  2266. @item channels, c
  2267. Specify which channels to filter, by default all available are filtered.
  2268. @item normalize, n
  2269. Normalize biquad coefficients, by default is disabled.
  2270. Enabling it will normalize magnitude response at DC to 0dB.
  2271. @item transform, a
  2272. Set transform type of IIR filter.
  2273. @table @option
  2274. @item di
  2275. @item dii
  2276. @item tdii
  2277. @item latt
  2278. @end table
  2279. @item precision, r
  2280. Set precison of filtering.
  2281. @table @option
  2282. @item auto
  2283. Pick automatic sample format depending on surround filters.
  2284. @item s16
  2285. Always use signed 16-bit.
  2286. @item s32
  2287. Always use signed 32-bit.
  2288. @item f32
  2289. Always use float 32-bit.
  2290. @item f64
  2291. Always use float 64-bit.
  2292. @end table
  2293. @end table
  2294. @subsection Commands
  2295. This filter supports the following commands:
  2296. @table @option
  2297. @item frequency, f
  2298. Change bandpass frequency.
  2299. Syntax for the command is : "@var{frequency}"
  2300. @item width_type, t
  2301. Change bandpass width_type.
  2302. Syntax for the command is : "@var{width_type}"
  2303. @item width, w
  2304. Change bandpass width.
  2305. Syntax for the command is : "@var{width}"
  2306. @item mix, m
  2307. Change bandpass mix.
  2308. Syntax for the command is : "@var{mix}"
  2309. @end table
  2310. @section bandreject
  2311. Apply a two-pole Butterworth band-reject filter with central
  2312. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2313. The filter roll off at 6dB per octave (20dB per decade).
  2314. The filter accepts the following options:
  2315. @table @option
  2316. @item frequency, f
  2317. Set the filter's central frequency. Default is @code{3000}.
  2318. @item width_type, t
  2319. Set method to specify band-width of filter.
  2320. @table @option
  2321. @item h
  2322. Hz
  2323. @item q
  2324. Q-Factor
  2325. @item o
  2326. octave
  2327. @item s
  2328. slope
  2329. @item k
  2330. kHz
  2331. @end table
  2332. @item width, w
  2333. Specify the band-width of a filter in width_type units.
  2334. @item mix, m
  2335. How much to use filtered signal in output. Default is 1.
  2336. Range is between 0 and 1.
  2337. @item channels, c
  2338. Specify which channels to filter, by default all available are filtered.
  2339. @item normalize, n
  2340. Normalize biquad coefficients, by default is disabled.
  2341. Enabling it will normalize magnitude response at DC to 0dB.
  2342. @item transform, a
  2343. Set transform type of IIR filter.
  2344. @table @option
  2345. @item di
  2346. @item dii
  2347. @item tdii
  2348. @item latt
  2349. @end table
  2350. @item precision, r
  2351. Set precison of filtering.
  2352. @table @option
  2353. @item auto
  2354. Pick automatic sample format depending on surround filters.
  2355. @item s16
  2356. Always use signed 16-bit.
  2357. @item s32
  2358. Always use signed 32-bit.
  2359. @item f32
  2360. Always use float 32-bit.
  2361. @item f64
  2362. Always use float 64-bit.
  2363. @end table
  2364. @end table
  2365. @subsection Commands
  2366. This filter supports the following commands:
  2367. @table @option
  2368. @item frequency, f
  2369. Change bandreject frequency.
  2370. Syntax for the command is : "@var{frequency}"
  2371. @item width_type, t
  2372. Change bandreject width_type.
  2373. Syntax for the command is : "@var{width_type}"
  2374. @item width, w
  2375. Change bandreject width.
  2376. Syntax for the command is : "@var{width}"
  2377. @item mix, m
  2378. Change bandreject mix.
  2379. Syntax for the command is : "@var{mix}"
  2380. @end table
  2381. @section bass, lowshelf
  2382. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2383. shelving filter with a response similar to that of a standard
  2384. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2385. The filter accepts the following options:
  2386. @table @option
  2387. @item gain, g
  2388. Give the gain at 0 Hz. Its useful range is about -20
  2389. (for a large cut) to +20 (for a large boost).
  2390. Beware of clipping when using a positive gain.
  2391. @item frequency, f
  2392. Set the filter's central frequency and so can be used
  2393. to extend or reduce the frequency range to be boosted or cut.
  2394. The default value is @code{100} Hz.
  2395. @item width_type, t
  2396. Set method to specify band-width of filter.
  2397. @table @option
  2398. @item h
  2399. Hz
  2400. @item q
  2401. Q-Factor
  2402. @item o
  2403. octave
  2404. @item s
  2405. slope
  2406. @item k
  2407. kHz
  2408. @end table
  2409. @item width, w
  2410. Determine how steep is the filter's shelf transition.
  2411. @item poles, p
  2412. Set number of poles. Default is 2.
  2413. @item mix, m
  2414. How much to use filtered signal in output. Default is 1.
  2415. Range is between 0 and 1.
  2416. @item channels, c
  2417. Specify which channels to filter, by default all available are filtered.
  2418. @item normalize, n
  2419. Normalize biquad coefficients, by default is disabled.
  2420. Enabling it will normalize magnitude response at DC to 0dB.
  2421. @item transform, a
  2422. Set transform type of IIR filter.
  2423. @table @option
  2424. @item di
  2425. @item dii
  2426. @item tdii
  2427. @item latt
  2428. @end table
  2429. @item precision, r
  2430. Set precison of filtering.
  2431. @table @option
  2432. @item auto
  2433. Pick automatic sample format depending on surround filters.
  2434. @item s16
  2435. Always use signed 16-bit.
  2436. @item s32
  2437. Always use signed 32-bit.
  2438. @item f32
  2439. Always use float 32-bit.
  2440. @item f64
  2441. Always use float 64-bit.
  2442. @end table
  2443. @end table
  2444. @subsection Commands
  2445. This filter supports the following commands:
  2446. @table @option
  2447. @item frequency, f
  2448. Change bass frequency.
  2449. Syntax for the command is : "@var{frequency}"
  2450. @item width_type, t
  2451. Change bass width_type.
  2452. Syntax for the command is : "@var{width_type}"
  2453. @item width, w
  2454. Change bass width.
  2455. Syntax for the command is : "@var{width}"
  2456. @item gain, g
  2457. Change bass gain.
  2458. Syntax for the command is : "@var{gain}"
  2459. @item mix, m
  2460. Change bass mix.
  2461. Syntax for the command is : "@var{mix}"
  2462. @end table
  2463. @section biquad
  2464. Apply a biquad IIR filter with the given coefficients.
  2465. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2466. are the numerator and denominator coefficients respectively.
  2467. and @var{channels}, @var{c} specify which channels to filter, by default all
  2468. available are filtered.
  2469. @subsection Commands
  2470. This filter supports the following commands:
  2471. @table @option
  2472. @item a0
  2473. @item a1
  2474. @item a2
  2475. @item b0
  2476. @item b1
  2477. @item b2
  2478. Change biquad parameter.
  2479. Syntax for the command is : "@var{value}"
  2480. @item mix, m
  2481. How much to use filtered signal in output. Default is 1.
  2482. Range is between 0 and 1.
  2483. @item channels, c
  2484. Specify which channels to filter, by default all available are filtered.
  2485. @item normalize, n
  2486. Normalize biquad coefficients, by default is disabled.
  2487. Enabling it will normalize magnitude response at DC to 0dB.
  2488. @item transform, a
  2489. Set transform type of IIR filter.
  2490. @table @option
  2491. @item di
  2492. @item dii
  2493. @item tdii
  2494. @item latt
  2495. @end table
  2496. @item precision, r
  2497. Set precison of filtering.
  2498. @table @option
  2499. @item auto
  2500. Pick automatic sample format depending on surround filters.
  2501. @item s16
  2502. Always use signed 16-bit.
  2503. @item s32
  2504. Always use signed 32-bit.
  2505. @item f32
  2506. Always use float 32-bit.
  2507. @item f64
  2508. Always use float 64-bit.
  2509. @end table
  2510. @end table
  2511. @section bs2b
  2512. Bauer stereo to binaural transformation, which improves headphone listening of
  2513. stereo audio records.
  2514. To enable compilation of this filter you need to configure FFmpeg with
  2515. @code{--enable-libbs2b}.
  2516. It accepts the following parameters:
  2517. @table @option
  2518. @item profile
  2519. Pre-defined crossfeed level.
  2520. @table @option
  2521. @item default
  2522. Default level (fcut=700, feed=50).
  2523. @item cmoy
  2524. Chu Moy circuit (fcut=700, feed=60).
  2525. @item jmeier
  2526. Jan Meier circuit (fcut=650, feed=95).
  2527. @end table
  2528. @item fcut
  2529. Cut frequency (in Hz).
  2530. @item feed
  2531. Feed level (in Hz).
  2532. @end table
  2533. @section channelmap
  2534. Remap input channels to new locations.
  2535. It accepts the following parameters:
  2536. @table @option
  2537. @item map
  2538. Map channels from input to output. The argument is a '|'-separated list of
  2539. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2540. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2541. channel (e.g. FL for front left) or its index in the input channel layout.
  2542. @var{out_channel} is the name of the output channel or its index in the output
  2543. channel layout. If @var{out_channel} is not given then it is implicitly an
  2544. index, starting with zero and increasing by one for each mapping.
  2545. @item channel_layout
  2546. The channel layout of the output stream.
  2547. @end table
  2548. If no mapping is present, the filter will implicitly map input channels to
  2549. output channels, preserving indices.
  2550. @subsection Examples
  2551. @itemize
  2552. @item
  2553. For example, assuming a 5.1+downmix input MOV file,
  2554. @example
  2555. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2556. @end example
  2557. will create an output WAV file tagged as stereo from the downmix channels of
  2558. the input.
  2559. @item
  2560. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2561. @example
  2562. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2563. @end example
  2564. @end itemize
  2565. @section channelsplit
  2566. Split each channel from an input audio stream into a separate output stream.
  2567. It accepts the following parameters:
  2568. @table @option
  2569. @item channel_layout
  2570. The channel layout of the input stream. The default is "stereo".
  2571. @item channels
  2572. A channel layout describing the channels to be extracted as separate output streams
  2573. or "all" to extract each input channel as a separate stream. The default is "all".
  2574. Choosing channels not present in channel layout in the input will result in an error.
  2575. @end table
  2576. @subsection Examples
  2577. @itemize
  2578. @item
  2579. For example, assuming a stereo input MP3 file,
  2580. @example
  2581. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2582. @end example
  2583. will create an output Matroska file with two audio streams, one containing only
  2584. the left channel and the other the right channel.
  2585. @item
  2586. Split a 5.1 WAV file into per-channel files:
  2587. @example
  2588. ffmpeg -i in.wav -filter_complex
  2589. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2590. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2591. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2592. side_right.wav
  2593. @end example
  2594. @item
  2595. Extract only LFE from a 5.1 WAV file:
  2596. @example
  2597. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2598. -map '[LFE]' lfe.wav
  2599. @end example
  2600. @end itemize
  2601. @section chorus
  2602. Add a chorus effect to the audio.
  2603. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2604. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2605. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2606. The modulation depth defines the range the modulated delay is played before or after
  2607. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2608. sound tuned around the original one, like in a chorus where some vocals are slightly
  2609. off key.
  2610. It accepts the following parameters:
  2611. @table @option
  2612. @item in_gain
  2613. Set input gain. Default is 0.4.
  2614. @item out_gain
  2615. Set output gain. Default is 0.4.
  2616. @item delays
  2617. Set delays. A typical delay is around 40ms to 60ms.
  2618. @item decays
  2619. Set decays.
  2620. @item speeds
  2621. Set speeds.
  2622. @item depths
  2623. Set depths.
  2624. @end table
  2625. @subsection Examples
  2626. @itemize
  2627. @item
  2628. A single delay:
  2629. @example
  2630. chorus=0.7:0.9:55:0.4:0.25:2
  2631. @end example
  2632. @item
  2633. Two delays:
  2634. @example
  2635. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2636. @end example
  2637. @item
  2638. Fuller sounding chorus with three delays:
  2639. @example
  2640. 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
  2641. @end example
  2642. @end itemize
  2643. @section compand
  2644. Compress or expand the audio's dynamic range.
  2645. It accepts the following parameters:
  2646. @table @option
  2647. @item attacks
  2648. @item decays
  2649. A list of times in seconds for each channel over which the instantaneous level
  2650. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2651. increase of volume and @var{decays} refers to decrease of volume. For most
  2652. situations, the attack time (response to the audio getting louder) should be
  2653. shorter than the decay time, because the human ear is more sensitive to sudden
  2654. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2655. a typical value for decay is 0.8 seconds.
  2656. If specified number of attacks & decays is lower than number of channels, the last
  2657. set attack/decay will be used for all remaining channels.
  2658. @item points
  2659. A list of points for the transfer function, specified in dB relative to the
  2660. maximum possible signal amplitude. Each key points list must be defined using
  2661. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2662. @code{x0/y0 x1/y1 x2/y2 ....}
  2663. The input values must be in strictly increasing order but the transfer function
  2664. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2665. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2666. function are @code{-70/-70|-60/-20|1/0}.
  2667. @item soft-knee
  2668. Set the curve radius in dB for all joints. It defaults to 0.01.
  2669. @item gain
  2670. Set the additional gain in dB to be applied at all points on the transfer
  2671. function. This allows for easy adjustment of the overall gain.
  2672. It defaults to 0.
  2673. @item volume
  2674. Set an initial volume, in dB, to be assumed for each channel when filtering
  2675. starts. This permits the user to supply a nominal level initially, so that, for
  2676. example, a very large gain is not applied to initial signal levels before the
  2677. companding has begun to operate. A typical value for audio which is initially
  2678. quiet is -90 dB. It defaults to 0.
  2679. @item delay
  2680. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2681. delayed before being fed to the volume adjuster. Specifying a delay
  2682. approximately equal to the attack/decay times allows the filter to effectively
  2683. operate in predictive rather than reactive mode. It defaults to 0.
  2684. @end table
  2685. @subsection Examples
  2686. @itemize
  2687. @item
  2688. Make music with both quiet and loud passages suitable for listening to in a
  2689. noisy environment:
  2690. @example
  2691. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2692. @end example
  2693. Another example for audio with whisper and explosion parts:
  2694. @example
  2695. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2696. @end example
  2697. @item
  2698. A noise gate for when the noise is at a lower level than the signal:
  2699. @example
  2700. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2701. @end example
  2702. @item
  2703. Here is another noise gate, this time for when the noise is at a higher level
  2704. than the signal (making it, in some ways, similar to squelch):
  2705. @example
  2706. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2707. @end example
  2708. @item
  2709. 2:1 compression starting at -6dB:
  2710. @example
  2711. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2712. @end example
  2713. @item
  2714. 2:1 compression starting at -9dB:
  2715. @example
  2716. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2717. @end example
  2718. @item
  2719. 2:1 compression starting at -12dB:
  2720. @example
  2721. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2722. @end example
  2723. @item
  2724. 2:1 compression starting at -18dB:
  2725. @example
  2726. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2727. @end example
  2728. @item
  2729. 3:1 compression starting at -15dB:
  2730. @example
  2731. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2732. @end example
  2733. @item
  2734. Compressor/Gate:
  2735. @example
  2736. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2737. @end example
  2738. @item
  2739. Expander:
  2740. @example
  2741. 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
  2742. @end example
  2743. @item
  2744. Hard limiter at -6dB:
  2745. @example
  2746. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2747. @end example
  2748. @item
  2749. Hard limiter at -12dB:
  2750. @example
  2751. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2752. @end example
  2753. @item
  2754. Hard noise gate at -35 dB:
  2755. @example
  2756. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2757. @end example
  2758. @item
  2759. Soft limiter:
  2760. @example
  2761. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2762. @end example
  2763. @end itemize
  2764. @section compensationdelay
  2765. Compensation Delay Line is a metric based delay to compensate differing
  2766. positions of microphones or speakers.
  2767. For example, you have recorded guitar with two microphones placed in
  2768. different locations. Because the front of sound wave has fixed speed in
  2769. normal conditions, the phasing of microphones can vary and depends on
  2770. their location and interposition. The best sound mix can be achieved when
  2771. these microphones are in phase (synchronized). Note that a distance of
  2772. ~30 cm between microphones makes one microphone capture the signal in
  2773. antiphase to the other microphone. That makes the final mix sound moody.
  2774. This filter helps to solve phasing problems by adding different delays
  2775. to each microphone track and make them synchronized.
  2776. The best result can be reached when you take one track as base and
  2777. synchronize other tracks one by one with it.
  2778. Remember that synchronization/delay tolerance depends on sample rate, too.
  2779. Higher sample rates will give more tolerance.
  2780. The filter accepts the following parameters:
  2781. @table @option
  2782. @item mm
  2783. Set millimeters distance. This is compensation distance for fine tuning.
  2784. Default is 0.
  2785. @item cm
  2786. Set cm distance. This is compensation distance for tightening distance setup.
  2787. Default is 0.
  2788. @item m
  2789. Set meters distance. This is compensation distance for hard distance setup.
  2790. Default is 0.
  2791. @item dry
  2792. Set dry amount. Amount of unprocessed (dry) signal.
  2793. Default is 0.
  2794. @item wet
  2795. Set wet amount. Amount of processed (wet) signal.
  2796. Default is 1.
  2797. @item temp
  2798. Set temperature in degrees Celsius. This is the temperature of the environment.
  2799. Default is 20.
  2800. @end table
  2801. @section crossfeed
  2802. Apply headphone crossfeed filter.
  2803. Crossfeed is the process of blending the left and right channels of stereo
  2804. audio recording.
  2805. It is mainly used to reduce extreme stereo separation of low frequencies.
  2806. The intent is to produce more speaker like sound to the listener.
  2807. The filter accepts the following options:
  2808. @table @option
  2809. @item strength
  2810. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2811. This sets gain of low shelf filter for side part of stereo image.
  2812. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2813. @item range
  2814. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2815. This sets cut off frequency of low shelf filter. Default is cut off near
  2816. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2817. @item slope
  2818. Set curve slope of low shelf filter. Default is 0.5.
  2819. Allowed range is from 0.01 to 1.
  2820. @item level_in
  2821. Set input gain. Default is 0.9.
  2822. @item level_out
  2823. Set output gain. Default is 1.
  2824. @end table
  2825. @subsection Commands
  2826. This filter supports the all above options as @ref{commands}.
  2827. @section crystalizer
  2828. Simple algorithm for audio noise sharpening.
  2829. This filter linearly increases differences betweeen each audio sample.
  2830. The filter accepts the following options:
  2831. @table @option
  2832. @item i
  2833. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  2834. (unchanged sound) to 10.0 (maximum effect).
  2835. To inverse filtering use negative value.
  2836. @item c
  2837. Enable clipping. By default is enabled.
  2838. @end table
  2839. @subsection Commands
  2840. This filter supports the all above options as @ref{commands}.
  2841. @section dcshift
  2842. Apply a DC shift to the audio.
  2843. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2844. in the recording chain) from the audio. The effect of a DC offset is reduced
  2845. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2846. a signal has a DC offset.
  2847. @table @option
  2848. @item shift
  2849. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2850. the audio.
  2851. @item limitergain
  2852. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2853. used to prevent clipping.
  2854. @end table
  2855. @section deesser
  2856. Apply de-essing to the audio samples.
  2857. @table @option
  2858. @item i
  2859. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2860. Default is 0.
  2861. @item m
  2862. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2863. Default is 0.5.
  2864. @item f
  2865. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2866. Default is 0.5.
  2867. @item s
  2868. Set the output mode.
  2869. It accepts the following values:
  2870. @table @option
  2871. @item i
  2872. Pass input unchanged.
  2873. @item o
  2874. Pass ess filtered out.
  2875. @item e
  2876. Pass only ess.
  2877. Default value is @var{o}.
  2878. @end table
  2879. @end table
  2880. @section drmeter
  2881. Measure audio dynamic range.
  2882. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2883. is found in transition material. And anything less that 8 have very poor dynamics
  2884. and is very compressed.
  2885. The filter accepts the following options:
  2886. @table @option
  2887. @item length
  2888. Set window length in seconds used to split audio into segments of equal length.
  2889. Default is 3 seconds.
  2890. @end table
  2891. @section dynaudnorm
  2892. Dynamic Audio Normalizer.
  2893. This filter applies a certain amount of gain to the input audio in order
  2894. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2895. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2896. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2897. This allows for applying extra gain to the "quiet" sections of the audio
  2898. while avoiding distortions or clipping the "loud" sections. In other words:
  2899. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2900. sections, in the sense that the volume of each section is brought to the
  2901. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2902. this goal *without* applying "dynamic range compressing". It will retain 100%
  2903. of the dynamic range *within* each section of the audio file.
  2904. @table @option
  2905. @item framelen, f
  2906. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2907. Default is 500 milliseconds.
  2908. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2909. referred to as frames. This is required, because a peak magnitude has no
  2910. meaning for just a single sample value. Instead, we need to determine the
  2911. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2912. normalizer would simply use the peak magnitude of the complete file, the
  2913. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2914. frame. The length of a frame is specified in milliseconds. By default, the
  2915. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2916. been found to give good results with most files.
  2917. Note that the exact frame length, in number of samples, will be determined
  2918. automatically, based on the sampling rate of the individual input audio file.
  2919. @item gausssize, g
  2920. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2921. number. Default is 31.
  2922. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2923. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2924. is specified in frames, centered around the current frame. For the sake of
  2925. simplicity, this must be an odd number. Consequently, the default value of 31
  2926. takes into account the current frame, as well as the 15 preceding frames and
  2927. the 15 subsequent frames. Using a larger window results in a stronger
  2928. smoothing effect and thus in less gain variation, i.e. slower gain
  2929. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2930. effect and thus in more gain variation, i.e. faster gain adaptation.
  2931. In other words, the more you increase this value, the more the Dynamic Audio
  2932. Normalizer will behave like a "traditional" normalization filter. On the
  2933. contrary, the more you decrease this value, the more the Dynamic Audio
  2934. Normalizer will behave like a dynamic range compressor.
  2935. @item peak, p
  2936. Set the target peak value. This specifies the highest permissible magnitude
  2937. level for the normalized audio input. This filter will try to approach the
  2938. target peak magnitude as closely as possible, but at the same time it also
  2939. makes sure that the normalized signal will never exceed the peak magnitude.
  2940. A frame's maximum local gain factor is imposed directly by the target peak
  2941. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2942. It is not recommended to go above this value.
  2943. @item maxgain, m
  2944. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2945. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2946. factor for each input frame, i.e. the maximum gain factor that does not
  2947. result in clipping or distortion. The maximum gain factor is determined by
  2948. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2949. additionally bounds the frame's maximum gain factor by a predetermined
  2950. (global) maximum gain factor. This is done in order to avoid excessive gain
  2951. factors in "silent" or almost silent frames. By default, the maximum gain
  2952. factor is 10.0, For most inputs the default value should be sufficient and
  2953. it usually is not recommended to increase this value. Though, for input
  2954. with an extremely low overall volume level, it may be necessary to allow even
  2955. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2956. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2957. Instead, a "sigmoid" threshold function will be applied. This way, the
  2958. gain factors will smoothly approach the threshold value, but never exceed that
  2959. value.
  2960. @item targetrms, r
  2961. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2962. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2963. This means that the maximum local gain factor for each frame is defined
  2964. (only) by the frame's highest magnitude sample. This way, the samples can
  2965. be amplified as much as possible without exceeding the maximum signal
  2966. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2967. Normalizer can also take into account the frame's root mean square,
  2968. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2969. determine the power of a time-varying signal. It is therefore considered
  2970. that the RMS is a better approximation of the "perceived loudness" than
  2971. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2972. frames to a constant RMS value, a uniform "perceived loudness" can be
  2973. established. If a target RMS value has been specified, a frame's local gain
  2974. factor is defined as the factor that would result in exactly that RMS value.
  2975. Note, however, that the maximum local gain factor is still restricted by the
  2976. frame's highest magnitude sample, in order to prevent clipping.
  2977. @item coupling, n
  2978. Enable channels coupling. By default is enabled.
  2979. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2980. amount. This means the same gain factor will be applied to all channels, i.e.
  2981. the maximum possible gain factor is determined by the "loudest" channel.
  2982. However, in some recordings, it may happen that the volume of the different
  2983. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2984. In this case, this option can be used to disable the channel coupling. This way,
  2985. the gain factor will be determined independently for each channel, depending
  2986. only on the individual channel's highest magnitude sample. This allows for
  2987. harmonizing the volume of the different channels.
  2988. @item correctdc, c
  2989. Enable DC bias correction. By default is disabled.
  2990. An audio signal (in the time domain) is a sequence of sample values.
  2991. In the Dynamic Audio Normalizer these sample values are represented in the
  2992. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2993. audio signal, or "waveform", should be centered around the zero point.
  2994. That means if we calculate the mean value of all samples in a file, or in a
  2995. single frame, then the result should be 0.0 or at least very close to that
  2996. value. If, however, there is a significant deviation of the mean value from
  2997. 0.0, in either positive or negative direction, this is referred to as a
  2998. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2999. Audio Normalizer provides optional DC bias correction.
  3000. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3001. the mean value, or "DC correction" offset, of each input frame and subtract
  3002. that value from all of the frame's sample values which ensures those samples
  3003. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3004. boundaries, the DC correction offset values will be interpolated smoothly
  3005. between neighbouring frames.
  3006. @item altboundary, b
  3007. Enable alternative boundary mode. By default is disabled.
  3008. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3009. around each frame. This includes the preceding frames as well as the
  3010. subsequent frames. However, for the "boundary" frames, located at the very
  3011. beginning and at the very end of the audio file, not all neighbouring
  3012. frames are available. In particular, for the first few frames in the audio
  3013. file, the preceding frames are not known. And, similarly, for the last few
  3014. frames in the audio file, the subsequent frames are not known. Thus, the
  3015. question arises which gain factors should be assumed for the missing frames
  3016. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3017. to deal with this situation. The default boundary mode assumes a gain factor
  3018. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3019. "fade out" at the beginning and at the end of the input, respectively.
  3020. @item compress, s
  3021. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3022. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3023. compression. This means that signal peaks will not be pruned and thus the
  3024. full dynamic range will be retained within each local neighbourhood. However,
  3025. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3026. normalization algorithm with a more "traditional" compression.
  3027. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3028. (thresholding) function. If (and only if) the compression feature is enabled,
  3029. all input frames will be processed by a soft knee thresholding function prior
  3030. to the actual normalization process. Put simply, the thresholding function is
  3031. going to prune all samples whose magnitude exceeds a certain threshold value.
  3032. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3033. value. Instead, the threshold value will be adjusted for each individual
  3034. frame.
  3035. In general, smaller parameters result in stronger compression, and vice versa.
  3036. Values below 3.0 are not recommended, because audible distortion may appear.
  3037. @item threshold, t
  3038. Set the target threshold value. This specifies the lowest permissible
  3039. magnitude level for the audio input which will be normalized.
  3040. If input frame volume is above this value frame will be normalized.
  3041. Otherwise frame may not be normalized at all. The default value is set
  3042. to 0, which means all input frames will be normalized.
  3043. This option is mostly useful if digital noise is not wanted to be amplified.
  3044. @end table
  3045. @subsection Commands
  3046. This filter supports the all above options as @ref{commands}.
  3047. @section earwax
  3048. Make audio easier to listen to on headphones.
  3049. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3050. so that when listened to on headphones the stereo image is moved from
  3051. inside your head (standard for headphones) to outside and in front of
  3052. the listener (standard for speakers).
  3053. Ported from SoX.
  3054. @section equalizer
  3055. Apply a two-pole peaking equalisation (EQ) filter. With this
  3056. filter, the signal-level at and around a selected frequency can
  3057. be increased or decreased, whilst (unlike bandpass and bandreject
  3058. filters) that at all other frequencies is unchanged.
  3059. In order to produce complex equalisation curves, this filter can
  3060. be given several times, each with a different central frequency.
  3061. The filter accepts the following options:
  3062. @table @option
  3063. @item frequency, f
  3064. Set the filter's central frequency in Hz.
  3065. @item width_type, t
  3066. Set method to specify band-width of filter.
  3067. @table @option
  3068. @item h
  3069. Hz
  3070. @item q
  3071. Q-Factor
  3072. @item o
  3073. octave
  3074. @item s
  3075. slope
  3076. @item k
  3077. kHz
  3078. @end table
  3079. @item width, w
  3080. Specify the band-width of a filter in width_type units.
  3081. @item gain, g
  3082. Set the required gain or attenuation in dB.
  3083. Beware of clipping when using a positive gain.
  3084. @item mix, m
  3085. How much to use filtered signal in output. Default is 1.
  3086. Range is between 0 and 1.
  3087. @item channels, c
  3088. Specify which channels to filter, by default all available are filtered.
  3089. @item normalize, n
  3090. Normalize biquad coefficients, by default is disabled.
  3091. Enabling it will normalize magnitude response at DC to 0dB.
  3092. @item transform, a
  3093. Set transform type of IIR filter.
  3094. @table @option
  3095. @item di
  3096. @item dii
  3097. @item tdii
  3098. @item latt
  3099. @end table
  3100. @item precision, r
  3101. Set precison of filtering.
  3102. @table @option
  3103. @item auto
  3104. Pick automatic sample format depending on surround filters.
  3105. @item s16
  3106. Always use signed 16-bit.
  3107. @item s32
  3108. Always use signed 32-bit.
  3109. @item f32
  3110. Always use float 32-bit.
  3111. @item f64
  3112. Always use float 64-bit.
  3113. @end table
  3114. @end table
  3115. @subsection Examples
  3116. @itemize
  3117. @item
  3118. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3119. @example
  3120. equalizer=f=1000:t=h:width=200:g=-10
  3121. @end example
  3122. @item
  3123. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3124. @example
  3125. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3126. @end example
  3127. @end itemize
  3128. @subsection Commands
  3129. This filter supports the following commands:
  3130. @table @option
  3131. @item frequency, f
  3132. Change equalizer frequency.
  3133. Syntax for the command is : "@var{frequency}"
  3134. @item width_type, t
  3135. Change equalizer width_type.
  3136. Syntax for the command is : "@var{width_type}"
  3137. @item width, w
  3138. Change equalizer width.
  3139. Syntax for the command is : "@var{width}"
  3140. @item gain, g
  3141. Change equalizer gain.
  3142. Syntax for the command is : "@var{gain}"
  3143. @item mix, m
  3144. Change equalizer mix.
  3145. Syntax for the command is : "@var{mix}"
  3146. @end table
  3147. @section extrastereo
  3148. Linearly increases the difference between left and right channels which
  3149. adds some sort of "live" effect to playback.
  3150. The filter accepts the following options:
  3151. @table @option
  3152. @item m
  3153. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3154. (average of both channels), with 1.0 sound will be unchanged, with
  3155. -1.0 left and right channels will be swapped.
  3156. @item c
  3157. Enable clipping. By default is enabled.
  3158. @end table
  3159. @subsection Commands
  3160. This filter supports the all above options as @ref{commands}.
  3161. @section firequalizer
  3162. Apply FIR Equalization using arbitrary frequency response.
  3163. The filter accepts the following option:
  3164. @table @option
  3165. @item gain
  3166. Set gain curve equation (in dB). The expression can contain variables:
  3167. @table @option
  3168. @item f
  3169. the evaluated frequency
  3170. @item sr
  3171. sample rate
  3172. @item ch
  3173. channel number, set to 0 when multichannels evaluation is disabled
  3174. @item chid
  3175. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3176. multichannels evaluation is disabled
  3177. @item chs
  3178. number of channels
  3179. @item chlayout
  3180. channel_layout, see libavutil/channel_layout.h
  3181. @end table
  3182. and functions:
  3183. @table @option
  3184. @item gain_interpolate(f)
  3185. interpolate gain on frequency f based on gain_entry
  3186. @item cubic_interpolate(f)
  3187. same as gain_interpolate, but smoother
  3188. @end table
  3189. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3190. @item gain_entry
  3191. Set gain entry for gain_interpolate function. The expression can
  3192. contain functions:
  3193. @table @option
  3194. @item entry(f, g)
  3195. store gain entry at frequency f with value g
  3196. @end table
  3197. This option is also available as command.
  3198. @item delay
  3199. Set filter delay in seconds. Higher value means more accurate.
  3200. Default is @code{0.01}.
  3201. @item accuracy
  3202. Set filter accuracy in Hz. Lower value means more accurate.
  3203. Default is @code{5}.
  3204. @item wfunc
  3205. Set window function. Acceptable values are:
  3206. @table @option
  3207. @item rectangular
  3208. rectangular window, useful when gain curve is already smooth
  3209. @item hann
  3210. hann window (default)
  3211. @item hamming
  3212. hamming window
  3213. @item blackman
  3214. blackman window
  3215. @item nuttall3
  3216. 3-terms continuous 1st derivative nuttall window
  3217. @item mnuttall3
  3218. minimum 3-terms discontinuous nuttall window
  3219. @item nuttall
  3220. 4-terms continuous 1st derivative nuttall window
  3221. @item bnuttall
  3222. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3223. @item bharris
  3224. blackman-harris window
  3225. @item tukey
  3226. tukey window
  3227. @end table
  3228. @item fixed
  3229. If enabled, use fixed number of audio samples. This improves speed when
  3230. filtering with large delay. Default is disabled.
  3231. @item multi
  3232. Enable multichannels evaluation on gain. Default is disabled.
  3233. @item zero_phase
  3234. Enable zero phase mode by subtracting timestamp to compensate delay.
  3235. Default is disabled.
  3236. @item scale
  3237. Set scale used by gain. Acceptable values are:
  3238. @table @option
  3239. @item linlin
  3240. linear frequency, linear gain
  3241. @item linlog
  3242. linear frequency, logarithmic (in dB) gain (default)
  3243. @item loglin
  3244. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3245. @item loglog
  3246. logarithmic frequency, logarithmic gain
  3247. @end table
  3248. @item dumpfile
  3249. Set file for dumping, suitable for gnuplot.
  3250. @item dumpscale
  3251. Set scale for dumpfile. Acceptable values are same with scale option.
  3252. Default is linlog.
  3253. @item fft2
  3254. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3255. Default is disabled.
  3256. @item min_phase
  3257. Enable minimum phase impulse response. Default is disabled.
  3258. @end table
  3259. @subsection Examples
  3260. @itemize
  3261. @item
  3262. lowpass at 1000 Hz:
  3263. @example
  3264. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3265. @end example
  3266. @item
  3267. lowpass at 1000 Hz with gain_entry:
  3268. @example
  3269. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3270. @end example
  3271. @item
  3272. custom equalization:
  3273. @example
  3274. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3275. @end example
  3276. @item
  3277. higher delay with zero phase to compensate delay:
  3278. @example
  3279. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3280. @end example
  3281. @item
  3282. lowpass on left channel, highpass on right channel:
  3283. @example
  3284. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3285. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3286. @end example
  3287. @end itemize
  3288. @section flanger
  3289. Apply a flanging effect to the audio.
  3290. The filter accepts the following options:
  3291. @table @option
  3292. @item delay
  3293. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3294. @item depth
  3295. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3296. @item regen
  3297. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3298. Default value is 0.
  3299. @item width
  3300. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3301. Default value is 71.
  3302. @item speed
  3303. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3304. @item shape
  3305. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3306. Default value is @var{sinusoidal}.
  3307. @item phase
  3308. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3309. Default value is 25.
  3310. @item interp
  3311. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3312. Default is @var{linear}.
  3313. @end table
  3314. @section haas
  3315. Apply Haas effect to audio.
  3316. Note that this makes most sense to apply on mono signals.
  3317. With this filter applied to mono signals it give some directionality and
  3318. stretches its stereo image.
  3319. The filter accepts the following options:
  3320. @table @option
  3321. @item level_in
  3322. Set input level. By default is @var{1}, or 0dB
  3323. @item level_out
  3324. Set output level. By default is @var{1}, or 0dB.
  3325. @item side_gain
  3326. Set gain applied to side part of signal. By default is @var{1}.
  3327. @item middle_source
  3328. Set kind of middle source. Can be one of the following:
  3329. @table @samp
  3330. @item left
  3331. Pick left channel.
  3332. @item right
  3333. Pick right channel.
  3334. @item mid
  3335. Pick middle part signal of stereo image.
  3336. @item side
  3337. Pick side part signal of stereo image.
  3338. @end table
  3339. @item middle_phase
  3340. Change middle phase. By default is disabled.
  3341. @item left_delay
  3342. Set left channel delay. By default is @var{2.05} milliseconds.
  3343. @item left_balance
  3344. Set left channel balance. By default is @var{-1}.
  3345. @item left_gain
  3346. Set left channel gain. By default is @var{1}.
  3347. @item left_phase
  3348. Change left phase. By default is disabled.
  3349. @item right_delay
  3350. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3351. @item right_balance
  3352. Set right channel balance. By default is @var{1}.
  3353. @item right_gain
  3354. Set right channel gain. By default is @var{1}.
  3355. @item right_phase
  3356. Change right phase. By default is enabled.
  3357. @end table
  3358. @section hdcd
  3359. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3360. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3361. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3362. of HDCD, and detects the Transient Filter flag.
  3363. @example
  3364. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3365. @end example
  3366. When using the filter with wav, note the default encoding for wav is 16-bit,
  3367. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3368. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3369. @example
  3370. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3371. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3372. @end example
  3373. The filter accepts the following options:
  3374. @table @option
  3375. @item disable_autoconvert
  3376. Disable any automatic format conversion or resampling in the filter graph.
  3377. @item process_stereo
  3378. Process the stereo channels together. If target_gain does not match between
  3379. channels, consider it invalid and use the last valid target_gain.
  3380. @item cdt_ms
  3381. Set the code detect timer period in ms.
  3382. @item force_pe
  3383. Always extend peaks above -3dBFS even if PE isn't signaled.
  3384. @item analyze_mode
  3385. Replace audio with a solid tone and adjust the amplitude to signal some
  3386. specific aspect of the decoding process. The output file can be loaded in
  3387. an audio editor alongside the original to aid analysis.
  3388. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3389. Modes are:
  3390. @table @samp
  3391. @item 0, off
  3392. Disabled
  3393. @item 1, lle
  3394. Gain adjustment level at each sample
  3395. @item 2, pe
  3396. Samples where peak extend occurs
  3397. @item 3, cdt
  3398. Samples where the code detect timer is active
  3399. @item 4, tgm
  3400. Samples where the target gain does not match between channels
  3401. @end table
  3402. @end table
  3403. @section headphone
  3404. Apply head-related transfer functions (HRTFs) to create virtual
  3405. loudspeakers around the user for binaural listening via headphones.
  3406. The HRIRs are provided via additional streams, for each channel
  3407. one stereo input stream is needed.
  3408. The filter accepts the following options:
  3409. @table @option
  3410. @item map
  3411. Set mapping of input streams for convolution.
  3412. The argument is a '|'-separated list of channel names in order as they
  3413. are given as additional stream inputs for filter.
  3414. This also specify number of input streams. Number of input streams
  3415. must be not less than number of channels in first stream plus one.
  3416. @item gain
  3417. Set gain applied to audio. Value is in dB. Default is 0.
  3418. @item type
  3419. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3420. processing audio in time domain which is slow.
  3421. @var{freq} is processing audio in frequency domain which is fast.
  3422. Default is @var{freq}.
  3423. @item lfe
  3424. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3425. @item size
  3426. Set size of frame in number of samples which will be processed at once.
  3427. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3428. @item hrir
  3429. Set format of hrir stream.
  3430. Default value is @var{stereo}. Alternative value is @var{multich}.
  3431. If value is set to @var{stereo}, number of additional streams should
  3432. be greater or equal to number of input channels in first input stream.
  3433. Also each additional stream should have stereo number of channels.
  3434. If value is set to @var{multich}, number of additional streams should
  3435. be exactly one. Also number of input channels of additional stream
  3436. should be equal or greater than twice number of channels of first input
  3437. stream.
  3438. @end table
  3439. @subsection Examples
  3440. @itemize
  3441. @item
  3442. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3443. each amovie filter use stereo file with IR coefficients as input.
  3444. The files give coefficients for each position of virtual loudspeaker:
  3445. @example
  3446. ffmpeg -i input.wav
  3447. -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"
  3448. output.wav
  3449. @end example
  3450. @item
  3451. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3452. but now in @var{multich} @var{hrir} format.
  3453. @example
  3454. 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"
  3455. output.wav
  3456. @end example
  3457. @end itemize
  3458. @section highpass
  3459. Apply a high-pass filter with 3dB point frequency.
  3460. The filter can be either single-pole, or double-pole (the default).
  3461. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3462. The filter accepts the following options:
  3463. @table @option
  3464. @item frequency, f
  3465. Set frequency in Hz. Default is 3000.
  3466. @item poles, p
  3467. Set number of poles. Default is 2.
  3468. @item width_type, t
  3469. Set method to specify band-width of filter.
  3470. @table @option
  3471. @item h
  3472. Hz
  3473. @item q
  3474. Q-Factor
  3475. @item o
  3476. octave
  3477. @item s
  3478. slope
  3479. @item k
  3480. kHz
  3481. @end table
  3482. @item width, w
  3483. Specify the band-width of a filter in width_type units.
  3484. Applies only to double-pole filter.
  3485. The default is 0.707q and gives a Butterworth response.
  3486. @item mix, m
  3487. How much to use filtered signal in output. Default is 1.
  3488. Range is between 0 and 1.
  3489. @item channels, c
  3490. Specify which channels to filter, by default all available are filtered.
  3491. @item normalize, n
  3492. Normalize biquad coefficients, by default is disabled.
  3493. Enabling it will normalize magnitude response at DC to 0dB.
  3494. @item transform, a
  3495. Set transform type of IIR filter.
  3496. @table @option
  3497. @item di
  3498. @item dii
  3499. @item tdii
  3500. @item latt
  3501. @end table
  3502. @item precision, r
  3503. Set precison of filtering.
  3504. @table @option
  3505. @item auto
  3506. Pick automatic sample format depending on surround filters.
  3507. @item s16
  3508. Always use signed 16-bit.
  3509. @item s32
  3510. Always use signed 32-bit.
  3511. @item f32
  3512. Always use float 32-bit.
  3513. @item f64
  3514. Always use float 64-bit.
  3515. @end table
  3516. @end table
  3517. @subsection Commands
  3518. This filter supports the following commands:
  3519. @table @option
  3520. @item frequency, f
  3521. Change highpass frequency.
  3522. Syntax for the command is : "@var{frequency}"
  3523. @item width_type, t
  3524. Change highpass width_type.
  3525. Syntax for the command is : "@var{width_type}"
  3526. @item width, w
  3527. Change highpass width.
  3528. Syntax for the command is : "@var{width}"
  3529. @item mix, m
  3530. Change highpass mix.
  3531. Syntax for the command is : "@var{mix}"
  3532. @end table
  3533. @section join
  3534. Join multiple input streams into one multi-channel stream.
  3535. It accepts the following parameters:
  3536. @table @option
  3537. @item inputs
  3538. The number of input streams. It defaults to 2.
  3539. @item channel_layout
  3540. The desired output channel layout. It defaults to stereo.
  3541. @item map
  3542. Map channels from inputs to output. The argument is a '|'-separated list of
  3543. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3544. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3545. can be either the name of the input channel (e.g. FL for front left) or its
  3546. index in the specified input stream. @var{out_channel} is the name of the output
  3547. channel.
  3548. @end table
  3549. The filter will attempt to guess the mappings when they are not specified
  3550. explicitly. It does so by first trying to find an unused matching input channel
  3551. and if that fails it picks the first unused input channel.
  3552. Join 3 inputs (with properly set channel layouts):
  3553. @example
  3554. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3555. @end example
  3556. Build a 5.1 output from 6 single-channel streams:
  3557. @example
  3558. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3559. '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'
  3560. out
  3561. @end example
  3562. @section ladspa
  3563. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3564. To enable compilation of this filter you need to configure FFmpeg with
  3565. @code{--enable-ladspa}.
  3566. @table @option
  3567. @item file, f
  3568. Specifies the name of LADSPA plugin library to load. If the environment
  3569. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3570. each one of the directories specified by the colon separated list in
  3571. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3572. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3573. @file{/usr/lib/ladspa/}.
  3574. @item plugin, p
  3575. Specifies the plugin within the library. Some libraries contain only
  3576. one plugin, but others contain many of them. If this is not set filter
  3577. will list all available plugins within the specified library.
  3578. @item controls, c
  3579. Set the '|' separated list of controls which are zero or more floating point
  3580. values that determine the behavior of the loaded plugin (for example delay,
  3581. threshold or gain).
  3582. Controls need to be defined using the following syntax:
  3583. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3584. @var{valuei} is the value set on the @var{i}-th control.
  3585. Alternatively they can be also defined using the following syntax:
  3586. @var{value0}|@var{value1}|@var{value2}|..., where
  3587. @var{valuei} is the value set on the @var{i}-th control.
  3588. If @option{controls} is set to @code{help}, all available controls and
  3589. their valid ranges are printed.
  3590. @item sample_rate, s
  3591. Specify the sample rate, default to 44100. Only used if plugin have
  3592. zero inputs.
  3593. @item nb_samples, n
  3594. Set the number of samples per channel per each output frame, default
  3595. is 1024. Only used if plugin have zero inputs.
  3596. @item duration, d
  3597. Set the minimum duration of the sourced audio. See
  3598. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3599. for the accepted syntax.
  3600. Note that the resulting duration may be greater than the specified duration,
  3601. as the generated audio is always cut at the end of a complete frame.
  3602. If not specified, or the expressed duration is negative, the audio is
  3603. supposed to be generated forever.
  3604. Only used if plugin have zero inputs.
  3605. @item latency, l
  3606. Enable latency compensation, by default is disabled.
  3607. Only used if plugin have inputs.
  3608. @end table
  3609. @subsection Examples
  3610. @itemize
  3611. @item
  3612. List all available plugins within amp (LADSPA example plugin) library:
  3613. @example
  3614. ladspa=file=amp
  3615. @end example
  3616. @item
  3617. List all available controls and their valid ranges for @code{vcf_notch}
  3618. plugin from @code{VCF} library:
  3619. @example
  3620. ladspa=f=vcf:p=vcf_notch:c=help
  3621. @end example
  3622. @item
  3623. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3624. plugin library:
  3625. @example
  3626. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3627. @end example
  3628. @item
  3629. Add reverberation to the audio using TAP-plugins
  3630. (Tom's Audio Processing plugins):
  3631. @example
  3632. ladspa=file=tap_reverb:tap_reverb
  3633. @end example
  3634. @item
  3635. Generate white noise, with 0.2 amplitude:
  3636. @example
  3637. ladspa=file=cmt:noise_source_white:c=c0=.2
  3638. @end example
  3639. @item
  3640. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3641. @code{C* Audio Plugin Suite} (CAPS) library:
  3642. @example
  3643. ladspa=file=caps:Click:c=c1=20'
  3644. @end example
  3645. @item
  3646. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3647. @example
  3648. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3649. @end example
  3650. @item
  3651. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3652. @code{SWH Plugins} collection:
  3653. @example
  3654. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3655. @end example
  3656. @item
  3657. Attenuate low frequencies using Multiband EQ from Steve Harris
  3658. @code{SWH Plugins} collection:
  3659. @example
  3660. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3661. @end example
  3662. @item
  3663. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3664. (CAPS) library:
  3665. @example
  3666. ladspa=caps:Narrower
  3667. @end example
  3668. @item
  3669. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3670. @example
  3671. ladspa=caps:White:.2
  3672. @end example
  3673. @item
  3674. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3675. @example
  3676. ladspa=caps:Fractal:c=c1=1
  3677. @end example
  3678. @item
  3679. Dynamic volume normalization using @code{VLevel} plugin:
  3680. @example
  3681. ladspa=vlevel-ladspa:vlevel_mono
  3682. @end example
  3683. @end itemize
  3684. @subsection Commands
  3685. This filter supports the following commands:
  3686. @table @option
  3687. @item cN
  3688. Modify the @var{N}-th control value.
  3689. If the specified value is not valid, it is ignored and prior one is kept.
  3690. @end table
  3691. @section loudnorm
  3692. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3693. Support for both single pass (livestreams, files) and double pass (files) modes.
  3694. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3695. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3696. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3697. The filter accepts the following options:
  3698. @table @option
  3699. @item I, i
  3700. Set integrated loudness target.
  3701. Range is -70.0 - -5.0. Default value is -24.0.
  3702. @item LRA, lra
  3703. Set loudness range target.
  3704. Range is 1.0 - 20.0. Default value is 7.0.
  3705. @item TP, tp
  3706. Set maximum true peak.
  3707. Range is -9.0 - +0.0. Default value is -2.0.
  3708. @item measured_I, measured_i
  3709. Measured IL of input file.
  3710. Range is -99.0 - +0.0.
  3711. @item measured_LRA, measured_lra
  3712. Measured LRA of input file.
  3713. Range is 0.0 - 99.0.
  3714. @item measured_TP, measured_tp
  3715. Measured true peak of input file.
  3716. Range is -99.0 - +99.0.
  3717. @item measured_thresh
  3718. Measured threshold of input file.
  3719. Range is -99.0 - +0.0.
  3720. @item offset
  3721. Set offset gain. Gain is applied before the true-peak limiter.
  3722. Range is -99.0 - +99.0. Default is +0.0.
  3723. @item linear
  3724. Normalize by linearly scaling the source audio.
  3725. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3726. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3727. be lower than source LRA and the change in integrated loudness shouldn't
  3728. result in a true peak which exceeds the target TP. If any of these
  3729. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3730. Options are @code{true} or @code{false}. Default is @code{true}.
  3731. @item dual_mono
  3732. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3733. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3734. If set to @code{true}, this option will compensate for this effect.
  3735. Multi-channel input files are not affected by this option.
  3736. Options are true or false. Default is false.
  3737. @item print_format
  3738. Set print format for stats. Options are summary, json, or none.
  3739. Default value is none.
  3740. @end table
  3741. @section lowpass
  3742. Apply a low-pass filter with 3dB point frequency.
  3743. The filter can be either single-pole or double-pole (the default).
  3744. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3745. The filter accepts the following options:
  3746. @table @option
  3747. @item frequency, f
  3748. Set frequency in Hz. Default is 500.
  3749. @item poles, p
  3750. Set number of poles. Default is 2.
  3751. @item width_type, t
  3752. Set method to specify band-width of filter.
  3753. @table @option
  3754. @item h
  3755. Hz
  3756. @item q
  3757. Q-Factor
  3758. @item o
  3759. octave
  3760. @item s
  3761. slope
  3762. @item k
  3763. kHz
  3764. @end table
  3765. @item width, w
  3766. Specify the band-width of a filter in width_type units.
  3767. Applies only to double-pole filter.
  3768. The default is 0.707q and gives a Butterworth response.
  3769. @item mix, m
  3770. How much to use filtered signal in output. Default is 1.
  3771. Range is between 0 and 1.
  3772. @item channels, c
  3773. Specify which channels to filter, by default all available are filtered.
  3774. @item normalize, n
  3775. Normalize biquad coefficients, by default is disabled.
  3776. Enabling it will normalize magnitude response at DC to 0dB.
  3777. @item transform, a
  3778. Set transform type of IIR filter.
  3779. @table @option
  3780. @item di
  3781. @item dii
  3782. @item tdii
  3783. @item latt
  3784. @end table
  3785. @item precision, r
  3786. Set precison of filtering.
  3787. @table @option
  3788. @item auto
  3789. Pick automatic sample format depending on surround filters.
  3790. @item s16
  3791. Always use signed 16-bit.
  3792. @item s32
  3793. Always use signed 32-bit.
  3794. @item f32
  3795. Always use float 32-bit.
  3796. @item f64
  3797. Always use float 64-bit.
  3798. @end table
  3799. @end table
  3800. @subsection Examples
  3801. @itemize
  3802. @item
  3803. Lowpass only LFE channel, it LFE is not present it does nothing:
  3804. @example
  3805. lowpass=c=LFE
  3806. @end example
  3807. @end itemize
  3808. @subsection Commands
  3809. This filter supports the following commands:
  3810. @table @option
  3811. @item frequency, f
  3812. Change lowpass frequency.
  3813. Syntax for the command is : "@var{frequency}"
  3814. @item width_type, t
  3815. Change lowpass width_type.
  3816. Syntax for the command is : "@var{width_type}"
  3817. @item width, w
  3818. Change lowpass width.
  3819. Syntax for the command is : "@var{width}"
  3820. @item mix, m
  3821. Change lowpass mix.
  3822. Syntax for the command is : "@var{mix}"
  3823. @end table
  3824. @section lv2
  3825. Load a LV2 (LADSPA Version 2) plugin.
  3826. To enable compilation of this filter you need to configure FFmpeg with
  3827. @code{--enable-lv2}.
  3828. @table @option
  3829. @item plugin, p
  3830. Specifies the plugin URI. You may need to escape ':'.
  3831. @item controls, c
  3832. Set the '|' separated list of controls which are zero or more floating point
  3833. values that determine the behavior of the loaded plugin (for example delay,
  3834. threshold or gain).
  3835. If @option{controls} is set to @code{help}, all available controls and
  3836. their valid ranges are printed.
  3837. @item sample_rate, s
  3838. Specify the sample rate, default to 44100. Only used if plugin have
  3839. zero inputs.
  3840. @item nb_samples, n
  3841. Set the number of samples per channel per each output frame, default
  3842. is 1024. Only used if plugin have zero inputs.
  3843. @item duration, d
  3844. Set the minimum duration of the sourced audio. See
  3845. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3846. for the accepted syntax.
  3847. Note that the resulting duration may be greater than the specified duration,
  3848. as the generated audio is always cut at the end of a complete frame.
  3849. If not specified, or the expressed duration is negative, the audio is
  3850. supposed to be generated forever.
  3851. Only used if plugin have zero inputs.
  3852. @end table
  3853. @subsection Examples
  3854. @itemize
  3855. @item
  3856. Apply bass enhancer plugin from Calf:
  3857. @example
  3858. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3859. @end example
  3860. @item
  3861. Apply vinyl plugin from Calf:
  3862. @example
  3863. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3864. @end example
  3865. @item
  3866. Apply bit crusher plugin from ArtyFX:
  3867. @example
  3868. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3869. @end example
  3870. @end itemize
  3871. @section mcompand
  3872. Multiband Compress or expand the audio's dynamic range.
  3873. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3874. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3875. response when absent compander action.
  3876. It accepts the following parameters:
  3877. @table @option
  3878. @item args
  3879. This option syntax is:
  3880. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3881. For explanation of each item refer to compand filter documentation.
  3882. @end table
  3883. @anchor{pan}
  3884. @section pan
  3885. Mix channels with specific gain levels. The filter accepts the output
  3886. channel layout followed by a set of channels definitions.
  3887. This filter is also designed to efficiently remap the channels of an audio
  3888. stream.
  3889. The filter accepts parameters of the form:
  3890. "@var{l}|@var{outdef}|@var{outdef}|..."
  3891. @table @option
  3892. @item l
  3893. output channel layout or number of channels
  3894. @item outdef
  3895. output channel specification, of the form:
  3896. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3897. @item out_name
  3898. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3899. number (c0, c1, etc.)
  3900. @item gain
  3901. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3902. @item in_name
  3903. input channel to use, see out_name for details; it is not possible to mix
  3904. named and numbered input channels
  3905. @end table
  3906. If the `=' in a channel specification is replaced by `<', then the gains for
  3907. that specification will be renormalized so that the total is 1, thus
  3908. avoiding clipping noise.
  3909. @subsection Mixing examples
  3910. For example, if you want to down-mix from stereo to mono, but with a bigger
  3911. factor for the left channel:
  3912. @example
  3913. pan=1c|c0=0.9*c0+0.1*c1
  3914. @end example
  3915. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3916. 7-channels surround:
  3917. @example
  3918. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3919. @end example
  3920. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3921. that should be preferred (see "-ac" option) unless you have very specific
  3922. needs.
  3923. @subsection Remapping examples
  3924. The channel remapping will be effective if, and only if:
  3925. @itemize
  3926. @item gain coefficients are zeroes or ones,
  3927. @item only one input per channel output,
  3928. @end itemize
  3929. If all these conditions are satisfied, the filter will notify the user ("Pure
  3930. channel mapping detected"), and use an optimized and lossless method to do the
  3931. remapping.
  3932. For example, if you have a 5.1 source and want a stereo audio stream by
  3933. dropping the extra channels:
  3934. @example
  3935. pan="stereo| c0=FL | c1=FR"
  3936. @end example
  3937. Given the same source, you can also switch front left and front right channels
  3938. and keep the input channel layout:
  3939. @example
  3940. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3941. @end example
  3942. If the input is a stereo audio stream, you can mute the front left channel (and
  3943. still keep the stereo channel layout) with:
  3944. @example
  3945. pan="stereo|c1=c1"
  3946. @end example
  3947. Still with a stereo audio stream input, you can copy the right channel in both
  3948. front left and right:
  3949. @example
  3950. pan="stereo| c0=FR | c1=FR"
  3951. @end example
  3952. @section replaygain
  3953. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3954. outputs it unchanged.
  3955. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3956. @section resample
  3957. Convert the audio sample format, sample rate and channel layout. It is
  3958. not meant to be used directly.
  3959. @section rubberband
  3960. Apply time-stretching and pitch-shifting with librubberband.
  3961. To enable compilation of this filter, you need to configure FFmpeg with
  3962. @code{--enable-librubberband}.
  3963. The filter accepts the following options:
  3964. @table @option
  3965. @item tempo
  3966. Set tempo scale factor.
  3967. @item pitch
  3968. Set pitch scale factor.
  3969. @item transients
  3970. Set transients detector.
  3971. Possible values are:
  3972. @table @var
  3973. @item crisp
  3974. @item mixed
  3975. @item smooth
  3976. @end table
  3977. @item detector
  3978. Set detector.
  3979. Possible values are:
  3980. @table @var
  3981. @item compound
  3982. @item percussive
  3983. @item soft
  3984. @end table
  3985. @item phase
  3986. Set phase.
  3987. Possible values are:
  3988. @table @var
  3989. @item laminar
  3990. @item independent
  3991. @end table
  3992. @item window
  3993. Set processing window size.
  3994. Possible values are:
  3995. @table @var
  3996. @item standard
  3997. @item short
  3998. @item long
  3999. @end table
  4000. @item smoothing
  4001. Set smoothing.
  4002. Possible values are:
  4003. @table @var
  4004. @item off
  4005. @item on
  4006. @end table
  4007. @item formant
  4008. Enable formant preservation when shift pitching.
  4009. Possible values are:
  4010. @table @var
  4011. @item shifted
  4012. @item preserved
  4013. @end table
  4014. @item pitchq
  4015. Set pitch quality.
  4016. Possible values are:
  4017. @table @var
  4018. @item quality
  4019. @item speed
  4020. @item consistency
  4021. @end table
  4022. @item channels
  4023. Set channels.
  4024. Possible values are:
  4025. @table @var
  4026. @item apart
  4027. @item together
  4028. @end table
  4029. @end table
  4030. @subsection Commands
  4031. This filter supports the following commands:
  4032. @table @option
  4033. @item tempo
  4034. Change filter tempo scale factor.
  4035. Syntax for the command is : "@var{tempo}"
  4036. @item pitch
  4037. Change filter pitch scale factor.
  4038. Syntax for the command is : "@var{pitch}"
  4039. @end table
  4040. @section sidechaincompress
  4041. This filter acts like normal compressor but has the ability to compress
  4042. detected signal using second input signal.
  4043. It needs two input streams and returns one output stream.
  4044. First input stream will be processed depending on second stream signal.
  4045. The filtered signal then can be filtered with other filters in later stages of
  4046. processing. See @ref{pan} and @ref{amerge} filter.
  4047. The filter accepts the following options:
  4048. @table @option
  4049. @item level_in
  4050. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4051. @item mode
  4052. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4053. Default is @code{downward}.
  4054. @item threshold
  4055. If a signal of second stream raises above this level it will affect the gain
  4056. reduction of first stream.
  4057. By default is 0.125. Range is between 0.00097563 and 1.
  4058. @item ratio
  4059. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4060. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4061. Default is 2. Range is between 1 and 20.
  4062. @item attack
  4063. Amount of milliseconds the signal has to rise above the threshold before gain
  4064. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4065. @item release
  4066. Amount of milliseconds the signal has to fall below the threshold before
  4067. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4068. @item makeup
  4069. Set the amount by how much signal will be amplified after processing.
  4070. Default is 1. Range is from 1 to 64.
  4071. @item knee
  4072. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4073. Default is 2.82843. Range is between 1 and 8.
  4074. @item link
  4075. Choose if the @code{average} level between all channels of side-chain stream
  4076. or the louder(@code{maximum}) channel of side-chain stream affects the
  4077. reduction. Default is @code{average}.
  4078. @item detection
  4079. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4080. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4081. @item level_sc
  4082. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4083. @item mix
  4084. How much to use compressed signal in output. Default is 1.
  4085. Range is between 0 and 1.
  4086. @end table
  4087. @subsection Commands
  4088. This filter supports the all above options as @ref{commands}.
  4089. @subsection Examples
  4090. @itemize
  4091. @item
  4092. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4093. depending on the signal of 2nd input and later compressed signal to be
  4094. merged with 2nd input:
  4095. @example
  4096. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4097. @end example
  4098. @end itemize
  4099. @section sidechaingate
  4100. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4101. filter the detected signal before sending it to the gain reduction stage.
  4102. Normally a gate uses the full range signal to detect a level above the
  4103. threshold.
  4104. For example: If you cut all lower frequencies from your sidechain signal
  4105. the gate will decrease the volume of your track only if not enough highs
  4106. appear. With this technique you are able to reduce the resonation of a
  4107. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4108. guitar.
  4109. It needs two input streams and returns one output stream.
  4110. First input stream will be processed depending on second stream signal.
  4111. The filter accepts the following options:
  4112. @table @option
  4113. @item level_in
  4114. Set input level before filtering.
  4115. Default is 1. Allowed range is from 0.015625 to 64.
  4116. @item mode
  4117. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4118. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4119. will be amplified, expanding dynamic range in upward direction.
  4120. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4121. @item range
  4122. Set the level of gain reduction when the signal is below the threshold.
  4123. Default is 0.06125. Allowed range is from 0 to 1.
  4124. Setting this to 0 disables reduction and then filter behaves like expander.
  4125. @item threshold
  4126. If a signal rises above this level the gain reduction is released.
  4127. Default is 0.125. Allowed range is from 0 to 1.
  4128. @item ratio
  4129. Set a ratio about which the signal is reduced.
  4130. Default is 2. Allowed range is from 1 to 9000.
  4131. @item attack
  4132. Amount of milliseconds the signal has to rise above the threshold before gain
  4133. reduction stops.
  4134. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4135. @item release
  4136. Amount of milliseconds the signal has to fall below the threshold before the
  4137. reduction is increased again. Default is 250 milliseconds.
  4138. Allowed range is from 0.01 to 9000.
  4139. @item makeup
  4140. Set amount of amplification of signal after processing.
  4141. Default is 1. Allowed range is from 1 to 64.
  4142. @item knee
  4143. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4144. Default is 2.828427125. Allowed range is from 1 to 8.
  4145. @item detection
  4146. Choose if exact signal should be taken for detection or an RMS like one.
  4147. Default is rms. Can be peak or rms.
  4148. @item link
  4149. Choose if the average level between all channels or the louder channel affects
  4150. the reduction.
  4151. Default is average. Can be average or maximum.
  4152. @item level_sc
  4153. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4154. @end table
  4155. @subsection Commands
  4156. This filter supports the all above options as @ref{commands}.
  4157. @section silencedetect
  4158. Detect silence in an audio stream.
  4159. This filter logs a message when it detects that the input audio volume is less
  4160. or equal to a noise tolerance value for a duration greater or equal to the
  4161. minimum detected noise duration.
  4162. The printed times and duration are expressed in seconds. The
  4163. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4164. is set on the first frame whose timestamp equals or exceeds the detection
  4165. duration and it contains the timestamp of the first frame of the silence.
  4166. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4167. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4168. keys are set on the first frame after the silence. If @option{mono} is
  4169. enabled, and each channel is evaluated separately, the @code{.X}
  4170. suffixed keys are used, and @code{X} corresponds to the channel number.
  4171. The filter accepts the following options:
  4172. @table @option
  4173. @item noise, n
  4174. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4175. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4176. @item duration, d
  4177. Set silence duration until notification (default is 2 seconds). See
  4178. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4179. for the accepted syntax.
  4180. @item mono, m
  4181. Process each channel separately, instead of combined. By default is disabled.
  4182. @end table
  4183. @subsection Examples
  4184. @itemize
  4185. @item
  4186. Detect 5 seconds of silence with -50dB noise tolerance:
  4187. @example
  4188. silencedetect=n=-50dB:d=5
  4189. @end example
  4190. @item
  4191. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4192. tolerance in @file{silence.mp3}:
  4193. @example
  4194. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4195. @end example
  4196. @end itemize
  4197. @section silenceremove
  4198. Remove silence from the beginning, middle or end of the audio.
  4199. The filter accepts the following options:
  4200. @table @option
  4201. @item start_periods
  4202. This value is used to indicate if audio should be trimmed at beginning of
  4203. the audio. A value of zero indicates no silence should be trimmed from the
  4204. beginning. When specifying a non-zero value, it trims audio up until it
  4205. finds non-silence. Normally, when trimming silence from beginning of audio
  4206. the @var{start_periods} will be @code{1} but it can be increased to higher
  4207. values to trim all audio up to specific count of non-silence periods.
  4208. Default value is @code{0}.
  4209. @item start_duration
  4210. Specify the amount of time that non-silence must be detected before it stops
  4211. trimming audio. By increasing the duration, bursts of noises can be treated
  4212. as silence and trimmed off. Default value is @code{0}.
  4213. @item start_threshold
  4214. This indicates what sample value should be treated as silence. For digital
  4215. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4216. you may wish to increase the value to account for background noise.
  4217. Can be specified in dB (in case "dB" is appended to the specified value)
  4218. or amplitude ratio. Default value is @code{0}.
  4219. @item start_silence
  4220. Specify max duration of silence at beginning that will be kept after
  4221. trimming. Default is 0, which is equal to trimming all samples detected
  4222. as silence.
  4223. @item start_mode
  4224. Specify mode of detection of silence end in start of multi-channel audio.
  4225. Can be @var{any} or @var{all}. Default is @var{any}.
  4226. With @var{any}, any sample that is detected as non-silence will cause
  4227. stopped trimming of silence.
  4228. With @var{all}, only if all channels are detected as non-silence will cause
  4229. stopped trimming of silence.
  4230. @item stop_periods
  4231. Set the count for trimming silence from the end of audio.
  4232. To remove silence from the middle of a file, specify a @var{stop_periods}
  4233. that is negative. This value is then treated as a positive value and is
  4234. used to indicate the effect should restart processing as specified by
  4235. @var{start_periods}, making it suitable for removing periods of silence
  4236. in the middle of the audio.
  4237. Default value is @code{0}.
  4238. @item stop_duration
  4239. Specify a duration of silence that must exist before audio is not copied any
  4240. more. By specifying a higher duration, silence that is wanted can be left in
  4241. the audio.
  4242. Default value is @code{0}.
  4243. @item stop_threshold
  4244. This is the same as @option{start_threshold} but for trimming silence from
  4245. the end of audio.
  4246. Can be specified in dB (in case "dB" is appended to the specified value)
  4247. or amplitude ratio. Default value is @code{0}.
  4248. @item stop_silence
  4249. Specify max duration of silence at end that will be kept after
  4250. trimming. Default is 0, which is equal to trimming all samples detected
  4251. as silence.
  4252. @item stop_mode
  4253. Specify mode of detection of silence start in end of multi-channel audio.
  4254. Can be @var{any} or @var{all}. Default is @var{any}.
  4255. With @var{any}, any sample that is detected as non-silence will cause
  4256. stopped trimming of silence.
  4257. With @var{all}, only if all channels are detected as non-silence will cause
  4258. stopped trimming of silence.
  4259. @item detection
  4260. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4261. and works better with digital silence which is exactly 0.
  4262. Default value is @code{rms}.
  4263. @item window
  4264. Set duration in number of seconds used to calculate size of window in number
  4265. of samples for detecting silence.
  4266. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4267. @end table
  4268. @subsection Examples
  4269. @itemize
  4270. @item
  4271. The following example shows how this filter can be used to start a recording
  4272. that does not contain the delay at the start which usually occurs between
  4273. pressing the record button and the start of the performance:
  4274. @example
  4275. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4276. @end example
  4277. @item
  4278. Trim all silence encountered from beginning to end where there is more than 1
  4279. second of silence in audio:
  4280. @example
  4281. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4282. @end example
  4283. @item
  4284. Trim all digital silence samples, using peak detection, from beginning to end
  4285. where there is more than 0 samples of digital silence in audio and digital
  4286. silence is detected in all channels at same positions in stream:
  4287. @example
  4288. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4289. @end example
  4290. @end itemize
  4291. @section sofalizer
  4292. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4293. loudspeakers around the user for binaural listening via headphones (audio
  4294. formats up to 9 channels supported).
  4295. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4296. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4297. Austrian Academy of Sciences.
  4298. To enable compilation of this filter you need to configure FFmpeg with
  4299. @code{--enable-libmysofa}.
  4300. The filter accepts the following options:
  4301. @table @option
  4302. @item sofa
  4303. Set the SOFA file used for rendering.
  4304. @item gain
  4305. Set gain applied to audio. Value is in dB. Default is 0.
  4306. @item rotation
  4307. Set rotation of virtual loudspeakers in deg. Default is 0.
  4308. @item elevation
  4309. Set elevation of virtual speakers in deg. Default is 0.
  4310. @item radius
  4311. Set distance in meters between loudspeakers and the listener with near-field
  4312. HRTFs. Default is 1.
  4313. @item type
  4314. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4315. processing audio in time domain which is slow.
  4316. @var{freq} is processing audio in frequency domain which is fast.
  4317. Default is @var{freq}.
  4318. @item speakers
  4319. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4320. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4321. Each virtual loudspeaker is described with short channel name following with
  4322. azimuth and elevation in degrees.
  4323. Each virtual loudspeaker description is separated by '|'.
  4324. For example to override front left and front right channel positions use:
  4325. 'speakers=FL 45 15|FR 345 15'.
  4326. Descriptions with unrecognised channel names are ignored.
  4327. @item lfegain
  4328. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4329. @item framesize
  4330. Set custom frame size in number of samples. Default is 1024.
  4331. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4332. is set to @var{freq}.
  4333. @item normalize
  4334. Should all IRs be normalized upon importing SOFA file.
  4335. By default is enabled.
  4336. @item interpolate
  4337. Should nearest IRs be interpolated with neighbor IRs if exact position
  4338. does not match. By default is disabled.
  4339. @item minphase
  4340. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4341. @item anglestep
  4342. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4343. @item radstep
  4344. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4345. @end table
  4346. @subsection Examples
  4347. @itemize
  4348. @item
  4349. Using ClubFritz6 sofa file:
  4350. @example
  4351. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4352. @end example
  4353. @item
  4354. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4355. @example
  4356. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4357. @end example
  4358. @item
  4359. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4360. and also with custom gain:
  4361. @example
  4362. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4363. @end example
  4364. @end itemize
  4365. @section speechnorm
  4366. Speech Normalizer.
  4367. This filter expands or compresses each half-cycle of audio samples
  4368. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4369. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4370. The filter accepts the following options:
  4371. @table @option
  4372. @item peak, p
  4373. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4374. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4375. @item expansion, e
  4376. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4377. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4378. would be such that local peak value reaches target peak value but never to surpass it and that
  4379. ratio between new and previous peak value does not surpass this option value.
  4380. @item compression, c
  4381. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4382. This option controls maximum local half-cycle of samples compression. This option is used
  4383. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4384. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4385. that peak's half-cycle will be compressed by current compression factor.
  4386. @item threshold, t
  4387. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4388. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4389. Any half-cycle samples with their local peak value below or same as this option value will be
  4390. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4391. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4392. @item raise, r
  4393. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4394. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4395. each new half-cycle until it reaches @option{expansion} value.
  4396. Setting this options too high may lead to distortions.
  4397. @item fall, f
  4398. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4399. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4400. each new half-cycle until it reaches @option{compression} value.
  4401. @item channels, h
  4402. Specify which channels to filter, by default all available channels are filtered.
  4403. @item invert, i
  4404. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4405. option. When enabled any half-cycle of samples with their local peak value below or same as
  4406. @option{threshold} option will be expanded otherwise it will be compressed.
  4407. @item link, l
  4408. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4409. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4410. is enabled the minimum of all possible gains for each filtered channel is used.
  4411. @end table
  4412. @subsection Commands
  4413. This filter supports the all above options as @ref{commands}.
  4414. @section stereotools
  4415. This filter has some handy utilities to manage stereo signals, for converting
  4416. M/S stereo recordings to L/R signal while having control over the parameters
  4417. or spreading the stereo image of master track.
  4418. The filter accepts the following options:
  4419. @table @option
  4420. @item level_in
  4421. Set input level before filtering for both channels. Defaults is 1.
  4422. Allowed range is from 0.015625 to 64.
  4423. @item level_out
  4424. Set output level after filtering for both channels. Defaults is 1.
  4425. Allowed range is from 0.015625 to 64.
  4426. @item balance_in
  4427. Set input balance between both channels. Default is 0.
  4428. Allowed range is from -1 to 1.
  4429. @item balance_out
  4430. Set output balance between both channels. Default is 0.
  4431. Allowed range is from -1 to 1.
  4432. @item softclip
  4433. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4434. clipping. Disabled by default.
  4435. @item mutel
  4436. Mute the left channel. Disabled by default.
  4437. @item muter
  4438. Mute the right channel. Disabled by default.
  4439. @item phasel
  4440. Change the phase of the left channel. Disabled by default.
  4441. @item phaser
  4442. Change the phase of the right channel. Disabled by default.
  4443. @item mode
  4444. Set stereo mode. Available values are:
  4445. @table @samp
  4446. @item lr>lr
  4447. Left/Right to Left/Right, this is default.
  4448. @item lr>ms
  4449. Left/Right to Mid/Side.
  4450. @item ms>lr
  4451. Mid/Side to Left/Right.
  4452. @item lr>ll
  4453. Left/Right to Left/Left.
  4454. @item lr>rr
  4455. Left/Right to Right/Right.
  4456. @item lr>l+r
  4457. Left/Right to Left + Right.
  4458. @item lr>rl
  4459. Left/Right to Right/Left.
  4460. @item ms>ll
  4461. Mid/Side to Left/Left.
  4462. @item ms>rr
  4463. Mid/Side to Right/Right.
  4464. @item ms>rl
  4465. Mid/Side to Right/Left.
  4466. @item lr>l-r
  4467. Left/Right to Left - Right.
  4468. @end table
  4469. @item slev
  4470. Set level of side signal. Default is 1.
  4471. Allowed range is from 0.015625 to 64.
  4472. @item sbal
  4473. Set balance of side signal. Default is 0.
  4474. Allowed range is from -1 to 1.
  4475. @item mlev
  4476. Set level of the middle signal. Default is 1.
  4477. Allowed range is from 0.015625 to 64.
  4478. @item mpan
  4479. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4480. @item base
  4481. Set stereo base between mono and inversed channels. Default is 0.
  4482. Allowed range is from -1 to 1.
  4483. @item delay
  4484. Set delay in milliseconds how much to delay left from right channel and
  4485. vice versa. Default is 0. Allowed range is from -20 to 20.
  4486. @item sclevel
  4487. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4488. @item phase
  4489. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4490. @item bmode_in, bmode_out
  4491. Set balance mode for balance_in/balance_out option.
  4492. Can be one of the following:
  4493. @table @samp
  4494. @item balance
  4495. Classic balance mode. Attenuate one channel at time.
  4496. Gain is raised up to 1.
  4497. @item amplitude
  4498. Similar as classic mode above but gain is raised up to 2.
  4499. @item power
  4500. Equal power distribution, from -6dB to +6dB range.
  4501. @end table
  4502. @end table
  4503. @subsection Commands
  4504. This filter supports the all above options as @ref{commands}.
  4505. @subsection Examples
  4506. @itemize
  4507. @item
  4508. Apply karaoke like effect:
  4509. @example
  4510. stereotools=mlev=0.015625
  4511. @end example
  4512. @item
  4513. Convert M/S signal to L/R:
  4514. @example
  4515. "stereotools=mode=ms>lr"
  4516. @end example
  4517. @end itemize
  4518. @section stereowiden
  4519. This filter enhance the stereo effect by suppressing signal common to both
  4520. channels and by delaying the signal of left into right and vice versa,
  4521. thereby widening the stereo effect.
  4522. The filter accepts the following options:
  4523. @table @option
  4524. @item delay
  4525. Time in milliseconds of the delay of left signal into right and vice versa.
  4526. Default is 20 milliseconds.
  4527. @item feedback
  4528. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4529. effect of left signal in right output and vice versa which gives widening
  4530. effect. Default is 0.3.
  4531. @item crossfeed
  4532. Cross feed of left into right with inverted phase. This helps in suppressing
  4533. the mono. If the value is 1 it will cancel all the signal common to both
  4534. channels. Default is 0.3.
  4535. @item drymix
  4536. Set level of input signal of original channel. Default is 0.8.
  4537. @end table
  4538. @subsection Commands
  4539. This filter supports the all above options except @code{delay} as @ref{commands}.
  4540. @section superequalizer
  4541. Apply 18 band equalizer.
  4542. The filter accepts the following options:
  4543. @table @option
  4544. @item 1b
  4545. Set 65Hz band gain.
  4546. @item 2b
  4547. Set 92Hz band gain.
  4548. @item 3b
  4549. Set 131Hz band gain.
  4550. @item 4b
  4551. Set 185Hz band gain.
  4552. @item 5b
  4553. Set 262Hz band gain.
  4554. @item 6b
  4555. Set 370Hz band gain.
  4556. @item 7b
  4557. Set 523Hz band gain.
  4558. @item 8b
  4559. Set 740Hz band gain.
  4560. @item 9b
  4561. Set 1047Hz band gain.
  4562. @item 10b
  4563. Set 1480Hz band gain.
  4564. @item 11b
  4565. Set 2093Hz band gain.
  4566. @item 12b
  4567. Set 2960Hz band gain.
  4568. @item 13b
  4569. Set 4186Hz band gain.
  4570. @item 14b
  4571. Set 5920Hz band gain.
  4572. @item 15b
  4573. Set 8372Hz band gain.
  4574. @item 16b
  4575. Set 11840Hz band gain.
  4576. @item 17b
  4577. Set 16744Hz band gain.
  4578. @item 18b
  4579. Set 20000Hz band gain.
  4580. @end table
  4581. @section surround
  4582. Apply audio surround upmix filter.
  4583. This filter allows to produce multichannel output from audio stream.
  4584. The filter accepts the following options:
  4585. @table @option
  4586. @item chl_out
  4587. Set output channel layout. By default, this is @var{5.1}.
  4588. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4589. for the required syntax.
  4590. @item chl_in
  4591. Set input channel layout. By default, this is @var{stereo}.
  4592. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4593. for the required syntax.
  4594. @item level_in
  4595. Set input volume level. By default, this is @var{1}.
  4596. @item level_out
  4597. Set output volume level. By default, this is @var{1}.
  4598. @item lfe
  4599. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4600. @item lfe_low
  4601. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4602. @item lfe_high
  4603. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4604. @item lfe_mode
  4605. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4606. In @var{add} mode, LFE channel is created from input audio and added to output.
  4607. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4608. also all non-LFE output channels are subtracted with output LFE channel.
  4609. @item angle
  4610. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4611. Default is @var{90}.
  4612. @item fc_in
  4613. Set front center input volume. By default, this is @var{1}.
  4614. @item fc_out
  4615. Set front center output volume. By default, this is @var{1}.
  4616. @item fl_in
  4617. Set front left input volume. By default, this is @var{1}.
  4618. @item fl_out
  4619. Set front left output volume. By default, this is @var{1}.
  4620. @item fr_in
  4621. Set front right input volume. By default, this is @var{1}.
  4622. @item fr_out
  4623. Set front right output volume. By default, this is @var{1}.
  4624. @item sl_in
  4625. Set side left input volume. By default, this is @var{1}.
  4626. @item sl_out
  4627. Set side left output volume. By default, this is @var{1}.
  4628. @item sr_in
  4629. Set side right input volume. By default, this is @var{1}.
  4630. @item sr_out
  4631. Set side right output volume. By default, this is @var{1}.
  4632. @item bl_in
  4633. Set back left input volume. By default, this is @var{1}.
  4634. @item bl_out
  4635. Set back left output volume. By default, this is @var{1}.
  4636. @item br_in
  4637. Set back right input volume. By default, this is @var{1}.
  4638. @item br_out
  4639. Set back right output volume. By default, this is @var{1}.
  4640. @item bc_in
  4641. Set back center input volume. By default, this is @var{1}.
  4642. @item bc_out
  4643. Set back center output volume. By default, this is @var{1}.
  4644. @item lfe_in
  4645. Set LFE input volume. By default, this is @var{1}.
  4646. @item lfe_out
  4647. Set LFE output volume. By default, this is @var{1}.
  4648. @item allx
  4649. Set spread usage of stereo image across X axis for all channels.
  4650. @item ally
  4651. Set spread usage of stereo image across Y axis for all channels.
  4652. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4653. Set spread usage of stereo image across X axis for each channel.
  4654. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4655. Set spread usage of stereo image across Y axis for each channel.
  4656. @item win_size
  4657. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4658. @item win_func
  4659. Set window function.
  4660. It accepts the following values:
  4661. @table @samp
  4662. @item rect
  4663. @item bartlett
  4664. @item hann, hanning
  4665. @item hamming
  4666. @item blackman
  4667. @item welch
  4668. @item flattop
  4669. @item bharris
  4670. @item bnuttall
  4671. @item bhann
  4672. @item sine
  4673. @item nuttall
  4674. @item lanczos
  4675. @item gauss
  4676. @item tukey
  4677. @item dolph
  4678. @item cauchy
  4679. @item parzen
  4680. @item poisson
  4681. @item bohman
  4682. @end table
  4683. Default is @code{hann}.
  4684. @item overlap
  4685. Set window overlap. If set to 1, the recommended overlap for selected
  4686. window function will be picked. Default is @code{0.5}.
  4687. @end table
  4688. @section treble, highshelf
  4689. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4690. shelving filter with a response similar to that of a standard
  4691. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4692. The filter accepts the following options:
  4693. @table @option
  4694. @item gain, g
  4695. Give the gain at whichever is the lower of ~22 kHz and the
  4696. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4697. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4698. @item frequency, f
  4699. Set the filter's central frequency and so can be used
  4700. to extend or reduce the frequency range to be boosted or cut.
  4701. The default value is @code{3000} Hz.
  4702. @item width_type, t
  4703. Set method to specify band-width of filter.
  4704. @table @option
  4705. @item h
  4706. Hz
  4707. @item q
  4708. Q-Factor
  4709. @item o
  4710. octave
  4711. @item s
  4712. slope
  4713. @item k
  4714. kHz
  4715. @end table
  4716. @item width, w
  4717. Determine how steep is the filter's shelf transition.
  4718. @item poles, p
  4719. Set number of poles. Default is 2.
  4720. @item mix, m
  4721. How much to use filtered signal in output. Default is 1.
  4722. Range is between 0 and 1.
  4723. @item channels, c
  4724. Specify which channels to filter, by default all available are filtered.
  4725. @item normalize, n
  4726. Normalize biquad coefficients, by default is disabled.
  4727. Enabling it will normalize magnitude response at DC to 0dB.
  4728. @item transform, a
  4729. Set transform type of IIR filter.
  4730. @table @option
  4731. @item di
  4732. @item dii
  4733. @item tdii
  4734. @item latt
  4735. @end table
  4736. @item precision, r
  4737. Set precison of filtering.
  4738. @table @option
  4739. @item auto
  4740. Pick automatic sample format depending on surround filters.
  4741. @item s16
  4742. Always use signed 16-bit.
  4743. @item s32
  4744. Always use signed 32-bit.
  4745. @item f32
  4746. Always use float 32-bit.
  4747. @item f64
  4748. Always use float 64-bit.
  4749. @end table
  4750. @end table
  4751. @subsection Commands
  4752. This filter supports the following commands:
  4753. @table @option
  4754. @item frequency, f
  4755. Change treble frequency.
  4756. Syntax for the command is : "@var{frequency}"
  4757. @item width_type, t
  4758. Change treble width_type.
  4759. Syntax for the command is : "@var{width_type}"
  4760. @item width, w
  4761. Change treble width.
  4762. Syntax for the command is : "@var{width}"
  4763. @item gain, g
  4764. Change treble gain.
  4765. Syntax for the command is : "@var{gain}"
  4766. @item mix, m
  4767. Change treble mix.
  4768. Syntax for the command is : "@var{mix}"
  4769. @end table
  4770. @section tremolo
  4771. Sinusoidal amplitude modulation.
  4772. The filter accepts the following options:
  4773. @table @option
  4774. @item f
  4775. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4776. (20 Hz or lower) will result in a tremolo effect.
  4777. This filter may also be used as a ring modulator by specifying
  4778. a modulation frequency higher than 20 Hz.
  4779. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4780. @item d
  4781. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4782. Default value is 0.5.
  4783. @end table
  4784. @section vibrato
  4785. Sinusoidal phase modulation.
  4786. The filter accepts the following options:
  4787. @table @option
  4788. @item f
  4789. Modulation frequency in Hertz.
  4790. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4791. @item d
  4792. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4793. Default value is 0.5.
  4794. @end table
  4795. @section volume
  4796. Adjust the input audio volume.
  4797. It accepts the following parameters:
  4798. @table @option
  4799. @item volume
  4800. Set audio volume expression.
  4801. Output values are clipped to the maximum value.
  4802. The output audio volume is given by the relation:
  4803. @example
  4804. @var{output_volume} = @var{volume} * @var{input_volume}
  4805. @end example
  4806. The default value for @var{volume} is "1.0".
  4807. @item precision
  4808. This parameter represents the mathematical precision.
  4809. It determines which input sample formats will be allowed, which affects the
  4810. precision of the volume scaling.
  4811. @table @option
  4812. @item fixed
  4813. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4814. @item float
  4815. 32-bit floating-point; this limits input sample format to FLT. (default)
  4816. @item double
  4817. 64-bit floating-point; this limits input sample format to DBL.
  4818. @end table
  4819. @item replaygain
  4820. Choose the behaviour on encountering ReplayGain side data in input frames.
  4821. @table @option
  4822. @item drop
  4823. Remove ReplayGain side data, ignoring its contents (the default).
  4824. @item ignore
  4825. Ignore ReplayGain side data, but leave it in the frame.
  4826. @item track
  4827. Prefer the track gain, if present.
  4828. @item album
  4829. Prefer the album gain, if present.
  4830. @end table
  4831. @item replaygain_preamp
  4832. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4833. Default value for @var{replaygain_preamp} is 0.0.
  4834. @item replaygain_noclip
  4835. Prevent clipping by limiting the gain applied.
  4836. Default value for @var{replaygain_noclip} is 1.
  4837. @item eval
  4838. Set when the volume expression is evaluated.
  4839. It accepts the following values:
  4840. @table @samp
  4841. @item once
  4842. only evaluate expression once during the filter initialization, or
  4843. when the @samp{volume} command is sent
  4844. @item frame
  4845. evaluate expression for each incoming frame
  4846. @end table
  4847. Default value is @samp{once}.
  4848. @end table
  4849. The volume expression can contain the following parameters.
  4850. @table @option
  4851. @item n
  4852. frame number (starting at zero)
  4853. @item nb_channels
  4854. number of channels
  4855. @item nb_consumed_samples
  4856. number of samples consumed by the filter
  4857. @item nb_samples
  4858. number of samples in the current frame
  4859. @item pos
  4860. original frame position in the file
  4861. @item pts
  4862. frame PTS
  4863. @item sample_rate
  4864. sample rate
  4865. @item startpts
  4866. PTS at start of stream
  4867. @item startt
  4868. time at start of stream
  4869. @item t
  4870. frame time
  4871. @item tb
  4872. timestamp timebase
  4873. @item volume
  4874. last set volume value
  4875. @end table
  4876. Note that when @option{eval} is set to @samp{once} only the
  4877. @var{sample_rate} and @var{tb} variables are available, all other
  4878. variables will evaluate to NAN.
  4879. @subsection Commands
  4880. This filter supports the following commands:
  4881. @table @option
  4882. @item volume
  4883. Modify the volume expression.
  4884. The command accepts the same syntax of the corresponding option.
  4885. If the specified expression is not valid, it is kept at its current
  4886. value.
  4887. @end table
  4888. @subsection Examples
  4889. @itemize
  4890. @item
  4891. Halve the input audio volume:
  4892. @example
  4893. volume=volume=0.5
  4894. volume=volume=1/2
  4895. volume=volume=-6.0206dB
  4896. @end example
  4897. In all the above example the named key for @option{volume} can be
  4898. omitted, for example like in:
  4899. @example
  4900. volume=0.5
  4901. @end example
  4902. @item
  4903. Increase input audio power by 6 decibels using fixed-point precision:
  4904. @example
  4905. volume=volume=6dB:precision=fixed
  4906. @end example
  4907. @item
  4908. Fade volume after time 10 with an annihilation period of 5 seconds:
  4909. @example
  4910. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4911. @end example
  4912. @end itemize
  4913. @section volumedetect
  4914. Detect the volume of the input video.
  4915. The filter has no parameters. The input is not modified. Statistics about
  4916. the volume will be printed in the log when the input stream end is reached.
  4917. In particular it will show the mean volume (root mean square), maximum
  4918. volume (on a per-sample basis), and the beginning of a histogram of the
  4919. registered volume values (from the maximum value to a cumulated 1/1000 of
  4920. the samples).
  4921. All volumes are in decibels relative to the maximum PCM value.
  4922. @subsection Examples
  4923. Here is an excerpt of the output:
  4924. @example
  4925. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4926. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4927. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4928. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4929. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4930. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4931. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4932. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4933. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4934. @end example
  4935. It means that:
  4936. @itemize
  4937. @item
  4938. The mean square energy is approximately -27 dB, or 10^-2.7.
  4939. @item
  4940. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4941. @item
  4942. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4943. @end itemize
  4944. In other words, raising the volume by +4 dB does not cause any clipping,
  4945. raising it by +5 dB causes clipping for 6 samples, etc.
  4946. @c man end AUDIO FILTERS
  4947. @chapter Audio Sources
  4948. @c man begin AUDIO SOURCES
  4949. Below is a description of the currently available audio sources.
  4950. @section abuffer
  4951. Buffer audio frames, and make them available to the filter chain.
  4952. This source is mainly intended for a programmatic use, in particular
  4953. through the interface defined in @file{libavfilter/buffersrc.h}.
  4954. It accepts the following parameters:
  4955. @table @option
  4956. @item time_base
  4957. The timebase which will be used for timestamps of submitted frames. It must be
  4958. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4959. @item sample_rate
  4960. The sample rate of the incoming audio buffers.
  4961. @item sample_fmt
  4962. The sample format of the incoming audio buffers.
  4963. Either a sample format name or its corresponding integer representation from
  4964. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4965. @item channel_layout
  4966. The channel layout of the incoming audio buffers.
  4967. Either a channel layout name from channel_layout_map in
  4968. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4969. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4970. @item channels
  4971. The number of channels of the incoming audio buffers.
  4972. If both @var{channels} and @var{channel_layout} are specified, then they
  4973. must be consistent.
  4974. @end table
  4975. @subsection Examples
  4976. @example
  4977. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4978. @end example
  4979. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4980. Since the sample format with name "s16p" corresponds to the number
  4981. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4982. equivalent to:
  4983. @example
  4984. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4985. @end example
  4986. @section aevalsrc
  4987. Generate an audio signal specified by an expression.
  4988. This source accepts in input one or more expressions (one for each
  4989. channel), which are evaluated and used to generate a corresponding
  4990. audio signal.
  4991. This source accepts the following options:
  4992. @table @option
  4993. @item exprs
  4994. Set the '|'-separated expressions list for each separate channel. In case the
  4995. @option{channel_layout} option is not specified, the selected channel layout
  4996. depends on the number of provided expressions. Otherwise the last
  4997. specified expression is applied to the remaining output channels.
  4998. @item channel_layout, c
  4999. Set the channel layout. The number of channels in the specified layout
  5000. must be equal to the number of specified expressions.
  5001. @item duration, d
  5002. Set the minimum duration of the sourced audio. See
  5003. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5004. for the accepted syntax.
  5005. Note that the resulting duration may be greater than the specified
  5006. duration, as the generated audio is always cut at the end of a
  5007. complete frame.
  5008. If not specified, or the expressed duration is negative, the audio is
  5009. supposed to be generated forever.
  5010. @item nb_samples, n
  5011. Set the number of samples per channel per each output frame,
  5012. default to 1024.
  5013. @item sample_rate, s
  5014. Specify the sample rate, default to 44100.
  5015. @end table
  5016. Each expression in @var{exprs} can contain the following constants:
  5017. @table @option
  5018. @item n
  5019. number of the evaluated sample, starting from 0
  5020. @item t
  5021. time of the evaluated sample expressed in seconds, starting from 0
  5022. @item s
  5023. sample rate
  5024. @end table
  5025. @subsection Examples
  5026. @itemize
  5027. @item
  5028. Generate silence:
  5029. @example
  5030. aevalsrc=0
  5031. @end example
  5032. @item
  5033. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5034. 8000 Hz:
  5035. @example
  5036. aevalsrc="sin(440*2*PI*t):s=8000"
  5037. @end example
  5038. @item
  5039. Generate a two channels signal, specify the channel layout (Front
  5040. Center + Back Center) explicitly:
  5041. @example
  5042. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  5043. @end example
  5044. @item
  5045. Generate white noise:
  5046. @example
  5047. aevalsrc="-2+random(0)"
  5048. @end example
  5049. @item
  5050. Generate an amplitude modulated signal:
  5051. @example
  5052. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5053. @end example
  5054. @item
  5055. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5056. @example
  5057. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5058. @end example
  5059. @end itemize
  5060. @section afirsrc
  5061. Generate a FIR coefficients using frequency sampling method.
  5062. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5063. The filter accepts the following options:
  5064. @table @option
  5065. @item taps, t
  5066. Set number of filter coefficents in output audio stream.
  5067. Default value is 1025.
  5068. @item frequency, f
  5069. Set frequency points from where magnitude and phase are set.
  5070. This must be in non decreasing order, and first element must be 0, while last element
  5071. must be 1. Elements are separated by white spaces.
  5072. @item magnitude, m
  5073. Set magnitude value for every frequency point set by @option{frequency}.
  5074. Number of values must be same as number of frequency points.
  5075. Values are separated by white spaces.
  5076. @item phase, p
  5077. Set phase value for every frequency point set by @option{frequency}.
  5078. Number of values must be same as number of frequency points.
  5079. Values are separated by white spaces.
  5080. @item sample_rate, r
  5081. Set sample rate, default is 44100.
  5082. @item nb_samples, n
  5083. Set number of samples per each frame. Default is 1024.
  5084. @item win_func, w
  5085. Set window function. Default is blackman.
  5086. @end table
  5087. @section anullsrc
  5088. The null audio source, return unprocessed audio frames. It is mainly useful
  5089. as a template and to be employed in analysis / debugging tools, or as
  5090. the source for filters which ignore the input data (for example the sox
  5091. synth filter).
  5092. This source accepts the following options:
  5093. @table @option
  5094. @item channel_layout, cl
  5095. Specifies the channel layout, and can be either an integer or a string
  5096. representing a channel layout. The default value of @var{channel_layout}
  5097. is "stereo".
  5098. Check the channel_layout_map definition in
  5099. @file{libavutil/channel_layout.c} for the mapping between strings and
  5100. channel layout values.
  5101. @item sample_rate, r
  5102. Specifies the sample rate, and defaults to 44100.
  5103. @item nb_samples, n
  5104. Set the number of samples per requested frames.
  5105. @item duration, d
  5106. Set the duration of the sourced audio. See
  5107. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5108. for the accepted syntax.
  5109. If not specified, or the expressed duration is negative, the audio is
  5110. supposed to be generated forever.
  5111. @end table
  5112. @subsection Examples
  5113. @itemize
  5114. @item
  5115. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5116. @example
  5117. anullsrc=r=48000:cl=4
  5118. @end example
  5119. @item
  5120. Do the same operation with a more obvious syntax:
  5121. @example
  5122. anullsrc=r=48000:cl=mono
  5123. @end example
  5124. @end itemize
  5125. All the parameters need to be explicitly defined.
  5126. @section flite
  5127. Synthesize a voice utterance using the libflite library.
  5128. To enable compilation of this filter you need to configure FFmpeg with
  5129. @code{--enable-libflite}.
  5130. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5131. The filter accepts the following options:
  5132. @table @option
  5133. @item list_voices
  5134. If set to 1, list the names of the available voices and exit
  5135. immediately. Default value is 0.
  5136. @item nb_samples, n
  5137. Set the maximum number of samples per frame. Default value is 512.
  5138. @item textfile
  5139. Set the filename containing the text to speak.
  5140. @item text
  5141. Set the text to speak.
  5142. @item voice, v
  5143. Set the voice to use for the speech synthesis. Default value is
  5144. @code{kal}. See also the @var{list_voices} option.
  5145. @end table
  5146. @subsection Examples
  5147. @itemize
  5148. @item
  5149. Read from file @file{speech.txt}, and synthesize the text using the
  5150. standard flite voice:
  5151. @example
  5152. flite=textfile=speech.txt
  5153. @end example
  5154. @item
  5155. Read the specified text selecting the @code{slt} voice:
  5156. @example
  5157. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5158. @end example
  5159. @item
  5160. Input text to ffmpeg:
  5161. @example
  5162. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5163. @end example
  5164. @item
  5165. Make @file{ffplay} speak the specified text, using @code{flite} and
  5166. the @code{lavfi} device:
  5167. @example
  5168. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5169. @end example
  5170. @end itemize
  5171. For more information about libflite, check:
  5172. @url{http://www.festvox.org/flite/}
  5173. @section anoisesrc
  5174. Generate a noise audio signal.
  5175. The filter accepts the following options:
  5176. @table @option
  5177. @item sample_rate, r
  5178. Specify the sample rate. Default value is 48000 Hz.
  5179. @item amplitude, a
  5180. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  5181. is 1.0.
  5182. @item duration, d
  5183. Specify the duration of the generated audio stream. Not specifying this option
  5184. results in noise with an infinite length.
  5185. @item color, colour, c
  5186. Specify the color of noise. Available noise colors are white, pink, brown,
  5187. blue, violet and velvet. Default color is white.
  5188. @item seed, s
  5189. Specify a value used to seed the PRNG.
  5190. @item nb_samples, n
  5191. Set the number of samples per each output frame, default is 1024.
  5192. @end table
  5193. @subsection Examples
  5194. @itemize
  5195. @item
  5196. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  5197. @example
  5198. anoisesrc=d=60:c=pink:r=44100:a=0.5
  5199. @end example
  5200. @end itemize
  5201. @section hilbert
  5202. Generate odd-tap Hilbert transform FIR coefficients.
  5203. The resulting stream can be used with @ref{afir} filter for phase-shifting
  5204. the signal by 90 degrees.
  5205. This is used in many matrix coding schemes and for analytic signal generation.
  5206. The process is often written as a multiplication by i (or j), the imaginary unit.
  5207. The filter accepts the following options:
  5208. @table @option
  5209. @item sample_rate, s
  5210. Set sample rate, default is 44100.
  5211. @item taps, t
  5212. Set length of FIR filter, default is 22051.
  5213. @item nb_samples, n
  5214. Set number of samples per each frame.
  5215. @item win_func, w
  5216. Set window function to be used when generating FIR coefficients.
  5217. @end table
  5218. @section sinc
  5219. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5220. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5221. The filter accepts the following options:
  5222. @table @option
  5223. @item sample_rate, r
  5224. Set sample rate, default is 44100.
  5225. @item nb_samples, n
  5226. Set number of samples per each frame. Default is 1024.
  5227. @item hp
  5228. Set high-pass frequency. Default is 0.
  5229. @item lp
  5230. Set low-pass frequency. Default is 0.
  5231. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  5232. is higher than 0 then filter will create band-pass filter coefficients,
  5233. otherwise band-reject filter coefficients.
  5234. @item phase
  5235. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  5236. @item beta
  5237. Set Kaiser window beta.
  5238. @item att
  5239. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  5240. @item round
  5241. Enable rounding, by default is disabled.
  5242. @item hptaps
  5243. Set number of taps for high-pass filter.
  5244. @item lptaps
  5245. Set number of taps for low-pass filter.
  5246. @end table
  5247. @section sine
  5248. Generate an audio signal made of a sine wave with amplitude 1/8.
  5249. The audio signal is bit-exact.
  5250. The filter accepts the following options:
  5251. @table @option
  5252. @item frequency, f
  5253. Set the carrier frequency. Default is 440 Hz.
  5254. @item beep_factor, b
  5255. Enable a periodic beep every second with frequency @var{beep_factor} times
  5256. the carrier frequency. Default is 0, meaning the beep is disabled.
  5257. @item sample_rate, r
  5258. Specify the sample rate, default is 44100.
  5259. @item duration, d
  5260. Specify the duration of the generated audio stream.
  5261. @item samples_per_frame
  5262. Set the number of samples per output frame.
  5263. The expression can contain the following constants:
  5264. @table @option
  5265. @item n
  5266. The (sequential) number of the output audio frame, starting from 0.
  5267. @item pts
  5268. The PTS (Presentation TimeStamp) of the output audio frame,
  5269. expressed in @var{TB} units.
  5270. @item t
  5271. The PTS of the output audio frame, expressed in seconds.
  5272. @item TB
  5273. The timebase of the output audio frames.
  5274. @end table
  5275. Default is @code{1024}.
  5276. @end table
  5277. @subsection Examples
  5278. @itemize
  5279. @item
  5280. Generate a simple 440 Hz sine wave:
  5281. @example
  5282. sine
  5283. @end example
  5284. @item
  5285. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5286. @example
  5287. sine=220:4:d=5
  5288. sine=f=220:b=4:d=5
  5289. sine=frequency=220:beep_factor=4:duration=5
  5290. @end example
  5291. @item
  5292. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5293. pattern:
  5294. @example
  5295. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5296. @end example
  5297. @end itemize
  5298. @c man end AUDIO SOURCES
  5299. @chapter Audio Sinks
  5300. @c man begin AUDIO SINKS
  5301. Below is a description of the currently available audio sinks.
  5302. @section abuffersink
  5303. Buffer audio frames, and make them available to the end of filter chain.
  5304. This sink is mainly intended for programmatic use, in particular
  5305. through the interface defined in @file{libavfilter/buffersink.h}
  5306. or the options system.
  5307. It accepts a pointer to an AVABufferSinkContext structure, which
  5308. defines the incoming buffers' formats, to be passed as the opaque
  5309. parameter to @code{avfilter_init_filter} for initialization.
  5310. @section anullsink
  5311. Null audio sink; do absolutely nothing with the input audio. It is
  5312. mainly useful as a template and for use in analysis / debugging
  5313. tools.
  5314. @c man end AUDIO SINKS
  5315. @chapter Video Filters
  5316. @c man begin VIDEO FILTERS
  5317. When you configure your FFmpeg build, you can disable any of the
  5318. existing filters using @code{--disable-filters}.
  5319. The configure output will show the video filters included in your
  5320. build.
  5321. Below is a description of the currently available video filters.
  5322. @section addroi
  5323. Mark a region of interest in a video frame.
  5324. The frame data is passed through unchanged, but metadata is attached
  5325. to the frame indicating regions of interest which can affect the
  5326. behaviour of later encoding. Multiple regions can be marked by
  5327. applying the filter multiple times.
  5328. @table @option
  5329. @item x
  5330. Region distance in pixels from the left edge of the frame.
  5331. @item y
  5332. Region distance in pixels from the top edge of the frame.
  5333. @item w
  5334. Region width in pixels.
  5335. @item h
  5336. Region height in pixels.
  5337. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5338. and may contain the following variables:
  5339. @table @option
  5340. @item iw
  5341. Width of the input frame.
  5342. @item ih
  5343. Height of the input frame.
  5344. @end table
  5345. @item qoffset
  5346. Quantisation offset to apply within the region.
  5347. This must be a real value in the range -1 to +1. A value of zero
  5348. indicates no quality change. A negative value asks for better quality
  5349. (less quantisation), while a positive value asks for worse quality
  5350. (greater quantisation).
  5351. The range is calibrated so that the extreme values indicate the
  5352. largest possible offset - if the rest of the frame is encoded with the
  5353. worst possible quality, an offset of -1 indicates that this region
  5354. should be encoded with the best possible quality anyway. Intermediate
  5355. values are then interpolated in some codec-dependent way.
  5356. For example, in 10-bit H.264 the quantisation parameter varies between
  5357. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5358. this region should be encoded with a QP around one-tenth of the full
  5359. range better than the rest of the frame. So, if most of the frame
  5360. were to be encoded with a QP of around 30, this region would get a QP
  5361. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5362. An extreme value of -1 would indicate that this region should be
  5363. encoded with the best possible quality regardless of the treatment of
  5364. the rest of the frame - that is, should be encoded at a QP of -12.
  5365. @item clear
  5366. If set to true, remove any existing regions of interest marked on the
  5367. frame before adding the new one.
  5368. @end table
  5369. @subsection Examples
  5370. @itemize
  5371. @item
  5372. Mark the centre quarter of the frame as interesting.
  5373. @example
  5374. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5375. @end example
  5376. @item
  5377. Mark the 100-pixel-wide region on the left edge of the frame as very
  5378. uninteresting (to be encoded at much lower quality than the rest of
  5379. the frame).
  5380. @example
  5381. addroi=0:0:100:ih:+1/5
  5382. @end example
  5383. @end itemize
  5384. @section alphaextract
  5385. Extract the alpha component from the input as a grayscale video. This
  5386. is especially useful with the @var{alphamerge} filter.
  5387. @section alphamerge
  5388. Add or replace the alpha component of the primary input with the
  5389. grayscale value of a second input. This is intended for use with
  5390. @var{alphaextract} to allow the transmission or storage of frame
  5391. sequences that have alpha in a format that doesn't support an alpha
  5392. channel.
  5393. For example, to reconstruct full frames from a normal YUV-encoded video
  5394. and a separate video created with @var{alphaextract}, you might use:
  5395. @example
  5396. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5397. @end example
  5398. @section amplify
  5399. Amplify differences between current pixel and pixels of adjacent frames in
  5400. same pixel location.
  5401. This filter accepts the following options:
  5402. @table @option
  5403. @item radius
  5404. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5405. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5406. @item factor
  5407. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5408. @item threshold
  5409. Set threshold for difference amplification. Any difference greater or equal to
  5410. this value will not alter source pixel. Default is 10.
  5411. Allowed range is from 0 to 65535.
  5412. @item tolerance
  5413. Set tolerance for difference amplification. Any difference lower to
  5414. this value will not alter source pixel. Default is 0.
  5415. Allowed range is from 0 to 65535.
  5416. @item low
  5417. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5418. This option controls maximum possible value that will decrease source pixel value.
  5419. @item high
  5420. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5421. This option controls maximum possible value that will increase source pixel value.
  5422. @item planes
  5423. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5424. @end table
  5425. @subsection Commands
  5426. This filter supports the following @ref{commands} that corresponds to option of same name:
  5427. @table @option
  5428. @item factor
  5429. @item threshold
  5430. @item tolerance
  5431. @item low
  5432. @item high
  5433. @item planes
  5434. @end table
  5435. @section ass
  5436. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5437. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5438. Substation Alpha) subtitles files.
  5439. This filter accepts the following option in addition to the common options from
  5440. the @ref{subtitles} filter:
  5441. @table @option
  5442. @item shaping
  5443. Set the shaping engine
  5444. Available values are:
  5445. @table @samp
  5446. @item auto
  5447. The default libass shaping engine, which is the best available.
  5448. @item simple
  5449. Fast, font-agnostic shaper that can do only substitutions
  5450. @item complex
  5451. Slower shaper using OpenType for substitutions and positioning
  5452. @end table
  5453. The default is @code{auto}.
  5454. @end table
  5455. @section atadenoise
  5456. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5457. The filter accepts the following options:
  5458. @table @option
  5459. @item 0a
  5460. Set threshold A for 1st plane. Default is 0.02.
  5461. Valid range is 0 to 0.3.
  5462. @item 0b
  5463. Set threshold B for 1st plane. Default is 0.04.
  5464. Valid range is 0 to 5.
  5465. @item 1a
  5466. Set threshold A for 2nd plane. Default is 0.02.
  5467. Valid range is 0 to 0.3.
  5468. @item 1b
  5469. Set threshold B for 2nd plane. Default is 0.04.
  5470. Valid range is 0 to 5.
  5471. @item 2a
  5472. Set threshold A for 3rd plane. Default is 0.02.
  5473. Valid range is 0 to 0.3.
  5474. @item 2b
  5475. Set threshold B for 3rd plane. Default is 0.04.
  5476. Valid range is 0 to 5.
  5477. Threshold A is designed to react on abrupt changes in the input signal and
  5478. threshold B is designed to react on continuous changes in the input signal.
  5479. @item s
  5480. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5481. number in range [5, 129].
  5482. @item p
  5483. Set what planes of frame filter will use for averaging. Default is all.
  5484. @item a
  5485. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5486. Alternatively can be set to @code{s} serial.
  5487. Parallel can be faster then serial, while other way around is never true.
  5488. Parallel will abort early on first change being greater then thresholds, while serial
  5489. will continue processing other side of frames if they are equal or below thresholds.
  5490. @item 0s
  5491. @item 1s
  5492. @item 2s
  5493. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  5494. Valid range is from 0 to 32767.
  5495. This options controls weight for each pixel in radius defined by size.
  5496. Default value means every pixel have same weight.
  5497. Setting this option to 0 effectively disables filtering.
  5498. @end table
  5499. @subsection Commands
  5500. This filter supports same @ref{commands} as options except option @code{s}.
  5501. The command accepts the same syntax of the corresponding option.
  5502. @section avgblur
  5503. Apply average blur filter.
  5504. The filter accepts the following options:
  5505. @table @option
  5506. @item sizeX
  5507. Set horizontal radius size.
  5508. @item planes
  5509. Set which planes to filter. By default all planes are filtered.
  5510. @item sizeY
  5511. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5512. Default is @code{0}.
  5513. @end table
  5514. @subsection Commands
  5515. This filter supports same commands as options.
  5516. The command accepts the same syntax of the corresponding option.
  5517. If the specified expression is not valid, it is kept at its current
  5518. value.
  5519. @section bbox
  5520. Compute the bounding box for the non-black pixels in the input frame
  5521. luminance plane.
  5522. This filter computes the bounding box containing all the pixels with a
  5523. luminance value greater than the minimum allowed value.
  5524. The parameters describing the bounding box are printed on the filter
  5525. log.
  5526. The filter accepts the following option:
  5527. @table @option
  5528. @item min_val
  5529. Set the minimal luminance value. Default is @code{16}.
  5530. @end table
  5531. @subsection Commands
  5532. This filter supports the all above options as @ref{commands}.
  5533. @section bilateral
  5534. Apply bilateral filter, spatial smoothing while preserving edges.
  5535. The filter accepts the following options:
  5536. @table @option
  5537. @item sigmaS
  5538. Set sigma of gaussian function to calculate spatial weight.
  5539. Allowed range is 0 to 512. Default is 0.1.
  5540. @item sigmaR
  5541. Set sigma of gaussian function to calculate range weight.
  5542. Allowed range is 0 to 1. Default is 0.1.
  5543. @item planes
  5544. Set planes to filter. Default is first only.
  5545. @end table
  5546. @subsection Commands
  5547. This filter supports the all above options as @ref{commands}.
  5548. @section bitplanenoise
  5549. Show and measure bit plane noise.
  5550. The filter accepts the following options:
  5551. @table @option
  5552. @item bitplane
  5553. Set which plane to analyze. Default is @code{1}.
  5554. @item filter
  5555. Filter out noisy pixels from @code{bitplane} set above.
  5556. Default is disabled.
  5557. @end table
  5558. @section blackdetect
  5559. Detect video intervals that are (almost) completely black. Can be
  5560. useful to detect chapter transitions, commercials, or invalid
  5561. recordings.
  5562. The filter outputs its detection analysis to both the log as well as
  5563. frame metadata. If a black segment of at least the specified minimum
  5564. duration is found, a line with the start and end timestamps as well
  5565. as duration is printed to the log with level @code{info}. In addition,
  5566. a log line with level @code{debug} is printed per frame showing the
  5567. black amount detected for that frame.
  5568. The filter also attaches metadata to the first frame of a black
  5569. segment with key @code{lavfi.black_start} and to the first frame
  5570. after the black segment ends with key @code{lavfi.black_end}. The
  5571. value is the frame's timestamp. This metadata is added regardless
  5572. of the minimum duration specified.
  5573. The filter accepts the following options:
  5574. @table @option
  5575. @item black_min_duration, d
  5576. Set the minimum detected black duration expressed in seconds. It must
  5577. be a non-negative floating point number.
  5578. Default value is 2.0.
  5579. @item picture_black_ratio_th, pic_th
  5580. Set the threshold for considering a picture "black".
  5581. Express the minimum value for the ratio:
  5582. @example
  5583. @var{nb_black_pixels} / @var{nb_pixels}
  5584. @end example
  5585. for which a picture is considered black.
  5586. Default value is 0.98.
  5587. @item pixel_black_th, pix_th
  5588. Set the threshold for considering a pixel "black".
  5589. The threshold expresses the maximum pixel luminance value for which a
  5590. pixel is considered "black". The provided value is scaled according to
  5591. the following equation:
  5592. @example
  5593. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5594. @end example
  5595. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5596. the input video format, the range is [0-255] for YUV full-range
  5597. formats and [16-235] for YUV non full-range formats.
  5598. Default value is 0.10.
  5599. @end table
  5600. The following example sets the maximum pixel threshold to the minimum
  5601. value, and detects only black intervals of 2 or more seconds:
  5602. @example
  5603. blackdetect=d=2:pix_th=0.00
  5604. @end example
  5605. @section blackframe
  5606. Detect frames that are (almost) completely black. Can be useful to
  5607. detect chapter transitions or commercials. Output lines consist of
  5608. the frame number of the detected frame, the percentage of blackness,
  5609. the position in the file if known or -1 and the timestamp in seconds.
  5610. In order to display the output lines, you need to set the loglevel at
  5611. least to the AV_LOG_INFO value.
  5612. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5613. The value represents the percentage of pixels in the picture that
  5614. are below the threshold value.
  5615. It accepts the following parameters:
  5616. @table @option
  5617. @item amount
  5618. The percentage of the pixels that have to be below the threshold; it defaults to
  5619. @code{98}.
  5620. @item threshold, thresh
  5621. The threshold below which a pixel value is considered black; it defaults to
  5622. @code{32}.
  5623. @end table
  5624. @anchor{blend}
  5625. @section blend
  5626. Blend two video frames into each other.
  5627. The @code{blend} filter takes two input streams and outputs one
  5628. stream, the first input is the "top" layer and second input is
  5629. "bottom" layer. By default, the output terminates when the longest input terminates.
  5630. The @code{tblend} (time blend) filter takes two consecutive frames
  5631. from one single stream, and outputs the result obtained by blending
  5632. the new frame on top of the old frame.
  5633. A description of the accepted options follows.
  5634. @table @option
  5635. @item c0_mode
  5636. @item c1_mode
  5637. @item c2_mode
  5638. @item c3_mode
  5639. @item all_mode
  5640. Set blend mode for specific pixel component or all pixel components in case
  5641. of @var{all_mode}. Default value is @code{normal}.
  5642. Available values for component modes are:
  5643. @table @samp
  5644. @item addition
  5645. @item grainmerge
  5646. @item and
  5647. @item average
  5648. @item burn
  5649. @item darken
  5650. @item difference
  5651. @item grainextract
  5652. @item divide
  5653. @item dodge
  5654. @item freeze
  5655. @item exclusion
  5656. @item extremity
  5657. @item glow
  5658. @item hardlight
  5659. @item hardmix
  5660. @item heat
  5661. @item lighten
  5662. @item linearlight
  5663. @item multiply
  5664. @item multiply128
  5665. @item negation
  5666. @item normal
  5667. @item or
  5668. @item overlay
  5669. @item phoenix
  5670. @item pinlight
  5671. @item reflect
  5672. @item screen
  5673. @item softlight
  5674. @item subtract
  5675. @item vividlight
  5676. @item xor
  5677. @end table
  5678. @item c0_opacity
  5679. @item c1_opacity
  5680. @item c2_opacity
  5681. @item c3_opacity
  5682. @item all_opacity
  5683. Set blend opacity for specific pixel component or all pixel components in case
  5684. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5685. @item c0_expr
  5686. @item c1_expr
  5687. @item c2_expr
  5688. @item c3_expr
  5689. @item all_expr
  5690. Set blend expression for specific pixel component or all pixel components in case
  5691. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5692. The expressions can use the following variables:
  5693. @table @option
  5694. @item N
  5695. The sequential number of the filtered frame, starting from @code{0}.
  5696. @item X
  5697. @item Y
  5698. the coordinates of the current sample
  5699. @item W
  5700. @item H
  5701. the width and height of currently filtered plane
  5702. @item SW
  5703. @item SH
  5704. Width and height scale for the plane being filtered. It is the
  5705. ratio between the dimensions of the current plane to the luma plane,
  5706. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5707. the luma plane and @code{0.5,0.5} for the chroma planes.
  5708. @item T
  5709. Time of the current frame, expressed in seconds.
  5710. @item TOP, A
  5711. Value of pixel component at current location for first video frame (top layer).
  5712. @item BOTTOM, B
  5713. Value of pixel component at current location for second video frame (bottom layer).
  5714. @end table
  5715. @end table
  5716. The @code{blend} filter also supports the @ref{framesync} options.
  5717. @subsection Examples
  5718. @itemize
  5719. @item
  5720. Apply transition from bottom layer to top layer in first 10 seconds:
  5721. @example
  5722. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5723. @end example
  5724. @item
  5725. Apply linear horizontal transition from top layer to bottom layer:
  5726. @example
  5727. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5728. @end example
  5729. @item
  5730. Apply 1x1 checkerboard effect:
  5731. @example
  5732. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5733. @end example
  5734. @item
  5735. Apply uncover left effect:
  5736. @example
  5737. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5738. @end example
  5739. @item
  5740. Apply uncover down effect:
  5741. @example
  5742. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5743. @end example
  5744. @item
  5745. Apply uncover up-left effect:
  5746. @example
  5747. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5748. @end example
  5749. @item
  5750. Split diagonally video and shows top and bottom layer on each side:
  5751. @example
  5752. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5753. @end example
  5754. @item
  5755. Display differences between the current and the previous frame:
  5756. @example
  5757. tblend=all_mode=grainextract
  5758. @end example
  5759. @end itemize
  5760. @section bm3d
  5761. Denoise frames using Block-Matching 3D algorithm.
  5762. The filter accepts the following options.
  5763. @table @option
  5764. @item sigma
  5765. Set denoising strength. Default value is 1.
  5766. Allowed range is from 0 to 999.9.
  5767. The denoising algorithm is very sensitive to sigma, so adjust it
  5768. according to the source.
  5769. @item block
  5770. Set local patch size. This sets dimensions in 2D.
  5771. @item bstep
  5772. Set sliding step for processing blocks. Default value is 4.
  5773. Allowed range is from 1 to 64.
  5774. Smaller values allows processing more reference blocks and is slower.
  5775. @item group
  5776. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5777. When set to 1, no block matching is done. Larger values allows more blocks
  5778. in single group.
  5779. Allowed range is from 1 to 256.
  5780. @item range
  5781. Set radius for search block matching. Default is 9.
  5782. Allowed range is from 1 to INT32_MAX.
  5783. @item mstep
  5784. Set step between two search locations for block matching. Default is 1.
  5785. Allowed range is from 1 to 64. Smaller is slower.
  5786. @item thmse
  5787. Set threshold of mean square error for block matching. Valid range is 0 to
  5788. INT32_MAX.
  5789. @item hdthr
  5790. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5791. Larger values results in stronger hard-thresholding filtering in frequency
  5792. domain.
  5793. @item estim
  5794. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5795. Default is @code{basic}.
  5796. @item ref
  5797. If enabled, filter will use 2nd stream for block matching.
  5798. Default is disabled for @code{basic} value of @var{estim} option,
  5799. and always enabled if value of @var{estim} is @code{final}.
  5800. @item planes
  5801. Set planes to filter. Default is all available except alpha.
  5802. @end table
  5803. @subsection Examples
  5804. @itemize
  5805. @item
  5806. Basic filtering with bm3d:
  5807. @example
  5808. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5809. @end example
  5810. @item
  5811. Same as above, but filtering only luma:
  5812. @example
  5813. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5814. @end example
  5815. @item
  5816. Same as above, but with both estimation modes:
  5817. @example
  5818. 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
  5819. @end example
  5820. @item
  5821. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5822. @example
  5823. 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
  5824. @end example
  5825. @end itemize
  5826. @section boxblur
  5827. Apply a boxblur algorithm to the input video.
  5828. It accepts the following parameters:
  5829. @table @option
  5830. @item luma_radius, lr
  5831. @item luma_power, lp
  5832. @item chroma_radius, cr
  5833. @item chroma_power, cp
  5834. @item alpha_radius, ar
  5835. @item alpha_power, ap
  5836. @end table
  5837. A description of the accepted options follows.
  5838. @table @option
  5839. @item luma_radius, lr
  5840. @item chroma_radius, cr
  5841. @item alpha_radius, ar
  5842. Set an expression for the box radius in pixels used for blurring the
  5843. corresponding input plane.
  5844. The radius value must be a non-negative number, and must not be
  5845. greater than the value of the expression @code{min(w,h)/2} for the
  5846. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5847. planes.
  5848. Default value for @option{luma_radius} is "2". If not specified,
  5849. @option{chroma_radius} and @option{alpha_radius} default to the
  5850. corresponding value set for @option{luma_radius}.
  5851. The expressions can contain the following constants:
  5852. @table @option
  5853. @item w
  5854. @item h
  5855. The input width and height in pixels.
  5856. @item cw
  5857. @item ch
  5858. The input chroma image width and height in pixels.
  5859. @item hsub
  5860. @item vsub
  5861. The horizontal and vertical chroma subsample values. For example, for the
  5862. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5863. @end table
  5864. @item luma_power, lp
  5865. @item chroma_power, cp
  5866. @item alpha_power, ap
  5867. Specify how many times the boxblur filter is applied to the
  5868. corresponding plane.
  5869. Default value for @option{luma_power} is 2. If not specified,
  5870. @option{chroma_power} and @option{alpha_power} default to the
  5871. corresponding value set for @option{luma_power}.
  5872. A value of 0 will disable the effect.
  5873. @end table
  5874. @subsection Examples
  5875. @itemize
  5876. @item
  5877. Apply a boxblur filter with the luma, chroma, and alpha radii
  5878. set to 2:
  5879. @example
  5880. boxblur=luma_radius=2:luma_power=1
  5881. boxblur=2:1
  5882. @end example
  5883. @item
  5884. Set the luma radius to 2, and alpha and chroma radius to 0:
  5885. @example
  5886. boxblur=2:1:cr=0:ar=0
  5887. @end example
  5888. @item
  5889. Set the luma and chroma radii to a fraction of the video dimension:
  5890. @example
  5891. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5892. @end example
  5893. @end itemize
  5894. @section bwdif
  5895. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5896. Deinterlacing Filter").
  5897. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5898. interpolation algorithms.
  5899. It accepts the following parameters:
  5900. @table @option
  5901. @item mode
  5902. The interlacing mode to adopt. It accepts one of the following values:
  5903. @table @option
  5904. @item 0, send_frame
  5905. Output one frame for each frame.
  5906. @item 1, send_field
  5907. Output one frame for each field.
  5908. @end table
  5909. The default value is @code{send_field}.
  5910. @item parity
  5911. The picture field parity assumed for the input interlaced video. It accepts one
  5912. of the following values:
  5913. @table @option
  5914. @item 0, tff
  5915. Assume the top field is first.
  5916. @item 1, bff
  5917. Assume the bottom field is first.
  5918. @item -1, auto
  5919. Enable automatic detection of field parity.
  5920. @end table
  5921. The default value is @code{auto}.
  5922. If the interlacing is unknown or the decoder does not export this information,
  5923. top field first will be assumed.
  5924. @item deint
  5925. Specify which frames to deinterlace. Accepts one of the following
  5926. values:
  5927. @table @option
  5928. @item 0, all
  5929. Deinterlace all frames.
  5930. @item 1, interlaced
  5931. Only deinterlace frames marked as interlaced.
  5932. @end table
  5933. The default value is @code{all}.
  5934. @end table
  5935. @section cas
  5936. Apply Contrast Adaptive Sharpen filter to video stream.
  5937. The filter accepts the following options:
  5938. @table @option
  5939. @item strength
  5940. Set the sharpening strength. Default value is 0.
  5941. @item planes
  5942. Set planes to filter. Default value is to filter all
  5943. planes except alpha plane.
  5944. @end table
  5945. @subsection Commands
  5946. This filter supports same @ref{commands} as options.
  5947. @section chromahold
  5948. Remove all color information for all colors except for certain one.
  5949. The filter accepts the following options:
  5950. @table @option
  5951. @item color
  5952. The color which will not be replaced with neutral chroma.
  5953. @item similarity
  5954. Similarity percentage with the above color.
  5955. 0.01 matches only the exact key color, while 1.0 matches everything.
  5956. @item blend
  5957. Blend percentage.
  5958. 0.0 makes pixels either fully gray, or not gray at all.
  5959. Higher values result in more preserved color.
  5960. @item yuv
  5961. Signals that the color passed is already in YUV instead of RGB.
  5962. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5963. This can be used to pass exact YUV values as hexadecimal numbers.
  5964. @end table
  5965. @subsection Commands
  5966. This filter supports same @ref{commands} as options.
  5967. The command accepts the same syntax of the corresponding option.
  5968. If the specified expression is not valid, it is kept at its current
  5969. value.
  5970. @section chromakey
  5971. YUV colorspace color/chroma keying.
  5972. The filter accepts the following options:
  5973. @table @option
  5974. @item color
  5975. The color which will be replaced with transparency.
  5976. @item similarity
  5977. Similarity percentage with the key color.
  5978. 0.01 matches only the exact key color, while 1.0 matches everything.
  5979. @item blend
  5980. Blend percentage.
  5981. 0.0 makes pixels either fully transparent, or not transparent at all.
  5982. Higher values result in semi-transparent pixels, with a higher transparency
  5983. the more similar the pixels color is to the key color.
  5984. @item yuv
  5985. Signals that the color passed is already in YUV instead of RGB.
  5986. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5987. This can be used to pass exact YUV values as hexadecimal numbers.
  5988. @end table
  5989. @subsection Commands
  5990. This filter supports same @ref{commands} as options.
  5991. The command accepts the same syntax of the corresponding option.
  5992. If the specified expression is not valid, it is kept at its current
  5993. value.
  5994. @subsection Examples
  5995. @itemize
  5996. @item
  5997. Make every green pixel in the input image transparent:
  5998. @example
  5999. ffmpeg -i input.png -vf chromakey=green out.png
  6000. @end example
  6001. @item
  6002. Overlay a greenscreen-video on top of a static black background.
  6003. @example
  6004. 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
  6005. @end example
  6006. @end itemize
  6007. @section chromanr
  6008. Reduce chrominance noise.
  6009. The filter accepts the following options:
  6010. @table @option
  6011. @item thres
  6012. Set threshold for averaging chrominance values.
  6013. Sum of absolute difference of Y, U and V pixel components of current
  6014. pixel and neighbour pixels lower than this threshold will be used in
  6015. averaging. Luma component is left unchanged and is copied to output.
  6016. Default value is 30. Allowed range is from 1 to 200.
  6017. @item sizew
  6018. Set horizontal radius of rectangle used for averaging.
  6019. Allowed range is from 1 to 100. Default value is 5.
  6020. @item sizeh
  6021. Set vertical radius of rectangle used for averaging.
  6022. Allowed range is from 1 to 100. Default value is 5.
  6023. @item stepw
  6024. Set horizontal step when averaging. Default value is 1.
  6025. Allowed range is from 1 to 50.
  6026. Mostly useful to speed-up filtering.
  6027. @item steph
  6028. Set vertical step when averaging. Default value is 1.
  6029. Allowed range is from 1 to 50.
  6030. Mostly useful to speed-up filtering.
  6031. @item threy
  6032. Set Y threshold for averaging chrominance values.
  6033. Set finer control for max allowed difference between Y components
  6034. of current pixel and neigbour pixels.
  6035. Default value is 200. Allowed range is from 1 to 200.
  6036. @item threu
  6037. Set U threshold for averaging chrominance values.
  6038. Set finer control for max allowed difference between U components
  6039. of current pixel and neigbour pixels.
  6040. Default value is 200. Allowed range is from 1 to 200.
  6041. @item threv
  6042. Set V threshold for averaging chrominance values.
  6043. Set finer control for max allowed difference between V components
  6044. of current pixel and neigbour pixels.
  6045. Default value is 200. Allowed range is from 1 to 200.
  6046. @end table
  6047. @subsection Commands
  6048. This filter supports same @ref{commands} as options.
  6049. The command accepts the same syntax of the corresponding option.
  6050. @section chromashift
  6051. Shift chroma pixels horizontally and/or vertically.
  6052. The filter accepts the following options:
  6053. @table @option
  6054. @item cbh
  6055. Set amount to shift chroma-blue horizontally.
  6056. @item cbv
  6057. Set amount to shift chroma-blue vertically.
  6058. @item crh
  6059. Set amount to shift chroma-red horizontally.
  6060. @item crv
  6061. Set amount to shift chroma-red vertically.
  6062. @item edge
  6063. Set edge mode, can be @var{smear}, default, or @var{warp}.
  6064. @end table
  6065. @subsection Commands
  6066. This filter supports the all above options as @ref{commands}.
  6067. @section ciescope
  6068. Display CIE color diagram with pixels overlaid onto it.
  6069. The filter accepts the following options:
  6070. @table @option
  6071. @item system
  6072. Set color system.
  6073. @table @samp
  6074. @item ntsc, 470m
  6075. @item ebu, 470bg
  6076. @item smpte
  6077. @item 240m
  6078. @item apple
  6079. @item widergb
  6080. @item cie1931
  6081. @item rec709, hdtv
  6082. @item uhdtv, rec2020
  6083. @item dcip3
  6084. @end table
  6085. @item cie
  6086. Set CIE system.
  6087. @table @samp
  6088. @item xyy
  6089. @item ucs
  6090. @item luv
  6091. @end table
  6092. @item gamuts
  6093. Set what gamuts to draw.
  6094. See @code{system} option for available values.
  6095. @item size, s
  6096. Set ciescope size, by default set to 512.
  6097. @item intensity, i
  6098. Set intensity used to map input pixel values to CIE diagram.
  6099. @item contrast
  6100. Set contrast used to draw tongue colors that are out of active color system gamut.
  6101. @item corrgamma
  6102. Correct gamma displayed on scope, by default enabled.
  6103. @item showwhite
  6104. Show white point on CIE diagram, by default disabled.
  6105. @item gamma
  6106. Set input gamma. Used only with XYZ input color space.
  6107. @end table
  6108. @section codecview
  6109. Visualize information exported by some codecs.
  6110. Some codecs can export information through frames using side-data or other
  6111. means. For example, some MPEG based codecs export motion vectors through the
  6112. @var{export_mvs} flag in the codec @option{flags2} option.
  6113. The filter accepts the following option:
  6114. @table @option
  6115. @item mv
  6116. Set motion vectors to visualize.
  6117. Available flags for @var{mv} are:
  6118. @table @samp
  6119. @item pf
  6120. forward predicted MVs of P-frames
  6121. @item bf
  6122. forward predicted MVs of B-frames
  6123. @item bb
  6124. backward predicted MVs of B-frames
  6125. @end table
  6126. @item qp
  6127. Display quantization parameters using the chroma planes.
  6128. @item mv_type, mvt
  6129. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  6130. Available flags for @var{mv_type} are:
  6131. @table @samp
  6132. @item fp
  6133. forward predicted MVs
  6134. @item bp
  6135. backward predicted MVs
  6136. @end table
  6137. @item frame_type, ft
  6138. Set frame type to visualize motion vectors of.
  6139. Available flags for @var{frame_type} are:
  6140. @table @samp
  6141. @item if
  6142. intra-coded frames (I-frames)
  6143. @item pf
  6144. predicted frames (P-frames)
  6145. @item bf
  6146. bi-directionally predicted frames (B-frames)
  6147. @end table
  6148. @end table
  6149. @subsection Examples
  6150. @itemize
  6151. @item
  6152. Visualize forward predicted MVs of all frames using @command{ffplay}:
  6153. @example
  6154. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  6155. @end example
  6156. @item
  6157. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  6158. @example
  6159. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  6160. @end example
  6161. @end itemize
  6162. @section colorbalance
  6163. Modify intensity of primary colors (red, green and blue) of input frames.
  6164. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  6165. regions for the red-cyan, green-magenta or blue-yellow balance.
  6166. A positive adjustment value shifts the balance towards the primary color, a negative
  6167. value towards the complementary color.
  6168. The filter accepts the following options:
  6169. @table @option
  6170. @item rs
  6171. @item gs
  6172. @item bs
  6173. Adjust red, green and blue shadows (darkest pixels).
  6174. @item rm
  6175. @item gm
  6176. @item bm
  6177. Adjust red, green and blue midtones (medium pixels).
  6178. @item rh
  6179. @item gh
  6180. @item bh
  6181. Adjust red, green and blue highlights (brightest pixels).
  6182. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6183. @item pl
  6184. Preserve lightness when changing color balance. Default is disabled.
  6185. @end table
  6186. @subsection Examples
  6187. @itemize
  6188. @item
  6189. Add red color cast to shadows:
  6190. @example
  6191. colorbalance=rs=.3
  6192. @end example
  6193. @end itemize
  6194. @subsection Commands
  6195. This filter supports the all above options as @ref{commands}.
  6196. @section colorcontrast
  6197. Adjust color contrast between RGB components.
  6198. The filter accepts the following options:
  6199. @table @option
  6200. @item rc
  6201. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6202. @item gm
  6203. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6204. @item by
  6205. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6206. @item rcw
  6207. @item gmw
  6208. @item byw
  6209. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  6210. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  6211. @item pl
  6212. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  6213. @end table
  6214. @subsection Commands
  6215. This filter supports the all above options as @ref{commands}.
  6216. @section colorcorrect
  6217. Adjust color white balance selectively for blacks and whites.
  6218. This filter operates in YUV colorspace.
  6219. The filter accepts the following options:
  6220. @table @option
  6221. @item rl
  6222. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  6223. Default value is 0.
  6224. @item bl
  6225. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  6226. Default value is 0.
  6227. @item rh
  6228. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6229. Default value is 0.
  6230. @item bh
  6231. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6232. Default value is 0.
  6233. @item saturation
  6234. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  6235. Default value is 1.
  6236. @end table
  6237. @subsection Commands
  6238. This filter supports the all above options as @ref{commands}.
  6239. @section colorchannelmixer
  6240. Adjust video input frames by re-mixing color channels.
  6241. This filter modifies a color channel by adding the values associated to
  6242. the other channels of the same pixels. For example if the value to
  6243. modify is red, the output value will be:
  6244. @example
  6245. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  6246. @end example
  6247. The filter accepts the following options:
  6248. @table @option
  6249. @item rr
  6250. @item rg
  6251. @item rb
  6252. @item ra
  6253. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  6254. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  6255. @item gr
  6256. @item gg
  6257. @item gb
  6258. @item ga
  6259. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  6260. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  6261. @item br
  6262. @item bg
  6263. @item bb
  6264. @item ba
  6265. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  6266. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  6267. @item ar
  6268. @item ag
  6269. @item ab
  6270. @item aa
  6271. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  6272. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  6273. Allowed ranges for options are @code{[-2.0, 2.0]}.
  6274. @item pl
  6275. Preserve lightness when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  6276. Default is @code{0.0}, thus disabled.
  6277. @end table
  6278. @subsection Examples
  6279. @itemize
  6280. @item
  6281. Convert source to grayscale:
  6282. @example
  6283. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  6284. @end example
  6285. @item
  6286. Simulate sepia tones:
  6287. @example
  6288. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  6289. @end example
  6290. @end itemize
  6291. @subsection Commands
  6292. This filter supports the all above options as @ref{commands}.
  6293. @section colorkey
  6294. RGB colorspace color keying.
  6295. The filter accepts the following options:
  6296. @table @option
  6297. @item color
  6298. The color which will be replaced with transparency.
  6299. @item similarity
  6300. Similarity percentage with the key color.
  6301. 0.01 matches only the exact key color, while 1.0 matches everything.
  6302. @item blend
  6303. Blend percentage.
  6304. 0.0 makes pixels either fully transparent, or not transparent at all.
  6305. Higher values result in semi-transparent pixels, with a higher transparency
  6306. the more similar the pixels color is to the key color.
  6307. @end table
  6308. @subsection Examples
  6309. @itemize
  6310. @item
  6311. Make every green pixel in the input image transparent:
  6312. @example
  6313. ffmpeg -i input.png -vf colorkey=green out.png
  6314. @end example
  6315. @item
  6316. Overlay a greenscreen-video on top of a static background image.
  6317. @example
  6318. 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
  6319. @end example
  6320. @end itemize
  6321. @subsection Commands
  6322. This filter supports same @ref{commands} as options.
  6323. The command accepts the same syntax of the corresponding option.
  6324. If the specified expression is not valid, it is kept at its current
  6325. value.
  6326. @section colorhold
  6327. Remove all color information for all RGB colors except for certain one.
  6328. The filter accepts the following options:
  6329. @table @option
  6330. @item color
  6331. The color which will not be replaced with neutral gray.
  6332. @item similarity
  6333. Similarity percentage with the above color.
  6334. 0.01 matches only the exact key color, while 1.0 matches everything.
  6335. @item blend
  6336. Blend percentage. 0.0 makes pixels fully gray.
  6337. Higher values result in more preserved color.
  6338. @end table
  6339. @subsection Commands
  6340. This filter supports same @ref{commands} as options.
  6341. The command accepts the same syntax of the corresponding option.
  6342. If the specified expression is not valid, it is kept at its current
  6343. value.
  6344. @section colorlevels
  6345. Adjust video input frames using levels.
  6346. The filter accepts the following options:
  6347. @table @option
  6348. @item rimin
  6349. @item gimin
  6350. @item bimin
  6351. @item aimin
  6352. Adjust red, green, blue and alpha input black point.
  6353. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6354. @item rimax
  6355. @item gimax
  6356. @item bimax
  6357. @item aimax
  6358. Adjust red, green, blue and alpha input white point.
  6359. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6360. Input levels are used to lighten highlights (bright tones), darken shadows
  6361. (dark tones), change the balance of bright and dark tones.
  6362. @item romin
  6363. @item gomin
  6364. @item bomin
  6365. @item aomin
  6366. Adjust red, green, blue and alpha output black point.
  6367. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6368. @item romax
  6369. @item gomax
  6370. @item bomax
  6371. @item aomax
  6372. Adjust red, green, blue and alpha output white point.
  6373. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6374. Output levels allows manual selection of a constrained output level range.
  6375. @end table
  6376. @subsection Examples
  6377. @itemize
  6378. @item
  6379. Make video output darker:
  6380. @example
  6381. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6382. @end example
  6383. @item
  6384. Increase contrast:
  6385. @example
  6386. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6387. @end example
  6388. @item
  6389. Make video output lighter:
  6390. @example
  6391. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6392. @end example
  6393. @item
  6394. Increase brightness:
  6395. @example
  6396. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6397. @end example
  6398. @end itemize
  6399. @subsection Commands
  6400. This filter supports the all above options as @ref{commands}.
  6401. @section colormatrix
  6402. Convert color matrix.
  6403. The filter accepts the following options:
  6404. @table @option
  6405. @item src
  6406. @item dst
  6407. Specify the source and destination color matrix. Both values must be
  6408. specified.
  6409. The accepted values are:
  6410. @table @samp
  6411. @item bt709
  6412. BT.709
  6413. @item fcc
  6414. FCC
  6415. @item bt601
  6416. BT.601
  6417. @item bt470
  6418. BT.470
  6419. @item bt470bg
  6420. BT.470BG
  6421. @item smpte170m
  6422. SMPTE-170M
  6423. @item smpte240m
  6424. SMPTE-240M
  6425. @item bt2020
  6426. BT.2020
  6427. @end table
  6428. @end table
  6429. For example to convert from BT.601 to SMPTE-240M, use the command:
  6430. @example
  6431. colormatrix=bt601:smpte240m
  6432. @end example
  6433. @section colorspace
  6434. Convert colorspace, transfer characteristics or color primaries.
  6435. Input video needs to have an even size.
  6436. The filter accepts the following options:
  6437. @table @option
  6438. @anchor{all}
  6439. @item all
  6440. Specify all color properties at once.
  6441. The accepted values are:
  6442. @table @samp
  6443. @item bt470m
  6444. BT.470M
  6445. @item bt470bg
  6446. BT.470BG
  6447. @item bt601-6-525
  6448. BT.601-6 525
  6449. @item bt601-6-625
  6450. BT.601-6 625
  6451. @item bt709
  6452. BT.709
  6453. @item smpte170m
  6454. SMPTE-170M
  6455. @item smpte240m
  6456. SMPTE-240M
  6457. @item bt2020
  6458. BT.2020
  6459. @end table
  6460. @anchor{space}
  6461. @item space
  6462. Specify output colorspace.
  6463. The accepted values are:
  6464. @table @samp
  6465. @item bt709
  6466. BT.709
  6467. @item fcc
  6468. FCC
  6469. @item bt470bg
  6470. BT.470BG or BT.601-6 625
  6471. @item smpte170m
  6472. SMPTE-170M or BT.601-6 525
  6473. @item smpte240m
  6474. SMPTE-240M
  6475. @item ycgco
  6476. YCgCo
  6477. @item bt2020ncl
  6478. BT.2020 with non-constant luminance
  6479. @end table
  6480. @anchor{trc}
  6481. @item trc
  6482. Specify output transfer characteristics.
  6483. The accepted values are:
  6484. @table @samp
  6485. @item bt709
  6486. BT.709
  6487. @item bt470m
  6488. BT.470M
  6489. @item bt470bg
  6490. BT.470BG
  6491. @item gamma22
  6492. Constant gamma of 2.2
  6493. @item gamma28
  6494. Constant gamma of 2.8
  6495. @item smpte170m
  6496. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6497. @item smpte240m
  6498. SMPTE-240M
  6499. @item srgb
  6500. SRGB
  6501. @item iec61966-2-1
  6502. iec61966-2-1
  6503. @item iec61966-2-4
  6504. iec61966-2-4
  6505. @item xvycc
  6506. xvycc
  6507. @item bt2020-10
  6508. BT.2020 for 10-bits content
  6509. @item bt2020-12
  6510. BT.2020 for 12-bits content
  6511. @end table
  6512. @anchor{primaries}
  6513. @item primaries
  6514. Specify output color primaries.
  6515. The accepted values are:
  6516. @table @samp
  6517. @item bt709
  6518. BT.709
  6519. @item bt470m
  6520. BT.470M
  6521. @item bt470bg
  6522. BT.470BG or BT.601-6 625
  6523. @item smpte170m
  6524. SMPTE-170M or BT.601-6 525
  6525. @item smpte240m
  6526. SMPTE-240M
  6527. @item film
  6528. film
  6529. @item smpte431
  6530. SMPTE-431
  6531. @item smpte432
  6532. SMPTE-432
  6533. @item bt2020
  6534. BT.2020
  6535. @item jedec-p22
  6536. JEDEC P22 phosphors
  6537. @end table
  6538. @anchor{range}
  6539. @item range
  6540. Specify output color range.
  6541. The accepted values are:
  6542. @table @samp
  6543. @item tv
  6544. TV (restricted) range
  6545. @item mpeg
  6546. MPEG (restricted) range
  6547. @item pc
  6548. PC (full) range
  6549. @item jpeg
  6550. JPEG (full) range
  6551. @end table
  6552. @item format
  6553. Specify output color format.
  6554. The accepted values are:
  6555. @table @samp
  6556. @item yuv420p
  6557. YUV 4:2:0 planar 8-bits
  6558. @item yuv420p10
  6559. YUV 4:2:0 planar 10-bits
  6560. @item yuv420p12
  6561. YUV 4:2:0 planar 12-bits
  6562. @item yuv422p
  6563. YUV 4:2:2 planar 8-bits
  6564. @item yuv422p10
  6565. YUV 4:2:2 planar 10-bits
  6566. @item yuv422p12
  6567. YUV 4:2:2 planar 12-bits
  6568. @item yuv444p
  6569. YUV 4:4:4 planar 8-bits
  6570. @item yuv444p10
  6571. YUV 4:4:4 planar 10-bits
  6572. @item yuv444p12
  6573. YUV 4:4:4 planar 12-bits
  6574. @end table
  6575. @item fast
  6576. Do a fast conversion, which skips gamma/primary correction. This will take
  6577. significantly less CPU, but will be mathematically incorrect. To get output
  6578. compatible with that produced by the colormatrix filter, use fast=1.
  6579. @item dither
  6580. Specify dithering mode.
  6581. The accepted values are:
  6582. @table @samp
  6583. @item none
  6584. No dithering
  6585. @item fsb
  6586. Floyd-Steinberg dithering
  6587. @end table
  6588. @item wpadapt
  6589. Whitepoint adaptation mode.
  6590. The accepted values are:
  6591. @table @samp
  6592. @item bradford
  6593. Bradford whitepoint adaptation
  6594. @item vonkries
  6595. von Kries whitepoint adaptation
  6596. @item identity
  6597. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6598. @end table
  6599. @item iall
  6600. Override all input properties at once. Same accepted values as @ref{all}.
  6601. @item ispace
  6602. Override input colorspace. Same accepted values as @ref{space}.
  6603. @item iprimaries
  6604. Override input color primaries. Same accepted values as @ref{primaries}.
  6605. @item itrc
  6606. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6607. @item irange
  6608. Override input color range. Same accepted values as @ref{range}.
  6609. @end table
  6610. The filter converts the transfer characteristics, color space and color
  6611. primaries to the specified user values. The output value, if not specified,
  6612. is set to a default value based on the "all" property. If that property is
  6613. also not specified, the filter will log an error. The output color range and
  6614. format default to the same value as the input color range and format. The
  6615. input transfer characteristics, color space, color primaries and color range
  6616. should be set on the input data. If any of these are missing, the filter will
  6617. log an error and no conversion will take place.
  6618. For example to convert the input to SMPTE-240M, use the command:
  6619. @example
  6620. colorspace=smpte240m
  6621. @end example
  6622. @section colortemperature
  6623. Adjust color temperature in video to simulate variations in ambient color temperature.
  6624. The filter accepts the following options:
  6625. @table @option
  6626. @item temperature
  6627. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  6628. Default value is 6500 K.
  6629. @item mix
  6630. Set mixing with filtered output. Allowed range is from 0 to 1.
  6631. Default value is 1.
  6632. @item pl
  6633. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  6634. Default value is 0.
  6635. @end table
  6636. @subsection Commands
  6637. This filter supports same @ref{commands} as options.
  6638. @section convolution
  6639. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6640. The filter accepts the following options:
  6641. @table @option
  6642. @item 0m
  6643. @item 1m
  6644. @item 2m
  6645. @item 3m
  6646. Set matrix for each plane.
  6647. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6648. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6649. @item 0rdiv
  6650. @item 1rdiv
  6651. @item 2rdiv
  6652. @item 3rdiv
  6653. Set multiplier for calculated value for each plane.
  6654. If unset or 0, it will be sum of all matrix elements.
  6655. @item 0bias
  6656. @item 1bias
  6657. @item 2bias
  6658. @item 3bias
  6659. Set bias for each plane. This value is added to the result of the multiplication.
  6660. Useful for making the overall image brighter or darker. Default is 0.0.
  6661. @item 0mode
  6662. @item 1mode
  6663. @item 2mode
  6664. @item 3mode
  6665. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6666. Default is @var{square}.
  6667. @end table
  6668. @subsection Commands
  6669. This filter supports the all above options as @ref{commands}.
  6670. @subsection Examples
  6671. @itemize
  6672. @item
  6673. Apply sharpen:
  6674. @example
  6675. 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"
  6676. @end example
  6677. @item
  6678. Apply blur:
  6679. @example
  6680. 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"
  6681. @end example
  6682. @item
  6683. Apply edge enhance:
  6684. @example
  6685. 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"
  6686. @end example
  6687. @item
  6688. Apply edge detect:
  6689. @example
  6690. 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"
  6691. @end example
  6692. @item
  6693. Apply laplacian edge detector which includes diagonals:
  6694. @example
  6695. 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"
  6696. @end example
  6697. @item
  6698. Apply emboss:
  6699. @example
  6700. 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"
  6701. @end example
  6702. @end itemize
  6703. @section convolve
  6704. Apply 2D convolution of video stream in frequency domain using second stream
  6705. as impulse.
  6706. The filter accepts the following options:
  6707. @table @option
  6708. @item planes
  6709. Set which planes to process.
  6710. @item impulse
  6711. Set which impulse video frames will be processed, can be @var{first}
  6712. or @var{all}. Default is @var{all}.
  6713. @end table
  6714. The @code{convolve} filter also supports the @ref{framesync} options.
  6715. @section copy
  6716. Copy the input video source unchanged to the output. This is mainly useful for
  6717. testing purposes.
  6718. @anchor{coreimage}
  6719. @section coreimage
  6720. Video filtering on GPU using Apple's CoreImage API on OSX.
  6721. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6722. processed by video hardware. However, software-based OpenGL implementations
  6723. exist which means there is no guarantee for hardware processing. It depends on
  6724. the respective OSX.
  6725. There are many filters and image generators provided by Apple that come with a
  6726. large variety of options. The filter has to be referenced by its name along
  6727. with its options.
  6728. The coreimage filter accepts the following options:
  6729. @table @option
  6730. @item list_filters
  6731. List all available filters and generators along with all their respective
  6732. options as well as possible minimum and maximum values along with the default
  6733. values.
  6734. @example
  6735. list_filters=true
  6736. @end example
  6737. @item filter
  6738. Specify all filters by their respective name and options.
  6739. Use @var{list_filters} to determine all valid filter names and options.
  6740. Numerical options are specified by a float value and are automatically clamped
  6741. to their respective value range. Vector and color options have to be specified
  6742. by a list of space separated float values. Character escaping has to be done.
  6743. A special option name @code{default} is available to use default options for a
  6744. filter.
  6745. It is required to specify either @code{default} or at least one of the filter options.
  6746. All omitted options are used with their default values.
  6747. The syntax of the filter string is as follows:
  6748. @example
  6749. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6750. @end example
  6751. @item output_rect
  6752. Specify a rectangle where the output of the filter chain is copied into the
  6753. input image. It is given by a list of space separated float values:
  6754. @example
  6755. output_rect=x\ y\ width\ height
  6756. @end example
  6757. If not given, the output rectangle equals the dimensions of the input image.
  6758. The output rectangle is automatically cropped at the borders of the input
  6759. image. Negative values are valid for each component.
  6760. @example
  6761. output_rect=25\ 25\ 100\ 100
  6762. @end example
  6763. @end table
  6764. Several filters can be chained for successive processing without GPU-HOST
  6765. transfers allowing for fast processing of complex filter chains.
  6766. Currently, only filters with zero (generators) or exactly one (filters) input
  6767. image and one output image are supported. Also, transition filters are not yet
  6768. usable as intended.
  6769. Some filters generate output images with additional padding depending on the
  6770. respective filter kernel. The padding is automatically removed to ensure the
  6771. filter output has the same size as the input image.
  6772. For image generators, the size of the output image is determined by the
  6773. previous output image of the filter chain or the input image of the whole
  6774. filterchain, respectively. The generators do not use the pixel information of
  6775. this image to generate their output. However, the generated output is
  6776. blended onto this image, resulting in partial or complete coverage of the
  6777. output image.
  6778. The @ref{coreimagesrc} video source can be used for generating input images
  6779. which are directly fed into the filter chain. By using it, providing input
  6780. images by another video source or an input video is not required.
  6781. @subsection Examples
  6782. @itemize
  6783. @item
  6784. List all filters available:
  6785. @example
  6786. coreimage=list_filters=true
  6787. @end example
  6788. @item
  6789. Use the CIBoxBlur filter with default options to blur an image:
  6790. @example
  6791. coreimage=filter=CIBoxBlur@@default
  6792. @end example
  6793. @item
  6794. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6795. its center at 100x100 and a radius of 50 pixels:
  6796. @example
  6797. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6798. @end example
  6799. @item
  6800. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6801. given as complete and escaped command-line for Apple's standard bash shell:
  6802. @example
  6803. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6804. @end example
  6805. @end itemize
  6806. @section cover_rect
  6807. Cover a rectangular object
  6808. It accepts the following options:
  6809. @table @option
  6810. @item cover
  6811. Filepath of the optional cover image, needs to be in yuv420.
  6812. @item mode
  6813. Set covering mode.
  6814. It accepts the following values:
  6815. @table @samp
  6816. @item cover
  6817. cover it by the supplied image
  6818. @item blur
  6819. cover it by interpolating the surrounding pixels
  6820. @end table
  6821. Default value is @var{blur}.
  6822. @end table
  6823. @subsection Examples
  6824. @itemize
  6825. @item
  6826. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6827. @example
  6828. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6829. @end example
  6830. @end itemize
  6831. @section crop
  6832. Crop the input video to given dimensions.
  6833. It accepts the following parameters:
  6834. @table @option
  6835. @item w, out_w
  6836. The width of the output video. It defaults to @code{iw}.
  6837. This expression is evaluated only once during the filter
  6838. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6839. @item h, out_h
  6840. The height of the output video. It defaults to @code{ih}.
  6841. This expression is evaluated only once during the filter
  6842. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6843. @item x
  6844. The horizontal position, in the input video, of the left edge of the output
  6845. video. It defaults to @code{(in_w-out_w)/2}.
  6846. This expression is evaluated per-frame.
  6847. @item y
  6848. The vertical position, in the input video, of the top edge of the output video.
  6849. It defaults to @code{(in_h-out_h)/2}.
  6850. This expression is evaluated per-frame.
  6851. @item keep_aspect
  6852. If set to 1 will force the output display aspect ratio
  6853. to be the same of the input, by changing the output sample aspect
  6854. ratio. It defaults to 0.
  6855. @item exact
  6856. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6857. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6858. It defaults to 0.
  6859. @end table
  6860. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6861. expressions containing the following constants:
  6862. @table @option
  6863. @item x
  6864. @item y
  6865. The computed values for @var{x} and @var{y}. They are evaluated for
  6866. each new frame.
  6867. @item in_w
  6868. @item in_h
  6869. The input width and height.
  6870. @item iw
  6871. @item ih
  6872. These are the same as @var{in_w} and @var{in_h}.
  6873. @item out_w
  6874. @item out_h
  6875. The output (cropped) width and height.
  6876. @item ow
  6877. @item oh
  6878. These are the same as @var{out_w} and @var{out_h}.
  6879. @item a
  6880. same as @var{iw} / @var{ih}
  6881. @item sar
  6882. input sample aspect ratio
  6883. @item dar
  6884. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6885. @item hsub
  6886. @item vsub
  6887. horizontal and vertical chroma subsample values. For example for the
  6888. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6889. @item n
  6890. The number of the input frame, starting from 0.
  6891. @item pos
  6892. the position in the file of the input frame, NAN if unknown
  6893. @item t
  6894. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6895. @end table
  6896. The expression for @var{out_w} may depend on the value of @var{out_h},
  6897. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6898. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6899. evaluated after @var{out_w} and @var{out_h}.
  6900. The @var{x} and @var{y} parameters specify the expressions for the
  6901. position of the top-left corner of the output (non-cropped) area. They
  6902. are evaluated for each frame. If the evaluated value is not valid, it
  6903. is approximated to the nearest valid value.
  6904. The expression for @var{x} may depend on @var{y}, and the expression
  6905. for @var{y} may depend on @var{x}.
  6906. @subsection Examples
  6907. @itemize
  6908. @item
  6909. Crop area with size 100x100 at position (12,34).
  6910. @example
  6911. crop=100:100:12:34
  6912. @end example
  6913. Using named options, the example above becomes:
  6914. @example
  6915. crop=w=100:h=100:x=12:y=34
  6916. @end example
  6917. @item
  6918. Crop the central input area with size 100x100:
  6919. @example
  6920. crop=100:100
  6921. @end example
  6922. @item
  6923. Crop the central input area with size 2/3 of the input video:
  6924. @example
  6925. crop=2/3*in_w:2/3*in_h
  6926. @end example
  6927. @item
  6928. Crop the input video central square:
  6929. @example
  6930. crop=out_w=in_h
  6931. crop=in_h
  6932. @end example
  6933. @item
  6934. Delimit the rectangle with the top-left corner placed at position
  6935. 100:100 and the right-bottom corner corresponding to the right-bottom
  6936. corner of the input image.
  6937. @example
  6938. crop=in_w-100:in_h-100:100:100
  6939. @end example
  6940. @item
  6941. Crop 10 pixels from the left and right borders, and 20 pixels from
  6942. the top and bottom borders
  6943. @example
  6944. crop=in_w-2*10:in_h-2*20
  6945. @end example
  6946. @item
  6947. Keep only the bottom right quarter of the input image:
  6948. @example
  6949. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6950. @end example
  6951. @item
  6952. Crop height for getting Greek harmony:
  6953. @example
  6954. crop=in_w:1/PHI*in_w
  6955. @end example
  6956. @item
  6957. Apply trembling effect:
  6958. @example
  6959. 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)
  6960. @end example
  6961. @item
  6962. Apply erratic camera effect depending on timestamp:
  6963. @example
  6964. 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)"
  6965. @end example
  6966. @item
  6967. Set x depending on the value of y:
  6968. @example
  6969. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6970. @end example
  6971. @end itemize
  6972. @subsection Commands
  6973. This filter supports the following commands:
  6974. @table @option
  6975. @item w, out_w
  6976. @item h, out_h
  6977. @item x
  6978. @item y
  6979. Set width/height of the output video and the horizontal/vertical position
  6980. in the input video.
  6981. The command accepts the same syntax of the corresponding option.
  6982. If the specified expression is not valid, it is kept at its current
  6983. value.
  6984. @end table
  6985. @section cropdetect
  6986. Auto-detect the crop size.
  6987. It calculates the necessary cropping parameters and prints the
  6988. recommended parameters via the logging system. The detected dimensions
  6989. correspond to the non-black area of the input video.
  6990. It accepts the following parameters:
  6991. @table @option
  6992. @item limit
  6993. Set higher black value threshold, which can be optionally specified
  6994. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6995. value greater to the set value is considered non-black. It defaults to 24.
  6996. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6997. on the bitdepth of the pixel format.
  6998. @item round
  6999. The value which the width/height should be divisible by. It defaults to
  7000. 16. The offset is automatically adjusted to center the video. Use 2 to
  7001. get only even dimensions (needed for 4:2:2 video). 16 is best when
  7002. encoding to most video codecs.
  7003. @item skip
  7004. Set the number of initial frames for which evaluation is skipped.
  7005. Default is 2. Range is 0 to INT_MAX.
  7006. @item reset_count, reset
  7007. Set the counter that determines after how many frames cropdetect will
  7008. reset the previously detected largest video area and start over to
  7009. detect the current optimal crop area. Default value is 0.
  7010. This can be useful when channel logos distort the video area. 0
  7011. indicates 'never reset', and returns the largest area encountered during
  7012. playback.
  7013. @end table
  7014. @anchor{cue}
  7015. @section cue
  7016. Delay video filtering until a given wallclock timestamp. The filter first
  7017. passes on @option{preroll} amount of frames, then it buffers at most
  7018. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  7019. it forwards the buffered frames and also any subsequent frames coming in its
  7020. input.
  7021. The filter can be used synchronize the output of multiple ffmpeg processes for
  7022. realtime output devices like decklink. By putting the delay in the filtering
  7023. chain and pre-buffering frames the process can pass on data to output almost
  7024. immediately after the target wallclock timestamp is reached.
  7025. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  7026. some use cases.
  7027. @table @option
  7028. @item cue
  7029. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  7030. @item preroll
  7031. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  7032. @item buffer
  7033. The maximum duration of content to buffer before waiting for the cue expressed
  7034. in seconds. Default is 0.
  7035. @end table
  7036. @anchor{curves}
  7037. @section curves
  7038. Apply color adjustments using curves.
  7039. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  7040. component (red, green and blue) has its values defined by @var{N} key points
  7041. tied from each other using a smooth curve. The x-axis represents the pixel
  7042. values from the input frame, and the y-axis the new pixel values to be set for
  7043. the output frame.
  7044. By default, a component curve is defined by the two points @var{(0;0)} and
  7045. @var{(1;1)}. This creates a straight line where each original pixel value is
  7046. "adjusted" to its own value, which means no change to the image.
  7047. The filter allows you to redefine these two points and add some more. A new
  7048. curve (using a natural cubic spline interpolation) will be define to pass
  7049. smoothly through all these new coordinates. The new defined points needs to be
  7050. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  7051. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  7052. the vector spaces, the values will be clipped accordingly.
  7053. The filter accepts the following options:
  7054. @table @option
  7055. @item preset
  7056. Select one of the available color presets. This option can be used in addition
  7057. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  7058. options takes priority on the preset values.
  7059. Available presets are:
  7060. @table @samp
  7061. @item none
  7062. @item color_negative
  7063. @item cross_process
  7064. @item darker
  7065. @item increase_contrast
  7066. @item lighter
  7067. @item linear_contrast
  7068. @item medium_contrast
  7069. @item negative
  7070. @item strong_contrast
  7071. @item vintage
  7072. @end table
  7073. Default is @code{none}.
  7074. @item master, m
  7075. Set the master key points. These points will define a second pass mapping. It
  7076. is sometimes called a "luminance" or "value" mapping. It can be used with
  7077. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  7078. post-processing LUT.
  7079. @item red, r
  7080. Set the key points for the red component.
  7081. @item green, g
  7082. Set the key points for the green component.
  7083. @item blue, b
  7084. Set the key points for the blue component.
  7085. @item all
  7086. Set the key points for all components (not including master).
  7087. Can be used in addition to the other key points component
  7088. options. In this case, the unset component(s) will fallback on this
  7089. @option{all} setting.
  7090. @item psfile
  7091. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  7092. @item plot
  7093. Save Gnuplot script of the curves in specified file.
  7094. @end table
  7095. To avoid some filtergraph syntax conflicts, each key points list need to be
  7096. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  7097. @subsection Examples
  7098. @itemize
  7099. @item
  7100. Increase slightly the middle level of blue:
  7101. @example
  7102. curves=blue='0/0 0.5/0.58 1/1'
  7103. @end example
  7104. @item
  7105. Vintage effect:
  7106. @example
  7107. 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'
  7108. @end example
  7109. Here we obtain the following coordinates for each components:
  7110. @table @var
  7111. @item red
  7112. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  7113. @item green
  7114. @code{(0;0) (0.50;0.48) (1;1)}
  7115. @item blue
  7116. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  7117. @end table
  7118. @item
  7119. The previous example can also be achieved with the associated built-in preset:
  7120. @example
  7121. curves=preset=vintage
  7122. @end example
  7123. @item
  7124. Or simply:
  7125. @example
  7126. curves=vintage
  7127. @end example
  7128. @item
  7129. Use a Photoshop preset and redefine the points of the green component:
  7130. @example
  7131. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  7132. @end example
  7133. @item
  7134. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  7135. and @command{gnuplot}:
  7136. @example
  7137. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  7138. gnuplot -p /tmp/curves.plt
  7139. @end example
  7140. @end itemize
  7141. @section datascope
  7142. Video data analysis filter.
  7143. This filter shows hexadecimal pixel values of part of video.
  7144. The filter accepts the following options:
  7145. @table @option
  7146. @item size, s
  7147. Set output video size.
  7148. @item x
  7149. Set x offset from where to pick pixels.
  7150. @item y
  7151. Set y offset from where to pick pixels.
  7152. @item mode
  7153. Set scope mode, can be one of the following:
  7154. @table @samp
  7155. @item mono
  7156. Draw hexadecimal pixel values with white color on black background.
  7157. @item color
  7158. Draw hexadecimal pixel values with input video pixel color on black
  7159. background.
  7160. @item color2
  7161. Draw hexadecimal pixel values on color background picked from input video,
  7162. the text color is picked in such way so its always visible.
  7163. @end table
  7164. @item axis
  7165. Draw rows and columns numbers on left and top of video.
  7166. @item opacity
  7167. Set background opacity.
  7168. @item format
  7169. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  7170. @item components
  7171. Set pixel components to display. By default all pixel components are displayed.
  7172. @end table
  7173. @section dblur
  7174. Apply Directional blur filter.
  7175. The filter accepts the following options:
  7176. @table @option
  7177. @item angle
  7178. Set angle of directional blur. Default is @code{45}.
  7179. @item radius
  7180. Set radius of directional blur. Default is @code{5}.
  7181. @item planes
  7182. Set which planes to filter. By default all planes are filtered.
  7183. @end table
  7184. @subsection Commands
  7185. This filter supports same @ref{commands} as options.
  7186. The command accepts the same syntax of the corresponding option.
  7187. If the specified expression is not valid, it is kept at its current
  7188. value.
  7189. @section dctdnoiz
  7190. Denoise frames using 2D DCT (frequency domain filtering).
  7191. This filter is not designed for real time.
  7192. The filter accepts the following options:
  7193. @table @option
  7194. @item sigma, s
  7195. Set the noise sigma constant.
  7196. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  7197. coefficient (absolute value) below this threshold with be dropped.
  7198. If you need a more advanced filtering, see @option{expr}.
  7199. Default is @code{0}.
  7200. @item overlap
  7201. Set number overlapping pixels for each block. Since the filter can be slow, you
  7202. may want to reduce this value, at the cost of a less effective filter and the
  7203. risk of various artefacts.
  7204. If the overlapping value doesn't permit processing the whole input width or
  7205. height, a warning will be displayed and according borders won't be denoised.
  7206. Default value is @var{blocksize}-1, which is the best possible setting.
  7207. @item expr, e
  7208. Set the coefficient factor expression.
  7209. For each coefficient of a DCT block, this expression will be evaluated as a
  7210. multiplier value for the coefficient.
  7211. If this is option is set, the @option{sigma} option will be ignored.
  7212. The absolute value of the coefficient can be accessed through the @var{c}
  7213. variable.
  7214. @item n
  7215. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  7216. @var{blocksize}, which is the width and height of the processed blocks.
  7217. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  7218. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  7219. on the speed processing. Also, a larger block size does not necessarily means a
  7220. better de-noising.
  7221. @end table
  7222. @subsection Examples
  7223. Apply a denoise with a @option{sigma} of @code{4.5}:
  7224. @example
  7225. dctdnoiz=4.5
  7226. @end example
  7227. The same operation can be achieved using the expression system:
  7228. @example
  7229. dctdnoiz=e='gte(c, 4.5*3)'
  7230. @end example
  7231. Violent denoise using a block size of @code{16x16}:
  7232. @example
  7233. dctdnoiz=15:n=4
  7234. @end example
  7235. @section deband
  7236. Remove banding artifacts from input video.
  7237. It works by replacing banded pixels with average value of referenced pixels.
  7238. The filter accepts the following options:
  7239. @table @option
  7240. @item 1thr
  7241. @item 2thr
  7242. @item 3thr
  7243. @item 4thr
  7244. Set banding detection threshold for each plane. Default is 0.02.
  7245. Valid range is 0.00003 to 0.5.
  7246. If difference between current pixel and reference pixel is less than threshold,
  7247. it will be considered as banded.
  7248. @item range, r
  7249. Banding detection range in pixels. Default is 16. If positive, random number
  7250. in range 0 to set value will be used. If negative, exact absolute value
  7251. will be used.
  7252. The range defines square of four pixels around current pixel.
  7253. @item direction, d
  7254. Set direction in radians from which four pixel will be compared. If positive,
  7255. random direction from 0 to set direction will be picked. If negative, exact of
  7256. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  7257. will pick only pixels on same row and -PI/2 will pick only pixels on same
  7258. column.
  7259. @item blur, b
  7260. If enabled, current pixel is compared with average value of all four
  7261. surrounding pixels. The default is enabled. If disabled current pixel is
  7262. compared with all four surrounding pixels. The pixel is considered banded
  7263. if only all four differences with surrounding pixels are less than threshold.
  7264. @item coupling, c
  7265. If enabled, current pixel is changed if and only if all pixel components are banded,
  7266. e.g. banding detection threshold is triggered for all color components.
  7267. The default is disabled.
  7268. @end table
  7269. @section deblock
  7270. Remove blocking artifacts from input video.
  7271. The filter accepts the following options:
  7272. @table @option
  7273. @item filter
  7274. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  7275. This controls what kind of deblocking is applied.
  7276. @item block
  7277. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  7278. @item alpha
  7279. @item beta
  7280. @item gamma
  7281. @item delta
  7282. Set blocking detection thresholds. Allowed range is 0 to 1.
  7283. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  7284. Using higher threshold gives more deblocking strength.
  7285. Setting @var{alpha} controls threshold detection at exact edge of block.
  7286. Remaining options controls threshold detection near the edge. Each one for
  7287. below/above or left/right. Setting any of those to @var{0} disables
  7288. deblocking.
  7289. @item planes
  7290. Set planes to filter. Default is to filter all available planes.
  7291. @end table
  7292. @subsection Examples
  7293. @itemize
  7294. @item
  7295. Deblock using weak filter and block size of 4 pixels.
  7296. @example
  7297. deblock=filter=weak:block=4
  7298. @end example
  7299. @item
  7300. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  7301. deblocking more edges.
  7302. @example
  7303. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  7304. @end example
  7305. @item
  7306. Similar as above, but filter only first plane.
  7307. @example
  7308. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  7309. @end example
  7310. @item
  7311. Similar as above, but filter only second and third plane.
  7312. @example
  7313. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  7314. @end example
  7315. @end itemize
  7316. @anchor{decimate}
  7317. @section decimate
  7318. Drop duplicated frames at regular intervals.
  7319. The filter accepts the following options:
  7320. @table @option
  7321. @item cycle
  7322. Set the number of frames from which one will be dropped. Setting this to
  7323. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  7324. Default is @code{5}.
  7325. @item dupthresh
  7326. Set the threshold for duplicate detection. If the difference metric for a frame
  7327. is less than or equal to this value, then it is declared as duplicate. Default
  7328. is @code{1.1}
  7329. @item scthresh
  7330. Set scene change threshold. Default is @code{15}.
  7331. @item blockx
  7332. @item blocky
  7333. Set the size of the x and y-axis blocks used during metric calculations.
  7334. Larger blocks give better noise suppression, but also give worse detection of
  7335. small movements. Must be a power of two. Default is @code{32}.
  7336. @item ppsrc
  7337. Mark main input as a pre-processed input and activate clean source input
  7338. stream. This allows the input to be pre-processed with various filters to help
  7339. the metrics calculation while keeping the frame selection lossless. When set to
  7340. @code{1}, the first stream is for the pre-processed input, and the second
  7341. stream is the clean source from where the kept frames are chosen. Default is
  7342. @code{0}.
  7343. @item chroma
  7344. Set whether or not chroma is considered in the metric calculations. Default is
  7345. @code{1}.
  7346. @end table
  7347. @section deconvolve
  7348. Apply 2D deconvolution of video stream in frequency domain using second stream
  7349. as impulse.
  7350. The filter accepts the following options:
  7351. @table @option
  7352. @item planes
  7353. Set which planes to process.
  7354. @item impulse
  7355. Set which impulse video frames will be processed, can be @var{first}
  7356. or @var{all}. Default is @var{all}.
  7357. @item noise
  7358. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  7359. and height are not same and not power of 2 or if stream prior to convolving
  7360. had noise.
  7361. @end table
  7362. The @code{deconvolve} filter also supports the @ref{framesync} options.
  7363. @section dedot
  7364. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  7365. It accepts the following options:
  7366. @table @option
  7367. @item m
  7368. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  7369. @var{rainbows} for cross-color reduction.
  7370. @item lt
  7371. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  7372. @item tl
  7373. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  7374. @item tc
  7375. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  7376. @item ct
  7377. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7378. @end table
  7379. @section deflate
  7380. Apply deflate effect to the video.
  7381. This filter replaces the pixel by the local(3x3) average by taking into account
  7382. only values lower than the pixel.
  7383. It accepts the following options:
  7384. @table @option
  7385. @item threshold0
  7386. @item threshold1
  7387. @item threshold2
  7388. @item threshold3
  7389. Limit the maximum change for each plane, default is 65535.
  7390. If 0, plane will remain unchanged.
  7391. @end table
  7392. @subsection Commands
  7393. This filter supports the all above options as @ref{commands}.
  7394. @section deflicker
  7395. Remove temporal frame luminance variations.
  7396. It accepts the following options:
  7397. @table @option
  7398. @item size, s
  7399. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7400. @item mode, m
  7401. Set averaging mode to smooth temporal luminance variations.
  7402. Available values are:
  7403. @table @samp
  7404. @item am
  7405. Arithmetic mean
  7406. @item gm
  7407. Geometric mean
  7408. @item hm
  7409. Harmonic mean
  7410. @item qm
  7411. Quadratic mean
  7412. @item cm
  7413. Cubic mean
  7414. @item pm
  7415. Power mean
  7416. @item median
  7417. Median
  7418. @end table
  7419. @item bypass
  7420. Do not actually modify frame. Useful when one only wants metadata.
  7421. @end table
  7422. @section dejudder
  7423. Remove judder produced by partially interlaced telecined content.
  7424. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7425. source was partially telecined content then the output of @code{pullup,dejudder}
  7426. will have a variable frame rate. May change the recorded frame rate of the
  7427. container. Aside from that change, this filter will not affect constant frame
  7428. rate video.
  7429. The option available in this filter is:
  7430. @table @option
  7431. @item cycle
  7432. Specify the length of the window over which the judder repeats.
  7433. Accepts any integer greater than 1. Useful values are:
  7434. @table @samp
  7435. @item 4
  7436. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7437. @item 5
  7438. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7439. @item 20
  7440. If a mixture of the two.
  7441. @end table
  7442. The default is @samp{4}.
  7443. @end table
  7444. @section delogo
  7445. Suppress a TV station logo by a simple interpolation of the surrounding
  7446. pixels. Just set a rectangle covering the logo and watch it disappear
  7447. (and sometimes something even uglier appear - your mileage may vary).
  7448. It accepts the following parameters:
  7449. @table @option
  7450. @item x
  7451. @item y
  7452. Specify the top left corner coordinates of the logo. They must be
  7453. specified.
  7454. @item w
  7455. @item h
  7456. Specify the width and height of the logo to clear. They must be
  7457. specified.
  7458. @item band, t
  7459. Specify the thickness of the fuzzy edge of the rectangle (added to
  7460. @var{w} and @var{h}). The default value is 1. This option is
  7461. deprecated, setting higher values should no longer be necessary and
  7462. is not recommended.
  7463. @item show
  7464. When set to 1, a green rectangle is drawn on the screen to simplify
  7465. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7466. The default value is 0.
  7467. The rectangle is drawn on the outermost pixels which will be (partly)
  7468. replaced with interpolated values. The values of the next pixels
  7469. immediately outside this rectangle in each direction will be used to
  7470. compute the interpolated pixel values inside the rectangle.
  7471. @end table
  7472. @subsection Examples
  7473. @itemize
  7474. @item
  7475. Set a rectangle covering the area with top left corner coordinates 0,0
  7476. and size 100x77, and a band of size 10:
  7477. @example
  7478. delogo=x=0:y=0:w=100:h=77:band=10
  7479. @end example
  7480. @end itemize
  7481. @anchor{derain}
  7482. @section derain
  7483. Remove the rain in the input image/video by applying the derain methods based on
  7484. convolutional neural networks. Supported models:
  7485. @itemize
  7486. @item
  7487. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7488. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7489. @end itemize
  7490. Training as well as model generation scripts are provided in
  7491. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7492. Native model files (.model) can be generated from TensorFlow model
  7493. files (.pb) by using tools/python/convert.py
  7494. The filter accepts the following options:
  7495. @table @option
  7496. @item filter_type
  7497. Specify which filter to use. This option accepts the following values:
  7498. @table @samp
  7499. @item derain
  7500. Derain filter. To conduct derain filter, you need to use a derain model.
  7501. @item dehaze
  7502. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7503. @end table
  7504. Default value is @samp{derain}.
  7505. @item dnn_backend
  7506. Specify which DNN backend to use for model loading and execution. This option accepts
  7507. the following values:
  7508. @table @samp
  7509. @item native
  7510. Native implementation of DNN loading and execution.
  7511. @item tensorflow
  7512. TensorFlow backend. To enable this backend you
  7513. need to install the TensorFlow for C library (see
  7514. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7515. @code{--enable-libtensorflow}
  7516. @end table
  7517. Default value is @samp{native}.
  7518. @item model
  7519. Set path to model file specifying network architecture and its parameters.
  7520. Note that different backends use different file formats. TensorFlow and native
  7521. backend can load files for only its format.
  7522. @end table
  7523. It can also be finished with @ref{dnn_processing} filter.
  7524. @section deshake
  7525. Attempt to fix small changes in horizontal and/or vertical shift. This
  7526. filter helps remove camera shake from hand-holding a camera, bumping a
  7527. tripod, moving on a vehicle, etc.
  7528. The filter accepts the following options:
  7529. @table @option
  7530. @item x
  7531. @item y
  7532. @item w
  7533. @item h
  7534. Specify a rectangular area where to limit the search for motion
  7535. vectors.
  7536. If desired the search for motion vectors can be limited to a
  7537. rectangular area of the frame defined by its top left corner, width
  7538. and height. These parameters have the same meaning as the drawbox
  7539. filter which can be used to visualise the position of the bounding
  7540. box.
  7541. This is useful when simultaneous movement of subjects within the frame
  7542. might be confused for camera motion by the motion vector search.
  7543. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7544. then the full frame is used. This allows later options to be set
  7545. without specifying the bounding box for the motion vector search.
  7546. Default - search the whole frame.
  7547. @item rx
  7548. @item ry
  7549. Specify the maximum extent of movement in x and y directions in the
  7550. range 0-64 pixels. Default 16.
  7551. @item edge
  7552. Specify how to generate pixels to fill blanks at the edge of the
  7553. frame. Available values are:
  7554. @table @samp
  7555. @item blank, 0
  7556. Fill zeroes at blank locations
  7557. @item original, 1
  7558. Original image at blank locations
  7559. @item clamp, 2
  7560. Extruded edge value at blank locations
  7561. @item mirror, 3
  7562. Mirrored edge at blank locations
  7563. @end table
  7564. Default value is @samp{mirror}.
  7565. @item blocksize
  7566. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7567. default 8.
  7568. @item contrast
  7569. Specify the contrast threshold for blocks. Only blocks with more than
  7570. the specified contrast (difference between darkest and lightest
  7571. pixels) will be considered. Range 1-255, default 125.
  7572. @item search
  7573. Specify the search strategy. Available values are:
  7574. @table @samp
  7575. @item exhaustive, 0
  7576. Set exhaustive search
  7577. @item less, 1
  7578. Set less exhaustive search.
  7579. @end table
  7580. Default value is @samp{exhaustive}.
  7581. @item filename
  7582. If set then a detailed log of the motion search is written to the
  7583. specified file.
  7584. @end table
  7585. @section despill
  7586. Remove unwanted contamination of foreground colors, caused by reflected color of
  7587. greenscreen or bluescreen.
  7588. This filter accepts the following options:
  7589. @table @option
  7590. @item type
  7591. Set what type of despill to use.
  7592. @item mix
  7593. Set how spillmap will be generated.
  7594. @item expand
  7595. Set how much to get rid of still remaining spill.
  7596. @item red
  7597. Controls amount of red in spill area.
  7598. @item green
  7599. Controls amount of green in spill area.
  7600. Should be -1 for greenscreen.
  7601. @item blue
  7602. Controls amount of blue in spill area.
  7603. Should be -1 for bluescreen.
  7604. @item brightness
  7605. Controls brightness of spill area, preserving colors.
  7606. @item alpha
  7607. Modify alpha from generated spillmap.
  7608. @end table
  7609. @subsection Commands
  7610. This filter supports the all above options as @ref{commands}.
  7611. @section detelecine
  7612. Apply an exact inverse of the telecine operation. It requires a predefined
  7613. pattern specified using the pattern option which must be the same as that passed
  7614. to the telecine filter.
  7615. This filter accepts the following options:
  7616. @table @option
  7617. @item first_field
  7618. @table @samp
  7619. @item top, t
  7620. top field first
  7621. @item bottom, b
  7622. bottom field first
  7623. The default value is @code{top}.
  7624. @end table
  7625. @item pattern
  7626. A string of numbers representing the pulldown pattern you wish to apply.
  7627. The default value is @code{23}.
  7628. @item start_frame
  7629. A number representing position of the first frame with respect to the telecine
  7630. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7631. @end table
  7632. @section dilation
  7633. Apply dilation effect to the video.
  7634. This filter replaces the pixel by the local(3x3) maximum.
  7635. It accepts the following options:
  7636. @table @option
  7637. @item threshold0
  7638. @item threshold1
  7639. @item threshold2
  7640. @item threshold3
  7641. Limit the maximum change for each plane, default is 65535.
  7642. If 0, plane will remain unchanged.
  7643. @item coordinates
  7644. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7645. pixels are used.
  7646. Flags to local 3x3 coordinates maps like this:
  7647. 1 2 3
  7648. 4 5
  7649. 6 7 8
  7650. @end table
  7651. @subsection Commands
  7652. This filter supports the all above options as @ref{commands}.
  7653. @section displace
  7654. Displace pixels as indicated by second and third input stream.
  7655. It takes three input streams and outputs one stream, the first input is the
  7656. source, and second and third input are displacement maps.
  7657. The second input specifies how much to displace pixels along the
  7658. x-axis, while the third input specifies how much to displace pixels
  7659. along the y-axis.
  7660. If one of displacement map streams terminates, last frame from that
  7661. displacement map will be used.
  7662. Note that once generated, displacements maps can be reused over and over again.
  7663. A description of the accepted options follows.
  7664. @table @option
  7665. @item edge
  7666. Set displace behavior for pixels that are out of range.
  7667. Available values are:
  7668. @table @samp
  7669. @item blank
  7670. Missing pixels are replaced by black pixels.
  7671. @item smear
  7672. Adjacent pixels will spread out to replace missing pixels.
  7673. @item wrap
  7674. Out of range pixels are wrapped so they point to pixels of other side.
  7675. @item mirror
  7676. Out of range pixels will be replaced with mirrored pixels.
  7677. @end table
  7678. Default is @samp{smear}.
  7679. @end table
  7680. @subsection Examples
  7681. @itemize
  7682. @item
  7683. Add ripple effect to rgb input of video size hd720:
  7684. @example
  7685. 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
  7686. @end example
  7687. @item
  7688. Add wave effect to rgb input of video size hd720:
  7689. @example
  7690. 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
  7691. @end example
  7692. @end itemize
  7693. @anchor{dnn_processing}
  7694. @section dnn_processing
  7695. Do image processing with deep neural networks. It works together with another filter
  7696. which converts the pixel format of the Frame to what the dnn network requires.
  7697. The filter accepts the following options:
  7698. @table @option
  7699. @item dnn_backend
  7700. Specify which DNN backend to use for model loading and execution. This option accepts
  7701. the following values:
  7702. @table @samp
  7703. @item native
  7704. Native implementation of DNN loading and execution.
  7705. @item tensorflow
  7706. TensorFlow backend. To enable this backend you
  7707. need to install the TensorFlow for C library (see
  7708. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7709. @code{--enable-libtensorflow}
  7710. @item openvino
  7711. OpenVINO backend. To enable this backend you
  7712. need to build and install the OpenVINO for C library (see
  7713. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7714. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7715. be needed if the header files and libraries are not installed into system path)
  7716. @end table
  7717. Default value is @samp{native}.
  7718. @item model
  7719. Set path to model file specifying network architecture and its parameters.
  7720. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7721. backend can load files for only its format.
  7722. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7723. @item input
  7724. Set the input name of the dnn network.
  7725. @item output
  7726. Set the output name of the dnn network.
  7727. @item async
  7728. use DNN async execution if set (default: set),
  7729. roll back to sync execution if the backend does not support async.
  7730. @end table
  7731. @subsection Examples
  7732. @itemize
  7733. @item
  7734. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7735. @example
  7736. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7737. @end example
  7738. @item
  7739. Halve the pixel value of the frame with format gray32f:
  7740. @example
  7741. 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
  7742. @end example
  7743. @item
  7744. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7745. @example
  7746. ./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
  7747. @end example
  7748. @item
  7749. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7750. @example
  7751. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7752. @end example
  7753. @end itemize
  7754. @section drawbox
  7755. Draw a colored box on the input image.
  7756. It accepts the following parameters:
  7757. @table @option
  7758. @item x
  7759. @item y
  7760. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7761. @item width, w
  7762. @item height, h
  7763. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7764. the input width and height. It defaults to 0.
  7765. @item color, c
  7766. Specify the color of the box to write. For the general syntax of this option,
  7767. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7768. value @code{invert} is used, the box edge color is the same as the
  7769. video with inverted luma.
  7770. @item thickness, t
  7771. The expression which sets the thickness of the box edge.
  7772. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7773. See below for the list of accepted constants.
  7774. @item replace
  7775. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7776. will overwrite the video's color and alpha pixels.
  7777. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7778. @end table
  7779. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7780. following constants:
  7781. @table @option
  7782. @item dar
  7783. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7784. @item hsub
  7785. @item vsub
  7786. horizontal and vertical chroma subsample values. For example for the
  7787. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7788. @item in_h, ih
  7789. @item in_w, iw
  7790. The input width and height.
  7791. @item sar
  7792. The input sample aspect ratio.
  7793. @item x
  7794. @item y
  7795. The x and y offset coordinates where the box is drawn.
  7796. @item w
  7797. @item h
  7798. The width and height of the drawn box.
  7799. @item t
  7800. The thickness of the drawn box.
  7801. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7802. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7803. @end table
  7804. @subsection Examples
  7805. @itemize
  7806. @item
  7807. Draw a black box around the edge of the input image:
  7808. @example
  7809. drawbox
  7810. @end example
  7811. @item
  7812. Draw a box with color red and an opacity of 50%:
  7813. @example
  7814. drawbox=10:20:200:60:red@@0.5
  7815. @end example
  7816. The previous example can be specified as:
  7817. @example
  7818. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7819. @end example
  7820. @item
  7821. Fill the box with pink color:
  7822. @example
  7823. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7824. @end example
  7825. @item
  7826. Draw a 2-pixel red 2.40:1 mask:
  7827. @example
  7828. 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
  7829. @end example
  7830. @end itemize
  7831. @subsection Commands
  7832. This filter supports same commands as options.
  7833. The command accepts the same syntax of the corresponding option.
  7834. If the specified expression is not valid, it is kept at its current
  7835. value.
  7836. @anchor{drawgraph}
  7837. @section drawgraph
  7838. Draw a graph using input video metadata.
  7839. It accepts the following parameters:
  7840. @table @option
  7841. @item m1
  7842. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7843. @item fg1
  7844. Set 1st foreground color expression.
  7845. @item m2
  7846. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7847. @item fg2
  7848. Set 2nd foreground color expression.
  7849. @item m3
  7850. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7851. @item fg3
  7852. Set 3rd foreground color expression.
  7853. @item m4
  7854. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7855. @item fg4
  7856. Set 4th foreground color expression.
  7857. @item min
  7858. Set minimal value of metadata value.
  7859. @item max
  7860. Set maximal value of metadata value.
  7861. @item bg
  7862. Set graph background color. Default is white.
  7863. @item mode
  7864. Set graph mode.
  7865. Available values for mode is:
  7866. @table @samp
  7867. @item bar
  7868. @item dot
  7869. @item line
  7870. @end table
  7871. Default is @code{line}.
  7872. @item slide
  7873. Set slide mode.
  7874. Available values for slide is:
  7875. @table @samp
  7876. @item frame
  7877. Draw new frame when right border is reached.
  7878. @item replace
  7879. Replace old columns with new ones.
  7880. @item scroll
  7881. Scroll from right to left.
  7882. @item rscroll
  7883. Scroll from left to right.
  7884. @item picture
  7885. Draw single picture.
  7886. @end table
  7887. Default is @code{frame}.
  7888. @item size
  7889. Set size of graph video. For the syntax of this option, check the
  7890. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7891. The default value is @code{900x256}.
  7892. @item rate, r
  7893. Set the output frame rate. Default value is @code{25}.
  7894. The foreground color expressions can use the following variables:
  7895. @table @option
  7896. @item MIN
  7897. Minimal value of metadata value.
  7898. @item MAX
  7899. Maximal value of metadata value.
  7900. @item VAL
  7901. Current metadata key value.
  7902. @end table
  7903. The color is defined as 0xAABBGGRR.
  7904. @end table
  7905. Example using metadata from @ref{signalstats} filter:
  7906. @example
  7907. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7908. @end example
  7909. Example using metadata from @ref{ebur128} filter:
  7910. @example
  7911. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7912. @end example
  7913. @section drawgrid
  7914. Draw a grid on the input image.
  7915. It accepts the following parameters:
  7916. @table @option
  7917. @item x
  7918. @item y
  7919. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7920. @item width, w
  7921. @item height, h
  7922. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7923. input width and height, respectively, minus @code{thickness}, so image gets
  7924. framed. Default to 0.
  7925. @item color, c
  7926. Specify the color of the grid. For the general syntax of this option,
  7927. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7928. value @code{invert} is used, the grid color is the same as the
  7929. video with inverted luma.
  7930. @item thickness, t
  7931. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7932. See below for the list of accepted constants.
  7933. @item replace
  7934. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7935. will overwrite the video's color and alpha pixels.
  7936. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7937. @end table
  7938. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7939. following constants:
  7940. @table @option
  7941. @item dar
  7942. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7943. @item hsub
  7944. @item vsub
  7945. horizontal and vertical chroma subsample values. For example for the
  7946. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7947. @item in_h, ih
  7948. @item in_w, iw
  7949. The input grid cell width and height.
  7950. @item sar
  7951. The input sample aspect ratio.
  7952. @item x
  7953. @item y
  7954. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7955. @item w
  7956. @item h
  7957. The width and height of the drawn cell.
  7958. @item t
  7959. The thickness of the drawn cell.
  7960. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7961. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7962. @end table
  7963. @subsection Examples
  7964. @itemize
  7965. @item
  7966. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7967. @example
  7968. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7969. @end example
  7970. @item
  7971. Draw a white 3x3 grid with an opacity of 50%:
  7972. @example
  7973. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7974. @end example
  7975. @end itemize
  7976. @subsection Commands
  7977. This filter supports same commands as options.
  7978. The command accepts the same syntax of the corresponding option.
  7979. If the specified expression is not valid, it is kept at its current
  7980. value.
  7981. @anchor{drawtext}
  7982. @section drawtext
  7983. Draw a text string or text from a specified file on top of a video, using the
  7984. libfreetype library.
  7985. To enable compilation of this filter, you need to configure FFmpeg with
  7986. @code{--enable-libfreetype}.
  7987. To enable default font fallback and the @var{font} option you need to
  7988. configure FFmpeg with @code{--enable-libfontconfig}.
  7989. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7990. @code{--enable-libfribidi}.
  7991. @subsection Syntax
  7992. It accepts the following parameters:
  7993. @table @option
  7994. @item box
  7995. Used to draw a box around text using the background color.
  7996. The value must be either 1 (enable) or 0 (disable).
  7997. The default value of @var{box} is 0.
  7998. @item boxborderw
  7999. Set the width of the border to be drawn around the box using @var{boxcolor}.
  8000. The default value of @var{boxborderw} is 0.
  8001. @item boxcolor
  8002. The color to be used for drawing box around text. For the syntax of this
  8003. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8004. The default value of @var{boxcolor} is "white".
  8005. @item line_spacing
  8006. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  8007. The default value of @var{line_spacing} is 0.
  8008. @item borderw
  8009. Set the width of the border to be drawn around the text using @var{bordercolor}.
  8010. The default value of @var{borderw} is 0.
  8011. @item bordercolor
  8012. Set the color to be used for drawing border around text. For the syntax of this
  8013. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8014. The default value of @var{bordercolor} is "black".
  8015. @item expansion
  8016. Select how the @var{text} is expanded. Can be either @code{none},
  8017. @code{strftime} (deprecated) or
  8018. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  8019. below for details.
  8020. @item basetime
  8021. Set a start time for the count. Value is in microseconds. Only applied
  8022. in the deprecated strftime expansion mode. To emulate in normal expansion
  8023. mode use the @code{pts} function, supplying the start time (in seconds)
  8024. as the second argument.
  8025. @item fix_bounds
  8026. If true, check and fix text coords to avoid clipping.
  8027. @item fontcolor
  8028. The color to be used for drawing fonts. For the syntax of this option, check
  8029. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8030. The default value of @var{fontcolor} is "black".
  8031. @item fontcolor_expr
  8032. String which is expanded the same way as @var{text} to obtain dynamic
  8033. @var{fontcolor} value. By default this option has empty value and is not
  8034. processed. When this option is set, it overrides @var{fontcolor} option.
  8035. @item font
  8036. The font family to be used for drawing text. By default Sans.
  8037. @item fontfile
  8038. The font file to be used for drawing text. The path must be included.
  8039. This parameter is mandatory if the fontconfig support is disabled.
  8040. @item alpha
  8041. Draw the text applying alpha blending. The value can
  8042. be a number between 0.0 and 1.0.
  8043. The expression accepts the same variables @var{x, y} as well.
  8044. The default value is 1.
  8045. Please see @var{fontcolor_expr}.
  8046. @item fontsize
  8047. The font size to be used for drawing text.
  8048. The default value of @var{fontsize} is 16.
  8049. @item text_shaping
  8050. If set to 1, attempt to shape the text (for example, reverse the order of
  8051. right-to-left text and join Arabic characters) before drawing it.
  8052. Otherwise, just draw the text exactly as given.
  8053. By default 1 (if supported).
  8054. @item ft_load_flags
  8055. The flags to be used for loading the fonts.
  8056. The flags map the corresponding flags supported by libfreetype, and are
  8057. a combination of the following values:
  8058. @table @var
  8059. @item default
  8060. @item no_scale
  8061. @item no_hinting
  8062. @item render
  8063. @item no_bitmap
  8064. @item vertical_layout
  8065. @item force_autohint
  8066. @item crop_bitmap
  8067. @item pedantic
  8068. @item ignore_global_advance_width
  8069. @item no_recurse
  8070. @item ignore_transform
  8071. @item monochrome
  8072. @item linear_design
  8073. @item no_autohint
  8074. @end table
  8075. Default value is "default".
  8076. For more information consult the documentation for the FT_LOAD_*
  8077. libfreetype flags.
  8078. @item shadowcolor
  8079. The color to be used for drawing a shadow behind the drawn text. For the
  8080. syntax of this option, check the @ref{color syntax,,"Color" section in the
  8081. ffmpeg-utils manual,ffmpeg-utils}.
  8082. The default value of @var{shadowcolor} is "black".
  8083. @item shadowx
  8084. @item shadowy
  8085. The x and y offsets for the text shadow position with respect to the
  8086. position of the text. They can be either positive or negative
  8087. values. The default value for both is "0".
  8088. @item start_number
  8089. The starting frame number for the n/frame_num variable. The default value
  8090. is "0".
  8091. @item tabsize
  8092. The size in number of spaces to use for rendering the tab.
  8093. Default value is 4.
  8094. @item timecode
  8095. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  8096. format. It can be used with or without text parameter. @var{timecode_rate}
  8097. option must be specified.
  8098. @item timecode_rate, rate, r
  8099. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  8100. integer. Minimum value is "1".
  8101. Drop-frame timecode is supported for frame rates 30 & 60.
  8102. @item tc24hmax
  8103. If set to 1, the output of the timecode option will wrap around at 24 hours.
  8104. Default is 0 (disabled).
  8105. @item text
  8106. The text string to be drawn. The text must be a sequence of UTF-8
  8107. encoded characters.
  8108. This parameter is mandatory if no file is specified with the parameter
  8109. @var{textfile}.
  8110. @item textfile
  8111. A text file containing text to be drawn. The text must be a sequence
  8112. of UTF-8 encoded characters.
  8113. This parameter is mandatory if no text string is specified with the
  8114. parameter @var{text}.
  8115. If both @var{text} and @var{textfile} are specified, an error is thrown.
  8116. @item reload
  8117. If set to 1, the @var{textfile} will be reloaded before each frame.
  8118. Be sure to update it atomically, or it may be read partially, or even fail.
  8119. @item x
  8120. @item y
  8121. The expressions which specify the offsets where text will be drawn
  8122. within the video frame. They are relative to the top/left border of the
  8123. output image.
  8124. The default value of @var{x} and @var{y} is "0".
  8125. See below for the list of accepted constants and functions.
  8126. @end table
  8127. The parameters for @var{x} and @var{y} are expressions containing the
  8128. following constants and functions:
  8129. @table @option
  8130. @item dar
  8131. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  8132. @item hsub
  8133. @item vsub
  8134. horizontal and vertical chroma subsample values. For example for the
  8135. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8136. @item line_h, lh
  8137. the height of each text line
  8138. @item main_h, h, H
  8139. the input height
  8140. @item main_w, w, W
  8141. the input width
  8142. @item max_glyph_a, ascent
  8143. the maximum distance from the baseline to the highest/upper grid
  8144. coordinate used to place a glyph outline point, for all the rendered
  8145. glyphs.
  8146. It is a positive value, due to the grid's orientation with the Y axis
  8147. upwards.
  8148. @item max_glyph_d, descent
  8149. the maximum distance from the baseline to the lowest grid coordinate
  8150. used to place a glyph outline point, for all the rendered glyphs.
  8151. This is a negative value, due to the grid's orientation, with the Y axis
  8152. upwards.
  8153. @item max_glyph_h
  8154. maximum glyph height, that is the maximum height for all the glyphs
  8155. contained in the rendered text, it is equivalent to @var{ascent} -
  8156. @var{descent}.
  8157. @item max_glyph_w
  8158. maximum glyph width, that is the maximum width for all the glyphs
  8159. contained in the rendered text
  8160. @item n
  8161. the number of input frame, starting from 0
  8162. @item rand(min, max)
  8163. return a random number included between @var{min} and @var{max}
  8164. @item sar
  8165. The input sample aspect ratio.
  8166. @item t
  8167. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8168. @item text_h, th
  8169. the height of the rendered text
  8170. @item text_w, tw
  8171. the width of the rendered text
  8172. @item x
  8173. @item y
  8174. the x and y offset coordinates where the text is drawn.
  8175. These parameters allow the @var{x} and @var{y} expressions to refer
  8176. to each other, so you can for example specify @code{y=x/dar}.
  8177. @item pict_type
  8178. A one character description of the current frame's picture type.
  8179. @item pkt_pos
  8180. The current packet's position in the input file or stream
  8181. (in bytes, from the start of the input). A value of -1 indicates
  8182. this info is not available.
  8183. @item pkt_duration
  8184. The current packet's duration, in seconds.
  8185. @item pkt_size
  8186. The current packet's size (in bytes).
  8187. @end table
  8188. @anchor{drawtext_expansion}
  8189. @subsection Text expansion
  8190. If @option{expansion} is set to @code{strftime},
  8191. the filter recognizes strftime() sequences in the provided text and
  8192. expands them accordingly. Check the documentation of strftime(). This
  8193. feature is deprecated.
  8194. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  8195. If @option{expansion} is set to @code{normal} (which is the default),
  8196. the following expansion mechanism is used.
  8197. The backslash character @samp{\}, followed by any character, always expands to
  8198. the second character.
  8199. Sequences of the form @code{%@{...@}} are expanded. The text between the
  8200. braces is a function name, possibly followed by arguments separated by ':'.
  8201. If the arguments contain special characters or delimiters (':' or '@}'),
  8202. they should be escaped.
  8203. Note that they probably must also be escaped as the value for the
  8204. @option{text} option in the filter argument string and as the filter
  8205. argument in the filtergraph description, and possibly also for the shell,
  8206. that makes up to four levels of escaping; using a text file avoids these
  8207. problems.
  8208. The following functions are available:
  8209. @table @command
  8210. @item expr, e
  8211. The expression evaluation result.
  8212. It must take one argument specifying the expression to be evaluated,
  8213. which accepts the same constants and functions as the @var{x} and
  8214. @var{y} values. Note that not all constants should be used, for
  8215. example the text size is not known when evaluating the expression, so
  8216. the constants @var{text_w} and @var{text_h} will have an undefined
  8217. value.
  8218. @item expr_int_format, eif
  8219. Evaluate the expression's value and output as formatted integer.
  8220. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  8221. The second argument specifies the output format. Allowed values are @samp{x},
  8222. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  8223. @code{printf} function.
  8224. The third parameter is optional and sets the number of positions taken by the output.
  8225. It can be used to add padding with zeros from the left.
  8226. @item gmtime
  8227. The time at which the filter is running, expressed in UTC.
  8228. It can accept an argument: a strftime() format string.
  8229. @item localtime
  8230. The time at which the filter is running, expressed in the local time zone.
  8231. It can accept an argument: a strftime() format string.
  8232. @item metadata
  8233. Frame metadata. Takes one or two arguments.
  8234. The first argument is mandatory and specifies the metadata key.
  8235. The second argument is optional and specifies a default value, used when the
  8236. metadata key is not found or empty.
  8237. Available metadata can be identified by inspecting entries
  8238. starting with TAG included within each frame section
  8239. printed by running @code{ffprobe -show_frames}.
  8240. String metadata generated in filters leading to
  8241. the drawtext filter are also available.
  8242. @item n, frame_num
  8243. The frame number, starting from 0.
  8244. @item pict_type
  8245. A one character description of the current picture type.
  8246. @item pts
  8247. The timestamp of the current frame.
  8248. It can take up to three arguments.
  8249. The first argument is the format of the timestamp; it defaults to @code{flt}
  8250. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  8251. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  8252. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  8253. @code{localtime} stands for the timestamp of the frame formatted as
  8254. local time zone time.
  8255. The second argument is an offset added to the timestamp.
  8256. If the format is set to @code{hms}, a third argument @code{24HH} may be
  8257. supplied to present the hour part of the formatted timestamp in 24h format
  8258. (00-23).
  8259. If the format is set to @code{localtime} or @code{gmtime},
  8260. a third argument may be supplied: a strftime() format string.
  8261. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  8262. @end table
  8263. @subsection Commands
  8264. This filter supports altering parameters via commands:
  8265. @table @option
  8266. @item reinit
  8267. Alter existing filter parameters.
  8268. Syntax for the argument is the same as for filter invocation, e.g.
  8269. @example
  8270. fontsize=56:fontcolor=green:text='Hello World'
  8271. @end example
  8272. Full filter invocation with sendcmd would look like this:
  8273. @example
  8274. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  8275. @end example
  8276. @end table
  8277. If the entire argument can't be parsed or applied as valid values then the filter will
  8278. continue with its existing parameters.
  8279. @subsection Examples
  8280. @itemize
  8281. @item
  8282. Draw "Test Text" with font FreeSerif, using the default values for the
  8283. optional parameters.
  8284. @example
  8285. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  8286. @end example
  8287. @item
  8288. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  8289. and y=50 (counting from the top-left corner of the screen), text is
  8290. yellow with a red box around it. Both the text and the box have an
  8291. opacity of 20%.
  8292. @example
  8293. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  8294. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  8295. @end example
  8296. Note that the double quotes are not necessary if spaces are not used
  8297. within the parameter list.
  8298. @item
  8299. Show the text at the center of the video frame:
  8300. @example
  8301. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  8302. @end example
  8303. @item
  8304. Show the text at a random position, switching to a new position every 30 seconds:
  8305. @example
  8306. 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)"
  8307. @end example
  8308. @item
  8309. Show a text line sliding from right to left in the last row of the video
  8310. frame. The file @file{LONG_LINE} is assumed to contain a single line
  8311. with no newlines.
  8312. @example
  8313. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  8314. @end example
  8315. @item
  8316. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  8317. @example
  8318. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  8319. @end example
  8320. @item
  8321. Draw a single green letter "g", at the center of the input video.
  8322. The glyph baseline is placed at half screen height.
  8323. @example
  8324. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  8325. @end example
  8326. @item
  8327. Show text for 1 second every 3 seconds:
  8328. @example
  8329. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  8330. @end example
  8331. @item
  8332. Use fontconfig to set the font. Note that the colons need to be escaped.
  8333. @example
  8334. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  8335. @end example
  8336. @item
  8337. Draw "Test Text" with font size dependent on height of the video.
  8338. @example
  8339. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  8340. @end example
  8341. @item
  8342. Print the date of a real-time encoding (see strftime(3)):
  8343. @example
  8344. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  8345. @end example
  8346. @item
  8347. Show text fading in and out (appearing/disappearing):
  8348. @example
  8349. #!/bin/sh
  8350. DS=1.0 # display start
  8351. DE=10.0 # display end
  8352. FID=1.5 # fade in duration
  8353. FOD=5 # fade out duration
  8354. 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 @}"
  8355. @end example
  8356. @item
  8357. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  8358. and the @option{fontsize} value are included in the @option{y} offset.
  8359. @example
  8360. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  8361. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  8362. @end example
  8363. @item
  8364. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  8365. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  8366. must have option @option{-export_path_metadata 1} for the special metadata fields
  8367. to be available for filters.
  8368. @example
  8369. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  8370. @end example
  8371. @end itemize
  8372. For more information about libfreetype, check:
  8373. @url{http://www.freetype.org/}.
  8374. For more information about fontconfig, check:
  8375. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  8376. For more information about libfribidi, check:
  8377. @url{http://fribidi.org/}.
  8378. @section edgedetect
  8379. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  8380. The filter accepts the following options:
  8381. @table @option
  8382. @item low
  8383. @item high
  8384. Set low and high threshold values used by the Canny thresholding
  8385. algorithm.
  8386. The high threshold selects the "strong" edge pixels, which are then
  8387. connected through 8-connectivity with the "weak" edge pixels selected
  8388. by the low threshold.
  8389. @var{low} and @var{high} threshold values must be chosen in the range
  8390. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8391. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8392. is @code{50/255}.
  8393. @item mode
  8394. Define the drawing mode.
  8395. @table @samp
  8396. @item wires
  8397. Draw white/gray wires on black background.
  8398. @item colormix
  8399. Mix the colors to create a paint/cartoon effect.
  8400. @item canny
  8401. Apply Canny edge detector on all selected planes.
  8402. @end table
  8403. Default value is @var{wires}.
  8404. @item planes
  8405. Select planes for filtering. By default all available planes are filtered.
  8406. @end table
  8407. @subsection Examples
  8408. @itemize
  8409. @item
  8410. Standard edge detection with custom values for the hysteresis thresholding:
  8411. @example
  8412. edgedetect=low=0.1:high=0.4
  8413. @end example
  8414. @item
  8415. Painting effect without thresholding:
  8416. @example
  8417. edgedetect=mode=colormix:high=0
  8418. @end example
  8419. @end itemize
  8420. @section elbg
  8421. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8422. For each input image, the filter will compute the optimal mapping from
  8423. the input to the output given the codebook length, that is the number
  8424. of distinct output colors.
  8425. This filter accepts the following options.
  8426. @table @option
  8427. @item codebook_length, l
  8428. Set codebook length. The value must be a positive integer, and
  8429. represents the number of distinct output colors. Default value is 256.
  8430. @item nb_steps, n
  8431. Set the maximum number of iterations to apply for computing the optimal
  8432. mapping. The higher the value the better the result and the higher the
  8433. computation time. Default value is 1.
  8434. @item seed, s
  8435. Set a random seed, must be an integer included between 0 and
  8436. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8437. will try to use a good random seed on a best effort basis.
  8438. @item pal8
  8439. Set pal8 output pixel format. This option does not work with codebook
  8440. length greater than 256.
  8441. @end table
  8442. @section entropy
  8443. Measure graylevel entropy in histogram of color channels of video frames.
  8444. It accepts the following parameters:
  8445. @table @option
  8446. @item mode
  8447. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8448. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8449. between neighbour histogram values.
  8450. @end table
  8451. @section epx
  8452. Apply the EPX magnification filter which is designed for pixel art.
  8453. It accepts the following option:
  8454. @table @option
  8455. @item n
  8456. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  8457. @code{3xEPX}.
  8458. Default is @code{3}.
  8459. @end table
  8460. @section eq
  8461. Set brightness, contrast, saturation and approximate gamma adjustment.
  8462. The filter accepts the following options:
  8463. @table @option
  8464. @item contrast
  8465. Set the contrast expression. The value must be a float value in range
  8466. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8467. @item brightness
  8468. Set the brightness expression. The value must be a float value in
  8469. range @code{-1.0} to @code{1.0}. The default value is "0".
  8470. @item saturation
  8471. Set the saturation expression. The value must be a float in
  8472. range @code{0.0} to @code{3.0}. The default value is "1".
  8473. @item gamma
  8474. Set the gamma expression. The value must be a float in range
  8475. @code{0.1} to @code{10.0}. The default value is "1".
  8476. @item gamma_r
  8477. Set the gamma expression for red. The value must be a float in
  8478. range @code{0.1} to @code{10.0}. The default value is "1".
  8479. @item gamma_g
  8480. Set the gamma expression for green. The value must be a float in range
  8481. @code{0.1} to @code{10.0}. The default value is "1".
  8482. @item gamma_b
  8483. Set the gamma expression for blue. The value must be a float in range
  8484. @code{0.1} to @code{10.0}. The default value is "1".
  8485. @item gamma_weight
  8486. Set the gamma weight expression. It can be used to reduce the effect
  8487. of a high gamma value on bright image areas, e.g. keep them from
  8488. getting overamplified and just plain white. The value must be a float
  8489. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8490. gamma correction all the way down while @code{1.0} leaves it at its
  8491. full strength. Default is "1".
  8492. @item eval
  8493. Set when the expressions for brightness, contrast, saturation and
  8494. gamma expressions are evaluated.
  8495. It accepts the following values:
  8496. @table @samp
  8497. @item init
  8498. only evaluate expressions once during the filter initialization or
  8499. when a command is processed
  8500. @item frame
  8501. evaluate expressions for each incoming frame
  8502. @end table
  8503. Default value is @samp{init}.
  8504. @end table
  8505. The expressions accept the following parameters:
  8506. @table @option
  8507. @item n
  8508. frame count of the input frame starting from 0
  8509. @item pos
  8510. byte position of the corresponding packet in the input file, NAN if
  8511. unspecified
  8512. @item r
  8513. frame rate of the input video, NAN if the input frame rate is unknown
  8514. @item t
  8515. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8516. @end table
  8517. @subsection Commands
  8518. The filter supports the following commands:
  8519. @table @option
  8520. @item contrast
  8521. Set the contrast expression.
  8522. @item brightness
  8523. Set the brightness expression.
  8524. @item saturation
  8525. Set the saturation expression.
  8526. @item gamma
  8527. Set the gamma expression.
  8528. @item gamma_r
  8529. Set the gamma_r expression.
  8530. @item gamma_g
  8531. Set gamma_g expression.
  8532. @item gamma_b
  8533. Set gamma_b expression.
  8534. @item gamma_weight
  8535. Set gamma_weight expression.
  8536. The command accepts the same syntax of the corresponding option.
  8537. If the specified expression is not valid, it is kept at its current
  8538. value.
  8539. @end table
  8540. @section erosion
  8541. Apply erosion effect to the video.
  8542. This filter replaces the pixel by the local(3x3) minimum.
  8543. It accepts the following options:
  8544. @table @option
  8545. @item threshold0
  8546. @item threshold1
  8547. @item threshold2
  8548. @item threshold3
  8549. Limit the maximum change for each plane, default is 65535.
  8550. If 0, plane will remain unchanged.
  8551. @item coordinates
  8552. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8553. pixels are used.
  8554. Flags to local 3x3 coordinates maps like this:
  8555. 1 2 3
  8556. 4 5
  8557. 6 7 8
  8558. @end table
  8559. @subsection Commands
  8560. This filter supports the all above options as @ref{commands}.
  8561. @section estdif
  8562. Deinterlace the input video ("estdif" stands for "Edge Slope
  8563. Tracing Deinterlacing Filter").
  8564. Spatial only filter that uses edge slope tracing algorithm
  8565. to interpolate missing lines.
  8566. It accepts the following parameters:
  8567. @table @option
  8568. @item mode
  8569. The interlacing mode to adopt. It accepts one of the following values:
  8570. @table @option
  8571. @item frame
  8572. Output one frame for each frame.
  8573. @item field
  8574. Output one frame for each field.
  8575. @end table
  8576. The default value is @code{field}.
  8577. @item parity
  8578. The picture field parity assumed for the input interlaced video. It accepts one
  8579. of the following values:
  8580. @table @option
  8581. @item tff
  8582. Assume the top field is first.
  8583. @item bff
  8584. Assume the bottom field is first.
  8585. @item auto
  8586. Enable automatic detection of field parity.
  8587. @end table
  8588. The default value is @code{auto}.
  8589. If the interlacing is unknown or the decoder does not export this information,
  8590. top field first will be assumed.
  8591. @item deint
  8592. Specify which frames to deinterlace. Accepts one of the following
  8593. values:
  8594. @table @option
  8595. @item all
  8596. Deinterlace all frames.
  8597. @item interlaced
  8598. Only deinterlace frames marked as interlaced.
  8599. @end table
  8600. The default value is @code{all}.
  8601. @item rslope
  8602. Specify the search radius for edge slope tracing. Default value is 1.
  8603. Allowed range is from 1 to 15.
  8604. @item redge
  8605. Specify the search radius for best edge matching. Default value is 2.
  8606. Allowed range is from 0 to 15.
  8607. @item interp
  8608. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  8609. of the following values:
  8610. @table @option
  8611. @item 2p
  8612. Two-point interpolation.
  8613. @item 4p
  8614. Four-point interpolation.
  8615. @item 6p
  8616. Six-point interpolation.
  8617. @end table
  8618. @end table
  8619. @subsection Commands
  8620. This filter supports same @ref{commands} as options.
  8621. @section extractplanes
  8622. Extract color channel components from input video stream into
  8623. separate grayscale video streams.
  8624. The filter accepts the following option:
  8625. @table @option
  8626. @item planes
  8627. Set plane(s) to extract.
  8628. Available values for planes are:
  8629. @table @samp
  8630. @item y
  8631. @item u
  8632. @item v
  8633. @item a
  8634. @item r
  8635. @item g
  8636. @item b
  8637. @end table
  8638. Choosing planes not available in the input will result in an error.
  8639. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8640. with @code{y}, @code{u}, @code{v} planes at same time.
  8641. @end table
  8642. @subsection Examples
  8643. @itemize
  8644. @item
  8645. Extract luma, u and v color channel component from input video frame
  8646. into 3 grayscale outputs:
  8647. @example
  8648. 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
  8649. @end example
  8650. @end itemize
  8651. @section fade
  8652. Apply a fade-in/out effect to the input video.
  8653. It accepts the following parameters:
  8654. @table @option
  8655. @item type, t
  8656. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8657. effect.
  8658. Default is @code{in}.
  8659. @item start_frame, s
  8660. Specify the number of the frame to start applying the fade
  8661. effect at. Default is 0.
  8662. @item nb_frames, n
  8663. The number of frames that the fade effect lasts. At the end of the
  8664. fade-in effect, the output video will have the same intensity as the input video.
  8665. At the end of the fade-out transition, the output video will be filled with the
  8666. selected @option{color}.
  8667. Default is 25.
  8668. @item alpha
  8669. If set to 1, fade only alpha channel, if one exists on the input.
  8670. Default value is 0.
  8671. @item start_time, st
  8672. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8673. effect. If both start_frame and start_time are specified, the fade will start at
  8674. whichever comes last. Default is 0.
  8675. @item duration, d
  8676. The number of seconds for which the fade effect has to last. At the end of the
  8677. fade-in effect the output video will have the same intensity as the input video,
  8678. at the end of the fade-out transition the output video will be filled with the
  8679. selected @option{color}.
  8680. If both duration and nb_frames are specified, duration is used. Default is 0
  8681. (nb_frames is used by default).
  8682. @item color, c
  8683. Specify the color of the fade. Default is "black".
  8684. @end table
  8685. @subsection Examples
  8686. @itemize
  8687. @item
  8688. Fade in the first 30 frames of video:
  8689. @example
  8690. fade=in:0:30
  8691. @end example
  8692. The command above is equivalent to:
  8693. @example
  8694. fade=t=in:s=0:n=30
  8695. @end example
  8696. @item
  8697. Fade out the last 45 frames of a 200-frame video:
  8698. @example
  8699. fade=out:155:45
  8700. fade=type=out:start_frame=155:nb_frames=45
  8701. @end example
  8702. @item
  8703. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8704. @example
  8705. fade=in:0:25, fade=out:975:25
  8706. @end example
  8707. @item
  8708. Make the first 5 frames yellow, then fade in from frame 5-24:
  8709. @example
  8710. fade=in:5:20:color=yellow
  8711. @end example
  8712. @item
  8713. Fade in alpha over first 25 frames of video:
  8714. @example
  8715. fade=in:0:25:alpha=1
  8716. @end example
  8717. @item
  8718. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8719. @example
  8720. fade=t=in:st=5.5:d=0.5
  8721. @end example
  8722. @end itemize
  8723. @section fftdnoiz
  8724. Denoise frames using 3D FFT (frequency domain filtering).
  8725. The filter accepts the following options:
  8726. @table @option
  8727. @item sigma
  8728. Set the noise sigma constant. This sets denoising strength.
  8729. Default value is 1. Allowed range is from 0 to 30.
  8730. Using very high sigma with low overlap may give blocking artifacts.
  8731. @item amount
  8732. Set amount of denoising. By default all detected noise is reduced.
  8733. Default value is 1. Allowed range is from 0 to 1.
  8734. @item block
  8735. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8736. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8737. block size in pixels is 2^4 which is 16.
  8738. @item overlap
  8739. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8740. @item prev
  8741. Set number of previous frames to use for denoising. By default is set to 0.
  8742. @item next
  8743. Set number of next frames to to use for denoising. By default is set to 0.
  8744. @item planes
  8745. Set planes which will be filtered, by default are all available filtered
  8746. except alpha.
  8747. @end table
  8748. @section fftfilt
  8749. Apply arbitrary expressions to samples in frequency domain
  8750. @table @option
  8751. @item dc_Y
  8752. Adjust the dc value (gain) of the luma plane of the image. The filter
  8753. accepts an integer value in range @code{0} to @code{1000}. The default
  8754. value is set to @code{0}.
  8755. @item dc_U
  8756. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8757. filter accepts an integer value in range @code{0} to @code{1000}. The
  8758. default value is set to @code{0}.
  8759. @item dc_V
  8760. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8761. filter accepts an integer value in range @code{0} to @code{1000}. The
  8762. default value is set to @code{0}.
  8763. @item weight_Y
  8764. Set the frequency domain weight expression for the luma plane.
  8765. @item weight_U
  8766. Set the frequency domain weight expression for the 1st chroma plane.
  8767. @item weight_V
  8768. Set the frequency domain weight expression for the 2nd chroma plane.
  8769. @item eval
  8770. Set when the expressions are evaluated.
  8771. It accepts the following values:
  8772. @table @samp
  8773. @item init
  8774. Only evaluate expressions once during the filter initialization.
  8775. @item frame
  8776. Evaluate expressions for each incoming frame.
  8777. @end table
  8778. Default value is @samp{init}.
  8779. The filter accepts the following variables:
  8780. @item X
  8781. @item Y
  8782. The coordinates of the current sample.
  8783. @item W
  8784. @item H
  8785. The width and height of the image.
  8786. @item N
  8787. The number of input frame, starting from 0.
  8788. @end table
  8789. @subsection Examples
  8790. @itemize
  8791. @item
  8792. High-pass:
  8793. @example
  8794. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8795. @end example
  8796. @item
  8797. Low-pass:
  8798. @example
  8799. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8800. @end example
  8801. @item
  8802. Sharpen:
  8803. @example
  8804. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8805. @end example
  8806. @item
  8807. Blur:
  8808. @example
  8809. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8810. @end example
  8811. @end itemize
  8812. @section field
  8813. Extract a single field from an interlaced image using stride
  8814. arithmetic to avoid wasting CPU time. The output frames are marked as
  8815. non-interlaced.
  8816. The filter accepts the following options:
  8817. @table @option
  8818. @item type
  8819. Specify whether to extract the top (if the value is @code{0} or
  8820. @code{top}) or the bottom field (if the value is @code{1} or
  8821. @code{bottom}).
  8822. @end table
  8823. @section fieldhint
  8824. Create new frames by copying the top and bottom fields from surrounding frames
  8825. supplied as numbers by the hint file.
  8826. @table @option
  8827. @item hint
  8828. Set file containing hints: absolute/relative frame numbers.
  8829. There must be one line for each frame in a clip. Each line must contain two
  8830. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8831. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8832. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8833. for @code{relative} mode. First number tells from which frame to pick up top
  8834. field and second number tells from which frame to pick up bottom field.
  8835. If optionally followed by @code{+} output frame will be marked as interlaced,
  8836. else if followed by @code{-} output frame will be marked as progressive, else
  8837. it will be marked same as input frame.
  8838. If optionally followed by @code{t} output frame will use only top field, or in
  8839. case of @code{b} it will use only bottom field.
  8840. If line starts with @code{#} or @code{;} that line is skipped.
  8841. @item mode
  8842. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8843. @end table
  8844. Example of first several lines of @code{hint} file for @code{relative} mode:
  8845. @example
  8846. 0,0 - # first frame
  8847. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8848. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8849. 1,0 -
  8850. 0,0 -
  8851. 0,0 -
  8852. 1,0 -
  8853. 1,0 -
  8854. 1,0 -
  8855. 0,0 -
  8856. 0,0 -
  8857. 1,0 -
  8858. 1,0 -
  8859. 1,0 -
  8860. 0,0 -
  8861. @end example
  8862. @section fieldmatch
  8863. Field matching filter for inverse telecine. It is meant to reconstruct the
  8864. progressive frames from a telecined stream. The filter does not drop duplicated
  8865. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8866. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8867. The separation of the field matching and the decimation is notably motivated by
  8868. the possibility of inserting a de-interlacing filter fallback between the two.
  8869. If the source has mixed telecined and real interlaced content,
  8870. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8871. But these remaining combed frames will be marked as interlaced, and thus can be
  8872. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8873. In addition to the various configuration options, @code{fieldmatch} can take an
  8874. optional second stream, activated through the @option{ppsrc} option. If
  8875. enabled, the frames reconstruction will be based on the fields and frames from
  8876. this second stream. This allows the first input to be pre-processed in order to
  8877. help the various algorithms of the filter, while keeping the output lossless
  8878. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8879. or brightness/contrast adjustments can help.
  8880. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8881. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8882. which @code{fieldmatch} is based on. While the semantic and usage are very
  8883. close, some behaviour and options names can differ.
  8884. The @ref{decimate} filter currently only works for constant frame rate input.
  8885. If your input has mixed telecined (30fps) and progressive content with a lower
  8886. framerate like 24fps use the following filterchain to produce the necessary cfr
  8887. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8888. The filter accepts the following options:
  8889. @table @option
  8890. @item order
  8891. Specify the assumed field order of the input stream. Available values are:
  8892. @table @samp
  8893. @item auto
  8894. Auto detect parity (use FFmpeg's internal parity value).
  8895. @item bff
  8896. Assume bottom field first.
  8897. @item tff
  8898. Assume top field first.
  8899. @end table
  8900. Note that it is sometimes recommended not to trust the parity announced by the
  8901. stream.
  8902. Default value is @var{auto}.
  8903. @item mode
  8904. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8905. sense that it won't risk creating jerkiness due to duplicate frames when
  8906. possible, but if there are bad edits or blended fields it will end up
  8907. outputting combed frames when a good match might actually exist. On the other
  8908. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8909. but will almost always find a good frame if there is one. The other values are
  8910. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8911. jerkiness and creating duplicate frames versus finding good matches in sections
  8912. with bad edits, orphaned fields, blended fields, etc.
  8913. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8914. Available values are:
  8915. @table @samp
  8916. @item pc
  8917. 2-way matching (p/c)
  8918. @item pc_n
  8919. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8920. @item pc_u
  8921. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8922. @item pc_n_ub
  8923. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8924. still combed (p/c + n + u/b)
  8925. @item pcn
  8926. 3-way matching (p/c/n)
  8927. @item pcn_ub
  8928. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8929. detected as combed (p/c/n + u/b)
  8930. @end table
  8931. The parenthesis at the end indicate the matches that would be used for that
  8932. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8933. @var{top}).
  8934. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8935. the slowest.
  8936. Default value is @var{pc_n}.
  8937. @item ppsrc
  8938. Mark the main input stream as a pre-processed input, and enable the secondary
  8939. input stream as the clean source to pick the fields from. See the filter
  8940. introduction for more details. It is similar to the @option{clip2} feature from
  8941. VFM/TFM.
  8942. Default value is @code{0} (disabled).
  8943. @item field
  8944. Set the field to match from. It is recommended to set this to the same value as
  8945. @option{order} unless you experience matching failures with that setting. In
  8946. certain circumstances changing the field that is used to match from can have a
  8947. large impact on matching performance. Available values are:
  8948. @table @samp
  8949. @item auto
  8950. Automatic (same value as @option{order}).
  8951. @item bottom
  8952. Match from the bottom field.
  8953. @item top
  8954. Match from the top field.
  8955. @end table
  8956. Default value is @var{auto}.
  8957. @item mchroma
  8958. Set whether or not chroma is included during the match comparisons. In most
  8959. cases it is recommended to leave this enabled. You should set this to @code{0}
  8960. only if your clip has bad chroma problems such as heavy rainbowing or other
  8961. artifacts. Setting this to @code{0} could also be used to speed things up at
  8962. the cost of some accuracy.
  8963. Default value is @code{1}.
  8964. @item y0
  8965. @item y1
  8966. These define an exclusion band which excludes the lines between @option{y0} and
  8967. @option{y1} from being included in the field matching decision. An exclusion
  8968. band can be used to ignore subtitles, a logo, or other things that may
  8969. interfere with the matching. @option{y0} sets the starting scan line and
  8970. @option{y1} sets the ending line; all lines in between @option{y0} and
  8971. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8972. @option{y0} and @option{y1} to the same value will disable the feature.
  8973. @option{y0} and @option{y1} defaults to @code{0}.
  8974. @item scthresh
  8975. Set the scene change detection threshold as a percentage of maximum change on
  8976. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8977. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8978. @option{scthresh} is @code{[0.0, 100.0]}.
  8979. Default value is @code{12.0}.
  8980. @item combmatch
  8981. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8982. account the combed scores of matches when deciding what match to use as the
  8983. final match. Available values are:
  8984. @table @samp
  8985. @item none
  8986. No final matching based on combed scores.
  8987. @item sc
  8988. Combed scores are only used when a scene change is detected.
  8989. @item full
  8990. Use combed scores all the time.
  8991. @end table
  8992. Default is @var{sc}.
  8993. @item combdbg
  8994. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8995. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8996. Available values are:
  8997. @table @samp
  8998. @item none
  8999. No forced calculation.
  9000. @item pcn
  9001. Force p/c/n calculations.
  9002. @item pcnub
  9003. Force p/c/n/u/b calculations.
  9004. @end table
  9005. Default value is @var{none}.
  9006. @item cthresh
  9007. This is the area combing threshold used for combed frame detection. This
  9008. essentially controls how "strong" or "visible" combing must be to be detected.
  9009. Larger values mean combing must be more visible and smaller values mean combing
  9010. can be less visible or strong and still be detected. Valid settings are from
  9011. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  9012. be detected as combed). This is basically a pixel difference value. A good
  9013. range is @code{[8, 12]}.
  9014. Default value is @code{9}.
  9015. @item chroma
  9016. Sets whether or not chroma is considered in the combed frame decision. Only
  9017. disable this if your source has chroma problems (rainbowing, etc.) that are
  9018. causing problems for the combed frame detection with chroma enabled. Actually,
  9019. using @option{chroma}=@var{0} is usually more reliable, except for the case
  9020. where there is chroma only combing in the source.
  9021. Default value is @code{0}.
  9022. @item blockx
  9023. @item blocky
  9024. Respectively set the x-axis and y-axis size of the window used during combed
  9025. frame detection. This has to do with the size of the area in which
  9026. @option{combpel} pixels are required to be detected as combed for a frame to be
  9027. declared combed. See the @option{combpel} parameter description for more info.
  9028. Possible values are any number that is a power of 2 starting at 4 and going up
  9029. to 512.
  9030. Default value is @code{16}.
  9031. @item combpel
  9032. The number of combed pixels inside any of the @option{blocky} by
  9033. @option{blockx} size blocks on the frame for the frame to be detected as
  9034. combed. While @option{cthresh} controls how "visible" the combing must be, this
  9035. setting controls "how much" combing there must be in any localized area (a
  9036. window defined by the @option{blockx} and @option{blocky} settings) on the
  9037. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  9038. which point no frames will ever be detected as combed). This setting is known
  9039. as @option{MI} in TFM/VFM vocabulary.
  9040. Default value is @code{80}.
  9041. @end table
  9042. @anchor{p/c/n/u/b meaning}
  9043. @subsection p/c/n/u/b meaning
  9044. @subsubsection p/c/n
  9045. We assume the following telecined stream:
  9046. @example
  9047. Top fields: 1 2 2 3 4
  9048. Bottom fields: 1 2 3 4 4
  9049. @end example
  9050. The numbers correspond to the progressive frame the fields relate to. Here, the
  9051. first two frames are progressive, the 3rd and 4th are combed, and so on.
  9052. When @code{fieldmatch} is configured to run a matching from bottom
  9053. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  9054. @example
  9055. Input stream:
  9056. T 1 2 2 3 4
  9057. B 1 2 3 4 4 <-- matching reference
  9058. Matches: c c n n c
  9059. Output stream:
  9060. T 1 2 3 4 4
  9061. B 1 2 3 4 4
  9062. @end example
  9063. As a result of the field matching, we can see that some frames get duplicated.
  9064. To perform a complete inverse telecine, you need to rely on a decimation filter
  9065. after this operation. See for instance the @ref{decimate} filter.
  9066. The same operation now matching from top fields (@option{field}=@var{top})
  9067. looks like this:
  9068. @example
  9069. Input stream:
  9070. T 1 2 2 3 4 <-- matching reference
  9071. B 1 2 3 4 4
  9072. Matches: c c p p c
  9073. Output stream:
  9074. T 1 2 2 3 4
  9075. B 1 2 2 3 4
  9076. @end example
  9077. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  9078. basically, they refer to the frame and field of the opposite parity:
  9079. @itemize
  9080. @item @var{p} matches the field of the opposite parity in the previous frame
  9081. @item @var{c} matches the field of the opposite parity in the current frame
  9082. @item @var{n} matches the field of the opposite parity in the next frame
  9083. @end itemize
  9084. @subsubsection u/b
  9085. The @var{u} and @var{b} matching are a bit special in the sense that they match
  9086. from the opposite parity flag. In the following examples, we assume that we are
  9087. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  9088. 'x' is placed above and below each matched fields.
  9089. With bottom matching (@option{field}=@var{bottom}):
  9090. @example
  9091. Match: c p n b u
  9092. x x x x x
  9093. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9094. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9095. x x x x x
  9096. Output frames:
  9097. 2 1 2 2 2
  9098. 2 2 2 1 3
  9099. @end example
  9100. With top matching (@option{field}=@var{top}):
  9101. @example
  9102. Match: c p n b u
  9103. x x x x x
  9104. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9105. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9106. x x x x x
  9107. Output frames:
  9108. 2 2 2 1 2
  9109. 2 1 3 2 2
  9110. @end example
  9111. @subsection Examples
  9112. Simple IVTC of a top field first telecined stream:
  9113. @example
  9114. fieldmatch=order=tff:combmatch=none, decimate
  9115. @end example
  9116. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  9117. @example
  9118. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  9119. @end example
  9120. @section fieldorder
  9121. Transform the field order of the input video.
  9122. It accepts the following parameters:
  9123. @table @option
  9124. @item order
  9125. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  9126. for bottom field first.
  9127. @end table
  9128. The default value is @samp{tff}.
  9129. The transformation is done by shifting the picture content up or down
  9130. by one line, and filling the remaining line with appropriate picture content.
  9131. This method is consistent with most broadcast field order converters.
  9132. If the input video is not flagged as being interlaced, or it is already
  9133. flagged as being of the required output field order, then this filter does
  9134. not alter the incoming video.
  9135. It is very useful when converting to or from PAL DV material,
  9136. which is bottom field first.
  9137. For example:
  9138. @example
  9139. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  9140. @end example
  9141. @section fifo, afifo
  9142. Buffer input images and send them when they are requested.
  9143. It is mainly useful when auto-inserted by the libavfilter
  9144. framework.
  9145. It does not take parameters.
  9146. @section fillborders
  9147. Fill borders of the input video, without changing video stream dimensions.
  9148. Sometimes video can have garbage at the four edges and you may not want to
  9149. crop video input to keep size multiple of some number.
  9150. This filter accepts the following options:
  9151. @table @option
  9152. @item left
  9153. Number of pixels to fill from left border.
  9154. @item right
  9155. Number of pixels to fill from right border.
  9156. @item top
  9157. Number of pixels to fill from top border.
  9158. @item bottom
  9159. Number of pixels to fill from bottom border.
  9160. @item mode
  9161. Set fill mode.
  9162. It accepts the following values:
  9163. @table @samp
  9164. @item smear
  9165. fill pixels using outermost pixels
  9166. @item mirror
  9167. fill pixels using mirroring (half sample symmetric)
  9168. @item fixed
  9169. fill pixels with constant value
  9170. @item reflect
  9171. fill pixels using reflecting (whole sample symmetric)
  9172. @item wrap
  9173. fill pixels using wrapping
  9174. @item fade
  9175. fade pixels to constant value
  9176. @end table
  9177. Default is @var{smear}.
  9178. @item color
  9179. Set color for pixels in fixed or fade mode. Default is @var{black}.
  9180. @end table
  9181. @subsection Commands
  9182. This filter supports same @ref{commands} as options.
  9183. The command accepts the same syntax of the corresponding option.
  9184. If the specified expression is not valid, it is kept at its current
  9185. value.
  9186. @section find_rect
  9187. Find a rectangular object
  9188. It accepts the following options:
  9189. @table @option
  9190. @item object
  9191. Filepath of the object image, needs to be in gray8.
  9192. @item threshold
  9193. Detection threshold, default is 0.5.
  9194. @item mipmaps
  9195. Number of mipmaps, default is 3.
  9196. @item xmin, ymin, xmax, ymax
  9197. Specifies the rectangle in which to search.
  9198. @end table
  9199. @subsection Examples
  9200. @itemize
  9201. @item
  9202. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  9203. @example
  9204. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  9205. @end example
  9206. @end itemize
  9207. @section floodfill
  9208. Flood area with values of same pixel components with another values.
  9209. It accepts the following options:
  9210. @table @option
  9211. @item x
  9212. Set pixel x coordinate.
  9213. @item y
  9214. Set pixel y coordinate.
  9215. @item s0
  9216. Set source #0 component value.
  9217. @item s1
  9218. Set source #1 component value.
  9219. @item s2
  9220. Set source #2 component value.
  9221. @item s3
  9222. Set source #3 component value.
  9223. @item d0
  9224. Set destination #0 component value.
  9225. @item d1
  9226. Set destination #1 component value.
  9227. @item d2
  9228. Set destination #2 component value.
  9229. @item d3
  9230. Set destination #3 component value.
  9231. @end table
  9232. @anchor{format}
  9233. @section format
  9234. Convert the input video to one of the specified pixel formats.
  9235. Libavfilter will try to pick one that is suitable as input to
  9236. the next filter.
  9237. It accepts the following parameters:
  9238. @table @option
  9239. @item pix_fmts
  9240. A '|'-separated list of pixel format names, such as
  9241. "pix_fmts=yuv420p|monow|rgb24".
  9242. @end table
  9243. @subsection Examples
  9244. @itemize
  9245. @item
  9246. Convert the input video to the @var{yuv420p} format
  9247. @example
  9248. format=pix_fmts=yuv420p
  9249. @end example
  9250. Convert the input video to any of the formats in the list
  9251. @example
  9252. format=pix_fmts=yuv420p|yuv444p|yuv410p
  9253. @end example
  9254. @end itemize
  9255. @anchor{fps}
  9256. @section fps
  9257. Convert the video to specified constant frame rate by duplicating or dropping
  9258. frames as necessary.
  9259. It accepts the following parameters:
  9260. @table @option
  9261. @item fps
  9262. The desired output frame rate. The default is @code{25}.
  9263. @item start_time
  9264. Assume the first PTS should be the given value, in seconds. This allows for
  9265. padding/trimming at the start of stream. By default, no assumption is made
  9266. about the first frame's expected PTS, so no padding or trimming is done.
  9267. For example, this could be set to 0 to pad the beginning with duplicates of
  9268. the first frame if a video stream starts after the audio stream or to trim any
  9269. frames with a negative PTS.
  9270. @item round
  9271. Timestamp (PTS) rounding method.
  9272. Possible values are:
  9273. @table @option
  9274. @item zero
  9275. round towards 0
  9276. @item inf
  9277. round away from 0
  9278. @item down
  9279. round towards -infinity
  9280. @item up
  9281. round towards +infinity
  9282. @item near
  9283. round to nearest
  9284. @end table
  9285. The default is @code{near}.
  9286. @item eof_action
  9287. Action performed when reading the last frame.
  9288. Possible values are:
  9289. @table @option
  9290. @item round
  9291. Use same timestamp rounding method as used for other frames.
  9292. @item pass
  9293. Pass through last frame if input duration has not been reached yet.
  9294. @end table
  9295. The default is @code{round}.
  9296. @end table
  9297. Alternatively, the options can be specified as a flat string:
  9298. @var{fps}[:@var{start_time}[:@var{round}]].
  9299. See also the @ref{setpts} filter.
  9300. @subsection Examples
  9301. @itemize
  9302. @item
  9303. A typical usage in order to set the fps to 25:
  9304. @example
  9305. fps=fps=25
  9306. @end example
  9307. @item
  9308. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  9309. @example
  9310. fps=fps=film:round=near
  9311. @end example
  9312. @end itemize
  9313. @section framepack
  9314. Pack two different video streams into a stereoscopic video, setting proper
  9315. metadata on supported codecs. The two views should have the same size and
  9316. framerate and processing will stop when the shorter video ends. Please note
  9317. that you may conveniently adjust view properties with the @ref{scale} and
  9318. @ref{fps} filters.
  9319. It accepts the following parameters:
  9320. @table @option
  9321. @item format
  9322. The desired packing format. Supported values are:
  9323. @table @option
  9324. @item sbs
  9325. The views are next to each other (default).
  9326. @item tab
  9327. The views are on top of each other.
  9328. @item lines
  9329. The views are packed by line.
  9330. @item columns
  9331. The views are packed by column.
  9332. @item frameseq
  9333. The views are temporally interleaved.
  9334. @end table
  9335. @end table
  9336. Some examples:
  9337. @example
  9338. # Convert left and right views into a frame-sequential video
  9339. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  9340. # Convert views into a side-by-side video with the same output resolution as the input
  9341. 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
  9342. @end example
  9343. @section framerate
  9344. Change the frame rate by interpolating new video output frames from the source
  9345. frames.
  9346. This filter is not designed to function correctly with interlaced media. If
  9347. you wish to change the frame rate of interlaced media then you are required
  9348. to deinterlace before this filter and re-interlace after this filter.
  9349. A description of the accepted options follows.
  9350. @table @option
  9351. @item fps
  9352. Specify the output frames per second. This option can also be specified
  9353. as a value alone. The default is @code{50}.
  9354. @item interp_start
  9355. Specify the start of a range where the output frame will be created as a
  9356. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9357. the default is @code{15}.
  9358. @item interp_end
  9359. Specify the end of a range where the output frame will be created as a
  9360. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9361. the default is @code{240}.
  9362. @item scene
  9363. Specify the level at which a scene change is detected as a value between
  9364. 0 and 100 to indicate a new scene; a low value reflects a low
  9365. probability for the current frame to introduce a new scene, while a higher
  9366. value means the current frame is more likely to be one.
  9367. The default is @code{8.2}.
  9368. @item flags
  9369. Specify flags influencing the filter process.
  9370. Available value for @var{flags} is:
  9371. @table @option
  9372. @item scene_change_detect, scd
  9373. Enable scene change detection using the value of the option @var{scene}.
  9374. This flag is enabled by default.
  9375. @end table
  9376. @end table
  9377. @section framestep
  9378. Select one frame every N-th frame.
  9379. This filter accepts the following option:
  9380. @table @option
  9381. @item step
  9382. Select frame after every @code{step} frames.
  9383. Allowed values are positive integers higher than 0. Default value is @code{1}.
  9384. @end table
  9385. @section freezedetect
  9386. Detect frozen video.
  9387. This filter logs a message and sets frame metadata when it detects that the
  9388. input video has no significant change in content during a specified duration.
  9389. Video freeze detection calculates the mean average absolute difference of all
  9390. the components of video frames and compares it to a noise floor.
  9391. The printed times and duration are expressed in seconds. The
  9392. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  9393. whose timestamp equals or exceeds the detection duration and it contains the
  9394. timestamp of the first frame of the freeze. The
  9395. @code{lavfi.freezedetect.freeze_duration} and
  9396. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  9397. after the freeze.
  9398. The filter accepts the following options:
  9399. @table @option
  9400. @item noise, n
  9401. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  9402. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  9403. 0.001.
  9404. @item duration, d
  9405. Set freeze duration until notification (default is 2 seconds).
  9406. @end table
  9407. @section freezeframes
  9408. Freeze video frames.
  9409. This filter freezes video frames using frame from 2nd input.
  9410. The filter accepts the following options:
  9411. @table @option
  9412. @item first
  9413. Set number of first frame from which to start freeze.
  9414. @item last
  9415. Set number of last frame from which to end freeze.
  9416. @item replace
  9417. Set number of frame from 2nd input which will be used instead of replaced frames.
  9418. @end table
  9419. @anchor{frei0r}
  9420. @section frei0r
  9421. Apply a frei0r effect to the input video.
  9422. To enable the compilation of this filter, you need to install the frei0r
  9423. header and configure FFmpeg with @code{--enable-frei0r}.
  9424. It accepts the following parameters:
  9425. @table @option
  9426. @item filter_name
  9427. The name of the frei0r effect to load. If the environment variable
  9428. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  9429. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  9430. Otherwise, the standard frei0r paths are searched, in this order:
  9431. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  9432. @file{/usr/lib/frei0r-1/}.
  9433. @item filter_params
  9434. A '|'-separated list of parameters to pass to the frei0r effect.
  9435. @end table
  9436. A frei0r effect parameter can be a boolean (its value is either
  9437. "y" or "n"), a double, a color (specified as
  9438. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  9439. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  9440. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  9441. a position (specified as @var{X}/@var{Y}, where
  9442. @var{X} and @var{Y} are floating point numbers) and/or a string.
  9443. The number and types of parameters depend on the loaded effect. If an
  9444. effect parameter is not specified, the default value is set.
  9445. @subsection Examples
  9446. @itemize
  9447. @item
  9448. Apply the distort0r effect, setting the first two double parameters:
  9449. @example
  9450. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  9451. @end example
  9452. @item
  9453. Apply the colordistance effect, taking a color as the first parameter:
  9454. @example
  9455. frei0r=colordistance:0.2/0.3/0.4
  9456. frei0r=colordistance:violet
  9457. frei0r=colordistance:0x112233
  9458. @end example
  9459. @item
  9460. Apply the perspective effect, specifying the top left and top right image
  9461. positions:
  9462. @example
  9463. frei0r=perspective:0.2/0.2|0.8/0.2
  9464. @end example
  9465. @end itemize
  9466. For more information, see
  9467. @url{http://frei0r.dyne.org}
  9468. @subsection Commands
  9469. This filter supports the @option{filter_params} option as @ref{commands}.
  9470. @section fspp
  9471. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  9472. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  9473. processing filter, one of them is performed once per block, not per pixel.
  9474. This allows for much higher speed.
  9475. The filter accepts the following options:
  9476. @table @option
  9477. @item quality
  9478. Set quality. This option defines the number of levels for averaging. It accepts
  9479. an integer in the range 4-5. Default value is @code{4}.
  9480. @item qp
  9481. Force a constant quantization parameter. It accepts an integer in range 0-63.
  9482. If not set, the filter will use the QP from the video stream (if available).
  9483. @item strength
  9484. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  9485. more details but also more artifacts, while higher values make the image smoother
  9486. but also blurrier. Default value is @code{0} − PSNR optimal.
  9487. @item use_bframe_qp
  9488. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9489. option may cause flicker since the B-Frames have often larger QP. Default is
  9490. @code{0} (not enabled).
  9491. @end table
  9492. @section gblur
  9493. Apply Gaussian blur filter.
  9494. The filter accepts the following options:
  9495. @table @option
  9496. @item sigma
  9497. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  9498. @item steps
  9499. Set number of steps for Gaussian approximation. Default is @code{1}.
  9500. @item planes
  9501. Set which planes to filter. By default all planes are filtered.
  9502. @item sigmaV
  9503. Set vertical sigma, if negative it will be same as @code{sigma}.
  9504. Default is @code{-1}.
  9505. @end table
  9506. @subsection Commands
  9507. This filter supports same commands as options.
  9508. The command accepts the same syntax of the corresponding option.
  9509. If the specified expression is not valid, it is kept at its current
  9510. value.
  9511. @section geq
  9512. Apply generic equation to each pixel.
  9513. The filter accepts the following options:
  9514. @table @option
  9515. @item lum_expr, lum
  9516. Set the luminance expression.
  9517. @item cb_expr, cb
  9518. Set the chrominance blue expression.
  9519. @item cr_expr, cr
  9520. Set the chrominance red expression.
  9521. @item alpha_expr, a
  9522. Set the alpha expression.
  9523. @item red_expr, r
  9524. Set the red expression.
  9525. @item green_expr, g
  9526. Set the green expression.
  9527. @item blue_expr, b
  9528. Set the blue expression.
  9529. @end table
  9530. The colorspace is selected according to the specified options. If one
  9531. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9532. options is specified, the filter will automatically select a YCbCr
  9533. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9534. @option{blue_expr} options is specified, it will select an RGB
  9535. colorspace.
  9536. If one of the chrominance expression is not defined, it falls back on the other
  9537. one. If no alpha expression is specified it will evaluate to opaque value.
  9538. If none of chrominance expressions are specified, they will evaluate
  9539. to the luminance expression.
  9540. The expressions can use the following variables and functions:
  9541. @table @option
  9542. @item N
  9543. The sequential number of the filtered frame, starting from @code{0}.
  9544. @item X
  9545. @item Y
  9546. The coordinates of the current sample.
  9547. @item W
  9548. @item H
  9549. The width and height of the image.
  9550. @item SW
  9551. @item SH
  9552. Width and height scale depending on the currently filtered plane. It is the
  9553. ratio between the corresponding luma plane number of pixels and the current
  9554. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9555. @code{0.5,0.5} for chroma planes.
  9556. @item T
  9557. Time of the current frame, expressed in seconds.
  9558. @item p(x, y)
  9559. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9560. plane.
  9561. @item lum(x, y)
  9562. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9563. plane.
  9564. @item cb(x, y)
  9565. Return the value of the pixel at location (@var{x},@var{y}) of the
  9566. blue-difference chroma plane. Return 0 if there is no such plane.
  9567. @item cr(x, y)
  9568. Return the value of the pixel at location (@var{x},@var{y}) of the
  9569. red-difference chroma plane. Return 0 if there is no such plane.
  9570. @item r(x, y)
  9571. @item g(x, y)
  9572. @item b(x, y)
  9573. Return the value of the pixel at location (@var{x},@var{y}) of the
  9574. red/green/blue component. Return 0 if there is no such component.
  9575. @item alpha(x, y)
  9576. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9577. plane. Return 0 if there is no such plane.
  9578. @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)
  9579. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9580. sums of samples within a rectangle. See the functions without the sum postfix.
  9581. @item interpolation
  9582. Set one of interpolation methods:
  9583. @table @option
  9584. @item nearest, n
  9585. @item bilinear, b
  9586. @end table
  9587. Default is bilinear.
  9588. @end table
  9589. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9590. automatically clipped to the closer edge.
  9591. Please note that this filter can use multiple threads in which case each slice
  9592. will have its own expression state. If you want to use only a single expression
  9593. state because your expressions depend on previous state then you should limit
  9594. the number of filter threads to 1.
  9595. @subsection Examples
  9596. @itemize
  9597. @item
  9598. Flip the image horizontally:
  9599. @example
  9600. geq=p(W-X\,Y)
  9601. @end example
  9602. @item
  9603. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9604. wavelength of 100 pixels:
  9605. @example
  9606. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9607. @end example
  9608. @item
  9609. Generate a fancy enigmatic moving light:
  9610. @example
  9611. 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
  9612. @end example
  9613. @item
  9614. Generate a quick emboss effect:
  9615. @example
  9616. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9617. @end example
  9618. @item
  9619. Modify RGB components depending on pixel position:
  9620. @example
  9621. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9622. @end example
  9623. @item
  9624. Create a radial gradient that is the same size as the input (also see
  9625. the @ref{vignette} filter):
  9626. @example
  9627. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9628. @end example
  9629. @end itemize
  9630. @section gradfun
  9631. Fix the banding artifacts that are sometimes introduced into nearly flat
  9632. regions by truncation to 8-bit color depth.
  9633. Interpolate the gradients that should go where the bands are, and
  9634. dither them.
  9635. It is designed for playback only. Do not use it prior to
  9636. lossy compression, because compression tends to lose the dither and
  9637. bring back the bands.
  9638. It accepts the following parameters:
  9639. @table @option
  9640. @item strength
  9641. The maximum amount by which the filter will change any one pixel. This is also
  9642. the threshold for detecting nearly flat regions. Acceptable values range from
  9643. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9644. valid range.
  9645. @item radius
  9646. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9647. gradients, but also prevents the filter from modifying the pixels near detailed
  9648. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9649. values will be clipped to the valid range.
  9650. @end table
  9651. Alternatively, the options can be specified as a flat string:
  9652. @var{strength}[:@var{radius}]
  9653. @subsection Examples
  9654. @itemize
  9655. @item
  9656. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9657. @example
  9658. gradfun=3.5:8
  9659. @end example
  9660. @item
  9661. Specify radius, omitting the strength (which will fall-back to the default
  9662. value):
  9663. @example
  9664. gradfun=radius=8
  9665. @end example
  9666. @end itemize
  9667. @anchor{graphmonitor}
  9668. @section graphmonitor
  9669. Show various filtergraph stats.
  9670. With this filter one can debug complete filtergraph.
  9671. Especially issues with links filling with queued frames.
  9672. The filter accepts the following options:
  9673. @table @option
  9674. @item size, s
  9675. Set video output size. Default is @var{hd720}.
  9676. @item opacity, o
  9677. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9678. @item mode, m
  9679. Set output mode, can be @var{fulll} or @var{compact}.
  9680. In @var{compact} mode only filters with some queued frames have displayed stats.
  9681. @item flags, f
  9682. Set flags which enable which stats are shown in video.
  9683. Available values for flags are:
  9684. @table @samp
  9685. @item queue
  9686. Display number of queued frames in each link.
  9687. @item frame_count_in
  9688. Display number of frames taken from filter.
  9689. @item frame_count_out
  9690. Display number of frames given out from filter.
  9691. @item pts
  9692. Display current filtered frame pts.
  9693. @item time
  9694. Display current filtered frame time.
  9695. @item timebase
  9696. Display time base for filter link.
  9697. @item format
  9698. Display used format for filter link.
  9699. @item size
  9700. Display video size or number of audio channels in case of audio used by filter link.
  9701. @item rate
  9702. Display video frame rate or sample rate in case of audio used by filter link.
  9703. @item eof
  9704. Display link output status.
  9705. @end table
  9706. @item rate, r
  9707. Set upper limit for video rate of output stream, Default value is @var{25}.
  9708. This guarantee that output video frame rate will not be higher than this value.
  9709. @end table
  9710. @section greyedge
  9711. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9712. and corrects the scene colors accordingly.
  9713. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9714. The filter accepts the following options:
  9715. @table @option
  9716. @item difford
  9717. The order of differentiation to be applied on the scene. Must be chosen in the range
  9718. [0,2] and default value is 1.
  9719. @item minknorm
  9720. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9721. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9722. max value instead of calculating Minkowski distance.
  9723. @item sigma
  9724. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9725. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9726. can't be equal to 0 if @var{difford} is greater than 0.
  9727. @end table
  9728. @subsection Examples
  9729. @itemize
  9730. @item
  9731. Grey Edge:
  9732. @example
  9733. greyedge=difford=1:minknorm=5:sigma=2
  9734. @end example
  9735. @item
  9736. Max Edge:
  9737. @example
  9738. greyedge=difford=1:minknorm=0:sigma=2
  9739. @end example
  9740. @end itemize
  9741. @anchor{haldclut}
  9742. @section haldclut
  9743. Apply a Hald CLUT to a video stream.
  9744. First input is the video stream to process, and second one is the Hald CLUT.
  9745. The Hald CLUT input can be a simple picture or a complete video stream.
  9746. The filter accepts the following options:
  9747. @table @option
  9748. @item shortest
  9749. Force termination when the shortest input terminates. Default is @code{0}.
  9750. @item repeatlast
  9751. Continue applying the last CLUT after the end of the stream. A value of
  9752. @code{0} disable the filter after the last frame of the CLUT is reached.
  9753. Default is @code{1}.
  9754. @end table
  9755. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9756. filters share the same internals).
  9757. This filter also supports the @ref{framesync} options.
  9758. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9759. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9760. @subsection Workflow examples
  9761. @subsubsection Hald CLUT video stream
  9762. Generate an identity Hald CLUT stream altered with various effects:
  9763. @example
  9764. 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
  9765. @end example
  9766. Note: make sure you use a lossless codec.
  9767. Then use it with @code{haldclut} to apply it on some random stream:
  9768. @example
  9769. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9770. @end example
  9771. The Hald CLUT will be applied to the 10 first seconds (duration of
  9772. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9773. to the remaining frames of the @code{mandelbrot} stream.
  9774. @subsubsection Hald CLUT with preview
  9775. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9776. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9777. biggest possible square starting at the top left of the picture. The remaining
  9778. padding pixels (bottom or right) will be ignored. This area can be used to add
  9779. a preview of the Hald CLUT.
  9780. Typically, the following generated Hald CLUT will be supported by the
  9781. @code{haldclut} filter:
  9782. @example
  9783. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9784. pad=iw+320 [padded_clut];
  9785. smptebars=s=320x256, split [a][b];
  9786. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9787. [main][b] overlay=W-320" -frames:v 1 clut.png
  9788. @end example
  9789. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9790. bars are displayed on the right-top, and below the same color bars processed by
  9791. the color changes.
  9792. Then, the effect of this Hald CLUT can be visualized with:
  9793. @example
  9794. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9795. @end example
  9796. @section hflip
  9797. Flip the input video horizontally.
  9798. For example, to horizontally flip the input video with @command{ffmpeg}:
  9799. @example
  9800. ffmpeg -i in.avi -vf "hflip" out.avi
  9801. @end example
  9802. @section histeq
  9803. This filter applies a global color histogram equalization on a
  9804. per-frame basis.
  9805. It can be used to correct video that has a compressed range of pixel
  9806. intensities. The filter redistributes the pixel intensities to
  9807. equalize their distribution across the intensity range. It may be
  9808. viewed as an "automatically adjusting contrast filter". This filter is
  9809. useful only for correcting degraded or poorly captured source
  9810. video.
  9811. The filter accepts the following options:
  9812. @table @option
  9813. @item strength
  9814. Determine the amount of equalization to be applied. As the strength
  9815. is reduced, the distribution of pixel intensities more-and-more
  9816. approaches that of the input frame. The value must be a float number
  9817. in the range [0,1] and defaults to 0.200.
  9818. @item intensity
  9819. Set the maximum intensity that can generated and scale the output
  9820. values appropriately. The strength should be set as desired and then
  9821. the intensity can be limited if needed to avoid washing-out. The value
  9822. must be a float number in the range [0,1] and defaults to 0.210.
  9823. @item antibanding
  9824. Set the antibanding level. If enabled the filter will randomly vary
  9825. the luminance of output pixels by a small amount to avoid banding of
  9826. the histogram. Possible values are @code{none}, @code{weak} or
  9827. @code{strong}. It defaults to @code{none}.
  9828. @end table
  9829. @anchor{histogram}
  9830. @section histogram
  9831. Compute and draw a color distribution histogram for the input video.
  9832. The computed histogram is a representation of the color component
  9833. distribution in an image.
  9834. Standard histogram displays the color components distribution in an image.
  9835. Displays color graph for each color component. Shows distribution of
  9836. the Y, U, V, A or R, G, B components, depending on input format, in the
  9837. current frame. Below each graph a color component scale meter is shown.
  9838. The filter accepts the following options:
  9839. @table @option
  9840. @item level_height
  9841. Set height of level. Default value is @code{200}.
  9842. Allowed range is [50, 2048].
  9843. @item scale_height
  9844. Set height of color scale. Default value is @code{12}.
  9845. Allowed range is [0, 40].
  9846. @item display_mode
  9847. Set display mode.
  9848. It accepts the following values:
  9849. @table @samp
  9850. @item stack
  9851. Per color component graphs are placed below each other.
  9852. @item parade
  9853. Per color component graphs are placed side by side.
  9854. @item overlay
  9855. Presents information identical to that in the @code{parade}, except
  9856. that the graphs representing color components are superimposed directly
  9857. over one another.
  9858. @end table
  9859. Default is @code{stack}.
  9860. @item levels_mode
  9861. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9862. Default is @code{linear}.
  9863. @item components
  9864. Set what color components to display.
  9865. Default is @code{7}.
  9866. @item fgopacity
  9867. Set foreground opacity. Default is @code{0.7}.
  9868. @item bgopacity
  9869. Set background opacity. Default is @code{0.5}.
  9870. @end table
  9871. @subsection Examples
  9872. @itemize
  9873. @item
  9874. Calculate and draw histogram:
  9875. @example
  9876. ffplay -i input -vf histogram
  9877. @end example
  9878. @end itemize
  9879. @anchor{hqdn3d}
  9880. @section hqdn3d
  9881. This is a high precision/quality 3d denoise filter. It aims to reduce
  9882. image noise, producing smooth images and making still images really
  9883. still. It should enhance compressibility.
  9884. It accepts the following optional parameters:
  9885. @table @option
  9886. @item luma_spatial
  9887. A non-negative floating point number which specifies spatial luma strength.
  9888. It defaults to 4.0.
  9889. @item chroma_spatial
  9890. A non-negative floating point number which specifies spatial chroma strength.
  9891. It defaults to 3.0*@var{luma_spatial}/4.0.
  9892. @item luma_tmp
  9893. A floating point number which specifies luma temporal strength. It defaults to
  9894. 6.0*@var{luma_spatial}/4.0.
  9895. @item chroma_tmp
  9896. A floating point number which specifies chroma temporal strength. It defaults to
  9897. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9898. @end table
  9899. @subsection Commands
  9900. This filter supports same @ref{commands} as options.
  9901. The command accepts the same syntax of the corresponding option.
  9902. If the specified expression is not valid, it is kept at its current
  9903. value.
  9904. @anchor{hwdownload}
  9905. @section hwdownload
  9906. Download hardware frames to system memory.
  9907. The input must be in hardware frames, and the output a non-hardware format.
  9908. Not all formats will be supported on the output - it may be necessary to insert
  9909. an additional @option{format} filter immediately following in the graph to get
  9910. the output in a supported format.
  9911. @section hwmap
  9912. Map hardware frames to system memory or to another device.
  9913. This filter has several different modes of operation; which one is used depends
  9914. on the input and output formats:
  9915. @itemize
  9916. @item
  9917. Hardware frame input, normal frame output
  9918. Map the input frames to system memory and pass them to the output. If the
  9919. original hardware frame is later required (for example, after overlaying
  9920. something else on part of it), the @option{hwmap} filter can be used again
  9921. in the next mode to retrieve it.
  9922. @item
  9923. Normal frame input, hardware frame output
  9924. If the input is actually a software-mapped hardware frame, then unmap it -
  9925. that is, return the original hardware frame.
  9926. Otherwise, a device must be provided. Create new hardware surfaces on that
  9927. device for the output, then map them back to the software format at the input
  9928. and give those frames to the preceding filter. This will then act like the
  9929. @option{hwupload} filter, but may be able to avoid an additional copy when
  9930. the input is already in a compatible format.
  9931. @item
  9932. Hardware frame input and output
  9933. A device must be supplied for the output, either directly or with the
  9934. @option{derive_device} option. The input and output devices must be of
  9935. different types and compatible - the exact meaning of this is
  9936. system-dependent, but typically it means that they must refer to the same
  9937. underlying hardware context (for example, refer to the same graphics card).
  9938. If the input frames were originally created on the output device, then unmap
  9939. to retrieve the original frames.
  9940. Otherwise, map the frames to the output device - create new hardware frames
  9941. on the output corresponding to the frames on the input.
  9942. @end itemize
  9943. The following additional parameters are accepted:
  9944. @table @option
  9945. @item mode
  9946. Set the frame mapping mode. Some combination of:
  9947. @table @var
  9948. @item read
  9949. The mapped frame should be readable.
  9950. @item write
  9951. The mapped frame should be writeable.
  9952. @item overwrite
  9953. The mapping will always overwrite the entire frame.
  9954. This may improve performance in some cases, as the original contents of the
  9955. frame need not be loaded.
  9956. @item direct
  9957. The mapping must not involve any copying.
  9958. Indirect mappings to copies of frames are created in some cases where either
  9959. direct mapping is not possible or it would have unexpected properties.
  9960. Setting this flag ensures that the mapping is direct and will fail if that is
  9961. not possible.
  9962. @end table
  9963. Defaults to @var{read+write} if not specified.
  9964. @item derive_device @var{type}
  9965. Rather than using the device supplied at initialisation, instead derive a new
  9966. device of type @var{type} from the device the input frames exist on.
  9967. @item reverse
  9968. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9969. and map them back to the source. This may be necessary in some cases where
  9970. a mapping in one direction is required but only the opposite direction is
  9971. supported by the devices being used.
  9972. This option is dangerous - it may break the preceding filter in undefined
  9973. ways if there are any additional constraints on that filter's output.
  9974. Do not use it without fully understanding the implications of its use.
  9975. @end table
  9976. @anchor{hwupload}
  9977. @section hwupload
  9978. Upload system memory frames to hardware surfaces.
  9979. The device to upload to must be supplied when the filter is initialised. If
  9980. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9981. option or with the @option{derive_device} option. The input and output devices
  9982. must be of different types and compatible - the exact meaning of this is
  9983. system-dependent, but typically it means that they must refer to the same
  9984. underlying hardware context (for example, refer to the same graphics card).
  9985. The following additional parameters are accepted:
  9986. @table @option
  9987. @item derive_device @var{type}
  9988. Rather than using the device supplied at initialisation, instead derive a new
  9989. device of type @var{type} from the device the input frames exist on.
  9990. @end table
  9991. @anchor{hwupload_cuda}
  9992. @section hwupload_cuda
  9993. Upload system memory frames to a CUDA device.
  9994. It accepts the following optional parameters:
  9995. @table @option
  9996. @item device
  9997. The number of the CUDA device to use
  9998. @end table
  9999. @section hqx
  10000. Apply a high-quality magnification filter designed for pixel art. This filter
  10001. was originally created by Maxim Stepin.
  10002. It accepts the following option:
  10003. @table @option
  10004. @item n
  10005. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  10006. @code{hq3x} and @code{4} for @code{hq4x}.
  10007. Default is @code{3}.
  10008. @end table
  10009. @section hstack
  10010. Stack input videos horizontally.
  10011. All streams must be of same pixel format and of same height.
  10012. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10013. to create same output.
  10014. The filter accepts the following option:
  10015. @table @option
  10016. @item inputs
  10017. Set number of input streams. Default is 2.
  10018. @item shortest
  10019. If set to 1, force the output to terminate when the shortest input
  10020. terminates. Default value is 0.
  10021. @end table
  10022. @section hue
  10023. Modify the hue and/or the saturation of the input.
  10024. It accepts the following parameters:
  10025. @table @option
  10026. @item h
  10027. Specify the hue angle as a number of degrees. It accepts an expression,
  10028. and defaults to "0".
  10029. @item s
  10030. Specify the saturation in the [-10,10] range. It accepts an expression and
  10031. defaults to "1".
  10032. @item H
  10033. Specify the hue angle as a number of radians. It accepts an
  10034. expression, and defaults to "0".
  10035. @item b
  10036. Specify the brightness in the [-10,10] range. It accepts an expression and
  10037. defaults to "0".
  10038. @end table
  10039. @option{h} and @option{H} are mutually exclusive, and can't be
  10040. specified at the same time.
  10041. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  10042. expressions containing the following constants:
  10043. @table @option
  10044. @item n
  10045. frame count of the input frame starting from 0
  10046. @item pts
  10047. presentation timestamp of the input frame expressed in time base units
  10048. @item r
  10049. frame rate of the input video, NAN if the input frame rate is unknown
  10050. @item t
  10051. timestamp expressed in seconds, NAN if the input timestamp is unknown
  10052. @item tb
  10053. time base of the input video
  10054. @end table
  10055. @subsection Examples
  10056. @itemize
  10057. @item
  10058. Set the hue to 90 degrees and the saturation to 1.0:
  10059. @example
  10060. hue=h=90:s=1
  10061. @end example
  10062. @item
  10063. Same command but expressing the hue in radians:
  10064. @example
  10065. hue=H=PI/2:s=1
  10066. @end example
  10067. @item
  10068. Rotate hue and make the saturation swing between 0
  10069. and 2 over a period of 1 second:
  10070. @example
  10071. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  10072. @end example
  10073. @item
  10074. Apply a 3 seconds saturation fade-in effect starting at 0:
  10075. @example
  10076. hue="s=min(t/3\,1)"
  10077. @end example
  10078. The general fade-in expression can be written as:
  10079. @example
  10080. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  10081. @end example
  10082. @item
  10083. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  10084. @example
  10085. hue="s=max(0\, min(1\, (8-t)/3))"
  10086. @end example
  10087. The general fade-out expression can be written as:
  10088. @example
  10089. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  10090. @end example
  10091. @end itemize
  10092. @subsection Commands
  10093. This filter supports the following commands:
  10094. @table @option
  10095. @item b
  10096. @item s
  10097. @item h
  10098. @item H
  10099. Modify the hue and/or the saturation and/or brightness of the input video.
  10100. The command accepts the same syntax of the corresponding option.
  10101. If the specified expression is not valid, it is kept at its current
  10102. value.
  10103. @end table
  10104. @section hysteresis
  10105. Grow first stream into second stream by connecting components.
  10106. This makes it possible to build more robust edge masks.
  10107. This filter accepts the following options:
  10108. @table @option
  10109. @item planes
  10110. Set which planes will be processed as bitmap, unprocessed planes will be
  10111. copied from first stream.
  10112. By default value 0xf, all planes will be processed.
  10113. @item threshold
  10114. Set threshold which is used in filtering. If pixel component value is higher than
  10115. this value filter algorithm for connecting components is activated.
  10116. By default value is 0.
  10117. @end table
  10118. The @code{hysteresis} filter also supports the @ref{framesync} options.
  10119. @section idet
  10120. Detect video interlacing type.
  10121. This filter tries to detect if the input frames are interlaced, progressive,
  10122. top or bottom field first. It will also try to detect fields that are
  10123. repeated between adjacent frames (a sign of telecine).
  10124. Single frame detection considers only immediately adjacent frames when classifying each frame.
  10125. Multiple frame detection incorporates the classification history of previous frames.
  10126. The filter will log these metadata values:
  10127. @table @option
  10128. @item single.current_frame
  10129. Detected type of current frame using single-frame detection. One of:
  10130. ``tff'' (top field first), ``bff'' (bottom field first),
  10131. ``progressive'', or ``undetermined''
  10132. @item single.tff
  10133. Cumulative number of frames detected as top field first using single-frame detection.
  10134. @item multiple.tff
  10135. Cumulative number of frames detected as top field first using multiple-frame detection.
  10136. @item single.bff
  10137. Cumulative number of frames detected as bottom field first using single-frame detection.
  10138. @item multiple.current_frame
  10139. Detected type of current frame using multiple-frame detection. One of:
  10140. ``tff'' (top field first), ``bff'' (bottom field first),
  10141. ``progressive'', or ``undetermined''
  10142. @item multiple.bff
  10143. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  10144. @item single.progressive
  10145. Cumulative number of frames detected as progressive using single-frame detection.
  10146. @item multiple.progressive
  10147. Cumulative number of frames detected as progressive using multiple-frame detection.
  10148. @item single.undetermined
  10149. Cumulative number of frames that could not be classified using single-frame detection.
  10150. @item multiple.undetermined
  10151. Cumulative number of frames that could not be classified using multiple-frame detection.
  10152. @item repeated.current_frame
  10153. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  10154. @item repeated.neither
  10155. Cumulative number of frames with no repeated field.
  10156. @item repeated.top
  10157. Cumulative number of frames with the top field repeated from the previous frame's top field.
  10158. @item repeated.bottom
  10159. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  10160. @end table
  10161. The filter accepts the following options:
  10162. @table @option
  10163. @item intl_thres
  10164. Set interlacing threshold.
  10165. @item prog_thres
  10166. Set progressive threshold.
  10167. @item rep_thres
  10168. Threshold for repeated field detection.
  10169. @item half_life
  10170. Number of frames after which a given frame's contribution to the
  10171. statistics is halved (i.e., it contributes only 0.5 to its
  10172. classification). The default of 0 means that all frames seen are given
  10173. full weight of 1.0 forever.
  10174. @item analyze_interlaced_flag
  10175. When this is not 0 then idet will use the specified number of frames to determine
  10176. if the interlaced flag is accurate, it will not count undetermined frames.
  10177. If the flag is found to be accurate it will be used without any further
  10178. computations, if it is found to be inaccurate it will be cleared without any
  10179. further computations. This allows inserting the idet filter as a low computational
  10180. method to clean up the interlaced flag
  10181. @end table
  10182. @section il
  10183. Deinterleave or interleave fields.
  10184. This filter allows one to process interlaced images fields without
  10185. deinterlacing them. Deinterleaving splits the input frame into 2
  10186. fields (so called half pictures). Odd lines are moved to the top
  10187. half of the output image, even lines to the bottom half.
  10188. You can process (filter) them independently and then re-interleave them.
  10189. The filter accepts the following options:
  10190. @table @option
  10191. @item luma_mode, l
  10192. @item chroma_mode, c
  10193. @item alpha_mode, a
  10194. Available values for @var{luma_mode}, @var{chroma_mode} and
  10195. @var{alpha_mode} are:
  10196. @table @samp
  10197. @item none
  10198. Do nothing.
  10199. @item deinterleave, d
  10200. Deinterleave fields, placing one above the other.
  10201. @item interleave, i
  10202. Interleave fields. Reverse the effect of deinterleaving.
  10203. @end table
  10204. Default value is @code{none}.
  10205. @item luma_swap, ls
  10206. @item chroma_swap, cs
  10207. @item alpha_swap, as
  10208. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  10209. @end table
  10210. @subsection Commands
  10211. This filter supports the all above options as @ref{commands}.
  10212. @section inflate
  10213. Apply inflate effect to the video.
  10214. This filter replaces the pixel by the local(3x3) average by taking into account
  10215. only values higher than the pixel.
  10216. It accepts the following options:
  10217. @table @option
  10218. @item threshold0
  10219. @item threshold1
  10220. @item threshold2
  10221. @item threshold3
  10222. Limit the maximum change for each plane, default is 65535.
  10223. If 0, plane will remain unchanged.
  10224. @end table
  10225. @subsection Commands
  10226. This filter supports the all above options as @ref{commands}.
  10227. @section interlace
  10228. Simple interlacing filter from progressive contents. This interleaves upper (or
  10229. lower) lines from odd frames with lower (or upper) lines from even frames,
  10230. halving the frame rate and preserving image height.
  10231. @example
  10232. Original Original New Frame
  10233. Frame 'j' Frame 'j+1' (tff)
  10234. ========== =========== ==================
  10235. Line 0 --------------------> Frame 'j' Line 0
  10236. Line 1 Line 1 ----> Frame 'j+1' Line 1
  10237. Line 2 ---------------------> Frame 'j' Line 2
  10238. Line 3 Line 3 ----> Frame 'j+1' Line 3
  10239. ... ... ...
  10240. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  10241. @end example
  10242. It accepts the following optional parameters:
  10243. @table @option
  10244. @item scan
  10245. This determines whether the interlaced frame is taken from the even
  10246. (tff - default) or odd (bff) lines of the progressive frame.
  10247. @item lowpass
  10248. Vertical lowpass filter to avoid twitter interlacing and
  10249. reduce moire patterns.
  10250. @table @samp
  10251. @item 0, off
  10252. Disable vertical lowpass filter
  10253. @item 1, linear
  10254. Enable linear filter (default)
  10255. @item 2, complex
  10256. Enable complex filter. This will slightly less reduce twitter and moire
  10257. but better retain detail and subjective sharpness impression.
  10258. @end table
  10259. @end table
  10260. @section kerndeint
  10261. Deinterlace input video by applying Donald Graft's adaptive kernel
  10262. deinterling. Work on interlaced parts of a video to produce
  10263. progressive frames.
  10264. The description of the accepted parameters follows.
  10265. @table @option
  10266. @item thresh
  10267. Set the threshold which affects the filter's tolerance when
  10268. determining if a pixel line must be processed. It must be an integer
  10269. in the range [0,255] and defaults to 10. A value of 0 will result in
  10270. applying the process on every pixels.
  10271. @item map
  10272. Paint pixels exceeding the threshold value to white if set to 1.
  10273. Default is 0.
  10274. @item order
  10275. Set the fields order. Swap fields if set to 1, leave fields alone if
  10276. 0. Default is 0.
  10277. @item sharp
  10278. Enable additional sharpening if set to 1. Default is 0.
  10279. @item twoway
  10280. Enable twoway sharpening if set to 1. Default is 0.
  10281. @end table
  10282. @subsection Examples
  10283. @itemize
  10284. @item
  10285. Apply default values:
  10286. @example
  10287. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  10288. @end example
  10289. @item
  10290. Enable additional sharpening:
  10291. @example
  10292. kerndeint=sharp=1
  10293. @end example
  10294. @item
  10295. Paint processed pixels in white:
  10296. @example
  10297. kerndeint=map=1
  10298. @end example
  10299. @end itemize
  10300. @section kirsch
  10301. Apply kirsch operator to input video stream.
  10302. The filter accepts the following option:
  10303. @table @option
  10304. @item planes
  10305. Set which planes will be processed, unprocessed planes will be copied.
  10306. By default value 0xf, all planes will be processed.
  10307. @item scale
  10308. Set value which will be multiplied with filtered result.
  10309. @item delta
  10310. Set value which will be added to filtered result.
  10311. @end table
  10312. @subsection Commands
  10313. This filter supports the all above options as @ref{commands}.
  10314. @section lagfun
  10315. Slowly update darker pixels.
  10316. This filter makes short flashes of light appear longer.
  10317. This filter accepts the following options:
  10318. @table @option
  10319. @item decay
  10320. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  10321. @item planes
  10322. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  10323. @end table
  10324. @subsection Commands
  10325. This filter supports the all above options as @ref{commands}.
  10326. @section lenscorrection
  10327. Correct radial lens distortion
  10328. This filter can be used to correct for radial distortion as can result from the use
  10329. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  10330. one can use tools available for example as part of opencv or simply trial-and-error.
  10331. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  10332. and extract the k1 and k2 coefficients from the resulting matrix.
  10333. Note that effectively the same filter is available in the open-source tools Krita and
  10334. Digikam from the KDE project.
  10335. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  10336. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  10337. brightness distribution, so you may want to use both filters together in certain
  10338. cases, though you will have to take care of ordering, i.e. whether vignetting should
  10339. be applied before or after lens correction.
  10340. @subsection Options
  10341. The filter accepts the following options:
  10342. @table @option
  10343. @item cx
  10344. Relative x-coordinate of the focal point of the image, and thereby the center of the
  10345. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10346. width. Default is 0.5.
  10347. @item cy
  10348. Relative y-coordinate of the focal point of the image, and thereby the center of the
  10349. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10350. height. Default is 0.5.
  10351. @item k1
  10352. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  10353. no correction. Default is 0.
  10354. @item k2
  10355. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  10356. 0 means no correction. Default is 0.
  10357. @item i
  10358. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  10359. Default is @code{nearest}.
  10360. @item fc
  10361. Specify the color of the unmapped pixels. For the syntax of this option,
  10362. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10363. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  10364. @end table
  10365. The formula that generates the correction is:
  10366. @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)
  10367. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  10368. distances from the focal point in the source and target images, respectively.
  10369. @subsection Commands
  10370. This filter supports the all above options as @ref{commands}.
  10371. @section lensfun
  10372. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  10373. The @code{lensfun} filter requires the camera make, camera model, and lens model
  10374. to apply the lens correction. The filter will load the lensfun database and
  10375. query it to find the corresponding camera and lens entries in the database. As
  10376. long as these entries can be found with the given options, the filter can
  10377. perform corrections on frames. Note that incomplete strings will result in the
  10378. filter choosing the best match with the given options, and the filter will
  10379. output the chosen camera and lens models (logged with level "info"). You must
  10380. provide the make, camera model, and lens model as they are required.
  10381. The filter accepts the following options:
  10382. @table @option
  10383. @item make
  10384. The make of the camera (for example, "Canon"). This option is required.
  10385. @item model
  10386. The model of the camera (for example, "Canon EOS 100D"). This option is
  10387. required.
  10388. @item lens_model
  10389. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  10390. option is required.
  10391. @item mode
  10392. The type of correction to apply. The following values are valid options:
  10393. @table @samp
  10394. @item vignetting
  10395. Enables fixing lens vignetting.
  10396. @item geometry
  10397. Enables fixing lens geometry. This is the default.
  10398. @item subpixel
  10399. Enables fixing chromatic aberrations.
  10400. @item vig_geo
  10401. Enables fixing lens vignetting and lens geometry.
  10402. @item vig_subpixel
  10403. Enables fixing lens vignetting and chromatic aberrations.
  10404. @item distortion
  10405. Enables fixing both lens geometry and chromatic aberrations.
  10406. @item all
  10407. Enables all possible corrections.
  10408. @end table
  10409. @item focal_length
  10410. The focal length of the image/video (zoom; expected constant for video). For
  10411. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  10412. range should be chosen when using that lens. Default 18.
  10413. @item aperture
  10414. The aperture of the image/video (expected constant for video). Note that
  10415. aperture is only used for vignetting correction. Default 3.5.
  10416. @item focus_distance
  10417. The focus distance of the image/video (expected constant for video). Note that
  10418. focus distance is only used for vignetting and only slightly affects the
  10419. vignetting correction process. If unknown, leave it at the default value (which
  10420. is 1000).
  10421. @item scale
  10422. The scale factor which is applied after transformation. After correction the
  10423. video is no longer necessarily rectangular. This parameter controls how much of
  10424. the resulting image is visible. The value 0 means that a value will be chosen
  10425. automatically such that there is little or no unmapped area in the output
  10426. image. 1.0 means that no additional scaling is done. Lower values may result
  10427. in more of the corrected image being visible, while higher values may avoid
  10428. unmapped areas in the output.
  10429. @item target_geometry
  10430. The target geometry of the output image/video. The following values are valid
  10431. options:
  10432. @table @samp
  10433. @item rectilinear (default)
  10434. @item fisheye
  10435. @item panoramic
  10436. @item equirectangular
  10437. @item fisheye_orthographic
  10438. @item fisheye_stereographic
  10439. @item fisheye_equisolid
  10440. @item fisheye_thoby
  10441. @end table
  10442. @item reverse
  10443. Apply the reverse of image correction (instead of correcting distortion, apply
  10444. it).
  10445. @item interpolation
  10446. The type of interpolation used when correcting distortion. The following values
  10447. are valid options:
  10448. @table @samp
  10449. @item nearest
  10450. @item linear (default)
  10451. @item lanczos
  10452. @end table
  10453. @end table
  10454. @subsection Examples
  10455. @itemize
  10456. @item
  10457. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  10458. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  10459. aperture of "8.0".
  10460. @example
  10461. 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
  10462. @end example
  10463. @item
  10464. Apply the same as before, but only for the first 5 seconds of video.
  10465. @example
  10466. 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
  10467. @end example
  10468. @end itemize
  10469. @section libvmaf
  10470. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  10471. score between two input videos.
  10472. The obtained VMAF score is printed through the logging system.
  10473. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  10474. After installing the library it can be enabled using:
  10475. @code{./configure --enable-libvmaf}.
  10476. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  10477. The filter has following options:
  10478. @table @option
  10479. @item model_path
  10480. Set the model path which is to be used for SVM.
  10481. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  10482. @item log_path
  10483. Set the file path to be used to store logs.
  10484. @item log_fmt
  10485. Set the format of the log file (csv, json or xml).
  10486. @item enable_transform
  10487. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  10488. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  10489. Default value: @code{false}
  10490. @item phone_model
  10491. Invokes the phone model which will generate VMAF scores higher than in the
  10492. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  10493. Default value: @code{false}
  10494. @item psnr
  10495. Enables computing psnr along with vmaf.
  10496. Default value: @code{false}
  10497. @item ssim
  10498. Enables computing ssim along with vmaf.
  10499. Default value: @code{false}
  10500. @item ms_ssim
  10501. Enables computing ms_ssim along with vmaf.
  10502. Default value: @code{false}
  10503. @item pool
  10504. Set the pool method to be used for computing vmaf.
  10505. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  10506. @item n_threads
  10507. Set number of threads to be used when computing vmaf.
  10508. Default value: @code{0}, which makes use of all available logical processors.
  10509. @item n_subsample
  10510. Set interval for frame subsampling used when computing vmaf.
  10511. Default value: @code{1}
  10512. @item enable_conf_interval
  10513. Enables confidence interval.
  10514. Default value: @code{false}
  10515. @end table
  10516. This filter also supports the @ref{framesync} options.
  10517. @subsection Examples
  10518. @itemize
  10519. @item
  10520. On the below examples the input file @file{main.mpg} being processed is
  10521. compared with the reference file @file{ref.mpg}.
  10522. @example
  10523. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  10524. @end example
  10525. @item
  10526. Example with options:
  10527. @example
  10528. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  10529. @end example
  10530. @item
  10531. Example with options and different containers:
  10532. @example
  10533. 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 -
  10534. @end example
  10535. @end itemize
  10536. @section limiter
  10537. Limits the pixel components values to the specified range [min, max].
  10538. The filter accepts the following options:
  10539. @table @option
  10540. @item min
  10541. Lower bound. Defaults to the lowest allowed value for the input.
  10542. @item max
  10543. Upper bound. Defaults to the highest allowed value for the input.
  10544. @item planes
  10545. Specify which planes will be processed. Defaults to all available.
  10546. @end table
  10547. @subsection Commands
  10548. This filter supports the all above options as @ref{commands}.
  10549. @section loop
  10550. Loop video frames.
  10551. The filter accepts the following options:
  10552. @table @option
  10553. @item loop
  10554. Set the number of loops. Setting this value to -1 will result in infinite loops.
  10555. Default is 0.
  10556. @item size
  10557. Set maximal size in number of frames. Default is 0.
  10558. @item start
  10559. Set first frame of loop. Default is 0.
  10560. @end table
  10561. @subsection Examples
  10562. @itemize
  10563. @item
  10564. Loop single first frame infinitely:
  10565. @example
  10566. loop=loop=-1:size=1:start=0
  10567. @end example
  10568. @item
  10569. Loop single first frame 10 times:
  10570. @example
  10571. loop=loop=10:size=1:start=0
  10572. @end example
  10573. @item
  10574. Loop 10 first frames 5 times:
  10575. @example
  10576. loop=loop=5:size=10:start=0
  10577. @end example
  10578. @end itemize
  10579. @section lut1d
  10580. Apply a 1D LUT to an input video.
  10581. The filter accepts the following options:
  10582. @table @option
  10583. @item file
  10584. Set the 1D LUT file name.
  10585. Currently supported formats:
  10586. @table @samp
  10587. @item cube
  10588. Iridas
  10589. @item csp
  10590. cineSpace
  10591. @end table
  10592. @item interp
  10593. Select interpolation mode.
  10594. Available values are:
  10595. @table @samp
  10596. @item nearest
  10597. Use values from the nearest defined point.
  10598. @item linear
  10599. Interpolate values using the linear interpolation.
  10600. @item cosine
  10601. Interpolate values using the cosine interpolation.
  10602. @item cubic
  10603. Interpolate values using the cubic interpolation.
  10604. @item spline
  10605. Interpolate values using the spline interpolation.
  10606. @end table
  10607. @end table
  10608. @anchor{lut3d}
  10609. @section lut3d
  10610. Apply a 3D LUT to an input video.
  10611. The filter accepts the following options:
  10612. @table @option
  10613. @item file
  10614. Set the 3D LUT file name.
  10615. Currently supported formats:
  10616. @table @samp
  10617. @item 3dl
  10618. AfterEffects
  10619. @item cube
  10620. Iridas
  10621. @item dat
  10622. DaVinci
  10623. @item m3d
  10624. Pandora
  10625. @item csp
  10626. cineSpace
  10627. @end table
  10628. @item interp
  10629. Select interpolation mode.
  10630. Available values are:
  10631. @table @samp
  10632. @item nearest
  10633. Use values from the nearest defined point.
  10634. @item trilinear
  10635. Interpolate values using the 8 points defining a cube.
  10636. @item tetrahedral
  10637. Interpolate values using a tetrahedron.
  10638. @item pyramid
  10639. Interpolate values using a pyramid.
  10640. @item prism
  10641. Interpolate values using a prism.
  10642. @end table
  10643. @end table
  10644. @section lumakey
  10645. Turn certain luma values into transparency.
  10646. The filter accepts the following options:
  10647. @table @option
  10648. @item threshold
  10649. Set the luma which will be used as base for transparency.
  10650. Default value is @code{0}.
  10651. @item tolerance
  10652. Set the range of luma values to be keyed out.
  10653. Default value is @code{0.01}.
  10654. @item softness
  10655. Set the range of softness. Default value is @code{0}.
  10656. Use this to control gradual transition from zero to full transparency.
  10657. @end table
  10658. @subsection Commands
  10659. This filter supports same @ref{commands} as options.
  10660. The command accepts the same syntax of the corresponding option.
  10661. If the specified expression is not valid, it is kept at its current
  10662. value.
  10663. @section lut, lutrgb, lutyuv
  10664. Compute a look-up table for binding each pixel component input value
  10665. to an output value, and apply it to the input video.
  10666. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10667. to an RGB input video.
  10668. These filters accept the following parameters:
  10669. @table @option
  10670. @item c0
  10671. set first pixel component expression
  10672. @item c1
  10673. set second pixel component expression
  10674. @item c2
  10675. set third pixel component expression
  10676. @item c3
  10677. set fourth pixel component expression, corresponds to the alpha component
  10678. @item r
  10679. set red component expression
  10680. @item g
  10681. set green component expression
  10682. @item b
  10683. set blue component expression
  10684. @item a
  10685. alpha component expression
  10686. @item y
  10687. set Y/luminance component expression
  10688. @item u
  10689. set U/Cb component expression
  10690. @item v
  10691. set V/Cr component expression
  10692. @end table
  10693. Each of them specifies the expression to use for computing the lookup table for
  10694. the corresponding pixel component values.
  10695. The exact component associated to each of the @var{c*} options depends on the
  10696. format in input.
  10697. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10698. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10699. The expressions can contain the following constants and functions:
  10700. @table @option
  10701. @item w
  10702. @item h
  10703. The input width and height.
  10704. @item val
  10705. The input value for the pixel component.
  10706. @item clipval
  10707. The input value, clipped to the @var{minval}-@var{maxval} range.
  10708. @item maxval
  10709. The maximum value for the pixel component.
  10710. @item minval
  10711. The minimum value for the pixel component.
  10712. @item negval
  10713. The negated value for the pixel component value, clipped to the
  10714. @var{minval}-@var{maxval} range; it corresponds to the expression
  10715. "maxval-clipval+minval".
  10716. @item clip(val)
  10717. The computed value in @var{val}, clipped to the
  10718. @var{minval}-@var{maxval} range.
  10719. @item gammaval(gamma)
  10720. The computed gamma correction value of the pixel component value,
  10721. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10722. expression
  10723. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10724. @end table
  10725. All expressions default to "val".
  10726. @subsection Examples
  10727. @itemize
  10728. @item
  10729. Negate input video:
  10730. @example
  10731. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10732. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10733. @end example
  10734. The above is the same as:
  10735. @example
  10736. lutrgb="r=negval:g=negval:b=negval"
  10737. lutyuv="y=negval:u=negval:v=negval"
  10738. @end example
  10739. @item
  10740. Negate luminance:
  10741. @example
  10742. lutyuv=y=negval
  10743. @end example
  10744. @item
  10745. Remove chroma components, turning the video into a graytone image:
  10746. @example
  10747. lutyuv="u=128:v=128"
  10748. @end example
  10749. @item
  10750. Apply a luma burning effect:
  10751. @example
  10752. lutyuv="y=2*val"
  10753. @end example
  10754. @item
  10755. Remove green and blue components:
  10756. @example
  10757. lutrgb="g=0:b=0"
  10758. @end example
  10759. @item
  10760. Set a constant alpha channel value on input:
  10761. @example
  10762. format=rgba,lutrgb=a="maxval-minval/2"
  10763. @end example
  10764. @item
  10765. Correct luminance gamma by a factor of 0.5:
  10766. @example
  10767. lutyuv=y=gammaval(0.5)
  10768. @end example
  10769. @item
  10770. Discard least significant bits of luma:
  10771. @example
  10772. lutyuv=y='bitand(val, 128+64+32)'
  10773. @end example
  10774. @item
  10775. Technicolor like effect:
  10776. @example
  10777. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10778. @end example
  10779. @end itemize
  10780. @section lut2, tlut2
  10781. The @code{lut2} filter takes two input streams and outputs one
  10782. stream.
  10783. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10784. from one single stream.
  10785. This filter accepts the following parameters:
  10786. @table @option
  10787. @item c0
  10788. set first pixel component expression
  10789. @item c1
  10790. set second pixel component expression
  10791. @item c2
  10792. set third pixel component expression
  10793. @item c3
  10794. set fourth pixel component expression, corresponds to the alpha component
  10795. @item d
  10796. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10797. which means bit depth is automatically picked from first input format.
  10798. @end table
  10799. The @code{lut2} filter also supports the @ref{framesync} options.
  10800. Each of them specifies the expression to use for computing the lookup table for
  10801. the corresponding pixel component values.
  10802. The exact component associated to each of the @var{c*} options depends on the
  10803. format in inputs.
  10804. The expressions can contain the following constants:
  10805. @table @option
  10806. @item w
  10807. @item h
  10808. The input width and height.
  10809. @item x
  10810. The first input value for the pixel component.
  10811. @item y
  10812. The second input value for the pixel component.
  10813. @item bdx
  10814. The first input video bit depth.
  10815. @item bdy
  10816. The second input video bit depth.
  10817. @end table
  10818. All expressions default to "x".
  10819. @subsection Examples
  10820. @itemize
  10821. @item
  10822. Highlight differences between two RGB video streams:
  10823. @example
  10824. 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)'
  10825. @end example
  10826. @item
  10827. Highlight differences between two YUV video streams:
  10828. @example
  10829. 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)'
  10830. @end example
  10831. @item
  10832. Show max difference between two video streams:
  10833. @example
  10834. 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)))'
  10835. @end example
  10836. @end itemize
  10837. @section maskedclamp
  10838. Clamp the first input stream with the second input and third input stream.
  10839. Returns the value of first stream to be between second input
  10840. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10841. This filter accepts the following options:
  10842. @table @option
  10843. @item undershoot
  10844. Default value is @code{0}.
  10845. @item overshoot
  10846. Default value is @code{0}.
  10847. @item planes
  10848. Set which planes will be processed as bitmap, unprocessed planes will be
  10849. copied from first stream.
  10850. By default value 0xf, all planes will be processed.
  10851. @end table
  10852. @subsection Commands
  10853. This filter supports the all above options as @ref{commands}.
  10854. @section maskedmax
  10855. Merge the second and third input stream into output stream using absolute differences
  10856. between second input stream and first input stream and absolute difference between
  10857. third input stream and first input stream. The picked value will be from second input
  10858. stream if second absolute difference is greater than first one or from third input stream
  10859. otherwise.
  10860. This filter accepts the following options:
  10861. @table @option
  10862. @item planes
  10863. Set which planes will be processed as bitmap, unprocessed planes will be
  10864. copied from first stream.
  10865. By default value 0xf, all planes will be processed.
  10866. @end table
  10867. @subsection Commands
  10868. This filter supports the all above options as @ref{commands}.
  10869. @section maskedmerge
  10870. Merge the first input stream with the second input stream using per pixel
  10871. weights in the third input stream.
  10872. A value of 0 in the third stream pixel component means that pixel component
  10873. from first stream is returned unchanged, while maximum value (eg. 255 for
  10874. 8-bit videos) means that pixel component from second stream is returned
  10875. unchanged. Intermediate values define the amount of merging between both
  10876. input stream's pixel components.
  10877. This filter accepts the following options:
  10878. @table @option
  10879. @item planes
  10880. Set which planes will be processed as bitmap, unprocessed planes will be
  10881. copied from first stream.
  10882. By default value 0xf, all planes will be processed.
  10883. @end table
  10884. @subsection Commands
  10885. This filter supports the all above options as @ref{commands}.
  10886. @section maskedmin
  10887. Merge the second and third input stream into output stream using absolute differences
  10888. between second input stream and first input stream and absolute difference between
  10889. third input stream and first input stream. The picked value will be from second input
  10890. stream if second absolute difference is less than first one or from third input stream
  10891. otherwise.
  10892. This filter accepts the following options:
  10893. @table @option
  10894. @item planes
  10895. Set which planes will be processed as bitmap, unprocessed planes will be
  10896. copied from first stream.
  10897. By default value 0xf, all planes will be processed.
  10898. @end table
  10899. @subsection Commands
  10900. This filter supports the all above options as @ref{commands}.
  10901. @section maskedthreshold
  10902. Pick pixels comparing absolute difference of two video streams with fixed
  10903. threshold.
  10904. If absolute difference between pixel component of first and second video
  10905. stream is equal or lower than user supplied threshold than pixel component
  10906. from first video stream is picked, otherwise pixel component from second
  10907. video stream is picked.
  10908. This filter accepts the following options:
  10909. @table @option
  10910. @item threshold
  10911. Set threshold used when picking pixels from absolute difference from two input
  10912. video streams.
  10913. @item planes
  10914. Set which planes will be processed as bitmap, unprocessed planes will be
  10915. copied from second stream.
  10916. By default value 0xf, all planes will be processed.
  10917. @end table
  10918. @subsection Commands
  10919. This filter supports the all above options as @ref{commands}.
  10920. @section maskfun
  10921. Create mask from input video.
  10922. For example it is useful to create motion masks after @code{tblend} filter.
  10923. This filter accepts the following options:
  10924. @table @option
  10925. @item low
  10926. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10927. @item high
  10928. Set high threshold. Any pixel component higher than this value will be set to max value
  10929. allowed for current pixel format.
  10930. @item planes
  10931. Set planes to filter, by default all available planes are filtered.
  10932. @item fill
  10933. Fill all frame pixels with this value.
  10934. @item sum
  10935. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10936. average, output frame will be completely filled with value set by @var{fill} option.
  10937. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10938. @end table
  10939. @section mcdeint
  10940. Apply motion-compensation deinterlacing.
  10941. It needs one field per frame as input and must thus be used together
  10942. with yadif=1/3 or equivalent.
  10943. This filter accepts the following options:
  10944. @table @option
  10945. @item mode
  10946. Set the deinterlacing mode.
  10947. It accepts one of the following values:
  10948. @table @samp
  10949. @item fast
  10950. @item medium
  10951. @item slow
  10952. use iterative motion estimation
  10953. @item extra_slow
  10954. like @samp{slow}, but use multiple reference frames.
  10955. @end table
  10956. Default value is @samp{fast}.
  10957. @item parity
  10958. Set the picture field parity assumed for the input video. It must be
  10959. one of the following values:
  10960. @table @samp
  10961. @item 0, tff
  10962. assume top field first
  10963. @item 1, bff
  10964. assume bottom field first
  10965. @end table
  10966. Default value is @samp{bff}.
  10967. @item qp
  10968. Set per-block quantization parameter (QP) used by the internal
  10969. encoder.
  10970. Higher values should result in a smoother motion vector field but less
  10971. optimal individual vectors. Default value is 1.
  10972. @end table
  10973. @section median
  10974. Pick median pixel from certain rectangle defined by radius.
  10975. This filter accepts the following options:
  10976. @table @option
  10977. @item radius
  10978. Set horizontal radius size. Default value is @code{1}.
  10979. Allowed range is integer from 1 to 127.
  10980. @item planes
  10981. Set which planes to process. Default is @code{15}, which is all available planes.
  10982. @item radiusV
  10983. Set vertical radius size. Default value is @code{0}.
  10984. Allowed range is integer from 0 to 127.
  10985. If it is 0, value will be picked from horizontal @code{radius} option.
  10986. @item percentile
  10987. Set median percentile. Default value is @code{0.5}.
  10988. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10989. minimum values, and @code{1} maximum values.
  10990. @end table
  10991. @subsection Commands
  10992. This filter supports same @ref{commands} as options.
  10993. The command accepts the same syntax of the corresponding option.
  10994. If the specified expression is not valid, it is kept at its current
  10995. value.
  10996. @section mergeplanes
  10997. Merge color channel components from several video streams.
  10998. The filter accepts up to 4 input streams, and merge selected input
  10999. planes to the output video.
  11000. This filter accepts the following options:
  11001. @table @option
  11002. @item mapping
  11003. Set input to output plane mapping. Default is @code{0}.
  11004. The mappings is specified as a bitmap. It should be specified as a
  11005. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  11006. mapping for the first plane of the output stream. 'A' sets the number of
  11007. the input stream to use (from 0 to 3), and 'a' the plane number of the
  11008. corresponding input to use (from 0 to 3). The rest of the mappings is
  11009. similar, 'Bb' describes the mapping for the output stream second
  11010. plane, 'Cc' describes the mapping for the output stream third plane and
  11011. 'Dd' describes the mapping for the output stream fourth plane.
  11012. @item format
  11013. Set output pixel format. Default is @code{yuva444p}.
  11014. @end table
  11015. @subsection Examples
  11016. @itemize
  11017. @item
  11018. Merge three gray video streams of same width and height into single video stream:
  11019. @example
  11020. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  11021. @end example
  11022. @item
  11023. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  11024. @example
  11025. [a0][a1]mergeplanes=0x00010210:yuva444p
  11026. @end example
  11027. @item
  11028. Swap Y and A plane in yuva444p stream:
  11029. @example
  11030. format=yuva444p,mergeplanes=0x03010200:yuva444p
  11031. @end example
  11032. @item
  11033. Swap U and V plane in yuv420p stream:
  11034. @example
  11035. format=yuv420p,mergeplanes=0x000201:yuv420p
  11036. @end example
  11037. @item
  11038. Cast a rgb24 clip to yuv444p:
  11039. @example
  11040. format=rgb24,mergeplanes=0x000102:yuv444p
  11041. @end example
  11042. @end itemize
  11043. @section mestimate
  11044. Estimate and export motion vectors using block matching algorithms.
  11045. Motion vectors are stored in frame side data to be used by other filters.
  11046. This filter accepts the following options:
  11047. @table @option
  11048. @item method
  11049. Specify the motion estimation method. Accepts one of the following values:
  11050. @table @samp
  11051. @item esa
  11052. Exhaustive search algorithm.
  11053. @item tss
  11054. Three step search algorithm.
  11055. @item tdls
  11056. Two dimensional logarithmic search algorithm.
  11057. @item ntss
  11058. New three step search algorithm.
  11059. @item fss
  11060. Four step search algorithm.
  11061. @item ds
  11062. Diamond search algorithm.
  11063. @item hexbs
  11064. Hexagon-based search algorithm.
  11065. @item epzs
  11066. Enhanced predictive zonal search algorithm.
  11067. @item umh
  11068. Uneven multi-hexagon search algorithm.
  11069. @end table
  11070. Default value is @samp{esa}.
  11071. @item mb_size
  11072. Macroblock size. Default @code{16}.
  11073. @item search_param
  11074. Search parameter. Default @code{7}.
  11075. @end table
  11076. @section midequalizer
  11077. Apply Midway Image Equalization effect using two video streams.
  11078. Midway Image Equalization adjusts a pair of images to have the same
  11079. histogram, while maintaining their dynamics as much as possible. It's
  11080. useful for e.g. matching exposures from a pair of stereo cameras.
  11081. This filter has two inputs and one output, which must be of same pixel format, but
  11082. may be of different sizes. The output of filter is first input adjusted with
  11083. midway histogram of both inputs.
  11084. This filter accepts the following option:
  11085. @table @option
  11086. @item planes
  11087. Set which planes to process. Default is @code{15}, which is all available planes.
  11088. @end table
  11089. @section minterpolate
  11090. Convert the video to specified frame rate using motion interpolation.
  11091. This filter accepts the following options:
  11092. @table @option
  11093. @item fps
  11094. 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}.
  11095. @item mi_mode
  11096. Motion interpolation mode. Following values are accepted:
  11097. @table @samp
  11098. @item dup
  11099. Duplicate previous or next frame for interpolating new ones.
  11100. @item blend
  11101. Blend source frames. Interpolated frame is mean of previous and next frames.
  11102. @item mci
  11103. Motion compensated interpolation. Following options are effective when this mode is selected:
  11104. @table @samp
  11105. @item mc_mode
  11106. Motion compensation mode. Following values are accepted:
  11107. @table @samp
  11108. @item obmc
  11109. Overlapped block motion compensation.
  11110. @item aobmc
  11111. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  11112. @end table
  11113. Default mode is @samp{obmc}.
  11114. @item me_mode
  11115. Motion estimation mode. Following values are accepted:
  11116. @table @samp
  11117. @item bidir
  11118. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  11119. @item bilat
  11120. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  11121. @end table
  11122. Default mode is @samp{bilat}.
  11123. @item me
  11124. The algorithm to be used for motion estimation. Following values are accepted:
  11125. @table @samp
  11126. @item esa
  11127. Exhaustive search algorithm.
  11128. @item tss
  11129. Three step search algorithm.
  11130. @item tdls
  11131. Two dimensional logarithmic search algorithm.
  11132. @item ntss
  11133. New three step search algorithm.
  11134. @item fss
  11135. Four step search algorithm.
  11136. @item ds
  11137. Diamond search algorithm.
  11138. @item hexbs
  11139. Hexagon-based search algorithm.
  11140. @item epzs
  11141. Enhanced predictive zonal search algorithm.
  11142. @item umh
  11143. Uneven multi-hexagon search algorithm.
  11144. @end table
  11145. Default algorithm is @samp{epzs}.
  11146. @item mb_size
  11147. Macroblock size. Default @code{16}.
  11148. @item search_param
  11149. Motion estimation search parameter. Default @code{32}.
  11150. @item vsbmc
  11151. 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).
  11152. @end table
  11153. @end table
  11154. @item scd
  11155. 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:
  11156. @table @samp
  11157. @item none
  11158. Disable scene change detection.
  11159. @item fdiff
  11160. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  11161. @end table
  11162. Default method is @samp{fdiff}.
  11163. @item scd_threshold
  11164. Scene change detection threshold. Default is @code{10.}.
  11165. @end table
  11166. @section mix
  11167. Mix several video input streams into one video stream.
  11168. A description of the accepted options follows.
  11169. @table @option
  11170. @item nb_inputs
  11171. The number of inputs. If unspecified, it defaults to 2.
  11172. @item weights
  11173. Specify weight of each input video stream as sequence.
  11174. Each weight is separated by space. If number of weights
  11175. is smaller than number of @var{frames} last specified
  11176. weight will be used for all remaining unset weights.
  11177. @item scale
  11178. Specify scale, if it is set it will be multiplied with sum
  11179. of each weight multiplied with pixel values to give final destination
  11180. pixel value. By default @var{scale} is auto scaled to sum of weights.
  11181. @item duration
  11182. Specify how end of stream is determined.
  11183. @table @samp
  11184. @item longest
  11185. The duration of the longest input. (default)
  11186. @item shortest
  11187. The duration of the shortest input.
  11188. @item first
  11189. The duration of the first input.
  11190. @end table
  11191. @end table
  11192. @section mpdecimate
  11193. Drop frames that do not differ greatly from the previous frame in
  11194. order to reduce frame rate.
  11195. The main use of this filter is for very-low-bitrate encoding
  11196. (e.g. streaming over dialup modem), but it could in theory be used for
  11197. fixing movies that were inverse-telecined incorrectly.
  11198. A description of the accepted options follows.
  11199. @table @option
  11200. @item max
  11201. Set the maximum number of consecutive frames which can be dropped (if
  11202. positive), or the minimum interval between dropped frames (if
  11203. negative). If the value is 0, the frame is dropped disregarding the
  11204. number of previous sequentially dropped frames.
  11205. Default value is 0.
  11206. @item hi
  11207. @item lo
  11208. @item frac
  11209. Set the dropping threshold values.
  11210. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  11211. represent actual pixel value differences, so a threshold of 64
  11212. corresponds to 1 unit of difference for each pixel, or the same spread
  11213. out differently over the block.
  11214. A frame is a candidate for dropping if no 8x8 blocks differ by more
  11215. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  11216. meaning the whole image) differ by more than a threshold of @option{lo}.
  11217. Default value for @option{hi} is 64*12, default value for @option{lo} is
  11218. 64*5, and default value for @option{frac} is 0.33.
  11219. @end table
  11220. @section negate
  11221. Negate (invert) the input video.
  11222. It accepts the following option:
  11223. @table @option
  11224. @item negate_alpha
  11225. With value 1, it negates the alpha component, if present. Default value is 0.
  11226. @end table
  11227. @anchor{nlmeans}
  11228. @section nlmeans
  11229. Denoise frames using Non-Local Means algorithm.
  11230. Each pixel is adjusted by looking for other pixels with similar contexts. This
  11231. context similarity is defined by comparing their surrounding patches of size
  11232. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  11233. around the pixel.
  11234. Note that the research area defines centers for patches, which means some
  11235. patches will be made of pixels outside that research area.
  11236. The filter accepts the following options.
  11237. @table @option
  11238. @item s
  11239. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  11240. @item p
  11241. Set patch size. Default is 7. Must be odd number in range [0, 99].
  11242. @item pc
  11243. Same as @option{p} but for chroma planes.
  11244. The default value is @var{0} and means automatic.
  11245. @item r
  11246. Set research size. Default is 15. Must be odd number in range [0, 99].
  11247. @item rc
  11248. Same as @option{r} but for chroma planes.
  11249. The default value is @var{0} and means automatic.
  11250. @end table
  11251. @section nnedi
  11252. Deinterlace video using neural network edge directed interpolation.
  11253. This filter accepts the following options:
  11254. @table @option
  11255. @item weights
  11256. Mandatory option, without binary file filter can not work.
  11257. Currently file can be found here:
  11258. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  11259. @item deint
  11260. Set which frames to deinterlace, by default it is @code{all}.
  11261. Can be @code{all} or @code{interlaced}.
  11262. @item field
  11263. Set mode of operation.
  11264. Can be one of the following:
  11265. @table @samp
  11266. @item af
  11267. Use frame flags, both fields.
  11268. @item a
  11269. Use frame flags, single field.
  11270. @item t
  11271. Use top field only.
  11272. @item b
  11273. Use bottom field only.
  11274. @item tf
  11275. Use both fields, top first.
  11276. @item bf
  11277. Use both fields, bottom first.
  11278. @end table
  11279. @item planes
  11280. Set which planes to process, by default filter process all frames.
  11281. @item nsize
  11282. Set size of local neighborhood around each pixel, used by the predictor neural
  11283. network.
  11284. Can be one of the following:
  11285. @table @samp
  11286. @item s8x6
  11287. @item s16x6
  11288. @item s32x6
  11289. @item s48x6
  11290. @item s8x4
  11291. @item s16x4
  11292. @item s32x4
  11293. @end table
  11294. @item nns
  11295. Set the number of neurons in predictor neural network.
  11296. Can be one of the following:
  11297. @table @samp
  11298. @item n16
  11299. @item n32
  11300. @item n64
  11301. @item n128
  11302. @item n256
  11303. @end table
  11304. @item qual
  11305. Controls the number of different neural network predictions that are blended
  11306. together to compute the final output value. Can be @code{fast}, default or
  11307. @code{slow}.
  11308. @item etype
  11309. Set which set of weights to use in the predictor.
  11310. Can be one of the following:
  11311. @table @samp
  11312. @item a, abs
  11313. weights trained to minimize absolute error
  11314. @item s, mse
  11315. weights trained to minimize squared error
  11316. @end table
  11317. @item pscrn
  11318. Controls whether or not the prescreener neural network is used to decide
  11319. which pixels should be processed by the predictor neural network and which
  11320. can be handled by simple cubic interpolation.
  11321. The prescreener is trained to know whether cubic interpolation will be
  11322. sufficient for a pixel or whether it should be predicted by the predictor nn.
  11323. The computational complexity of the prescreener nn is much less than that of
  11324. the predictor nn. Since most pixels can be handled by cubic interpolation,
  11325. using the prescreener generally results in much faster processing.
  11326. The prescreener is pretty accurate, so the difference between using it and not
  11327. using it is almost always unnoticeable.
  11328. Can be one of the following:
  11329. @table @samp
  11330. @item none
  11331. @item original
  11332. @item new
  11333. @item new2
  11334. @item new3
  11335. @end table
  11336. Default is @code{new}.
  11337. @end table
  11338. @subsection Commands
  11339. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  11340. @section noformat
  11341. Force libavfilter not to use any of the specified pixel formats for the
  11342. input to the next filter.
  11343. It accepts the following parameters:
  11344. @table @option
  11345. @item pix_fmts
  11346. A '|'-separated list of pixel format names, such as
  11347. pix_fmts=yuv420p|monow|rgb24".
  11348. @end table
  11349. @subsection Examples
  11350. @itemize
  11351. @item
  11352. Force libavfilter to use a format different from @var{yuv420p} for the
  11353. input to the vflip filter:
  11354. @example
  11355. noformat=pix_fmts=yuv420p,vflip
  11356. @end example
  11357. @item
  11358. Convert the input video to any of the formats not contained in the list:
  11359. @example
  11360. noformat=yuv420p|yuv444p|yuv410p
  11361. @end example
  11362. @end itemize
  11363. @section noise
  11364. Add noise on video input frame.
  11365. The filter accepts the following options:
  11366. @table @option
  11367. @item all_seed
  11368. @item c0_seed
  11369. @item c1_seed
  11370. @item c2_seed
  11371. @item c3_seed
  11372. Set noise seed for specific pixel component or all pixel components in case
  11373. of @var{all_seed}. Default value is @code{123457}.
  11374. @item all_strength, alls
  11375. @item c0_strength, c0s
  11376. @item c1_strength, c1s
  11377. @item c2_strength, c2s
  11378. @item c3_strength, c3s
  11379. Set noise strength for specific pixel component or all pixel components in case
  11380. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  11381. @item all_flags, allf
  11382. @item c0_flags, c0f
  11383. @item c1_flags, c1f
  11384. @item c2_flags, c2f
  11385. @item c3_flags, c3f
  11386. Set pixel component flags or set flags for all components if @var{all_flags}.
  11387. Available values for component flags are:
  11388. @table @samp
  11389. @item a
  11390. averaged temporal noise (smoother)
  11391. @item p
  11392. mix random noise with a (semi)regular pattern
  11393. @item t
  11394. temporal noise (noise pattern changes between frames)
  11395. @item u
  11396. uniform noise (gaussian otherwise)
  11397. @end table
  11398. @end table
  11399. @subsection Examples
  11400. Add temporal and uniform noise to input video:
  11401. @example
  11402. noise=alls=20:allf=t+u
  11403. @end example
  11404. @section normalize
  11405. Normalize RGB video (aka histogram stretching, contrast stretching).
  11406. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  11407. For each channel of each frame, the filter computes the input range and maps
  11408. it linearly to the user-specified output range. The output range defaults
  11409. to the full dynamic range from pure black to pure white.
  11410. Temporal smoothing can be used on the input range to reduce flickering (rapid
  11411. changes in brightness) caused when small dark or bright objects enter or leave
  11412. the scene. This is similar to the auto-exposure (automatic gain control) on a
  11413. video camera, and, like a video camera, it may cause a period of over- or
  11414. under-exposure of the video.
  11415. The R,G,B channels can be normalized independently, which may cause some
  11416. color shifting, or linked together as a single channel, which prevents
  11417. color shifting. Linked normalization preserves hue. Independent normalization
  11418. does not, so it can be used to remove some color casts. Independent and linked
  11419. normalization can be combined in any ratio.
  11420. The normalize filter accepts the following options:
  11421. @table @option
  11422. @item blackpt
  11423. @item whitept
  11424. Colors which define the output range. The minimum input value is mapped to
  11425. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  11426. The defaults are black and white respectively. Specifying white for
  11427. @var{blackpt} and black for @var{whitept} will give color-inverted,
  11428. normalized video. Shades of grey can be used to reduce the dynamic range
  11429. (contrast). Specifying saturated colors here can create some interesting
  11430. effects.
  11431. @item smoothing
  11432. The number of previous frames to use for temporal smoothing. The input range
  11433. of each channel is smoothed using a rolling average over the current frame
  11434. and the @var{smoothing} previous frames. The default is 0 (no temporal
  11435. smoothing).
  11436. @item independence
  11437. Controls the ratio of independent (color shifting) channel normalization to
  11438. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  11439. independent. Defaults to 1.0 (fully independent).
  11440. @item strength
  11441. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  11442. expensive no-op. Defaults to 1.0 (full strength).
  11443. @end table
  11444. @subsection Commands
  11445. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  11446. The command accepts the same syntax of the corresponding option.
  11447. If the specified expression is not valid, it is kept at its current
  11448. value.
  11449. @subsection Examples
  11450. Stretch video contrast to use the full dynamic range, with no temporal
  11451. smoothing; may flicker depending on the source content:
  11452. @example
  11453. normalize=blackpt=black:whitept=white:smoothing=0
  11454. @end example
  11455. As above, but with 50 frames of temporal smoothing; flicker should be
  11456. reduced, depending on the source content:
  11457. @example
  11458. normalize=blackpt=black:whitept=white:smoothing=50
  11459. @end example
  11460. As above, but with hue-preserving linked channel normalization:
  11461. @example
  11462. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  11463. @end example
  11464. As above, but with half strength:
  11465. @example
  11466. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  11467. @end example
  11468. Map the darkest input color to red, the brightest input color to cyan:
  11469. @example
  11470. normalize=blackpt=red:whitept=cyan
  11471. @end example
  11472. @section null
  11473. Pass the video source unchanged to the output.
  11474. @section ocr
  11475. Optical Character Recognition
  11476. This filter uses Tesseract for optical character recognition. To enable
  11477. compilation of this filter, you need to configure FFmpeg with
  11478. @code{--enable-libtesseract}.
  11479. It accepts the following options:
  11480. @table @option
  11481. @item datapath
  11482. Set datapath to tesseract data. Default is to use whatever was
  11483. set at installation.
  11484. @item language
  11485. Set language, default is "eng".
  11486. @item whitelist
  11487. Set character whitelist.
  11488. @item blacklist
  11489. Set character blacklist.
  11490. @end table
  11491. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  11492. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  11493. @section ocv
  11494. Apply a video transform using libopencv.
  11495. To enable this filter, install the libopencv library and headers and
  11496. configure FFmpeg with @code{--enable-libopencv}.
  11497. It accepts the following parameters:
  11498. @table @option
  11499. @item filter_name
  11500. The name of the libopencv filter to apply.
  11501. @item filter_params
  11502. The parameters to pass to the libopencv filter. If not specified, the default
  11503. values are assumed.
  11504. @end table
  11505. Refer to the official libopencv documentation for more precise
  11506. information:
  11507. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  11508. Several libopencv filters are supported; see the following subsections.
  11509. @anchor{dilate}
  11510. @subsection dilate
  11511. Dilate an image by using a specific structuring element.
  11512. It corresponds to the libopencv function @code{cvDilate}.
  11513. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  11514. @var{struct_el} represents a structuring element, and has the syntax:
  11515. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  11516. @var{cols} and @var{rows} represent the number of columns and rows of
  11517. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  11518. point, and @var{shape} the shape for the structuring element. @var{shape}
  11519. must be "rect", "cross", "ellipse", or "custom".
  11520. If the value for @var{shape} is "custom", it must be followed by a
  11521. string of the form "=@var{filename}". The file with name
  11522. @var{filename} is assumed to represent a binary image, with each
  11523. printable character corresponding to a bright pixel. When a custom
  11524. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  11525. or columns and rows of the read file are assumed instead.
  11526. The default value for @var{struct_el} is "3x3+0x0/rect".
  11527. @var{nb_iterations} specifies the number of times the transform is
  11528. applied to the image, and defaults to 1.
  11529. Some examples:
  11530. @example
  11531. # Use the default values
  11532. ocv=dilate
  11533. # Dilate using a structuring element with a 5x5 cross, iterating two times
  11534. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  11535. # Read the shape from the file diamond.shape, iterating two times.
  11536. # The file diamond.shape may contain a pattern of characters like this
  11537. # *
  11538. # ***
  11539. # *****
  11540. # ***
  11541. # *
  11542. # The specified columns and rows are ignored
  11543. # but the anchor point coordinates are not
  11544. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  11545. @end example
  11546. @subsection erode
  11547. Erode an image by using a specific structuring element.
  11548. It corresponds to the libopencv function @code{cvErode}.
  11549. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  11550. with the same syntax and semantics as the @ref{dilate} filter.
  11551. @subsection smooth
  11552. Smooth the input video.
  11553. The filter takes the following parameters:
  11554. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  11555. @var{type} is the type of smooth filter to apply, and must be one of
  11556. the following values: "blur", "blur_no_scale", "median", "gaussian",
  11557. or "bilateral". The default value is "gaussian".
  11558. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  11559. depends on the smooth type. @var{param1} and
  11560. @var{param2} accept integer positive values or 0. @var{param3} and
  11561. @var{param4} accept floating point values.
  11562. The default value for @var{param1} is 3. The default value for the
  11563. other parameters is 0.
  11564. These parameters correspond to the parameters assigned to the
  11565. libopencv function @code{cvSmooth}.
  11566. @section oscilloscope
  11567. 2D Video Oscilloscope.
  11568. Useful to measure spatial impulse, step responses, chroma delays, etc.
  11569. It accepts the following parameters:
  11570. @table @option
  11571. @item x
  11572. Set scope center x position.
  11573. @item y
  11574. Set scope center y position.
  11575. @item s
  11576. Set scope size, relative to frame diagonal.
  11577. @item t
  11578. Set scope tilt/rotation.
  11579. @item o
  11580. Set trace opacity.
  11581. @item tx
  11582. Set trace center x position.
  11583. @item ty
  11584. Set trace center y position.
  11585. @item tw
  11586. Set trace width, relative to width of frame.
  11587. @item th
  11588. Set trace height, relative to height of frame.
  11589. @item c
  11590. Set which components to trace. By default it traces first three components.
  11591. @item g
  11592. Draw trace grid. By default is enabled.
  11593. @item st
  11594. Draw some statistics. By default is enabled.
  11595. @item sc
  11596. Draw scope. By default is enabled.
  11597. @end table
  11598. @subsection Commands
  11599. This filter supports same @ref{commands} as options.
  11600. The command accepts the same syntax of the corresponding option.
  11601. If the specified expression is not valid, it is kept at its current
  11602. value.
  11603. @subsection Examples
  11604. @itemize
  11605. @item
  11606. Inspect full first row of video frame.
  11607. @example
  11608. oscilloscope=x=0.5:y=0:s=1
  11609. @end example
  11610. @item
  11611. Inspect full last row of video frame.
  11612. @example
  11613. oscilloscope=x=0.5:y=1:s=1
  11614. @end example
  11615. @item
  11616. Inspect full 5th line of video frame of height 1080.
  11617. @example
  11618. oscilloscope=x=0.5:y=5/1080:s=1
  11619. @end example
  11620. @item
  11621. Inspect full last column of video frame.
  11622. @example
  11623. oscilloscope=x=1:y=0.5:s=1:t=1
  11624. @end example
  11625. @end itemize
  11626. @anchor{overlay}
  11627. @section overlay
  11628. Overlay one video on top of another.
  11629. It takes two inputs and has one output. The first input is the "main"
  11630. video on which the second input is overlaid.
  11631. It accepts the following parameters:
  11632. A description of the accepted options follows.
  11633. @table @option
  11634. @item x
  11635. @item y
  11636. Set the expression for the x and y coordinates of the overlaid video
  11637. on the main video. Default value is "0" for both expressions. In case
  11638. the expression is invalid, it is set to a huge value (meaning that the
  11639. overlay will not be displayed within the output visible area).
  11640. @item eof_action
  11641. See @ref{framesync}.
  11642. @item eval
  11643. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11644. It accepts the following values:
  11645. @table @samp
  11646. @item init
  11647. only evaluate expressions once during the filter initialization or
  11648. when a command is processed
  11649. @item frame
  11650. evaluate expressions for each incoming frame
  11651. @end table
  11652. Default value is @samp{frame}.
  11653. @item shortest
  11654. See @ref{framesync}.
  11655. @item format
  11656. Set the format for the output video.
  11657. It accepts the following values:
  11658. @table @samp
  11659. @item yuv420
  11660. force YUV420 output
  11661. @item yuv420p10
  11662. force YUV420p10 output
  11663. @item yuv422
  11664. force YUV422 output
  11665. @item yuv422p10
  11666. force YUV422p10 output
  11667. @item yuv444
  11668. force YUV444 output
  11669. @item rgb
  11670. force packed RGB output
  11671. @item gbrp
  11672. force planar RGB output
  11673. @item auto
  11674. automatically pick format
  11675. @end table
  11676. Default value is @samp{yuv420}.
  11677. @item repeatlast
  11678. See @ref{framesync}.
  11679. @item alpha
  11680. Set format of alpha of the overlaid video, it can be @var{straight} or
  11681. @var{premultiplied}. Default is @var{straight}.
  11682. @end table
  11683. The @option{x}, and @option{y} expressions can contain the following
  11684. parameters.
  11685. @table @option
  11686. @item main_w, W
  11687. @item main_h, H
  11688. The main input width and height.
  11689. @item overlay_w, w
  11690. @item overlay_h, h
  11691. The overlay input width and height.
  11692. @item x
  11693. @item y
  11694. The computed values for @var{x} and @var{y}. They are evaluated for
  11695. each new frame.
  11696. @item hsub
  11697. @item vsub
  11698. horizontal and vertical chroma subsample values of the output
  11699. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11700. @var{vsub} is 1.
  11701. @item n
  11702. the number of input frame, starting from 0
  11703. @item pos
  11704. the position in the file of the input frame, NAN if unknown
  11705. @item t
  11706. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11707. @end table
  11708. This filter also supports the @ref{framesync} options.
  11709. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11710. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11711. when @option{eval} is set to @samp{init}.
  11712. Be aware that frames are taken from each input video in timestamp
  11713. order, hence, if their initial timestamps differ, it is a good idea
  11714. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11715. have them begin in the same zero timestamp, as the example for
  11716. the @var{movie} filter does.
  11717. You can chain together more overlays but you should test the
  11718. efficiency of such approach.
  11719. @subsection Commands
  11720. This filter supports the following commands:
  11721. @table @option
  11722. @item x
  11723. @item y
  11724. Modify the x and y of the overlay input.
  11725. The command accepts the same syntax of the corresponding option.
  11726. If the specified expression is not valid, it is kept at its current
  11727. value.
  11728. @end table
  11729. @subsection Examples
  11730. @itemize
  11731. @item
  11732. Draw the overlay at 10 pixels from the bottom right corner of the main
  11733. video:
  11734. @example
  11735. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11736. @end example
  11737. Using named options the example above becomes:
  11738. @example
  11739. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11740. @end example
  11741. @item
  11742. Insert a transparent PNG logo in the bottom left corner of the input,
  11743. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11744. @example
  11745. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11746. @end example
  11747. @item
  11748. Insert 2 different transparent PNG logos (second logo on bottom
  11749. right corner) using the @command{ffmpeg} tool:
  11750. @example
  11751. 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
  11752. @end example
  11753. @item
  11754. Add a transparent color layer on top of the main video; @code{WxH}
  11755. must specify the size of the main input to the overlay filter:
  11756. @example
  11757. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11758. @end example
  11759. @item
  11760. Play an original video and a filtered version (here with the deshake
  11761. filter) side by side using the @command{ffplay} tool:
  11762. @example
  11763. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11764. @end example
  11765. The above command is the same as:
  11766. @example
  11767. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11768. @end example
  11769. @item
  11770. Make a sliding overlay appearing from the left to the right top part of the
  11771. screen starting since time 2:
  11772. @example
  11773. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11774. @end example
  11775. @item
  11776. Compose output by putting two input videos side to side:
  11777. @example
  11778. ffmpeg -i left.avi -i right.avi -filter_complex "
  11779. nullsrc=size=200x100 [background];
  11780. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11781. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11782. [background][left] overlay=shortest=1 [background+left];
  11783. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11784. "
  11785. @end example
  11786. @item
  11787. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11788. @example
  11789. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11790. -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]'
  11791. masked.avi
  11792. @end example
  11793. @item
  11794. Chain several overlays in cascade:
  11795. @example
  11796. nullsrc=s=200x200 [bg];
  11797. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11798. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11799. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11800. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11801. [in3] null, [mid2] overlay=100:100 [out0]
  11802. @end example
  11803. @end itemize
  11804. @anchor{overlay_cuda}
  11805. @section overlay_cuda
  11806. Overlay one video on top of another.
  11807. This is the CUDA variant of the @ref{overlay} filter.
  11808. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11809. It takes two inputs and has one output. The first input is the "main"
  11810. video on which the second input is overlaid.
  11811. It accepts the following parameters:
  11812. @table @option
  11813. @item x
  11814. @item y
  11815. Set the x and y coordinates of the overlaid video on the main video.
  11816. Default value is "0" for both expressions.
  11817. @item eof_action
  11818. See @ref{framesync}.
  11819. @item shortest
  11820. See @ref{framesync}.
  11821. @item repeatlast
  11822. See @ref{framesync}.
  11823. @end table
  11824. This filter also supports the @ref{framesync} options.
  11825. @section owdenoise
  11826. Apply Overcomplete Wavelet denoiser.
  11827. The filter accepts the following options:
  11828. @table @option
  11829. @item depth
  11830. Set depth.
  11831. Larger depth values will denoise lower frequency components more, but
  11832. slow down filtering.
  11833. Must be an int in the range 8-16, default is @code{8}.
  11834. @item luma_strength, ls
  11835. Set luma strength.
  11836. Must be a double value in the range 0-1000, default is @code{1.0}.
  11837. @item chroma_strength, cs
  11838. Set chroma strength.
  11839. Must be a double value in the range 0-1000, default is @code{1.0}.
  11840. @end table
  11841. @anchor{pad}
  11842. @section pad
  11843. Add paddings to the input image, and place the original input at the
  11844. provided @var{x}, @var{y} coordinates.
  11845. It accepts the following parameters:
  11846. @table @option
  11847. @item width, w
  11848. @item height, h
  11849. Specify an expression for the size of the output image with the
  11850. paddings added. If the value for @var{width} or @var{height} is 0, the
  11851. corresponding input size is used for the output.
  11852. The @var{width} expression can reference the value set by the
  11853. @var{height} expression, and vice versa.
  11854. The default value of @var{width} and @var{height} is 0.
  11855. @item x
  11856. @item y
  11857. Specify the offsets to place the input image at within the padded area,
  11858. with respect to the top/left border of the output image.
  11859. The @var{x} expression can reference the value set by the @var{y}
  11860. expression, and vice versa.
  11861. The default value of @var{x} and @var{y} is 0.
  11862. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11863. so the input image is centered on the padded area.
  11864. @item color
  11865. Specify the color of the padded area. For the syntax of this option,
  11866. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11867. manual,ffmpeg-utils}.
  11868. The default value of @var{color} is "black".
  11869. @item eval
  11870. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11871. It accepts the following values:
  11872. @table @samp
  11873. @item init
  11874. Only evaluate expressions once during the filter initialization or when
  11875. a command is processed.
  11876. @item frame
  11877. Evaluate expressions for each incoming frame.
  11878. @end table
  11879. Default value is @samp{init}.
  11880. @item aspect
  11881. Pad to aspect instead to a resolution.
  11882. @end table
  11883. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11884. options are expressions containing the following constants:
  11885. @table @option
  11886. @item in_w
  11887. @item in_h
  11888. The input video width and height.
  11889. @item iw
  11890. @item ih
  11891. These are the same as @var{in_w} and @var{in_h}.
  11892. @item out_w
  11893. @item out_h
  11894. The output width and height (the size of the padded area), as
  11895. specified by the @var{width} and @var{height} expressions.
  11896. @item ow
  11897. @item oh
  11898. These are the same as @var{out_w} and @var{out_h}.
  11899. @item x
  11900. @item y
  11901. The x and y offsets as specified by the @var{x} and @var{y}
  11902. expressions, or NAN if not yet specified.
  11903. @item a
  11904. same as @var{iw} / @var{ih}
  11905. @item sar
  11906. input sample aspect ratio
  11907. @item dar
  11908. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11909. @item hsub
  11910. @item vsub
  11911. The horizontal and vertical chroma subsample values. For example for the
  11912. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11913. @end table
  11914. @subsection Examples
  11915. @itemize
  11916. @item
  11917. Add paddings with the color "violet" to the input video. The output video
  11918. size is 640x480, and the top-left corner of the input video is placed at
  11919. column 0, row 40
  11920. @example
  11921. pad=640:480:0:40:violet
  11922. @end example
  11923. The example above is equivalent to the following command:
  11924. @example
  11925. pad=width=640:height=480:x=0:y=40:color=violet
  11926. @end example
  11927. @item
  11928. Pad the input to get an output with dimensions increased by 3/2,
  11929. and put the input video at the center of the padded area:
  11930. @example
  11931. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11932. @end example
  11933. @item
  11934. Pad the input to get a squared output with size equal to the maximum
  11935. value between the input width and height, and put the input video at
  11936. the center of the padded area:
  11937. @example
  11938. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11939. @end example
  11940. @item
  11941. Pad the input to get a final w/h ratio of 16:9:
  11942. @example
  11943. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11944. @end example
  11945. @item
  11946. In case of anamorphic video, in order to set the output display aspect
  11947. correctly, it is necessary to use @var{sar} in the expression,
  11948. according to the relation:
  11949. @example
  11950. (ih * X / ih) * sar = output_dar
  11951. X = output_dar / sar
  11952. @end example
  11953. Thus the previous example needs to be modified to:
  11954. @example
  11955. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11956. @end example
  11957. @item
  11958. Double the output size and put the input video in the bottom-right
  11959. corner of the output padded area:
  11960. @example
  11961. pad="2*iw:2*ih:ow-iw:oh-ih"
  11962. @end example
  11963. @end itemize
  11964. @anchor{palettegen}
  11965. @section palettegen
  11966. Generate one palette for a whole video stream.
  11967. It accepts the following options:
  11968. @table @option
  11969. @item max_colors
  11970. Set the maximum number of colors to quantize in the palette.
  11971. Note: the palette will still contain 256 colors; the unused palette entries
  11972. will be black.
  11973. @item reserve_transparent
  11974. Create a palette of 255 colors maximum and reserve the last one for
  11975. transparency. Reserving the transparency color is useful for GIF optimization.
  11976. If not set, the maximum of colors in the palette will be 256. You probably want
  11977. to disable this option for a standalone image.
  11978. Set by default.
  11979. @item transparency_color
  11980. Set the color that will be used as background for transparency.
  11981. @item stats_mode
  11982. Set statistics mode.
  11983. It accepts the following values:
  11984. @table @samp
  11985. @item full
  11986. Compute full frame histograms.
  11987. @item diff
  11988. Compute histograms only for the part that differs from previous frame. This
  11989. might be relevant to give more importance to the moving part of your input if
  11990. the background is static.
  11991. @item single
  11992. Compute new histogram for each frame.
  11993. @end table
  11994. Default value is @var{full}.
  11995. @end table
  11996. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11997. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11998. color quantization of the palette. This information is also visible at
  11999. @var{info} logging level.
  12000. @subsection Examples
  12001. @itemize
  12002. @item
  12003. Generate a representative palette of a given video using @command{ffmpeg}:
  12004. @example
  12005. ffmpeg -i input.mkv -vf palettegen palette.png
  12006. @end example
  12007. @end itemize
  12008. @section paletteuse
  12009. Use a palette to downsample an input video stream.
  12010. The filter takes two inputs: one video stream and a palette. The palette must
  12011. be a 256 pixels image.
  12012. It accepts the following options:
  12013. @table @option
  12014. @item dither
  12015. Select dithering mode. Available algorithms are:
  12016. @table @samp
  12017. @item bayer
  12018. Ordered 8x8 bayer dithering (deterministic)
  12019. @item heckbert
  12020. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  12021. Note: this dithering is sometimes considered "wrong" and is included as a
  12022. reference.
  12023. @item floyd_steinberg
  12024. Floyd and Steingberg dithering (error diffusion)
  12025. @item sierra2
  12026. Frankie Sierra dithering v2 (error diffusion)
  12027. @item sierra2_4a
  12028. Frankie Sierra dithering v2 "Lite" (error diffusion)
  12029. @end table
  12030. Default is @var{sierra2_4a}.
  12031. @item bayer_scale
  12032. When @var{bayer} dithering is selected, this option defines the scale of the
  12033. pattern (how much the crosshatch pattern is visible). A low value means more
  12034. visible pattern for less banding, and higher value means less visible pattern
  12035. at the cost of more banding.
  12036. The option must be an integer value in the range [0,5]. Default is @var{2}.
  12037. @item diff_mode
  12038. If set, define the zone to process
  12039. @table @samp
  12040. @item rectangle
  12041. Only the changing rectangle will be reprocessed. This is similar to GIF
  12042. cropping/offsetting compression mechanism. This option can be useful for speed
  12043. if only a part of the image is changing, and has use cases such as limiting the
  12044. scope of the error diffusal @option{dither} to the rectangle that bounds the
  12045. moving scene (it leads to more deterministic output if the scene doesn't change
  12046. much, and as a result less moving noise and better GIF compression).
  12047. @end table
  12048. Default is @var{none}.
  12049. @item new
  12050. Take new palette for each output frame.
  12051. @item alpha_threshold
  12052. Sets the alpha threshold for transparency. Alpha values above this threshold
  12053. will be treated as completely opaque, and values below this threshold will be
  12054. treated as completely transparent.
  12055. The option must be an integer value in the range [0,255]. Default is @var{128}.
  12056. @end table
  12057. @subsection Examples
  12058. @itemize
  12059. @item
  12060. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  12061. using @command{ffmpeg}:
  12062. @example
  12063. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  12064. @end example
  12065. @end itemize
  12066. @section perspective
  12067. Correct perspective of video not recorded perpendicular to the screen.
  12068. A description of the accepted parameters follows.
  12069. @table @option
  12070. @item x0
  12071. @item y0
  12072. @item x1
  12073. @item y1
  12074. @item x2
  12075. @item y2
  12076. @item x3
  12077. @item y3
  12078. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  12079. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  12080. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  12081. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  12082. then the corners of the source will be sent to the specified coordinates.
  12083. The expressions can use the following variables:
  12084. @table @option
  12085. @item W
  12086. @item H
  12087. the width and height of video frame.
  12088. @item in
  12089. Input frame count.
  12090. @item on
  12091. Output frame count.
  12092. @end table
  12093. @item interpolation
  12094. Set interpolation for perspective correction.
  12095. It accepts the following values:
  12096. @table @samp
  12097. @item linear
  12098. @item cubic
  12099. @end table
  12100. Default value is @samp{linear}.
  12101. @item sense
  12102. Set interpretation of coordinate options.
  12103. It accepts the following values:
  12104. @table @samp
  12105. @item 0, source
  12106. Send point in the source specified by the given coordinates to
  12107. the corners of the destination.
  12108. @item 1, destination
  12109. Send the corners of the source to the point in the destination specified
  12110. by the given coordinates.
  12111. Default value is @samp{source}.
  12112. @end table
  12113. @item eval
  12114. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  12115. It accepts the following values:
  12116. @table @samp
  12117. @item init
  12118. only evaluate expressions once during the filter initialization or
  12119. when a command is processed
  12120. @item frame
  12121. evaluate expressions for each incoming frame
  12122. @end table
  12123. Default value is @samp{init}.
  12124. @end table
  12125. @section phase
  12126. Delay interlaced video by one field time so that the field order changes.
  12127. The intended use is to fix PAL movies that have been captured with the
  12128. opposite field order to the film-to-video transfer.
  12129. A description of the accepted parameters follows.
  12130. @table @option
  12131. @item mode
  12132. Set phase mode.
  12133. It accepts the following values:
  12134. @table @samp
  12135. @item t
  12136. Capture field order top-first, transfer bottom-first.
  12137. Filter will delay the bottom field.
  12138. @item b
  12139. Capture field order bottom-first, transfer top-first.
  12140. Filter will delay the top field.
  12141. @item p
  12142. Capture and transfer with the same field order. This mode only exists
  12143. for the documentation of the other options to refer to, but if you
  12144. actually select it, the filter will faithfully do nothing.
  12145. @item a
  12146. Capture field order determined automatically by field flags, transfer
  12147. opposite.
  12148. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  12149. basis using field flags. If no field information is available,
  12150. then this works just like @samp{u}.
  12151. @item u
  12152. Capture unknown or varying, transfer opposite.
  12153. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  12154. analyzing the images and selecting the alternative that produces best
  12155. match between the fields.
  12156. @item T
  12157. Capture top-first, transfer unknown or varying.
  12158. Filter selects among @samp{t} and @samp{p} using image analysis.
  12159. @item B
  12160. Capture bottom-first, transfer unknown or varying.
  12161. Filter selects among @samp{b} and @samp{p} using image analysis.
  12162. @item A
  12163. Capture determined by field flags, transfer unknown or varying.
  12164. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  12165. image analysis. If no field information is available, then this works just
  12166. like @samp{U}. This is the default mode.
  12167. @item U
  12168. Both capture and transfer unknown or varying.
  12169. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  12170. @end table
  12171. @end table
  12172. @subsection Commands
  12173. This filter supports the all above options as @ref{commands}.
  12174. @section photosensitivity
  12175. Reduce various flashes in video, so to help users with epilepsy.
  12176. It accepts the following options:
  12177. @table @option
  12178. @item frames, f
  12179. Set how many frames to use when filtering. Default is 30.
  12180. @item threshold, t
  12181. Set detection threshold factor. Default is 1.
  12182. Lower is stricter.
  12183. @item skip
  12184. Set how many pixels to skip when sampling frames. Default is 1.
  12185. Allowed range is from 1 to 1024.
  12186. @item bypass
  12187. Leave frames unchanged. Default is disabled.
  12188. @end table
  12189. @section pixdesctest
  12190. Pixel format descriptor test filter, mainly useful for internal
  12191. testing. The output video should be equal to the input video.
  12192. For example:
  12193. @example
  12194. format=monow, pixdesctest
  12195. @end example
  12196. can be used to test the monowhite pixel format descriptor definition.
  12197. @section pixscope
  12198. Display sample values of color channels. Mainly useful for checking color
  12199. and levels. Minimum supported resolution is 640x480.
  12200. The filters accept the following options:
  12201. @table @option
  12202. @item x
  12203. Set scope X position, relative offset on X axis.
  12204. @item y
  12205. Set scope Y position, relative offset on Y axis.
  12206. @item w
  12207. Set scope width.
  12208. @item h
  12209. Set scope height.
  12210. @item o
  12211. Set window opacity. This window also holds statistics about pixel area.
  12212. @item wx
  12213. Set window X position, relative offset on X axis.
  12214. @item wy
  12215. Set window Y position, relative offset on Y axis.
  12216. @end table
  12217. @section pp
  12218. Enable the specified chain of postprocessing subfilters using libpostproc. This
  12219. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  12220. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  12221. Each subfilter and some options have a short and a long name that can be used
  12222. interchangeably, i.e. dr/dering are the same.
  12223. The filters accept the following options:
  12224. @table @option
  12225. @item subfilters
  12226. Set postprocessing subfilters string.
  12227. @end table
  12228. All subfilters share common options to determine their scope:
  12229. @table @option
  12230. @item a/autoq
  12231. Honor the quality commands for this subfilter.
  12232. @item c/chrom
  12233. Do chrominance filtering, too (default).
  12234. @item y/nochrom
  12235. Do luminance filtering only (no chrominance).
  12236. @item n/noluma
  12237. Do chrominance filtering only (no luminance).
  12238. @end table
  12239. These options can be appended after the subfilter name, separated by a '|'.
  12240. Available subfilters are:
  12241. @table @option
  12242. @item hb/hdeblock[|difference[|flatness]]
  12243. Horizontal deblocking filter
  12244. @table @option
  12245. @item difference
  12246. Difference factor where higher values mean more deblocking (default: @code{32}).
  12247. @item flatness
  12248. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12249. @end table
  12250. @item vb/vdeblock[|difference[|flatness]]
  12251. Vertical deblocking filter
  12252. @table @option
  12253. @item difference
  12254. Difference factor where higher values mean more deblocking (default: @code{32}).
  12255. @item flatness
  12256. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12257. @end table
  12258. @item ha/hadeblock[|difference[|flatness]]
  12259. Accurate horizontal deblocking filter
  12260. @table @option
  12261. @item difference
  12262. Difference factor where higher values mean more deblocking (default: @code{32}).
  12263. @item flatness
  12264. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12265. @end table
  12266. @item va/vadeblock[|difference[|flatness]]
  12267. Accurate vertical deblocking filter
  12268. @table @option
  12269. @item difference
  12270. Difference factor where higher values mean more deblocking (default: @code{32}).
  12271. @item flatness
  12272. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12273. @end table
  12274. @end table
  12275. The horizontal and vertical deblocking filters share the difference and
  12276. flatness values so you cannot set different horizontal and vertical
  12277. thresholds.
  12278. @table @option
  12279. @item h1/x1hdeblock
  12280. Experimental horizontal deblocking filter
  12281. @item v1/x1vdeblock
  12282. Experimental vertical deblocking filter
  12283. @item dr/dering
  12284. Deringing filter
  12285. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  12286. @table @option
  12287. @item threshold1
  12288. larger -> stronger filtering
  12289. @item threshold2
  12290. larger -> stronger filtering
  12291. @item threshold3
  12292. larger -> stronger filtering
  12293. @end table
  12294. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  12295. @table @option
  12296. @item f/fullyrange
  12297. Stretch luminance to @code{0-255}.
  12298. @end table
  12299. @item lb/linblenddeint
  12300. Linear blend deinterlacing filter that deinterlaces the given block by
  12301. filtering all lines with a @code{(1 2 1)} filter.
  12302. @item li/linipoldeint
  12303. Linear interpolating deinterlacing filter that deinterlaces the given block by
  12304. linearly interpolating every second line.
  12305. @item ci/cubicipoldeint
  12306. Cubic interpolating deinterlacing filter deinterlaces the given block by
  12307. cubically interpolating every second line.
  12308. @item md/mediandeint
  12309. Median deinterlacing filter that deinterlaces the given block by applying a
  12310. median filter to every second line.
  12311. @item fd/ffmpegdeint
  12312. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  12313. second line with a @code{(-1 4 2 4 -1)} filter.
  12314. @item l5/lowpass5
  12315. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  12316. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  12317. @item fq/forceQuant[|quantizer]
  12318. Overrides the quantizer table from the input with the constant quantizer you
  12319. specify.
  12320. @table @option
  12321. @item quantizer
  12322. Quantizer to use
  12323. @end table
  12324. @item de/default
  12325. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  12326. @item fa/fast
  12327. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  12328. @item ac
  12329. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  12330. @end table
  12331. @subsection Examples
  12332. @itemize
  12333. @item
  12334. Apply horizontal and vertical deblocking, deringing and automatic
  12335. brightness/contrast:
  12336. @example
  12337. pp=hb/vb/dr/al
  12338. @end example
  12339. @item
  12340. Apply default filters without brightness/contrast correction:
  12341. @example
  12342. pp=de/-al
  12343. @end example
  12344. @item
  12345. Apply default filters and temporal denoiser:
  12346. @example
  12347. pp=default/tmpnoise|1|2|3
  12348. @end example
  12349. @item
  12350. Apply deblocking on luminance only, and switch vertical deblocking on or off
  12351. automatically depending on available CPU time:
  12352. @example
  12353. pp=hb|y/vb|a
  12354. @end example
  12355. @end itemize
  12356. @section pp7
  12357. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  12358. similar to spp = 6 with 7 point DCT, where only the center sample is
  12359. used after IDCT.
  12360. The filter accepts the following options:
  12361. @table @option
  12362. @item qp
  12363. Force a constant quantization parameter. It accepts an integer in range
  12364. 0 to 63. If not set, the filter will use the QP from the video stream
  12365. (if available).
  12366. @item mode
  12367. Set thresholding mode. Available modes are:
  12368. @table @samp
  12369. @item hard
  12370. Set hard thresholding.
  12371. @item soft
  12372. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12373. @item medium
  12374. Set medium thresholding (good results, default).
  12375. @end table
  12376. @end table
  12377. @section premultiply
  12378. Apply alpha premultiply effect to input video stream using first plane
  12379. of second stream as alpha.
  12380. Both streams must have same dimensions and same pixel format.
  12381. The filter accepts the following option:
  12382. @table @option
  12383. @item planes
  12384. Set which planes will be processed, unprocessed planes will be copied.
  12385. By default value 0xf, all planes will be processed.
  12386. @item inplace
  12387. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12388. @end table
  12389. @section prewitt
  12390. Apply prewitt operator to input video stream.
  12391. The filter accepts the following option:
  12392. @table @option
  12393. @item planes
  12394. Set which planes will be processed, unprocessed planes will be copied.
  12395. By default value 0xf, all planes will be processed.
  12396. @item scale
  12397. Set value which will be multiplied with filtered result.
  12398. @item delta
  12399. Set value which will be added to filtered result.
  12400. @end table
  12401. @subsection Commands
  12402. This filter supports the all above options as @ref{commands}.
  12403. @section pseudocolor
  12404. Alter frame colors in video with pseudocolors.
  12405. This filter accepts the following options:
  12406. @table @option
  12407. @item c0
  12408. set pixel first component expression
  12409. @item c1
  12410. set pixel second component expression
  12411. @item c2
  12412. set pixel third component expression
  12413. @item c3
  12414. set pixel fourth component expression, corresponds to the alpha component
  12415. @item i
  12416. set component to use as base for altering colors
  12417. @item p
  12418. Pick one of built-in LUTs. By default is set to none.
  12419. Available LUTs:
  12420. @table @samp
  12421. @item magma
  12422. @item inferno
  12423. @item plasma
  12424. @item viridis
  12425. @item turbo
  12426. @item cividis
  12427. @item range1
  12428. @item range2
  12429. @end table
  12430. @end table
  12431. Each of them specifies the expression to use for computing the lookup table for
  12432. the corresponding pixel component values.
  12433. The expressions can contain the following constants and functions:
  12434. @table @option
  12435. @item w
  12436. @item h
  12437. The input width and height.
  12438. @item val
  12439. The input value for the pixel component.
  12440. @item ymin, umin, vmin, amin
  12441. The minimum allowed component value.
  12442. @item ymax, umax, vmax, amax
  12443. The maximum allowed component value.
  12444. @end table
  12445. All expressions default to "val".
  12446. @subsection Commands
  12447. This filter supports the all above options as @ref{commands}.
  12448. @subsection Examples
  12449. @itemize
  12450. @item
  12451. Change too high luma values to gradient:
  12452. @example
  12453. 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'"
  12454. @end example
  12455. @end itemize
  12456. @section psnr
  12457. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  12458. Ratio) between two input videos.
  12459. This filter takes in input two input videos, the first input is
  12460. considered the "main" source and is passed unchanged to the
  12461. output. The second input is used as a "reference" video for computing
  12462. the PSNR.
  12463. Both video inputs must have the same resolution and pixel format for
  12464. this filter to work correctly. Also it assumes that both inputs
  12465. have the same number of frames, which are compared one by one.
  12466. The obtained average PSNR is printed through the logging system.
  12467. The filter stores the accumulated MSE (mean squared error) of each
  12468. frame, and at the end of the processing it is averaged across all frames
  12469. equally, and the following formula is applied to obtain the PSNR:
  12470. @example
  12471. PSNR = 10*log10(MAX^2/MSE)
  12472. @end example
  12473. Where MAX is the average of the maximum values of each component of the
  12474. image.
  12475. The description of the accepted parameters follows.
  12476. @table @option
  12477. @item stats_file, f
  12478. If specified the filter will use the named file to save the PSNR of
  12479. each individual frame. When filename equals "-" the data is sent to
  12480. standard output.
  12481. @item stats_version
  12482. Specifies which version of the stats file format to use. Details of
  12483. each format are written below.
  12484. Default value is 1.
  12485. @item stats_add_max
  12486. Determines whether the max value is output to the stats log.
  12487. Default value is 0.
  12488. Requires stats_version >= 2. If this is set and stats_version < 2,
  12489. the filter will return an error.
  12490. @end table
  12491. This filter also supports the @ref{framesync} options.
  12492. The file printed if @var{stats_file} is selected, contains a sequence of
  12493. key/value pairs of the form @var{key}:@var{value} for each compared
  12494. couple of frames.
  12495. If a @var{stats_version} greater than 1 is specified, a header line precedes
  12496. the list of per-frame-pair stats, with key value pairs following the frame
  12497. format with the following parameters:
  12498. @table @option
  12499. @item psnr_log_version
  12500. The version of the log file format. Will match @var{stats_version}.
  12501. @item fields
  12502. A comma separated list of the per-frame-pair parameters included in
  12503. the log.
  12504. @end table
  12505. A description of each shown per-frame-pair parameter follows:
  12506. @table @option
  12507. @item n
  12508. sequential number of the input frame, starting from 1
  12509. @item mse_avg
  12510. Mean Square Error pixel-by-pixel average difference of the compared
  12511. frames, averaged over all the image components.
  12512. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  12513. Mean Square Error pixel-by-pixel average difference of the compared
  12514. frames for the component specified by the suffix.
  12515. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  12516. Peak Signal to Noise ratio of the compared frames for the component
  12517. specified by the suffix.
  12518. @item max_avg, max_y, max_u, max_v
  12519. Maximum allowed value for each channel, and average over all
  12520. channels.
  12521. @end table
  12522. @subsection Examples
  12523. @itemize
  12524. @item
  12525. For example:
  12526. @example
  12527. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12528. [main][ref] psnr="stats_file=stats.log" [out]
  12529. @end example
  12530. On this example the input file being processed is compared with the
  12531. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  12532. is stored in @file{stats.log}.
  12533. @item
  12534. Another example with different containers:
  12535. @example
  12536. 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 -
  12537. @end example
  12538. @end itemize
  12539. @anchor{pullup}
  12540. @section pullup
  12541. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  12542. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  12543. content.
  12544. The pullup filter is designed to take advantage of future context in making
  12545. its decisions. This filter is stateless in the sense that it does not lock
  12546. onto a pattern to follow, but it instead looks forward to the following
  12547. fields in order to identify matches and rebuild progressive frames.
  12548. To produce content with an even framerate, insert the fps filter after
  12549. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  12550. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  12551. The filter accepts the following options:
  12552. @table @option
  12553. @item jl
  12554. @item jr
  12555. @item jt
  12556. @item jb
  12557. These options set the amount of "junk" to ignore at the left, right, top, and
  12558. bottom of the image, respectively. Left and right are in units of 8 pixels,
  12559. while top and bottom are in units of 2 lines.
  12560. The default is 8 pixels on each side.
  12561. @item sb
  12562. Set the strict breaks. Setting this option to 1 will reduce the chances of
  12563. filter generating an occasional mismatched frame, but it may also cause an
  12564. excessive number of frames to be dropped during high motion sequences.
  12565. Conversely, setting it to -1 will make filter match fields more easily.
  12566. This may help processing of video where there is slight blurring between
  12567. the fields, but may also cause there to be interlaced frames in the output.
  12568. Default value is @code{0}.
  12569. @item mp
  12570. Set the metric plane to use. It accepts the following values:
  12571. @table @samp
  12572. @item l
  12573. Use luma plane.
  12574. @item u
  12575. Use chroma blue plane.
  12576. @item v
  12577. Use chroma red plane.
  12578. @end table
  12579. This option may be set to use chroma plane instead of the default luma plane
  12580. for doing filter's computations. This may improve accuracy on very clean
  12581. source material, but more likely will decrease accuracy, especially if there
  12582. is chroma noise (rainbow effect) or any grayscale video.
  12583. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  12584. load and make pullup usable in realtime on slow machines.
  12585. @end table
  12586. For best results (without duplicated frames in the output file) it is
  12587. necessary to change the output frame rate. For example, to inverse
  12588. telecine NTSC input:
  12589. @example
  12590. ffmpeg -i input -vf pullup -r 24000/1001 ...
  12591. @end example
  12592. @section qp
  12593. Change video quantization parameters (QP).
  12594. The filter accepts the following option:
  12595. @table @option
  12596. @item qp
  12597. Set expression for quantization parameter.
  12598. @end table
  12599. The expression is evaluated through the eval API and can contain, among others,
  12600. the following constants:
  12601. @table @var
  12602. @item known
  12603. 1 if index is not 129, 0 otherwise.
  12604. @item qp
  12605. Sequential index starting from -129 to 128.
  12606. @end table
  12607. @subsection Examples
  12608. @itemize
  12609. @item
  12610. Some equation like:
  12611. @example
  12612. qp=2+2*sin(PI*qp)
  12613. @end example
  12614. @end itemize
  12615. @section random
  12616. Flush video frames from internal cache of frames into a random order.
  12617. No frame is discarded.
  12618. Inspired by @ref{frei0r} nervous filter.
  12619. @table @option
  12620. @item frames
  12621. Set size in number of frames of internal cache, in range from @code{2} to
  12622. @code{512}. Default is @code{30}.
  12623. @item seed
  12624. Set seed for random number generator, must be an integer included between
  12625. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12626. less than @code{0}, the filter will try to use a good random seed on a
  12627. best effort basis.
  12628. @end table
  12629. @section readeia608
  12630. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12631. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12632. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12633. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12634. @table @option
  12635. @item lavfi.readeia608.X.cc
  12636. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12637. @item lavfi.readeia608.X.line
  12638. The number of the line on which the EIA-608 data was identified and read.
  12639. @end table
  12640. This filter accepts the following options:
  12641. @table @option
  12642. @item scan_min
  12643. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12644. @item scan_max
  12645. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12646. @item spw
  12647. Set the ratio of width reserved for sync code detection.
  12648. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12649. @item chp
  12650. Enable checking the parity bit. In the event of a parity error, the filter will output
  12651. @code{0x00} for that character. Default is false.
  12652. @item lp
  12653. Lowpass lines prior to further processing. Default is enabled.
  12654. @end table
  12655. @subsection Commands
  12656. This filter supports the all above options as @ref{commands}.
  12657. @subsection Examples
  12658. @itemize
  12659. @item
  12660. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12661. @example
  12662. 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
  12663. @end example
  12664. @end itemize
  12665. @section readvitc
  12666. Read vertical interval timecode (VITC) information from the top lines of a
  12667. video frame.
  12668. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12669. timecode value, if a valid timecode has been detected. Further metadata key
  12670. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12671. timecode data has been found or not.
  12672. This filter accepts the following options:
  12673. @table @option
  12674. @item scan_max
  12675. Set the maximum number of lines to scan for VITC data. If the value is set to
  12676. @code{-1} the full video frame is scanned. Default is @code{45}.
  12677. @item thr_b
  12678. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12679. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12680. @item thr_w
  12681. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12682. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12683. @end table
  12684. @subsection Examples
  12685. @itemize
  12686. @item
  12687. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12688. draw @code{--:--:--:--} as a placeholder:
  12689. @example
  12690. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12691. @end example
  12692. @end itemize
  12693. @section remap
  12694. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12695. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12696. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12697. value for pixel will be used for destination pixel.
  12698. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12699. will have Xmap/Ymap video stream dimensions.
  12700. Xmap and Ymap input video streams are 16bit depth, single channel.
  12701. @table @option
  12702. @item format
  12703. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12704. Default is @code{color}.
  12705. @item fill
  12706. Specify the color of the unmapped pixels. For the syntax of this option,
  12707. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12708. manual,ffmpeg-utils}. Default color is @code{black}.
  12709. @end table
  12710. @section removegrain
  12711. The removegrain filter is a spatial denoiser for progressive video.
  12712. @table @option
  12713. @item m0
  12714. Set mode for the first plane.
  12715. @item m1
  12716. Set mode for the second plane.
  12717. @item m2
  12718. Set mode for the third plane.
  12719. @item m3
  12720. Set mode for the fourth plane.
  12721. @end table
  12722. Range of mode is from 0 to 24. Description of each mode follows:
  12723. @table @var
  12724. @item 0
  12725. Leave input plane unchanged. Default.
  12726. @item 1
  12727. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12728. @item 2
  12729. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12730. @item 3
  12731. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12732. @item 4
  12733. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12734. This is equivalent to a median filter.
  12735. @item 5
  12736. Line-sensitive clipping giving the minimal change.
  12737. @item 6
  12738. Line-sensitive clipping, intermediate.
  12739. @item 7
  12740. Line-sensitive clipping, intermediate.
  12741. @item 8
  12742. Line-sensitive clipping, intermediate.
  12743. @item 9
  12744. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12745. @item 10
  12746. Replaces the target pixel with the closest neighbour.
  12747. @item 11
  12748. [1 2 1] horizontal and vertical kernel blur.
  12749. @item 12
  12750. Same as mode 11.
  12751. @item 13
  12752. Bob mode, interpolates top field from the line where the neighbours
  12753. pixels are the closest.
  12754. @item 14
  12755. Bob mode, interpolates bottom field from the line where the neighbours
  12756. pixels are the closest.
  12757. @item 15
  12758. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12759. interpolation formula.
  12760. @item 16
  12761. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12762. interpolation formula.
  12763. @item 17
  12764. Clips the pixel with the minimum and maximum of respectively the maximum and
  12765. minimum of each pair of opposite neighbour pixels.
  12766. @item 18
  12767. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12768. the current pixel is minimal.
  12769. @item 19
  12770. Replaces the pixel with the average of its 8 neighbours.
  12771. @item 20
  12772. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12773. @item 21
  12774. Clips pixels using the averages of opposite neighbour.
  12775. @item 22
  12776. Same as mode 21 but simpler and faster.
  12777. @item 23
  12778. Small edge and halo removal, but reputed useless.
  12779. @item 24
  12780. Similar as 23.
  12781. @end table
  12782. @section removelogo
  12783. Suppress a TV station logo, using an image file to determine which
  12784. pixels comprise the logo. It works by filling in the pixels that
  12785. comprise the logo with neighboring pixels.
  12786. The filter accepts the following options:
  12787. @table @option
  12788. @item filename, f
  12789. Set the filter bitmap file, which can be any image format supported by
  12790. libavformat. The width and height of the image file must match those of the
  12791. video stream being processed.
  12792. @end table
  12793. Pixels in the provided bitmap image with a value of zero are not
  12794. considered part of the logo, non-zero pixels are considered part of
  12795. the logo. If you use white (255) for the logo and black (0) for the
  12796. rest, you will be safe. For making the filter bitmap, it is
  12797. recommended to take a screen capture of a black frame with the logo
  12798. visible, and then using a threshold filter followed by the erode
  12799. filter once or twice.
  12800. If needed, little splotches can be fixed manually. Remember that if
  12801. logo pixels are not covered, the filter quality will be much
  12802. reduced. Marking too many pixels as part of the logo does not hurt as
  12803. much, but it will increase the amount of blurring needed to cover over
  12804. the image and will destroy more information than necessary, and extra
  12805. pixels will slow things down on a large logo.
  12806. @section repeatfields
  12807. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12808. fields based on its value.
  12809. @section reverse
  12810. Reverse a video clip.
  12811. Warning: This filter requires memory to buffer the entire clip, so trimming
  12812. is suggested.
  12813. @subsection Examples
  12814. @itemize
  12815. @item
  12816. Take the first 5 seconds of a clip, and reverse it.
  12817. @example
  12818. trim=end=5,reverse
  12819. @end example
  12820. @end itemize
  12821. @section rgbashift
  12822. Shift R/G/B/A pixels horizontally and/or vertically.
  12823. The filter accepts the following options:
  12824. @table @option
  12825. @item rh
  12826. Set amount to shift red horizontally.
  12827. @item rv
  12828. Set amount to shift red vertically.
  12829. @item gh
  12830. Set amount to shift green horizontally.
  12831. @item gv
  12832. Set amount to shift green vertically.
  12833. @item bh
  12834. Set amount to shift blue horizontally.
  12835. @item bv
  12836. Set amount to shift blue vertically.
  12837. @item ah
  12838. Set amount to shift alpha horizontally.
  12839. @item av
  12840. Set amount to shift alpha vertically.
  12841. @item edge
  12842. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12843. @end table
  12844. @subsection Commands
  12845. This filter supports the all above options as @ref{commands}.
  12846. @section roberts
  12847. Apply roberts cross operator to input video stream.
  12848. The filter accepts the following option:
  12849. @table @option
  12850. @item planes
  12851. Set which planes will be processed, unprocessed planes will be copied.
  12852. By default value 0xf, all planes will be processed.
  12853. @item scale
  12854. Set value which will be multiplied with filtered result.
  12855. @item delta
  12856. Set value which will be added to filtered result.
  12857. @end table
  12858. @subsection Commands
  12859. This filter supports the all above options as @ref{commands}.
  12860. @section rotate
  12861. Rotate video by an arbitrary angle expressed in radians.
  12862. The filter accepts the following options:
  12863. A description of the optional parameters follows.
  12864. @table @option
  12865. @item angle, a
  12866. Set an expression for the angle by which to rotate the input video
  12867. clockwise, expressed as a number of radians. A negative value will
  12868. result in a counter-clockwise rotation. By default it is set to "0".
  12869. This expression is evaluated for each frame.
  12870. @item out_w, ow
  12871. Set the output width expression, default value is "iw".
  12872. This expression is evaluated just once during configuration.
  12873. @item out_h, oh
  12874. Set the output height expression, default value is "ih".
  12875. This expression is evaluated just once during configuration.
  12876. @item bilinear
  12877. Enable bilinear interpolation if set to 1, a value of 0 disables
  12878. it. Default value is 1.
  12879. @item fillcolor, c
  12880. Set the color used to fill the output area not covered by the rotated
  12881. image. For the general syntax of this option, check the
  12882. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12883. If the special value "none" is selected then no
  12884. background is printed (useful for example if the background is never shown).
  12885. Default value is "black".
  12886. @end table
  12887. The expressions for the angle and the output size can contain the
  12888. following constants and functions:
  12889. @table @option
  12890. @item n
  12891. sequential number of the input frame, starting from 0. It is always NAN
  12892. before the first frame is filtered.
  12893. @item t
  12894. time in seconds of the input frame, it is set to 0 when the filter is
  12895. configured. It is always NAN before the first frame is filtered.
  12896. @item hsub
  12897. @item vsub
  12898. horizontal and vertical chroma subsample values. For example for the
  12899. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12900. @item in_w, iw
  12901. @item in_h, ih
  12902. the input video width and height
  12903. @item out_w, ow
  12904. @item out_h, oh
  12905. the output width and height, that is the size of the padded area as
  12906. specified by the @var{width} and @var{height} expressions
  12907. @item rotw(a)
  12908. @item roth(a)
  12909. the minimal width/height required for completely containing the input
  12910. video rotated by @var{a} radians.
  12911. These are only available when computing the @option{out_w} and
  12912. @option{out_h} expressions.
  12913. @end table
  12914. @subsection Examples
  12915. @itemize
  12916. @item
  12917. Rotate the input by PI/6 radians clockwise:
  12918. @example
  12919. rotate=PI/6
  12920. @end example
  12921. @item
  12922. Rotate the input by PI/6 radians counter-clockwise:
  12923. @example
  12924. rotate=-PI/6
  12925. @end example
  12926. @item
  12927. Rotate the input by 45 degrees clockwise:
  12928. @example
  12929. rotate=45*PI/180
  12930. @end example
  12931. @item
  12932. Apply a constant rotation with period T, starting from an angle of PI/3:
  12933. @example
  12934. rotate=PI/3+2*PI*t/T
  12935. @end example
  12936. @item
  12937. Make the input video rotation oscillating with a period of T
  12938. seconds and an amplitude of A radians:
  12939. @example
  12940. rotate=A*sin(2*PI/T*t)
  12941. @end example
  12942. @item
  12943. Rotate the video, output size is chosen so that the whole rotating
  12944. input video is always completely contained in the output:
  12945. @example
  12946. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12947. @end example
  12948. @item
  12949. Rotate the video, reduce the output size so that no background is ever
  12950. shown:
  12951. @example
  12952. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12953. @end example
  12954. @end itemize
  12955. @subsection Commands
  12956. The filter supports the following commands:
  12957. @table @option
  12958. @item a, angle
  12959. Set the angle expression.
  12960. The command accepts the same syntax of the corresponding option.
  12961. If the specified expression is not valid, it is kept at its current
  12962. value.
  12963. @end table
  12964. @section sab
  12965. Apply Shape Adaptive Blur.
  12966. The filter accepts the following options:
  12967. @table @option
  12968. @item luma_radius, lr
  12969. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12970. value is 1.0. A greater value will result in a more blurred image, and
  12971. in slower processing.
  12972. @item luma_pre_filter_radius, lpfr
  12973. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12974. value is 1.0.
  12975. @item luma_strength, ls
  12976. Set luma maximum difference between pixels to still be considered, must
  12977. be a value in the 0.1-100.0 range, default value is 1.0.
  12978. @item chroma_radius, cr
  12979. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12980. greater value will result in a more blurred image, and in slower
  12981. processing.
  12982. @item chroma_pre_filter_radius, cpfr
  12983. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12984. @item chroma_strength, cs
  12985. Set chroma maximum difference between pixels to still be considered,
  12986. must be a value in the -0.9-100.0 range.
  12987. @end table
  12988. Each chroma option value, if not explicitly specified, is set to the
  12989. corresponding luma option value.
  12990. @anchor{scale}
  12991. @section scale
  12992. Scale (resize) the input video, using the libswscale library.
  12993. The scale filter forces the output display aspect ratio to be the same
  12994. of the input, by changing the output sample aspect ratio.
  12995. If the input image format is different from the format requested by
  12996. the next filter, the scale filter will convert the input to the
  12997. requested format.
  12998. @subsection Options
  12999. The filter accepts the following options, or any of the options
  13000. supported by the libswscale scaler.
  13001. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  13002. the complete list of scaler options.
  13003. @table @option
  13004. @item width, w
  13005. @item height, h
  13006. Set the output video dimension expression. Default value is the input
  13007. dimension.
  13008. If the @var{width} or @var{w} value is 0, the input width is used for
  13009. the output. If the @var{height} or @var{h} value is 0, the input height
  13010. is used for the output.
  13011. If one and only one of the values is -n with n >= 1, the scale filter
  13012. will use a value that maintains the aspect ratio of the input image,
  13013. calculated from the other specified dimension. After that it will,
  13014. however, make sure that the calculated dimension is divisible by n and
  13015. adjust the value if necessary.
  13016. If both values are -n with n >= 1, the behavior will be identical to
  13017. both values being set to 0 as previously detailed.
  13018. See below for the list of accepted constants for use in the dimension
  13019. expression.
  13020. @item eval
  13021. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  13022. @table @samp
  13023. @item init
  13024. Only evaluate expressions once during the filter initialization or when a command is processed.
  13025. @item frame
  13026. Evaluate expressions for each incoming frame.
  13027. @end table
  13028. Default value is @samp{init}.
  13029. @item interl
  13030. Set the interlacing mode. It accepts the following values:
  13031. @table @samp
  13032. @item 1
  13033. Force interlaced aware scaling.
  13034. @item 0
  13035. Do not apply interlaced scaling.
  13036. @item -1
  13037. Select interlaced aware scaling depending on whether the source frames
  13038. are flagged as interlaced or not.
  13039. @end table
  13040. Default value is @samp{0}.
  13041. @item flags
  13042. Set libswscale scaling flags. See
  13043. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  13044. complete list of values. If not explicitly specified the filter applies
  13045. the default flags.
  13046. @item param0, param1
  13047. Set libswscale input parameters for scaling algorithms that need them. See
  13048. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  13049. complete documentation. If not explicitly specified the filter applies
  13050. empty parameters.
  13051. @item size, s
  13052. Set the video size. For the syntax of this option, check the
  13053. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13054. @item in_color_matrix
  13055. @item out_color_matrix
  13056. Set in/output YCbCr color space type.
  13057. This allows the autodetected value to be overridden as well as allows forcing
  13058. a specific value used for the output and encoder.
  13059. If not specified, the color space type depends on the pixel format.
  13060. Possible values:
  13061. @table @samp
  13062. @item auto
  13063. Choose automatically.
  13064. @item bt709
  13065. Format conforming to International Telecommunication Union (ITU)
  13066. Recommendation BT.709.
  13067. @item fcc
  13068. Set color space conforming to the United States Federal Communications
  13069. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  13070. @item bt601
  13071. @item bt470
  13072. @item smpte170m
  13073. Set color space conforming to:
  13074. @itemize
  13075. @item
  13076. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  13077. @item
  13078. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  13079. @item
  13080. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  13081. @end itemize
  13082. @item smpte240m
  13083. Set color space conforming to SMPTE ST 240:1999.
  13084. @item bt2020
  13085. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  13086. @end table
  13087. @item in_range
  13088. @item out_range
  13089. Set in/output YCbCr sample range.
  13090. This allows the autodetected value to be overridden as well as allows forcing
  13091. a specific value used for the output and encoder. If not specified, the
  13092. range depends on the pixel format. Possible values:
  13093. @table @samp
  13094. @item auto/unknown
  13095. Choose automatically.
  13096. @item jpeg/full/pc
  13097. Set full range (0-255 in case of 8-bit luma).
  13098. @item mpeg/limited/tv
  13099. Set "MPEG" range (16-235 in case of 8-bit luma).
  13100. @end table
  13101. @item force_original_aspect_ratio
  13102. Enable decreasing or increasing output video width or height if necessary to
  13103. keep the original aspect ratio. Possible values:
  13104. @table @samp
  13105. @item disable
  13106. Scale the video as specified and disable this feature.
  13107. @item decrease
  13108. The output video dimensions will automatically be decreased if needed.
  13109. @item increase
  13110. The output video dimensions will automatically be increased if needed.
  13111. @end table
  13112. One useful instance of this option is that when you know a specific device's
  13113. maximum allowed resolution, you can use this to limit the output video to
  13114. that, while retaining the aspect ratio. For example, device A allows
  13115. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  13116. decrease) and specifying 1280x720 to the command line makes the output
  13117. 1280x533.
  13118. Please note that this is a different thing than specifying -1 for @option{w}
  13119. or @option{h}, you still need to specify the output resolution for this option
  13120. to work.
  13121. @item force_divisible_by
  13122. Ensures that both the output dimensions, width and height, are divisible by the
  13123. given integer when used together with @option{force_original_aspect_ratio}. This
  13124. works similar to using @code{-n} in the @option{w} and @option{h} options.
  13125. This option respects the value set for @option{force_original_aspect_ratio},
  13126. increasing or decreasing the resolution accordingly. The video's aspect ratio
  13127. may be slightly modified.
  13128. This option can be handy if you need to have a video fit within or exceed
  13129. a defined resolution using @option{force_original_aspect_ratio} but also have
  13130. encoder restrictions on width or height divisibility.
  13131. @end table
  13132. The values of the @option{w} and @option{h} options are expressions
  13133. containing the following constants:
  13134. @table @var
  13135. @item in_w
  13136. @item in_h
  13137. The input width and height
  13138. @item iw
  13139. @item ih
  13140. These are the same as @var{in_w} and @var{in_h}.
  13141. @item out_w
  13142. @item out_h
  13143. The output (scaled) width and height
  13144. @item ow
  13145. @item oh
  13146. These are the same as @var{out_w} and @var{out_h}
  13147. @item a
  13148. The same as @var{iw} / @var{ih}
  13149. @item sar
  13150. input sample aspect ratio
  13151. @item dar
  13152. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13153. @item hsub
  13154. @item vsub
  13155. horizontal and vertical input chroma subsample values. For example for the
  13156. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13157. @item ohsub
  13158. @item ovsub
  13159. horizontal and vertical output chroma subsample values. For example for the
  13160. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13161. @item n
  13162. The (sequential) number of the input frame, starting from 0.
  13163. Only available with @code{eval=frame}.
  13164. @item t
  13165. The presentation timestamp of the input frame, expressed as a number of
  13166. seconds. Only available with @code{eval=frame}.
  13167. @item pos
  13168. The position (byte offset) of the frame in the input stream, or NaN if
  13169. this information is unavailable and/or meaningless (for example in case of synthetic video).
  13170. Only available with @code{eval=frame}.
  13171. @end table
  13172. @subsection Examples
  13173. @itemize
  13174. @item
  13175. Scale the input video to a size of 200x100
  13176. @example
  13177. scale=w=200:h=100
  13178. @end example
  13179. This is equivalent to:
  13180. @example
  13181. scale=200:100
  13182. @end example
  13183. or:
  13184. @example
  13185. scale=200x100
  13186. @end example
  13187. @item
  13188. Specify a size abbreviation for the output size:
  13189. @example
  13190. scale=qcif
  13191. @end example
  13192. which can also be written as:
  13193. @example
  13194. scale=size=qcif
  13195. @end example
  13196. @item
  13197. Scale the input to 2x:
  13198. @example
  13199. scale=w=2*iw:h=2*ih
  13200. @end example
  13201. @item
  13202. The above is the same as:
  13203. @example
  13204. scale=2*in_w:2*in_h
  13205. @end example
  13206. @item
  13207. Scale the input to 2x with forced interlaced scaling:
  13208. @example
  13209. scale=2*iw:2*ih:interl=1
  13210. @end example
  13211. @item
  13212. Scale the input to half size:
  13213. @example
  13214. scale=w=iw/2:h=ih/2
  13215. @end example
  13216. @item
  13217. Increase the width, and set the height to the same size:
  13218. @example
  13219. scale=3/2*iw:ow
  13220. @end example
  13221. @item
  13222. Seek Greek harmony:
  13223. @example
  13224. scale=iw:1/PHI*iw
  13225. scale=ih*PHI:ih
  13226. @end example
  13227. @item
  13228. Increase the height, and set the width to 3/2 of the height:
  13229. @example
  13230. scale=w=3/2*oh:h=3/5*ih
  13231. @end example
  13232. @item
  13233. Increase the size, making the size a multiple of the chroma
  13234. subsample values:
  13235. @example
  13236. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  13237. @end example
  13238. @item
  13239. Increase the width to a maximum of 500 pixels,
  13240. keeping the same aspect ratio as the input:
  13241. @example
  13242. scale=w='min(500\, iw*3/2):h=-1'
  13243. @end example
  13244. @item
  13245. Make pixels square by combining scale and setsar:
  13246. @example
  13247. scale='trunc(ih*dar):ih',setsar=1/1
  13248. @end example
  13249. @item
  13250. Make pixels square by combining scale and setsar,
  13251. making sure the resulting resolution is even (required by some codecs):
  13252. @example
  13253. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  13254. @end example
  13255. @end itemize
  13256. @subsection Commands
  13257. This filter supports the following commands:
  13258. @table @option
  13259. @item width, w
  13260. @item height, h
  13261. Set the output video dimension expression.
  13262. The command accepts the same syntax of the corresponding option.
  13263. If the specified expression is not valid, it is kept at its current
  13264. value.
  13265. @end table
  13266. @section scale_npp
  13267. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  13268. format conversion on CUDA video frames. Setting the output width and height
  13269. works in the same way as for the @var{scale} filter.
  13270. The following additional options are accepted:
  13271. @table @option
  13272. @item format
  13273. The pixel format of the output CUDA frames. If set to the string "same" (the
  13274. default), the input format will be kept. Note that automatic format negotiation
  13275. and conversion is not yet supported for hardware frames
  13276. @item interp_algo
  13277. The interpolation algorithm used for resizing. One of the following:
  13278. @table @option
  13279. @item nn
  13280. Nearest neighbour.
  13281. @item linear
  13282. @item cubic
  13283. @item cubic2p_bspline
  13284. 2-parameter cubic (B=1, C=0)
  13285. @item cubic2p_catmullrom
  13286. 2-parameter cubic (B=0, C=1/2)
  13287. @item cubic2p_b05c03
  13288. 2-parameter cubic (B=1/2, C=3/10)
  13289. @item super
  13290. Supersampling
  13291. @item lanczos
  13292. @end table
  13293. @item force_original_aspect_ratio
  13294. Enable decreasing or increasing output video width or height if necessary to
  13295. keep the original aspect ratio. Possible values:
  13296. @table @samp
  13297. @item disable
  13298. Scale the video as specified and disable this feature.
  13299. @item decrease
  13300. The output video dimensions will automatically be decreased if needed.
  13301. @item increase
  13302. The output video dimensions will automatically be increased if needed.
  13303. @end table
  13304. One useful instance of this option is that when you know a specific device's
  13305. maximum allowed resolution, you can use this to limit the output video to
  13306. that, while retaining the aspect ratio. For example, device A allows
  13307. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  13308. decrease) and specifying 1280x720 to the command line makes the output
  13309. 1280x533.
  13310. Please note that this is a different thing than specifying -1 for @option{w}
  13311. or @option{h}, you still need to specify the output resolution for this option
  13312. to work.
  13313. @item force_divisible_by
  13314. Ensures that both the output dimensions, width and height, are divisible by the
  13315. given integer when used together with @option{force_original_aspect_ratio}. This
  13316. works similar to using @code{-n} in the @option{w} and @option{h} options.
  13317. This option respects the value set for @option{force_original_aspect_ratio},
  13318. increasing or decreasing the resolution accordingly. The video's aspect ratio
  13319. may be slightly modified.
  13320. This option can be handy if you need to have a video fit within or exceed
  13321. a defined resolution using @option{force_original_aspect_ratio} but also have
  13322. encoder restrictions on width or height divisibility.
  13323. @end table
  13324. @section scale2ref
  13325. Scale (resize) the input video, based on a reference video.
  13326. See the scale filter for available options, scale2ref supports the same but
  13327. uses the reference video instead of the main input as basis. scale2ref also
  13328. supports the following additional constants for the @option{w} and
  13329. @option{h} options:
  13330. @table @var
  13331. @item main_w
  13332. @item main_h
  13333. The main input video's width and height
  13334. @item main_a
  13335. The same as @var{main_w} / @var{main_h}
  13336. @item main_sar
  13337. The main input video's sample aspect ratio
  13338. @item main_dar, mdar
  13339. The main input video's display aspect ratio. Calculated from
  13340. @code{(main_w / main_h) * main_sar}.
  13341. @item main_hsub
  13342. @item main_vsub
  13343. The main input video's horizontal and vertical chroma subsample values.
  13344. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  13345. is 1.
  13346. @item main_n
  13347. The (sequential) number of the main input frame, starting from 0.
  13348. Only available with @code{eval=frame}.
  13349. @item main_t
  13350. The presentation timestamp of the main input frame, expressed as a number of
  13351. seconds. Only available with @code{eval=frame}.
  13352. @item main_pos
  13353. The position (byte offset) of the frame in the main input stream, or NaN if
  13354. this information is unavailable and/or meaningless (for example in case of synthetic video).
  13355. Only available with @code{eval=frame}.
  13356. @end table
  13357. @subsection Examples
  13358. @itemize
  13359. @item
  13360. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  13361. @example
  13362. 'scale2ref[b][a];[a][b]overlay'
  13363. @end example
  13364. @item
  13365. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  13366. @example
  13367. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  13368. @end example
  13369. @end itemize
  13370. @subsection Commands
  13371. This filter supports the following commands:
  13372. @table @option
  13373. @item width, w
  13374. @item height, h
  13375. Set the output video dimension expression.
  13376. The command accepts the same syntax of the corresponding option.
  13377. If the specified expression is not valid, it is kept at its current
  13378. value.
  13379. @end table
  13380. @section scroll
  13381. Scroll input video horizontally and/or vertically by constant speed.
  13382. The filter accepts the following options:
  13383. @table @option
  13384. @item horizontal, h
  13385. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13386. Negative values changes scrolling direction.
  13387. @item vertical, v
  13388. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13389. Negative values changes scrolling direction.
  13390. @item hpos
  13391. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  13392. @item vpos
  13393. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  13394. @end table
  13395. @subsection Commands
  13396. This filter supports the following @ref{commands}:
  13397. @table @option
  13398. @item horizontal, h
  13399. Set the horizontal scrolling speed.
  13400. @item vertical, v
  13401. Set the vertical scrolling speed.
  13402. @end table
  13403. @anchor{scdet}
  13404. @section scdet
  13405. Detect video scene change.
  13406. This filter sets frame metadata with mafd between frame, the scene score, and
  13407. forward the frame to the next filter, so they can use these metadata to detect
  13408. scene change or others.
  13409. In addition, this filter logs a message and sets frame metadata when it detects
  13410. a scene change by @option{threshold}.
  13411. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  13412. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  13413. to detect scene change.
  13414. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  13415. detect scene change with @option{threshold}.
  13416. The filter accepts the following options:
  13417. @table @option
  13418. @item threshold, t
  13419. Set the scene change detection threshold as a percentage of maximum change. Good
  13420. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  13421. @code{[0., 100.]}.
  13422. Default value is @code{10.}.
  13423. @item sc_pass, s
  13424. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  13425. You can enable it if you want to get snapshot of scene change frames only.
  13426. @end table
  13427. @anchor{selectivecolor}
  13428. @section selectivecolor
  13429. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  13430. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  13431. by the "purity" of the color (that is, how saturated it already is).
  13432. This filter is similar to the Adobe Photoshop Selective Color tool.
  13433. The filter accepts the following options:
  13434. @table @option
  13435. @item correction_method
  13436. Select color correction method.
  13437. Available values are:
  13438. @table @samp
  13439. @item absolute
  13440. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  13441. component value).
  13442. @item relative
  13443. Specified adjustments are relative to the original component value.
  13444. @end table
  13445. Default is @code{absolute}.
  13446. @item reds
  13447. Adjustments for red pixels (pixels where the red component is the maximum)
  13448. @item yellows
  13449. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  13450. @item greens
  13451. Adjustments for green pixels (pixels where the green component is the maximum)
  13452. @item cyans
  13453. Adjustments for cyan pixels (pixels where the red component is the minimum)
  13454. @item blues
  13455. Adjustments for blue pixels (pixels where the blue component is the maximum)
  13456. @item magentas
  13457. Adjustments for magenta pixels (pixels where the green component is the minimum)
  13458. @item whites
  13459. Adjustments for white pixels (pixels where all components are greater than 128)
  13460. @item neutrals
  13461. Adjustments for all pixels except pure black and pure white
  13462. @item blacks
  13463. Adjustments for black pixels (pixels where all components are lesser than 128)
  13464. @item psfile
  13465. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  13466. @end table
  13467. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  13468. 4 space separated floating point adjustment values in the [-1,1] range,
  13469. respectively to adjust the amount of cyan, magenta, yellow and black for the
  13470. pixels of its range.
  13471. @subsection Examples
  13472. @itemize
  13473. @item
  13474. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  13475. increase magenta by 27% in blue areas:
  13476. @example
  13477. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  13478. @end example
  13479. @item
  13480. Use a Photoshop selective color preset:
  13481. @example
  13482. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  13483. @end example
  13484. @end itemize
  13485. @anchor{separatefields}
  13486. @section separatefields
  13487. The @code{separatefields} takes a frame-based video input and splits
  13488. each frame into its components fields, producing a new half height clip
  13489. with twice the frame rate and twice the frame count.
  13490. This filter use field-dominance information in frame to decide which
  13491. of each pair of fields to place first in the output.
  13492. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  13493. @section setdar, setsar
  13494. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  13495. output video.
  13496. This is done by changing the specified Sample (aka Pixel) Aspect
  13497. Ratio, according to the following equation:
  13498. @example
  13499. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  13500. @end example
  13501. Keep in mind that the @code{setdar} filter does not modify the pixel
  13502. dimensions of the video frame. Also, the display aspect ratio set by
  13503. this filter may be changed by later filters in the filterchain,
  13504. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  13505. applied.
  13506. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  13507. the filter output video.
  13508. Note that as a consequence of the application of this filter, the
  13509. output display aspect ratio will change according to the equation
  13510. above.
  13511. Keep in mind that the sample aspect ratio set by the @code{setsar}
  13512. filter may be changed by later filters in the filterchain, e.g. if
  13513. another "setsar" or a "setdar" filter is applied.
  13514. It accepts the following parameters:
  13515. @table @option
  13516. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  13517. Set the aspect ratio used by the filter.
  13518. The parameter can be a floating point number string, an expression, or
  13519. a string of the form @var{num}:@var{den}, where @var{num} and
  13520. @var{den} are the numerator and denominator of the aspect ratio. If
  13521. the parameter is not specified, it is assumed the value "0".
  13522. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  13523. should be escaped.
  13524. @item max
  13525. Set the maximum integer value to use for expressing numerator and
  13526. denominator when reducing the expressed aspect ratio to a rational.
  13527. Default value is @code{100}.
  13528. @end table
  13529. The parameter @var{sar} is an expression containing
  13530. the following constants:
  13531. @table @option
  13532. @item E, PI, PHI
  13533. These are approximated values for the mathematical constants e
  13534. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  13535. @item w, h
  13536. The input width and height.
  13537. @item a
  13538. These are the same as @var{w} / @var{h}.
  13539. @item sar
  13540. The input sample aspect ratio.
  13541. @item dar
  13542. The input display aspect ratio. It is the same as
  13543. (@var{w} / @var{h}) * @var{sar}.
  13544. @item hsub, vsub
  13545. Horizontal and vertical chroma subsample values. For example, for the
  13546. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13547. @end table
  13548. @subsection Examples
  13549. @itemize
  13550. @item
  13551. To change the display aspect ratio to 16:9, specify one of the following:
  13552. @example
  13553. setdar=dar=1.77777
  13554. setdar=dar=16/9
  13555. @end example
  13556. @item
  13557. To change the sample aspect ratio to 10:11, specify:
  13558. @example
  13559. setsar=sar=10/11
  13560. @end example
  13561. @item
  13562. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  13563. 1000 in the aspect ratio reduction, use the command:
  13564. @example
  13565. setdar=ratio=16/9:max=1000
  13566. @end example
  13567. @end itemize
  13568. @anchor{setfield}
  13569. @section setfield
  13570. Force field for the output video frame.
  13571. The @code{setfield} filter marks the interlace type field for the
  13572. output frames. It does not change the input frame, but only sets the
  13573. corresponding property, which affects how the frame is treated by
  13574. following filters (e.g. @code{fieldorder} or @code{yadif}).
  13575. The filter accepts the following options:
  13576. @table @option
  13577. @item mode
  13578. Available values are:
  13579. @table @samp
  13580. @item auto
  13581. Keep the same field property.
  13582. @item bff
  13583. Mark the frame as bottom-field-first.
  13584. @item tff
  13585. Mark the frame as top-field-first.
  13586. @item prog
  13587. Mark the frame as progressive.
  13588. @end table
  13589. @end table
  13590. @anchor{setparams}
  13591. @section setparams
  13592. Force frame parameter for the output video frame.
  13593. The @code{setparams} filter marks interlace and color range for the
  13594. output frames. It does not change the input frame, but only sets the
  13595. corresponding property, which affects how the frame is treated by
  13596. filters/encoders.
  13597. @table @option
  13598. @item field_mode
  13599. Available values are:
  13600. @table @samp
  13601. @item auto
  13602. Keep the same field property (default).
  13603. @item bff
  13604. Mark the frame as bottom-field-first.
  13605. @item tff
  13606. Mark the frame as top-field-first.
  13607. @item prog
  13608. Mark the frame as progressive.
  13609. @end table
  13610. @item range
  13611. Available values are:
  13612. @table @samp
  13613. @item auto
  13614. Keep the same color range property (default).
  13615. @item unspecified, unknown
  13616. Mark the frame as unspecified color range.
  13617. @item limited, tv, mpeg
  13618. Mark the frame as limited range.
  13619. @item full, pc, jpeg
  13620. Mark the frame as full range.
  13621. @end table
  13622. @item color_primaries
  13623. Set the color primaries.
  13624. Available values are:
  13625. @table @samp
  13626. @item auto
  13627. Keep the same color primaries property (default).
  13628. @item bt709
  13629. @item unknown
  13630. @item bt470m
  13631. @item bt470bg
  13632. @item smpte170m
  13633. @item smpte240m
  13634. @item film
  13635. @item bt2020
  13636. @item smpte428
  13637. @item smpte431
  13638. @item smpte432
  13639. @item jedec-p22
  13640. @end table
  13641. @item color_trc
  13642. Set the color transfer.
  13643. Available values are:
  13644. @table @samp
  13645. @item auto
  13646. Keep the same color trc property (default).
  13647. @item bt709
  13648. @item unknown
  13649. @item bt470m
  13650. @item bt470bg
  13651. @item smpte170m
  13652. @item smpte240m
  13653. @item linear
  13654. @item log100
  13655. @item log316
  13656. @item iec61966-2-4
  13657. @item bt1361e
  13658. @item iec61966-2-1
  13659. @item bt2020-10
  13660. @item bt2020-12
  13661. @item smpte2084
  13662. @item smpte428
  13663. @item arib-std-b67
  13664. @end table
  13665. @item colorspace
  13666. Set the colorspace.
  13667. Available values are:
  13668. @table @samp
  13669. @item auto
  13670. Keep the same colorspace property (default).
  13671. @item gbr
  13672. @item bt709
  13673. @item unknown
  13674. @item fcc
  13675. @item bt470bg
  13676. @item smpte170m
  13677. @item smpte240m
  13678. @item ycgco
  13679. @item bt2020nc
  13680. @item bt2020c
  13681. @item smpte2085
  13682. @item chroma-derived-nc
  13683. @item chroma-derived-c
  13684. @item ictcp
  13685. @end table
  13686. @end table
  13687. @section shear
  13688. Apply shear transform to input video.
  13689. This filter supports the following options:
  13690. @table @option
  13691. @item shx
  13692. Shear factor in X-direction. Default value is 0.
  13693. Allowed range is from -2 to 2.
  13694. @item shy
  13695. Shear factor in Y-direction. Default value is 0.
  13696. Allowed range is from -2 to 2.
  13697. @item fillcolor, c
  13698. Set the color used to fill the output area not covered by the transformed
  13699. video. For the general syntax of this option, check the
  13700. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13701. If the special value "none" is selected then no
  13702. background is printed (useful for example if the background is never shown).
  13703. Default value is "black".
  13704. @item interp
  13705. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  13706. @end table
  13707. @subsection Commands
  13708. This filter supports the all above options as @ref{commands}.
  13709. @section showinfo
  13710. Show a line containing various information for each input video frame.
  13711. The input video is not modified.
  13712. This filter supports the following options:
  13713. @table @option
  13714. @item checksum
  13715. Calculate checksums of each plane. By default enabled.
  13716. @end table
  13717. The shown line contains a sequence of key/value pairs of the form
  13718. @var{key}:@var{value}.
  13719. The following values are shown in the output:
  13720. @table @option
  13721. @item n
  13722. The (sequential) number of the input frame, starting from 0.
  13723. @item pts
  13724. The Presentation TimeStamp of the input frame, expressed as a number of
  13725. time base units. The time base unit depends on the filter input pad.
  13726. @item pts_time
  13727. The Presentation TimeStamp of the input frame, expressed as a number of
  13728. seconds.
  13729. @item pos
  13730. The position of the frame in the input stream, or -1 if this information is
  13731. unavailable and/or meaningless (for example in case of synthetic video).
  13732. @item fmt
  13733. The pixel format name.
  13734. @item sar
  13735. The sample aspect ratio of the input frame, expressed in the form
  13736. @var{num}/@var{den}.
  13737. @item s
  13738. The size of the input frame. For the syntax of this option, check the
  13739. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13740. @item i
  13741. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13742. for bottom field first).
  13743. @item iskey
  13744. This is 1 if the frame is a key frame, 0 otherwise.
  13745. @item type
  13746. The picture type of the input frame ("I" for an I-frame, "P" for a
  13747. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13748. Also refer to the documentation of the @code{AVPictureType} enum and of
  13749. the @code{av_get_picture_type_char} function defined in
  13750. @file{libavutil/avutil.h}.
  13751. @item checksum
  13752. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13753. @item plane_checksum
  13754. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13755. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13756. @item mean
  13757. The mean value of pixels in each plane of the input frame, expressed in the form
  13758. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13759. @item stdev
  13760. The standard deviation of pixel values in each plane of the input frame, expressed
  13761. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13762. @end table
  13763. @section showpalette
  13764. Displays the 256 colors palette of each frame. This filter is only relevant for
  13765. @var{pal8} pixel format frames.
  13766. It accepts the following option:
  13767. @table @option
  13768. @item s
  13769. Set the size of the box used to represent one palette color entry. Default is
  13770. @code{30} (for a @code{30x30} pixel box).
  13771. @end table
  13772. @section shuffleframes
  13773. Reorder and/or duplicate and/or drop video frames.
  13774. It accepts the following parameters:
  13775. @table @option
  13776. @item mapping
  13777. Set the destination indexes of input frames.
  13778. This is space or '|' separated list of indexes that maps input frames to output
  13779. frames. Number of indexes also sets maximal value that each index may have.
  13780. '-1' index have special meaning and that is to drop frame.
  13781. @end table
  13782. The first frame has the index 0. The default is to keep the input unchanged.
  13783. @subsection Examples
  13784. @itemize
  13785. @item
  13786. Swap second and third frame of every three frames of the input:
  13787. @example
  13788. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13789. @end example
  13790. @item
  13791. Swap 10th and 1st frame of every ten frames of the input:
  13792. @example
  13793. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13794. @end example
  13795. @end itemize
  13796. @section shufflepixels
  13797. Reorder pixels in video frames.
  13798. This filter accepts the following options:
  13799. @table @option
  13800. @item direction, d
  13801. Set shuffle direction. Can be forward or inverse direction.
  13802. Default direction is forward.
  13803. @item mode, m
  13804. Set shuffle mode. Can be horizontal, vertical or block mode.
  13805. @item width, w
  13806. @item height, h
  13807. Set shuffle block_size. In case of horizontal shuffle mode only width
  13808. part of size is used, and in case of vertical shuffle mode only height
  13809. part of size is used.
  13810. @item seed, s
  13811. Set random seed used with shuffling pixels. Mainly useful to set to be able
  13812. to reverse filtering process to get original input.
  13813. For example, to reverse forward shuffle you need to use same parameters
  13814. and exact same seed and to set direction to inverse.
  13815. @end table
  13816. @section shuffleplanes
  13817. Reorder and/or duplicate video planes.
  13818. It accepts the following parameters:
  13819. @table @option
  13820. @item map0
  13821. The index of the input plane to be used as the first output plane.
  13822. @item map1
  13823. The index of the input plane to be used as the second output plane.
  13824. @item map2
  13825. The index of the input plane to be used as the third output plane.
  13826. @item map3
  13827. The index of the input plane to be used as the fourth output plane.
  13828. @end table
  13829. The first plane has the index 0. The default is to keep the input unchanged.
  13830. @subsection Examples
  13831. @itemize
  13832. @item
  13833. Swap the second and third planes of the input:
  13834. @example
  13835. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13836. @end example
  13837. @end itemize
  13838. @anchor{signalstats}
  13839. @section signalstats
  13840. Evaluate various visual metrics that assist in determining issues associated
  13841. with the digitization of analog video media.
  13842. By default the filter will log these metadata values:
  13843. @table @option
  13844. @item YMIN
  13845. Display the minimal Y value contained within the input frame. Expressed in
  13846. range of [0-255].
  13847. @item YLOW
  13848. Display the Y value at the 10% percentile within the input frame. Expressed in
  13849. range of [0-255].
  13850. @item YAVG
  13851. Display the average Y value within the input frame. Expressed in range of
  13852. [0-255].
  13853. @item YHIGH
  13854. Display the Y value at the 90% percentile within the input frame. Expressed in
  13855. range of [0-255].
  13856. @item YMAX
  13857. Display the maximum Y value contained within the input frame. Expressed in
  13858. range of [0-255].
  13859. @item UMIN
  13860. Display the minimal U value contained within the input frame. Expressed in
  13861. range of [0-255].
  13862. @item ULOW
  13863. Display the U value at the 10% percentile within the input frame. Expressed in
  13864. range of [0-255].
  13865. @item UAVG
  13866. Display the average U value within the input frame. Expressed in range of
  13867. [0-255].
  13868. @item UHIGH
  13869. Display the U value at the 90% percentile within the input frame. Expressed in
  13870. range of [0-255].
  13871. @item UMAX
  13872. Display the maximum U value contained within the input frame. Expressed in
  13873. range of [0-255].
  13874. @item VMIN
  13875. Display the minimal V value contained within the input frame. Expressed in
  13876. range of [0-255].
  13877. @item VLOW
  13878. Display the V value at the 10% percentile within the input frame. Expressed in
  13879. range of [0-255].
  13880. @item VAVG
  13881. Display the average V value within the input frame. Expressed in range of
  13882. [0-255].
  13883. @item VHIGH
  13884. Display the V value at the 90% percentile within the input frame. Expressed in
  13885. range of [0-255].
  13886. @item VMAX
  13887. Display the maximum V value contained within the input frame. Expressed in
  13888. range of [0-255].
  13889. @item SATMIN
  13890. Display the minimal saturation value contained within the input frame.
  13891. Expressed in range of [0-~181.02].
  13892. @item SATLOW
  13893. Display the saturation value at the 10% percentile within the input frame.
  13894. Expressed in range of [0-~181.02].
  13895. @item SATAVG
  13896. Display the average saturation value within the input frame. Expressed in range
  13897. of [0-~181.02].
  13898. @item SATHIGH
  13899. Display the saturation value at the 90% percentile within the input frame.
  13900. Expressed in range of [0-~181.02].
  13901. @item SATMAX
  13902. Display the maximum saturation value contained within the input frame.
  13903. Expressed in range of [0-~181.02].
  13904. @item HUEMED
  13905. Display the median value for hue within the input frame. Expressed in range of
  13906. [0-360].
  13907. @item HUEAVG
  13908. Display the average value for hue within the input frame. Expressed in range of
  13909. [0-360].
  13910. @item YDIF
  13911. Display the average of sample value difference between all values of the Y
  13912. plane in the current frame and corresponding values of the previous input frame.
  13913. Expressed in range of [0-255].
  13914. @item UDIF
  13915. Display the average of sample value difference between all values of the U
  13916. plane in the current frame and corresponding values of the previous input frame.
  13917. Expressed in range of [0-255].
  13918. @item VDIF
  13919. Display the average of sample value difference between all values of the V
  13920. plane in the current frame and corresponding values of the previous input frame.
  13921. Expressed in range of [0-255].
  13922. @item YBITDEPTH
  13923. Display bit depth of Y plane in current frame.
  13924. Expressed in range of [0-16].
  13925. @item UBITDEPTH
  13926. Display bit depth of U plane in current frame.
  13927. Expressed in range of [0-16].
  13928. @item VBITDEPTH
  13929. Display bit depth of V plane in current frame.
  13930. Expressed in range of [0-16].
  13931. @end table
  13932. The filter accepts the following options:
  13933. @table @option
  13934. @item stat
  13935. @item out
  13936. @option{stat} specify an additional form of image analysis.
  13937. @option{out} output video with the specified type of pixel highlighted.
  13938. Both options accept the following values:
  13939. @table @samp
  13940. @item tout
  13941. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13942. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13943. include the results of video dropouts, head clogs, or tape tracking issues.
  13944. @item vrep
  13945. Identify @var{vertical line repetition}. Vertical line repetition includes
  13946. similar rows of pixels within a frame. In born-digital video vertical line
  13947. repetition is common, but this pattern is uncommon in video digitized from an
  13948. analog source. When it occurs in video that results from the digitization of an
  13949. analog source it can indicate concealment from a dropout compensator.
  13950. @item brng
  13951. Identify pixels that fall outside of legal broadcast range.
  13952. @end table
  13953. @item color, c
  13954. Set the highlight color for the @option{out} option. The default color is
  13955. yellow.
  13956. @end table
  13957. @subsection Examples
  13958. @itemize
  13959. @item
  13960. Output data of various video metrics:
  13961. @example
  13962. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13963. @end example
  13964. @item
  13965. Output specific data about the minimum and maximum values of the Y plane per frame:
  13966. @example
  13967. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13968. @end example
  13969. @item
  13970. Playback video while highlighting pixels that are outside of broadcast range in red.
  13971. @example
  13972. ffplay example.mov -vf signalstats="out=brng:color=red"
  13973. @end example
  13974. @item
  13975. Playback video with signalstats metadata drawn over the frame.
  13976. @example
  13977. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13978. @end example
  13979. The contents of signalstat_drawtext.txt used in the command are:
  13980. @example
  13981. time %@{pts:hms@}
  13982. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13983. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13984. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13985. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13986. @end example
  13987. @end itemize
  13988. @anchor{signature}
  13989. @section signature
  13990. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13991. input. In this case the matching between the inputs can be calculated additionally.
  13992. The filter always passes through the first input. The signature of each stream can
  13993. be written into a file.
  13994. It accepts the following options:
  13995. @table @option
  13996. @item detectmode
  13997. Enable or disable the matching process.
  13998. Available values are:
  13999. @table @samp
  14000. @item off
  14001. Disable the calculation of a matching (default).
  14002. @item full
  14003. Calculate the matching for the whole video and output whether the whole video
  14004. matches or only parts.
  14005. @item fast
  14006. Calculate only until a matching is found or the video ends. Should be faster in
  14007. some cases.
  14008. @end table
  14009. @item nb_inputs
  14010. Set the number of inputs. The option value must be a non negative integer.
  14011. Default value is 1.
  14012. @item filename
  14013. Set the path to which the output is written. If there is more than one input,
  14014. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  14015. integer), that will be replaced with the input number. If no filename is
  14016. specified, no output will be written. This is the default.
  14017. @item format
  14018. Choose the output format.
  14019. Available values are:
  14020. @table @samp
  14021. @item binary
  14022. Use the specified binary representation (default).
  14023. @item xml
  14024. Use the specified xml representation.
  14025. @end table
  14026. @item th_d
  14027. Set threshold to detect one word as similar. The option value must be an integer
  14028. greater than zero. The default value is 9000.
  14029. @item th_dc
  14030. Set threshold to detect all words as similar. The option value must be an integer
  14031. greater than zero. The default value is 60000.
  14032. @item th_xh
  14033. Set threshold to detect frames as similar. The option value must be an integer
  14034. greater than zero. The default value is 116.
  14035. @item th_di
  14036. Set the minimum length of a sequence in frames to recognize it as matching
  14037. sequence. The option value must be a non negative integer value.
  14038. The default value is 0.
  14039. @item th_it
  14040. Set the minimum relation, that matching frames to all frames must have.
  14041. The option value must be a double value between 0 and 1. The default value is 0.5.
  14042. @end table
  14043. @subsection Examples
  14044. @itemize
  14045. @item
  14046. To calculate the signature of an input video and store it in signature.bin:
  14047. @example
  14048. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  14049. @end example
  14050. @item
  14051. To detect whether two videos match and store the signatures in XML format in
  14052. signature0.xml and signature1.xml:
  14053. @example
  14054. 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 -
  14055. @end example
  14056. @end itemize
  14057. @anchor{smartblur}
  14058. @section smartblur
  14059. Blur the input video without impacting the outlines.
  14060. It accepts the following options:
  14061. @table @option
  14062. @item luma_radius, lr
  14063. Set the luma radius. The option value must be a float number in
  14064. the range [0.1,5.0] that specifies the variance of the gaussian filter
  14065. used to blur the image (slower if larger). Default value is 1.0.
  14066. @item luma_strength, ls
  14067. Set the luma strength. The option value must be a float number
  14068. in the range [-1.0,1.0] that configures the blurring. A value included
  14069. in [0.0,1.0] will blur the image whereas a value included in
  14070. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  14071. @item luma_threshold, lt
  14072. Set the luma threshold used as a coefficient to determine
  14073. whether a pixel should be blurred or not. The option value must be an
  14074. integer in the range [-30,30]. A value of 0 will filter all the image,
  14075. a value included in [0,30] will filter flat areas and a value included
  14076. in [-30,0] will filter edges. Default value is 0.
  14077. @item chroma_radius, cr
  14078. Set the chroma radius. The option value must be a float number in
  14079. the range [0.1,5.0] that specifies the variance of the gaussian filter
  14080. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  14081. @item chroma_strength, cs
  14082. Set the chroma strength. The option value must be a float number
  14083. in the range [-1.0,1.0] that configures the blurring. A value included
  14084. in [0.0,1.0] will blur the image whereas a value included in
  14085. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  14086. @item chroma_threshold, ct
  14087. Set the chroma threshold used as a coefficient to determine
  14088. whether a pixel should be blurred or not. The option value must be an
  14089. integer in the range [-30,30]. A value of 0 will filter all the image,
  14090. a value included in [0,30] will filter flat areas and a value included
  14091. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  14092. @end table
  14093. If a chroma option is not explicitly set, the corresponding luma value
  14094. is set.
  14095. @section sobel
  14096. Apply sobel operator to input video stream.
  14097. The filter accepts the following option:
  14098. @table @option
  14099. @item planes
  14100. Set which planes will be processed, unprocessed planes will be copied.
  14101. By default value 0xf, all planes will be processed.
  14102. @item scale
  14103. Set value which will be multiplied with filtered result.
  14104. @item delta
  14105. Set value which will be added to filtered result.
  14106. @end table
  14107. @subsection Commands
  14108. This filter supports the all above options as @ref{commands}.
  14109. @anchor{spp}
  14110. @section spp
  14111. Apply a simple postprocessing filter that compresses and decompresses the image
  14112. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  14113. and average the results.
  14114. The filter accepts the following options:
  14115. @table @option
  14116. @item quality
  14117. Set quality. This option defines the number of levels for averaging. It accepts
  14118. an integer in the range 0-6. If set to @code{0}, the filter will have no
  14119. effect. A value of @code{6} means the higher quality. For each increment of
  14120. that value the speed drops by a factor of approximately 2. Default value is
  14121. @code{3}.
  14122. @item qp
  14123. Force a constant quantization parameter. If not set, the filter will use the QP
  14124. from the video stream (if available).
  14125. @item mode
  14126. Set thresholding mode. Available modes are:
  14127. @table @samp
  14128. @item hard
  14129. Set hard thresholding (default).
  14130. @item soft
  14131. Set soft thresholding (better de-ringing effect, but likely blurrier).
  14132. @end table
  14133. @item use_bframe_qp
  14134. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  14135. option may cause flicker since the B-Frames have often larger QP. Default is
  14136. @code{0} (not enabled).
  14137. @end table
  14138. @subsection Commands
  14139. This filter supports the following commands:
  14140. @table @option
  14141. @item quality, level
  14142. Set quality level. The value @code{max} can be used to set the maximum level,
  14143. currently @code{6}.
  14144. @end table
  14145. @anchor{sr}
  14146. @section sr
  14147. Scale the input by applying one of the super-resolution methods based on
  14148. convolutional neural networks. Supported models:
  14149. @itemize
  14150. @item
  14151. Super-Resolution Convolutional Neural Network model (SRCNN).
  14152. See @url{https://arxiv.org/abs/1501.00092}.
  14153. @item
  14154. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  14155. See @url{https://arxiv.org/abs/1609.05158}.
  14156. @end itemize
  14157. Training scripts as well as scripts for model file (.pb) saving can be found at
  14158. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  14159. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  14160. Native model files (.model) can be generated from TensorFlow model
  14161. files (.pb) by using tools/python/convert.py
  14162. The filter accepts the following options:
  14163. @table @option
  14164. @item dnn_backend
  14165. Specify which DNN backend to use for model loading and execution. This option accepts
  14166. the following values:
  14167. @table @samp
  14168. @item native
  14169. Native implementation of DNN loading and execution.
  14170. @item tensorflow
  14171. TensorFlow backend. To enable this backend you
  14172. need to install the TensorFlow for C library (see
  14173. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  14174. @code{--enable-libtensorflow}
  14175. @end table
  14176. Default value is @samp{native}.
  14177. @item model
  14178. Set path to model file specifying network architecture and its parameters.
  14179. Note that different backends use different file formats. TensorFlow backend
  14180. can load files for both formats, while native backend can load files for only
  14181. its format.
  14182. @item scale_factor
  14183. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  14184. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  14185. input upscaled using bicubic upscaling with proper scale factor.
  14186. @end table
  14187. This feature can also be finished with @ref{dnn_processing} filter.
  14188. @section ssim
  14189. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  14190. This filter takes in input two input videos, the first input is
  14191. considered the "main" source and is passed unchanged to the
  14192. output. The second input is used as a "reference" video for computing
  14193. the SSIM.
  14194. Both video inputs must have the same resolution and pixel format for
  14195. this filter to work correctly. Also it assumes that both inputs
  14196. have the same number of frames, which are compared one by one.
  14197. The filter stores the calculated SSIM of each frame.
  14198. The description of the accepted parameters follows.
  14199. @table @option
  14200. @item stats_file, f
  14201. If specified the filter will use the named file to save the SSIM of
  14202. each individual frame. When filename equals "-" the data is sent to
  14203. standard output.
  14204. @end table
  14205. The file printed if @var{stats_file} is selected, contains a sequence of
  14206. key/value pairs of the form @var{key}:@var{value} for each compared
  14207. couple of frames.
  14208. A description of each shown parameter follows:
  14209. @table @option
  14210. @item n
  14211. sequential number of the input frame, starting from 1
  14212. @item Y, U, V, R, G, B
  14213. SSIM of the compared frames for the component specified by the suffix.
  14214. @item All
  14215. SSIM of the compared frames for the whole frame.
  14216. @item dB
  14217. Same as above but in dB representation.
  14218. @end table
  14219. This filter also supports the @ref{framesync} options.
  14220. @subsection Examples
  14221. @itemize
  14222. @item
  14223. For example:
  14224. @example
  14225. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  14226. [main][ref] ssim="stats_file=stats.log" [out]
  14227. @end example
  14228. On this example the input file being processed is compared with the
  14229. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  14230. is stored in @file{stats.log}.
  14231. @item
  14232. Another example with both psnr and ssim at same time:
  14233. @example
  14234. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  14235. @end example
  14236. @item
  14237. Another example with different containers:
  14238. @example
  14239. 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 -
  14240. @end example
  14241. @end itemize
  14242. @section stereo3d
  14243. Convert between different stereoscopic image formats.
  14244. The filters accept the following options:
  14245. @table @option
  14246. @item in
  14247. Set stereoscopic image format of input.
  14248. Available values for input image formats are:
  14249. @table @samp
  14250. @item sbsl
  14251. side by side parallel (left eye left, right eye right)
  14252. @item sbsr
  14253. side by side crosseye (right eye left, left eye right)
  14254. @item sbs2l
  14255. side by side parallel with half width resolution
  14256. (left eye left, right eye right)
  14257. @item sbs2r
  14258. side by side crosseye with half width resolution
  14259. (right eye left, left eye right)
  14260. @item abl
  14261. @item tbl
  14262. above-below (left eye above, right eye below)
  14263. @item abr
  14264. @item tbr
  14265. above-below (right eye above, left eye below)
  14266. @item ab2l
  14267. @item tb2l
  14268. above-below with half height resolution
  14269. (left eye above, right eye below)
  14270. @item ab2r
  14271. @item tb2r
  14272. above-below with half height resolution
  14273. (right eye above, left eye below)
  14274. @item al
  14275. alternating frames (left eye first, right eye second)
  14276. @item ar
  14277. alternating frames (right eye first, left eye second)
  14278. @item irl
  14279. interleaved rows (left eye has top row, right eye starts on next row)
  14280. @item irr
  14281. interleaved rows (right eye has top row, left eye starts on next row)
  14282. @item icl
  14283. interleaved columns, left eye first
  14284. @item icr
  14285. interleaved columns, right eye first
  14286. Default value is @samp{sbsl}.
  14287. @end table
  14288. @item out
  14289. Set stereoscopic image format of output.
  14290. @table @samp
  14291. @item sbsl
  14292. side by side parallel (left eye left, right eye right)
  14293. @item sbsr
  14294. side by side crosseye (right eye left, left eye right)
  14295. @item sbs2l
  14296. side by side parallel with half width resolution
  14297. (left eye left, right eye right)
  14298. @item sbs2r
  14299. side by side crosseye with half width resolution
  14300. (right eye left, left eye right)
  14301. @item abl
  14302. @item tbl
  14303. above-below (left eye above, right eye below)
  14304. @item abr
  14305. @item tbr
  14306. above-below (right eye above, left eye below)
  14307. @item ab2l
  14308. @item tb2l
  14309. above-below with half height resolution
  14310. (left eye above, right eye below)
  14311. @item ab2r
  14312. @item tb2r
  14313. above-below with half height resolution
  14314. (right eye above, left eye below)
  14315. @item al
  14316. alternating frames (left eye first, right eye second)
  14317. @item ar
  14318. alternating frames (right eye first, left eye second)
  14319. @item irl
  14320. interleaved rows (left eye has top row, right eye starts on next row)
  14321. @item irr
  14322. interleaved rows (right eye has top row, left eye starts on next row)
  14323. @item arbg
  14324. anaglyph red/blue gray
  14325. (red filter on left eye, blue filter on right eye)
  14326. @item argg
  14327. anaglyph red/green gray
  14328. (red filter on left eye, green filter on right eye)
  14329. @item arcg
  14330. anaglyph red/cyan gray
  14331. (red filter on left eye, cyan filter on right eye)
  14332. @item arch
  14333. anaglyph red/cyan half colored
  14334. (red filter on left eye, cyan filter on right eye)
  14335. @item arcc
  14336. anaglyph red/cyan color
  14337. (red filter on left eye, cyan filter on right eye)
  14338. @item arcd
  14339. anaglyph red/cyan color optimized with the least squares projection of dubois
  14340. (red filter on left eye, cyan filter on right eye)
  14341. @item agmg
  14342. anaglyph green/magenta gray
  14343. (green filter on left eye, magenta filter on right eye)
  14344. @item agmh
  14345. anaglyph green/magenta half colored
  14346. (green filter on left eye, magenta filter on right eye)
  14347. @item agmc
  14348. anaglyph green/magenta colored
  14349. (green filter on left eye, magenta filter on right eye)
  14350. @item agmd
  14351. anaglyph green/magenta color optimized with the least squares projection of dubois
  14352. (green filter on left eye, magenta filter on right eye)
  14353. @item aybg
  14354. anaglyph yellow/blue gray
  14355. (yellow filter on left eye, blue filter on right eye)
  14356. @item aybh
  14357. anaglyph yellow/blue half colored
  14358. (yellow filter on left eye, blue filter on right eye)
  14359. @item aybc
  14360. anaglyph yellow/blue colored
  14361. (yellow filter on left eye, blue filter on right eye)
  14362. @item aybd
  14363. anaglyph yellow/blue color optimized with the least squares projection of dubois
  14364. (yellow filter on left eye, blue filter on right eye)
  14365. @item ml
  14366. mono output (left eye only)
  14367. @item mr
  14368. mono output (right eye only)
  14369. @item chl
  14370. checkerboard, left eye first
  14371. @item chr
  14372. checkerboard, right eye first
  14373. @item icl
  14374. interleaved columns, left eye first
  14375. @item icr
  14376. interleaved columns, right eye first
  14377. @item hdmi
  14378. HDMI frame pack
  14379. @end table
  14380. Default value is @samp{arcd}.
  14381. @end table
  14382. @subsection Examples
  14383. @itemize
  14384. @item
  14385. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  14386. @example
  14387. stereo3d=sbsl:aybd
  14388. @end example
  14389. @item
  14390. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  14391. @example
  14392. stereo3d=abl:sbsr
  14393. @end example
  14394. @end itemize
  14395. @section streamselect, astreamselect
  14396. Select video or audio streams.
  14397. The filter accepts the following options:
  14398. @table @option
  14399. @item inputs
  14400. Set number of inputs. Default is 2.
  14401. @item map
  14402. Set input indexes to remap to outputs.
  14403. @end table
  14404. @subsection Commands
  14405. The @code{streamselect} and @code{astreamselect} filter supports the following
  14406. commands:
  14407. @table @option
  14408. @item map
  14409. Set input indexes to remap to outputs.
  14410. @end table
  14411. @subsection Examples
  14412. @itemize
  14413. @item
  14414. Select first 5 seconds 1st stream and rest of time 2nd stream:
  14415. @example
  14416. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  14417. @end example
  14418. @item
  14419. Same as above, but for audio:
  14420. @example
  14421. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  14422. @end example
  14423. @end itemize
  14424. @anchor{subtitles}
  14425. @section subtitles
  14426. Draw subtitles on top of input video using the libass library.
  14427. To enable compilation of this filter you need to configure FFmpeg with
  14428. @code{--enable-libass}. This filter also requires a build with libavcodec and
  14429. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  14430. Alpha) subtitles format.
  14431. The filter accepts the following options:
  14432. @table @option
  14433. @item filename, f
  14434. Set the filename of the subtitle file to read. It must be specified.
  14435. @item original_size
  14436. Specify the size of the original video, the video for which the ASS file
  14437. was composed. For the syntax of this option, check the
  14438. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14439. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  14440. correctly scale the fonts if the aspect ratio has been changed.
  14441. @item fontsdir
  14442. Set a directory path containing fonts that can be used by the filter.
  14443. These fonts will be used in addition to whatever the font provider uses.
  14444. @item alpha
  14445. Process alpha channel, by default alpha channel is untouched.
  14446. @item charenc
  14447. Set subtitles input character encoding. @code{subtitles} filter only. Only
  14448. useful if not UTF-8.
  14449. @item stream_index, si
  14450. Set subtitles stream index. @code{subtitles} filter only.
  14451. @item force_style
  14452. Override default style or script info parameters of the subtitles. It accepts a
  14453. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  14454. @end table
  14455. If the first key is not specified, it is assumed that the first value
  14456. specifies the @option{filename}.
  14457. For example, to render the file @file{sub.srt} on top of the input
  14458. video, use the command:
  14459. @example
  14460. subtitles=sub.srt
  14461. @end example
  14462. which is equivalent to:
  14463. @example
  14464. subtitles=filename=sub.srt
  14465. @end example
  14466. To render the default subtitles stream from file @file{video.mkv}, use:
  14467. @example
  14468. subtitles=video.mkv
  14469. @end example
  14470. To render the second subtitles stream from that file, use:
  14471. @example
  14472. subtitles=video.mkv:si=1
  14473. @end example
  14474. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  14475. @code{DejaVu Serif}, use:
  14476. @example
  14477. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  14478. @end example
  14479. @section super2xsai
  14480. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  14481. Interpolate) pixel art scaling algorithm.
  14482. Useful for enlarging pixel art images without reducing sharpness.
  14483. @section swaprect
  14484. Swap two rectangular objects in video.
  14485. This filter accepts the following options:
  14486. @table @option
  14487. @item w
  14488. Set object width.
  14489. @item h
  14490. Set object height.
  14491. @item x1
  14492. Set 1st rect x coordinate.
  14493. @item y1
  14494. Set 1st rect y coordinate.
  14495. @item x2
  14496. Set 2nd rect x coordinate.
  14497. @item y2
  14498. Set 2nd rect y coordinate.
  14499. All expressions are evaluated once for each frame.
  14500. @end table
  14501. The all options are expressions containing the following constants:
  14502. @table @option
  14503. @item w
  14504. @item h
  14505. The input width and height.
  14506. @item a
  14507. same as @var{w} / @var{h}
  14508. @item sar
  14509. input sample aspect ratio
  14510. @item dar
  14511. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  14512. @item n
  14513. The number of the input frame, starting from 0.
  14514. @item t
  14515. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  14516. @item pos
  14517. the position in the file of the input frame, NAN if unknown
  14518. @end table
  14519. @section swapuv
  14520. Swap U & V plane.
  14521. @section tblend
  14522. Blend successive video frames.
  14523. See @ref{blend}
  14524. @section telecine
  14525. Apply telecine process to the video.
  14526. This filter accepts the following options:
  14527. @table @option
  14528. @item first_field
  14529. @table @samp
  14530. @item top, t
  14531. top field first
  14532. @item bottom, b
  14533. bottom field first
  14534. The default value is @code{top}.
  14535. @end table
  14536. @item pattern
  14537. A string of numbers representing the pulldown pattern you wish to apply.
  14538. The default value is @code{23}.
  14539. @end table
  14540. @example
  14541. Some typical patterns:
  14542. NTSC output (30i):
  14543. 27.5p: 32222
  14544. 24p: 23 (classic)
  14545. 24p: 2332 (preferred)
  14546. 20p: 33
  14547. 18p: 334
  14548. 16p: 3444
  14549. PAL output (25i):
  14550. 27.5p: 12222
  14551. 24p: 222222222223 ("Euro pulldown")
  14552. 16.67p: 33
  14553. 16p: 33333334
  14554. @end example
  14555. @section thistogram
  14556. Compute and draw a color distribution histogram for the input video across time.
  14557. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  14558. at certain time, this filter shows also past histograms of number of frames defined
  14559. by @code{width} option.
  14560. The computed histogram is a representation of the color component
  14561. distribution in an image.
  14562. The filter accepts the following options:
  14563. @table @option
  14564. @item width, w
  14565. Set width of single color component output. Default value is @code{0}.
  14566. Value of @code{0} means width will be picked from input video.
  14567. This also set number of passed histograms to keep.
  14568. Allowed range is [0, 8192].
  14569. @item display_mode, d
  14570. Set display mode.
  14571. It accepts the following values:
  14572. @table @samp
  14573. @item stack
  14574. Per color component graphs are placed below each other.
  14575. @item parade
  14576. Per color component graphs are placed side by side.
  14577. @item overlay
  14578. Presents information identical to that in the @code{parade}, except
  14579. that the graphs representing color components are superimposed directly
  14580. over one another.
  14581. @end table
  14582. Default is @code{stack}.
  14583. @item levels_mode, m
  14584. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  14585. Default is @code{linear}.
  14586. @item components, c
  14587. Set what color components to display.
  14588. Default is @code{7}.
  14589. @item bgopacity, b
  14590. Set background opacity. Default is @code{0.9}.
  14591. @item envelope, e
  14592. Show envelope. Default is disabled.
  14593. @item ecolor, ec
  14594. Set envelope color. Default is @code{gold}.
  14595. @item slide
  14596. Set slide mode.
  14597. Available values for slide is:
  14598. @table @samp
  14599. @item frame
  14600. Draw new frame when right border is reached.
  14601. @item replace
  14602. Replace old columns with new ones.
  14603. @item scroll
  14604. Scroll from right to left.
  14605. @item rscroll
  14606. Scroll from left to right.
  14607. @item picture
  14608. Draw single picture.
  14609. @end table
  14610. Default is @code{replace}.
  14611. @end table
  14612. @section threshold
  14613. Apply threshold effect to video stream.
  14614. This filter needs four video streams to perform thresholding.
  14615. First stream is stream we are filtering.
  14616. Second stream is holding threshold values, third stream is holding min values,
  14617. and last, fourth stream is holding max values.
  14618. The filter accepts the following option:
  14619. @table @option
  14620. @item planes
  14621. Set which planes will be processed, unprocessed planes will be copied.
  14622. By default value 0xf, all planes will be processed.
  14623. @end table
  14624. For example if first stream pixel's component value is less then threshold value
  14625. of pixel component from 2nd threshold stream, third stream value will picked,
  14626. otherwise fourth stream pixel component value will be picked.
  14627. Using color source filter one can perform various types of thresholding:
  14628. @subsection Examples
  14629. @itemize
  14630. @item
  14631. Binary threshold, using gray color as threshold:
  14632. @example
  14633. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  14634. @end example
  14635. @item
  14636. Inverted binary threshold, using gray color as threshold:
  14637. @example
  14638. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  14639. @end example
  14640. @item
  14641. Truncate binary threshold, using gray color as threshold:
  14642. @example
  14643. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14644. @end example
  14645. @item
  14646. Threshold to zero, using gray color as threshold:
  14647. @example
  14648. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14649. @end example
  14650. @item
  14651. Inverted threshold to zero, using gray color as threshold:
  14652. @example
  14653. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14654. @end example
  14655. @end itemize
  14656. @section thumbnail
  14657. Select the most representative frame in a given sequence of consecutive frames.
  14658. The filter accepts the following options:
  14659. @table @option
  14660. @item n
  14661. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14662. will pick one of them, and then handle the next batch of @var{n} frames until
  14663. the end. Default is @code{100}.
  14664. @end table
  14665. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14666. value will result in a higher memory usage, so a high value is not recommended.
  14667. @subsection Examples
  14668. @itemize
  14669. @item
  14670. Extract one picture each 50 frames:
  14671. @example
  14672. thumbnail=50
  14673. @end example
  14674. @item
  14675. Complete example of a thumbnail creation with @command{ffmpeg}:
  14676. @example
  14677. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14678. @end example
  14679. @end itemize
  14680. @anchor{tile}
  14681. @section tile
  14682. Tile several successive frames together.
  14683. The @ref{untile} filter can do the reverse.
  14684. The filter accepts the following options:
  14685. @table @option
  14686. @item layout
  14687. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14688. this option, check the
  14689. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14690. @item nb_frames
  14691. Set the maximum number of frames to render in the given area. It must be less
  14692. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14693. the area will be used.
  14694. @item margin
  14695. Set the outer border margin in pixels.
  14696. @item padding
  14697. Set the inner border thickness (i.e. the number of pixels between frames). For
  14698. more advanced padding options (such as having different values for the edges),
  14699. refer to the pad video filter.
  14700. @item color
  14701. Specify the color of the unused area. For the syntax of this option, check the
  14702. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14703. The default value of @var{color} is "black".
  14704. @item overlap
  14705. Set the number of frames to overlap when tiling several successive frames together.
  14706. The value must be between @code{0} and @var{nb_frames - 1}.
  14707. @item init_padding
  14708. Set the number of frames to initially be empty before displaying first output frame.
  14709. This controls how soon will one get first output frame.
  14710. The value must be between @code{0} and @var{nb_frames - 1}.
  14711. @end table
  14712. @subsection Examples
  14713. @itemize
  14714. @item
  14715. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14716. @example
  14717. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14718. @end example
  14719. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14720. duplicating each output frame to accommodate the originally detected frame
  14721. rate.
  14722. @item
  14723. Display @code{5} pictures in an area of @code{3x2} frames,
  14724. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14725. mixed flat and named options:
  14726. @example
  14727. tile=3x2:nb_frames=5:padding=7:margin=2
  14728. @end example
  14729. @end itemize
  14730. @section tinterlace
  14731. Perform various types of temporal field interlacing.
  14732. Frames are counted starting from 1, so the first input frame is
  14733. considered odd.
  14734. The filter accepts the following options:
  14735. @table @option
  14736. @item mode
  14737. Specify the mode of the interlacing. This option can also be specified
  14738. as a value alone. See below for a list of values for this option.
  14739. Available values are:
  14740. @table @samp
  14741. @item merge, 0
  14742. Move odd frames into the upper field, even into the lower field,
  14743. generating a double height frame at half frame rate.
  14744. @example
  14745. ------> time
  14746. Input:
  14747. Frame 1 Frame 2 Frame 3 Frame 4
  14748. 11111 22222 33333 44444
  14749. 11111 22222 33333 44444
  14750. 11111 22222 33333 44444
  14751. 11111 22222 33333 44444
  14752. Output:
  14753. 11111 33333
  14754. 22222 44444
  14755. 11111 33333
  14756. 22222 44444
  14757. 11111 33333
  14758. 22222 44444
  14759. 11111 33333
  14760. 22222 44444
  14761. @end example
  14762. @item drop_even, 1
  14763. Only output odd frames, even frames are dropped, generating a frame with
  14764. unchanged height at half frame rate.
  14765. @example
  14766. ------> time
  14767. Input:
  14768. Frame 1 Frame 2 Frame 3 Frame 4
  14769. 11111 22222 33333 44444
  14770. 11111 22222 33333 44444
  14771. 11111 22222 33333 44444
  14772. 11111 22222 33333 44444
  14773. Output:
  14774. 11111 33333
  14775. 11111 33333
  14776. 11111 33333
  14777. 11111 33333
  14778. @end example
  14779. @item drop_odd, 2
  14780. Only output even frames, odd frames are dropped, generating a frame with
  14781. unchanged height at half frame rate.
  14782. @example
  14783. ------> time
  14784. Input:
  14785. Frame 1 Frame 2 Frame 3 Frame 4
  14786. 11111 22222 33333 44444
  14787. 11111 22222 33333 44444
  14788. 11111 22222 33333 44444
  14789. 11111 22222 33333 44444
  14790. Output:
  14791. 22222 44444
  14792. 22222 44444
  14793. 22222 44444
  14794. 22222 44444
  14795. @end example
  14796. @item pad, 3
  14797. Expand each frame to full height, but pad alternate lines with black,
  14798. generating a frame with double height at the same input frame rate.
  14799. @example
  14800. ------> time
  14801. Input:
  14802. Frame 1 Frame 2 Frame 3 Frame 4
  14803. 11111 22222 33333 44444
  14804. 11111 22222 33333 44444
  14805. 11111 22222 33333 44444
  14806. 11111 22222 33333 44444
  14807. Output:
  14808. 11111 ..... 33333 .....
  14809. ..... 22222 ..... 44444
  14810. 11111 ..... 33333 .....
  14811. ..... 22222 ..... 44444
  14812. 11111 ..... 33333 .....
  14813. ..... 22222 ..... 44444
  14814. 11111 ..... 33333 .....
  14815. ..... 22222 ..... 44444
  14816. @end example
  14817. @item interleave_top, 4
  14818. Interleave the upper field from odd frames with the lower field from
  14819. even frames, generating a frame with unchanged height at half frame rate.
  14820. @example
  14821. ------> time
  14822. Input:
  14823. Frame 1 Frame 2 Frame 3 Frame 4
  14824. 11111<- 22222 33333<- 44444
  14825. 11111 22222<- 33333 44444<-
  14826. 11111<- 22222 33333<- 44444
  14827. 11111 22222<- 33333 44444<-
  14828. Output:
  14829. 11111 33333
  14830. 22222 44444
  14831. 11111 33333
  14832. 22222 44444
  14833. @end example
  14834. @item interleave_bottom, 5
  14835. Interleave the lower field from odd frames with the upper field from
  14836. even frames, generating a frame with unchanged height at half frame rate.
  14837. @example
  14838. ------> time
  14839. Input:
  14840. Frame 1 Frame 2 Frame 3 Frame 4
  14841. 11111 22222<- 33333 44444<-
  14842. 11111<- 22222 33333<- 44444
  14843. 11111 22222<- 33333 44444<-
  14844. 11111<- 22222 33333<- 44444
  14845. Output:
  14846. 22222 44444
  14847. 11111 33333
  14848. 22222 44444
  14849. 11111 33333
  14850. @end example
  14851. @item interlacex2, 6
  14852. Double frame rate with unchanged height. Frames are inserted each
  14853. containing the second temporal field from the previous input frame and
  14854. the first temporal field from the next input frame. This mode relies on
  14855. the top_field_first flag. Useful for interlaced video displays with no
  14856. field synchronisation.
  14857. @example
  14858. ------> time
  14859. Input:
  14860. Frame 1 Frame 2 Frame 3 Frame 4
  14861. 11111 22222 33333 44444
  14862. 11111 22222 33333 44444
  14863. 11111 22222 33333 44444
  14864. 11111 22222 33333 44444
  14865. Output:
  14866. 11111 22222 22222 33333 33333 44444 44444
  14867. 11111 11111 22222 22222 33333 33333 44444
  14868. 11111 22222 22222 33333 33333 44444 44444
  14869. 11111 11111 22222 22222 33333 33333 44444
  14870. @end example
  14871. @item mergex2, 7
  14872. Move odd frames into the upper field, even into the lower field,
  14873. generating a double height frame at same frame rate.
  14874. @example
  14875. ------> time
  14876. Input:
  14877. Frame 1 Frame 2 Frame 3 Frame 4
  14878. 11111 22222 33333 44444
  14879. 11111 22222 33333 44444
  14880. 11111 22222 33333 44444
  14881. 11111 22222 33333 44444
  14882. Output:
  14883. 11111 33333 33333 55555
  14884. 22222 22222 44444 44444
  14885. 11111 33333 33333 55555
  14886. 22222 22222 44444 44444
  14887. 11111 33333 33333 55555
  14888. 22222 22222 44444 44444
  14889. 11111 33333 33333 55555
  14890. 22222 22222 44444 44444
  14891. @end example
  14892. @end table
  14893. Numeric values are deprecated but are accepted for backward
  14894. compatibility reasons.
  14895. Default mode is @code{merge}.
  14896. @item flags
  14897. Specify flags influencing the filter process.
  14898. Available value for @var{flags} is:
  14899. @table @option
  14900. @item low_pass_filter, vlpf
  14901. Enable linear vertical low-pass filtering in the filter.
  14902. Vertical low-pass filtering is required when creating an interlaced
  14903. destination from a progressive source which contains high-frequency
  14904. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14905. patterning.
  14906. @item complex_filter, cvlpf
  14907. Enable complex vertical low-pass filtering.
  14908. This will slightly less reduce interlace 'twitter' and Moire
  14909. patterning but better retain detail and subjective sharpness impression.
  14910. @item bypass_il
  14911. Bypass already interlaced frames, only adjust the frame rate.
  14912. @end table
  14913. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14914. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14915. @end table
  14916. @section tmedian
  14917. Pick median pixels from several successive input video frames.
  14918. The filter accepts the following options:
  14919. @table @option
  14920. @item radius
  14921. Set radius of median filter.
  14922. Default is 1. Allowed range is from 1 to 127.
  14923. @item planes
  14924. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14925. @item percentile
  14926. Set median percentile. Default value is @code{0.5}.
  14927. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14928. minimum values, and @code{1} maximum values.
  14929. @end table
  14930. @subsection Commands
  14931. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  14932. @section tmidequalizer
  14933. Apply Temporal Midway Video Equalization effect.
  14934. Midway Video Equalization adjusts a sequence of video frames to have the same
  14935. histograms, while maintaining their dynamics as much as possible. It's
  14936. useful for e.g. matching exposures from a video frames sequence.
  14937. This filter accepts the following option:
  14938. @table @option
  14939. @item radius
  14940. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  14941. @item sigma
  14942. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  14943. Setting this option to 0 effectively does nothing.
  14944. @item planes
  14945. Set which planes to process. Default is @code{15}, which is all available planes.
  14946. @end table
  14947. @section tmix
  14948. Mix successive video frames.
  14949. A description of the accepted options follows.
  14950. @table @option
  14951. @item frames
  14952. The number of successive frames to mix. If unspecified, it defaults to 3.
  14953. @item weights
  14954. Specify weight of each input video frame.
  14955. Each weight is separated by space. If number of weights is smaller than
  14956. number of @var{frames} last specified weight will be used for all remaining
  14957. unset weights.
  14958. @item scale
  14959. Specify scale, if it is set it will be multiplied with sum
  14960. of each weight multiplied with pixel values to give final destination
  14961. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14962. @end table
  14963. @subsection Examples
  14964. @itemize
  14965. @item
  14966. Average 7 successive frames:
  14967. @example
  14968. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14969. @end example
  14970. @item
  14971. Apply simple temporal convolution:
  14972. @example
  14973. tmix=frames=3:weights="-1 3 -1"
  14974. @end example
  14975. @item
  14976. Similar as above but only showing temporal differences:
  14977. @example
  14978. tmix=frames=3:weights="-1 2 -1":scale=1
  14979. @end example
  14980. @end itemize
  14981. @anchor{tonemap}
  14982. @section tonemap
  14983. Tone map colors from different dynamic ranges.
  14984. This filter expects data in single precision floating point, as it needs to
  14985. operate on (and can output) out-of-range values. Another filter, such as
  14986. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14987. The tonemapping algorithms implemented only work on linear light, so input
  14988. data should be linearized beforehand (and possibly correctly tagged).
  14989. @example
  14990. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14991. @end example
  14992. @subsection Options
  14993. The filter accepts the following options.
  14994. @table @option
  14995. @item tonemap
  14996. Set the tone map algorithm to use.
  14997. Possible values are:
  14998. @table @var
  14999. @item none
  15000. Do not apply any tone map, only desaturate overbright pixels.
  15001. @item clip
  15002. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  15003. in-range values, while distorting out-of-range values.
  15004. @item linear
  15005. Stretch the entire reference gamut to a linear multiple of the display.
  15006. @item gamma
  15007. Fit a logarithmic transfer between the tone curves.
  15008. @item reinhard
  15009. Preserve overall image brightness with a simple curve, using nonlinear
  15010. contrast, which results in flattening details and degrading color accuracy.
  15011. @item hable
  15012. Preserve both dark and bright details better than @var{reinhard}, at the cost
  15013. of slightly darkening everything. Use it when detail preservation is more
  15014. important than color and brightness accuracy.
  15015. @item mobius
  15016. Smoothly map out-of-range values, while retaining contrast and colors for
  15017. in-range material as much as possible. Use it when color accuracy is more
  15018. important than detail preservation.
  15019. @end table
  15020. Default is none.
  15021. @item param
  15022. Tune the tone mapping algorithm.
  15023. This affects the following algorithms:
  15024. @table @var
  15025. @item none
  15026. Ignored.
  15027. @item linear
  15028. Specifies the scale factor to use while stretching.
  15029. Default to 1.0.
  15030. @item gamma
  15031. Specifies the exponent of the function.
  15032. Default to 1.8.
  15033. @item clip
  15034. Specify an extra linear coefficient to multiply into the signal before clipping.
  15035. Default to 1.0.
  15036. @item reinhard
  15037. Specify the local contrast coefficient at the display peak.
  15038. Default to 0.5, which means that in-gamut values will be about half as bright
  15039. as when clipping.
  15040. @item hable
  15041. Ignored.
  15042. @item mobius
  15043. Specify the transition point from linear to mobius transform. Every value
  15044. below this point is guaranteed to be mapped 1:1. The higher the value, the
  15045. more accurate the result will be, at the cost of losing bright details.
  15046. Default to 0.3, which due to the steep initial slope still preserves in-range
  15047. colors fairly accurately.
  15048. @end table
  15049. @item desat
  15050. Apply desaturation for highlights that exceed this level of brightness. The
  15051. higher the parameter, the more color information will be preserved. This
  15052. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15053. (smoothly) turning into white instead. This makes images feel more natural,
  15054. at the cost of reducing information about out-of-range colors.
  15055. The default of 2.0 is somewhat conservative and will mostly just apply to
  15056. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  15057. This option works only if the input frame has a supported color tag.
  15058. @item peak
  15059. Override signal/nominal/reference peak with this value. Useful when the
  15060. embedded peak information in display metadata is not reliable or when tone
  15061. mapping from a lower range to a higher range.
  15062. @end table
  15063. @section tpad
  15064. Temporarily pad video frames.
  15065. The filter accepts the following options:
  15066. @table @option
  15067. @item start
  15068. Specify number of delay frames before input video stream. Default is 0.
  15069. @item stop
  15070. Specify number of padding frames after input video stream.
  15071. Set to -1 to pad indefinitely. Default is 0.
  15072. @item start_mode
  15073. Set kind of frames added to beginning of stream.
  15074. Can be either @var{add} or @var{clone}.
  15075. With @var{add} frames of solid-color are added.
  15076. With @var{clone} frames are clones of first frame.
  15077. Default is @var{add}.
  15078. @item stop_mode
  15079. Set kind of frames added to end of stream.
  15080. Can be either @var{add} or @var{clone}.
  15081. With @var{add} frames of solid-color are added.
  15082. With @var{clone} frames are clones of last frame.
  15083. Default is @var{add}.
  15084. @item start_duration, stop_duration
  15085. Specify the duration of the start/stop delay. See
  15086. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15087. for the accepted syntax.
  15088. These options override @var{start} and @var{stop}. Default is 0.
  15089. @item color
  15090. Specify the color of the padded area. For the syntax of this option,
  15091. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  15092. manual,ffmpeg-utils}.
  15093. The default value of @var{color} is "black".
  15094. @end table
  15095. @anchor{transpose}
  15096. @section transpose
  15097. Transpose rows with columns in the input video and optionally flip it.
  15098. It accepts the following parameters:
  15099. @table @option
  15100. @item dir
  15101. Specify the transposition direction.
  15102. Can assume the following values:
  15103. @table @samp
  15104. @item 0, 4, cclock_flip
  15105. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  15106. @example
  15107. L.R L.l
  15108. . . -> . .
  15109. l.r R.r
  15110. @end example
  15111. @item 1, 5, clock
  15112. Rotate by 90 degrees clockwise, that is:
  15113. @example
  15114. L.R l.L
  15115. . . -> . .
  15116. l.r r.R
  15117. @end example
  15118. @item 2, 6, cclock
  15119. Rotate by 90 degrees counterclockwise, that is:
  15120. @example
  15121. L.R R.r
  15122. . . -> . .
  15123. l.r L.l
  15124. @end example
  15125. @item 3, 7, clock_flip
  15126. Rotate by 90 degrees clockwise and vertically flip, that is:
  15127. @example
  15128. L.R r.R
  15129. . . -> . .
  15130. l.r l.L
  15131. @end example
  15132. @end table
  15133. For values between 4-7, the transposition is only done if the input
  15134. video geometry is portrait and not landscape. These values are
  15135. deprecated, the @code{passthrough} option should be used instead.
  15136. Numerical values are deprecated, and should be dropped in favor of
  15137. symbolic constants.
  15138. @item passthrough
  15139. Do not apply the transposition if the input geometry matches the one
  15140. specified by the specified value. It accepts the following values:
  15141. @table @samp
  15142. @item none
  15143. Always apply transposition.
  15144. @item portrait
  15145. Preserve portrait geometry (when @var{height} >= @var{width}).
  15146. @item landscape
  15147. Preserve landscape geometry (when @var{width} >= @var{height}).
  15148. @end table
  15149. Default value is @code{none}.
  15150. @end table
  15151. For example to rotate by 90 degrees clockwise and preserve portrait
  15152. layout:
  15153. @example
  15154. transpose=dir=1:passthrough=portrait
  15155. @end example
  15156. The command above can also be specified as:
  15157. @example
  15158. transpose=1:portrait
  15159. @end example
  15160. @section transpose_npp
  15161. Transpose rows with columns in the input video and optionally flip it.
  15162. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  15163. It accepts the following parameters:
  15164. @table @option
  15165. @item dir
  15166. Specify the transposition direction.
  15167. Can assume the following values:
  15168. @table @samp
  15169. @item cclock_flip
  15170. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  15171. @item clock
  15172. Rotate by 90 degrees clockwise.
  15173. @item cclock
  15174. Rotate by 90 degrees counterclockwise.
  15175. @item clock_flip
  15176. Rotate by 90 degrees clockwise and vertically flip.
  15177. @end table
  15178. @item passthrough
  15179. Do not apply the transposition if the input geometry matches the one
  15180. specified by the specified value. It accepts the following values:
  15181. @table @samp
  15182. @item none
  15183. Always apply transposition. (default)
  15184. @item portrait
  15185. Preserve portrait geometry (when @var{height} >= @var{width}).
  15186. @item landscape
  15187. Preserve landscape geometry (when @var{width} >= @var{height}).
  15188. @end table
  15189. @end table
  15190. @section trim
  15191. Trim the input so that the output contains one continuous subpart of the input.
  15192. It accepts the following parameters:
  15193. @table @option
  15194. @item start
  15195. Specify the time of the start of the kept section, i.e. the frame with the
  15196. timestamp @var{start} will be the first frame in the output.
  15197. @item end
  15198. Specify the time of the first frame that will be dropped, i.e. the frame
  15199. immediately preceding the one with the timestamp @var{end} will be the last
  15200. frame in the output.
  15201. @item start_pts
  15202. This is the same as @var{start}, except this option sets the start timestamp
  15203. in timebase units instead of seconds.
  15204. @item end_pts
  15205. This is the same as @var{end}, except this option sets the end timestamp
  15206. in timebase units instead of seconds.
  15207. @item duration
  15208. The maximum duration of the output in seconds.
  15209. @item start_frame
  15210. The number of the first frame that should be passed to the output.
  15211. @item end_frame
  15212. The number of the first frame that should be dropped.
  15213. @end table
  15214. @option{start}, @option{end}, and @option{duration} are expressed as time
  15215. duration specifications; see
  15216. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15217. for the accepted syntax.
  15218. Note that the first two sets of the start/end options and the @option{duration}
  15219. option look at the frame timestamp, while the _frame variants simply count the
  15220. frames that pass through the filter. Also note that this filter does not modify
  15221. the timestamps. If you wish for the output timestamps to start at zero, insert a
  15222. setpts filter after the trim filter.
  15223. If multiple start or end options are set, this filter tries to be greedy and
  15224. keep all the frames that match at least one of the specified constraints. To keep
  15225. only the part that matches all the constraints at once, chain multiple trim
  15226. filters.
  15227. The defaults are such that all the input is kept. So it is possible to set e.g.
  15228. just the end values to keep everything before the specified time.
  15229. Examples:
  15230. @itemize
  15231. @item
  15232. Drop everything except the second minute of input:
  15233. @example
  15234. ffmpeg -i INPUT -vf trim=60:120
  15235. @end example
  15236. @item
  15237. Keep only the first second:
  15238. @example
  15239. ffmpeg -i INPUT -vf trim=duration=1
  15240. @end example
  15241. @end itemize
  15242. @section unpremultiply
  15243. Apply alpha unpremultiply effect to input video stream using first plane
  15244. of second stream as alpha.
  15245. Both streams must have same dimensions and same pixel format.
  15246. The filter accepts the following option:
  15247. @table @option
  15248. @item planes
  15249. Set which planes will be processed, unprocessed planes will be copied.
  15250. By default value 0xf, all planes will be processed.
  15251. If the format has 1 or 2 components, then luma is bit 0.
  15252. If the format has 3 or 4 components:
  15253. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  15254. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  15255. If present, the alpha channel is always the last bit.
  15256. @item inplace
  15257. Do not require 2nd input for processing, instead use alpha plane from input stream.
  15258. @end table
  15259. @anchor{unsharp}
  15260. @section unsharp
  15261. Sharpen or blur the input video.
  15262. It accepts the following parameters:
  15263. @table @option
  15264. @item luma_msize_x, lx
  15265. Set the luma matrix horizontal size. It must be an odd integer between
  15266. 3 and 23. The default value is 5.
  15267. @item luma_msize_y, ly
  15268. Set the luma matrix vertical size. It must be an odd integer between 3
  15269. and 23. The default value is 5.
  15270. @item luma_amount, la
  15271. Set the luma effect strength. It must be a floating point number, reasonable
  15272. values lay between -1.5 and 1.5.
  15273. Negative values will blur the input video, while positive values will
  15274. sharpen it, a value of zero will disable the effect.
  15275. Default value is 1.0.
  15276. @item chroma_msize_x, cx
  15277. Set the chroma matrix horizontal size. It must be an odd integer
  15278. between 3 and 23. The default value is 5.
  15279. @item chroma_msize_y, cy
  15280. Set the chroma matrix vertical size. It must be an odd integer
  15281. between 3 and 23. The default value is 5.
  15282. @item chroma_amount, ca
  15283. Set the chroma effect strength. It must be a floating point number, reasonable
  15284. values lay between -1.5 and 1.5.
  15285. Negative values will blur the input video, while positive values will
  15286. sharpen it, a value of zero will disable the effect.
  15287. Default value is 0.0.
  15288. @end table
  15289. All parameters are optional and default to the equivalent of the
  15290. string '5:5:1.0:5:5:0.0'.
  15291. @subsection Examples
  15292. @itemize
  15293. @item
  15294. Apply strong luma sharpen effect:
  15295. @example
  15296. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  15297. @end example
  15298. @item
  15299. Apply a strong blur of both luma and chroma parameters:
  15300. @example
  15301. unsharp=7:7:-2:7:7:-2
  15302. @end example
  15303. @end itemize
  15304. @anchor{untile}
  15305. @section untile
  15306. Decompose a video made of tiled images into the individual images.
  15307. The frame rate of the output video is the frame rate of the input video
  15308. multiplied by the number of tiles.
  15309. This filter does the reverse of @ref{tile}.
  15310. The filter accepts the following options:
  15311. @table @option
  15312. @item layout
  15313. Set the grid size (i.e. the number of lines and columns). For the syntax of
  15314. this option, check the
  15315. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15316. @end table
  15317. @subsection Examples
  15318. @itemize
  15319. @item
  15320. Produce a 1-second video from a still image file made of 25 frames stacked
  15321. vertically, like an analogic film reel:
  15322. @example
  15323. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  15324. @end example
  15325. @end itemize
  15326. @section uspp
  15327. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  15328. the image at several (or - in the case of @option{quality} level @code{8} - all)
  15329. shifts and average the results.
  15330. The way this differs from the behavior of spp is that uspp actually encodes &
  15331. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  15332. DCT similar to MJPEG.
  15333. The filter accepts the following options:
  15334. @table @option
  15335. @item quality
  15336. Set quality. This option defines the number of levels for averaging. It accepts
  15337. an integer in the range 0-8. If set to @code{0}, the filter will have no
  15338. effect. A value of @code{8} means the higher quality. For each increment of
  15339. that value the speed drops by a factor of approximately 2. Default value is
  15340. @code{3}.
  15341. @item qp
  15342. Force a constant quantization parameter. If not set, the filter will use the QP
  15343. from the video stream (if available).
  15344. @end table
  15345. @section v360
  15346. Convert 360 videos between various formats.
  15347. The filter accepts the following options:
  15348. @table @option
  15349. @item input
  15350. @item output
  15351. Set format of the input/output video.
  15352. Available formats:
  15353. @table @samp
  15354. @item e
  15355. @item equirect
  15356. Equirectangular projection.
  15357. @item c3x2
  15358. @item c6x1
  15359. @item c1x6
  15360. Cubemap with 3x2/6x1/1x6 layout.
  15361. Format specific options:
  15362. @table @option
  15363. @item in_pad
  15364. @item out_pad
  15365. Set padding proportion for the input/output cubemap. Values in decimals.
  15366. Example values:
  15367. @table @samp
  15368. @item 0
  15369. No padding.
  15370. @item 0.01
  15371. 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)
  15372. @end table
  15373. Default value is @b{@samp{0}}.
  15374. Maximum value is @b{@samp{0.1}}.
  15375. @item fin_pad
  15376. @item fout_pad
  15377. Set fixed padding for the input/output cubemap. Values in pixels.
  15378. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  15379. @item in_forder
  15380. @item out_forder
  15381. Set order of faces for the input/output cubemap. Choose one direction for each position.
  15382. Designation of directions:
  15383. @table @samp
  15384. @item r
  15385. right
  15386. @item l
  15387. left
  15388. @item u
  15389. up
  15390. @item d
  15391. down
  15392. @item f
  15393. forward
  15394. @item b
  15395. back
  15396. @end table
  15397. Default value is @b{@samp{rludfb}}.
  15398. @item in_frot
  15399. @item out_frot
  15400. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  15401. Designation of angles:
  15402. @table @samp
  15403. @item 0
  15404. 0 degrees clockwise
  15405. @item 1
  15406. 90 degrees clockwise
  15407. @item 2
  15408. 180 degrees clockwise
  15409. @item 3
  15410. 270 degrees clockwise
  15411. @end table
  15412. Default value is @b{@samp{000000}}.
  15413. @end table
  15414. @item eac
  15415. Equi-Angular Cubemap.
  15416. @item flat
  15417. @item gnomonic
  15418. @item rectilinear
  15419. Regular video.
  15420. Format specific options:
  15421. @table @option
  15422. @item h_fov
  15423. @item v_fov
  15424. @item d_fov
  15425. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15426. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15427. @item ih_fov
  15428. @item iv_fov
  15429. @item id_fov
  15430. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15431. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15432. @end table
  15433. @item dfisheye
  15434. Dual fisheye.
  15435. Format specific options:
  15436. @table @option
  15437. @item h_fov
  15438. @item v_fov
  15439. @item d_fov
  15440. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15441. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15442. @item ih_fov
  15443. @item iv_fov
  15444. @item id_fov
  15445. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15446. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15447. @end table
  15448. @item barrel
  15449. @item fb
  15450. @item barrelsplit
  15451. Facebook's 360 formats.
  15452. @item sg
  15453. Stereographic format.
  15454. Format specific options:
  15455. @table @option
  15456. @item h_fov
  15457. @item v_fov
  15458. @item d_fov
  15459. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15460. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15461. @item ih_fov
  15462. @item iv_fov
  15463. @item id_fov
  15464. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15465. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15466. @end table
  15467. @item mercator
  15468. Mercator format.
  15469. @item ball
  15470. Ball format, gives significant distortion toward the back.
  15471. @item hammer
  15472. Hammer-Aitoff map projection format.
  15473. @item sinusoidal
  15474. Sinusoidal map projection format.
  15475. @item fisheye
  15476. Fisheye projection.
  15477. Format specific options:
  15478. @table @option
  15479. @item h_fov
  15480. @item v_fov
  15481. @item d_fov
  15482. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15483. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15484. @item ih_fov
  15485. @item iv_fov
  15486. @item id_fov
  15487. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15488. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15489. @end table
  15490. @item pannini
  15491. Pannini projection.
  15492. Format specific options:
  15493. @table @option
  15494. @item h_fov
  15495. Set output pannini parameter.
  15496. @item ih_fov
  15497. Set input pannini parameter.
  15498. @end table
  15499. @item cylindrical
  15500. Cylindrical projection.
  15501. Format specific options:
  15502. @table @option
  15503. @item h_fov
  15504. @item v_fov
  15505. @item d_fov
  15506. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15507. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15508. @item ih_fov
  15509. @item iv_fov
  15510. @item id_fov
  15511. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15512. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15513. @end table
  15514. @item perspective
  15515. Perspective projection. @i{(output only)}
  15516. Format specific options:
  15517. @table @option
  15518. @item v_fov
  15519. Set perspective parameter.
  15520. @end table
  15521. @item tetrahedron
  15522. Tetrahedron projection.
  15523. @item tsp
  15524. Truncated square pyramid projection.
  15525. @item he
  15526. @item hequirect
  15527. Half equirectangular projection.
  15528. @item equisolid
  15529. Equisolid format.
  15530. Format specific options:
  15531. @table @option
  15532. @item h_fov
  15533. @item v_fov
  15534. @item d_fov
  15535. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15536. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15537. @item ih_fov
  15538. @item iv_fov
  15539. @item id_fov
  15540. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15541. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15542. @end table
  15543. @item og
  15544. Orthographic format.
  15545. Format specific options:
  15546. @table @option
  15547. @item h_fov
  15548. @item v_fov
  15549. @item d_fov
  15550. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15551. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15552. @item ih_fov
  15553. @item iv_fov
  15554. @item id_fov
  15555. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15556. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15557. @end table
  15558. @item octahedron
  15559. Octahedron projection.
  15560. @end table
  15561. @item interp
  15562. Set interpolation method.@*
  15563. @i{Note: more complex interpolation methods require much more memory to run.}
  15564. Available methods:
  15565. @table @samp
  15566. @item near
  15567. @item nearest
  15568. Nearest neighbour.
  15569. @item line
  15570. @item linear
  15571. Bilinear interpolation.
  15572. @item lagrange9
  15573. Lagrange9 interpolation.
  15574. @item cube
  15575. @item cubic
  15576. Bicubic interpolation.
  15577. @item lanc
  15578. @item lanczos
  15579. Lanczos interpolation.
  15580. @item sp16
  15581. @item spline16
  15582. Spline16 interpolation.
  15583. @item gauss
  15584. @item gaussian
  15585. Gaussian interpolation.
  15586. @item mitchell
  15587. Mitchell interpolation.
  15588. @end table
  15589. Default value is @b{@samp{line}}.
  15590. @item w
  15591. @item h
  15592. Set the output video resolution.
  15593. Default resolution depends on formats.
  15594. @item in_stereo
  15595. @item out_stereo
  15596. Set the input/output stereo format.
  15597. @table @samp
  15598. @item 2d
  15599. 2D mono
  15600. @item sbs
  15601. Side by side
  15602. @item tb
  15603. Top bottom
  15604. @end table
  15605. Default value is @b{@samp{2d}} for input and output format.
  15606. @item yaw
  15607. @item pitch
  15608. @item roll
  15609. Set rotation for the output video. Values in degrees.
  15610. @item rorder
  15611. Set rotation order for the output video. Choose one item for each position.
  15612. @table @samp
  15613. @item y, Y
  15614. yaw
  15615. @item p, P
  15616. pitch
  15617. @item r, R
  15618. roll
  15619. @end table
  15620. Default value is @b{@samp{ypr}}.
  15621. @item h_flip
  15622. @item v_flip
  15623. @item d_flip
  15624. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  15625. @item ih_flip
  15626. @item iv_flip
  15627. Set if input video is flipped horizontally/vertically. Boolean values.
  15628. @item in_trans
  15629. Set if input video is transposed. Boolean value, by default disabled.
  15630. @item out_trans
  15631. Set if output video needs to be transposed. Boolean value, by default disabled.
  15632. @item alpha_mask
  15633. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  15634. @end table
  15635. @subsection Examples
  15636. @itemize
  15637. @item
  15638. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  15639. @example
  15640. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  15641. @end example
  15642. @item
  15643. Extract back view of Equi-Angular Cubemap:
  15644. @example
  15645. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  15646. @end example
  15647. @item
  15648. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  15649. @example
  15650. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  15651. @end example
  15652. @end itemize
  15653. @subsection Commands
  15654. This filter supports subset of above options as @ref{commands}.
  15655. @section vaguedenoiser
  15656. Apply a wavelet based denoiser.
  15657. It transforms each frame from the video input into the wavelet domain,
  15658. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15659. the obtained coefficients. It does an inverse wavelet transform after.
  15660. Due to wavelet properties, it should give a nice smoothed result, and
  15661. reduced noise, without blurring picture features.
  15662. This filter accepts the following options:
  15663. @table @option
  15664. @item threshold
  15665. The filtering strength. The higher, the more filtered the video will be.
  15666. Hard thresholding can use a higher threshold than soft thresholding
  15667. before the video looks overfiltered. Default value is 2.
  15668. @item method
  15669. The filtering method the filter will use.
  15670. It accepts the following values:
  15671. @table @samp
  15672. @item hard
  15673. All values under the threshold will be zeroed.
  15674. @item soft
  15675. All values under the threshold will be zeroed. All values above will be
  15676. reduced by the threshold.
  15677. @item garrote
  15678. Scales or nullifies coefficients - intermediary between (more) soft and
  15679. (less) hard thresholding.
  15680. @end table
  15681. Default is garrote.
  15682. @item nsteps
  15683. Number of times, the wavelet will decompose the picture. Picture can't
  15684. be decomposed beyond a particular point (typically, 8 for a 640x480
  15685. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15686. @item percent
  15687. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15688. @item planes
  15689. A list of the planes to process. By default all planes are processed.
  15690. @item type
  15691. The threshold type the filter will use.
  15692. It accepts the following values:
  15693. @table @samp
  15694. @item universal
  15695. Threshold used is same for all decompositions.
  15696. @item bayes
  15697. Threshold used depends also on each decomposition coefficients.
  15698. @end table
  15699. Default is universal.
  15700. @end table
  15701. @section vectorscope
  15702. Display 2 color component values in the two dimensional graph (which is called
  15703. a vectorscope).
  15704. This filter accepts the following options:
  15705. @table @option
  15706. @item mode, m
  15707. Set vectorscope mode.
  15708. It accepts the following values:
  15709. @table @samp
  15710. @item gray
  15711. @item tint
  15712. Gray values are displayed on graph, higher brightness means more pixels have
  15713. same component color value on location in graph. This is the default mode.
  15714. @item color
  15715. Gray values are displayed on graph. Surrounding pixels values which are not
  15716. present in video frame are drawn in gradient of 2 color components which are
  15717. set by option @code{x} and @code{y}. The 3rd color component is static.
  15718. @item color2
  15719. Actual color components values present in video frame are displayed on graph.
  15720. @item color3
  15721. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15722. on graph increases value of another color component, which is luminance by
  15723. default values of @code{x} and @code{y}.
  15724. @item color4
  15725. Actual colors present in video frame are displayed on graph. If two different
  15726. colors map to same position on graph then color with higher value of component
  15727. not present in graph is picked.
  15728. @item color5
  15729. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15730. component picked from radial gradient.
  15731. @end table
  15732. @item x
  15733. Set which color component will be represented on X-axis. Default is @code{1}.
  15734. @item y
  15735. Set which color component will be represented on Y-axis. Default is @code{2}.
  15736. @item intensity, i
  15737. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15738. of color component which represents frequency of (X, Y) location in graph.
  15739. @item envelope, e
  15740. @table @samp
  15741. @item none
  15742. No envelope, this is default.
  15743. @item instant
  15744. Instant envelope, even darkest single pixel will be clearly highlighted.
  15745. @item peak
  15746. Hold maximum and minimum values presented in graph over time. This way you
  15747. can still spot out of range values without constantly looking at vectorscope.
  15748. @item peak+instant
  15749. Peak and instant envelope combined together.
  15750. @end table
  15751. @item graticule, g
  15752. Set what kind of graticule to draw.
  15753. @table @samp
  15754. @item none
  15755. @item green
  15756. @item color
  15757. @item invert
  15758. @end table
  15759. @item opacity, o
  15760. Set graticule opacity.
  15761. @item flags, f
  15762. Set graticule flags.
  15763. @table @samp
  15764. @item white
  15765. Draw graticule for white point.
  15766. @item black
  15767. Draw graticule for black point.
  15768. @item name
  15769. Draw color points short names.
  15770. @end table
  15771. @item bgopacity, b
  15772. Set background opacity.
  15773. @item lthreshold, l
  15774. Set low threshold for color component not represented on X or Y axis.
  15775. Values lower than this value will be ignored. Default is 0.
  15776. Note this value is multiplied with actual max possible value one pixel component
  15777. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15778. is 0.1 * 255 = 25.
  15779. @item hthreshold, h
  15780. Set high threshold for color component not represented on X or Y axis.
  15781. Values higher than this value will be ignored. Default is 1.
  15782. Note this value is multiplied with actual max possible value one pixel component
  15783. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15784. is 0.9 * 255 = 230.
  15785. @item colorspace, c
  15786. Set what kind of colorspace to use when drawing graticule.
  15787. @table @samp
  15788. @item auto
  15789. @item 601
  15790. @item 709
  15791. @end table
  15792. Default is auto.
  15793. @item tint0, t0
  15794. @item tint1, t1
  15795. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15796. This means no tint, and output will remain gray.
  15797. @end table
  15798. @anchor{vidstabdetect}
  15799. @section vidstabdetect
  15800. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15801. @ref{vidstabtransform} for pass 2.
  15802. This filter generates a file with relative translation and rotation
  15803. transform information about subsequent frames, which is then used by
  15804. the @ref{vidstabtransform} filter.
  15805. To enable compilation of this filter you need to configure FFmpeg with
  15806. @code{--enable-libvidstab}.
  15807. This filter accepts the following options:
  15808. @table @option
  15809. @item result
  15810. Set the path to the file used to write the transforms information.
  15811. Default value is @file{transforms.trf}.
  15812. @item shakiness
  15813. Set how shaky the video is and how quick the camera is. It accepts an
  15814. integer in the range 1-10, a value of 1 means little shakiness, a
  15815. value of 10 means strong shakiness. Default value is 5.
  15816. @item accuracy
  15817. Set the accuracy of the detection process. It must be a value in the
  15818. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15819. accuracy. Default value is 15.
  15820. @item stepsize
  15821. Set stepsize of the search process. The region around minimum is
  15822. scanned with 1 pixel resolution. Default value is 6.
  15823. @item mincontrast
  15824. Set minimum contrast. Below this value a local measurement field is
  15825. discarded. Must be a floating point value in the range 0-1. Default
  15826. value is 0.3.
  15827. @item tripod
  15828. Set reference frame number for tripod mode.
  15829. If enabled, the motion of the frames is compared to a reference frame
  15830. in the filtered stream, identified by the specified number. The idea
  15831. is to compensate all movements in a more-or-less static scene and keep
  15832. the camera view absolutely still.
  15833. If set to 0, it is disabled. The frames are counted starting from 1.
  15834. @item show
  15835. Show fields and transforms in the resulting frames. It accepts an
  15836. integer in the range 0-2. Default value is 0, which disables any
  15837. visualization.
  15838. @end table
  15839. @subsection Examples
  15840. @itemize
  15841. @item
  15842. Use default values:
  15843. @example
  15844. vidstabdetect
  15845. @end example
  15846. @item
  15847. Analyze strongly shaky movie and put the results in file
  15848. @file{mytransforms.trf}:
  15849. @example
  15850. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15851. @end example
  15852. @item
  15853. Visualize the result of internal transformations in the resulting
  15854. video:
  15855. @example
  15856. vidstabdetect=show=1
  15857. @end example
  15858. @item
  15859. Analyze a video with medium shakiness using @command{ffmpeg}:
  15860. @example
  15861. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15862. @end example
  15863. @end itemize
  15864. @anchor{vidstabtransform}
  15865. @section vidstabtransform
  15866. Video stabilization/deshaking: pass 2 of 2,
  15867. see @ref{vidstabdetect} for pass 1.
  15868. Read a file with transform information for each frame and
  15869. apply/compensate them. Together with the @ref{vidstabdetect}
  15870. filter this can be used to deshake videos. See also
  15871. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15872. the @ref{unsharp} filter, see below.
  15873. To enable compilation of this filter you need to configure FFmpeg with
  15874. @code{--enable-libvidstab}.
  15875. @subsection Options
  15876. @table @option
  15877. @item input
  15878. Set path to the file used to read the transforms. Default value is
  15879. @file{transforms.trf}.
  15880. @item smoothing
  15881. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15882. camera movements. Default value is 10.
  15883. For example a number of 10 means that 21 frames are used (10 in the
  15884. past and 10 in the future) to smoothen the motion in the video. A
  15885. larger value leads to a smoother video, but limits the acceleration of
  15886. the camera (pan/tilt movements). 0 is a special case where a static
  15887. camera is simulated.
  15888. @item optalgo
  15889. Set the camera path optimization algorithm.
  15890. Accepted values are:
  15891. @table @samp
  15892. @item gauss
  15893. gaussian kernel low-pass filter on camera motion (default)
  15894. @item avg
  15895. averaging on transformations
  15896. @end table
  15897. @item maxshift
  15898. Set maximal number of pixels to translate frames. Default value is -1,
  15899. meaning no limit.
  15900. @item maxangle
  15901. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15902. value is -1, meaning no limit.
  15903. @item crop
  15904. Specify how to deal with borders that may be visible due to movement
  15905. compensation.
  15906. Available values are:
  15907. @table @samp
  15908. @item keep
  15909. keep image information from previous frame (default)
  15910. @item black
  15911. fill the border black
  15912. @end table
  15913. @item invert
  15914. Invert transforms if set to 1. Default value is 0.
  15915. @item relative
  15916. Consider transforms as relative to previous frame if set to 1,
  15917. absolute if set to 0. Default value is 0.
  15918. @item zoom
  15919. Set percentage to zoom. A positive value will result in a zoom-in
  15920. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15921. zoom).
  15922. @item optzoom
  15923. Set optimal zooming to avoid borders.
  15924. Accepted values are:
  15925. @table @samp
  15926. @item 0
  15927. disabled
  15928. @item 1
  15929. optimal static zoom value is determined (only very strong movements
  15930. will lead to visible borders) (default)
  15931. @item 2
  15932. optimal adaptive zoom value is determined (no borders will be
  15933. visible), see @option{zoomspeed}
  15934. @end table
  15935. Note that the value given at zoom is added to the one calculated here.
  15936. @item zoomspeed
  15937. Set percent to zoom maximally each frame (enabled when
  15938. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15939. 0.25.
  15940. @item interpol
  15941. Specify type of interpolation.
  15942. Available values are:
  15943. @table @samp
  15944. @item no
  15945. no interpolation
  15946. @item linear
  15947. linear only horizontal
  15948. @item bilinear
  15949. linear in both directions (default)
  15950. @item bicubic
  15951. cubic in both directions (slow)
  15952. @end table
  15953. @item tripod
  15954. Enable virtual tripod mode if set to 1, which is equivalent to
  15955. @code{relative=0:smoothing=0}. Default value is 0.
  15956. Use also @code{tripod} option of @ref{vidstabdetect}.
  15957. @item debug
  15958. Increase log verbosity if set to 1. Also the detected global motions
  15959. are written to the temporary file @file{global_motions.trf}. Default
  15960. value is 0.
  15961. @end table
  15962. @subsection Examples
  15963. @itemize
  15964. @item
  15965. Use @command{ffmpeg} for a typical stabilization with default values:
  15966. @example
  15967. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15968. @end example
  15969. Note the use of the @ref{unsharp} filter which is always recommended.
  15970. @item
  15971. Zoom in a bit more and load transform data from a given file:
  15972. @example
  15973. vidstabtransform=zoom=5:input="mytransforms.trf"
  15974. @end example
  15975. @item
  15976. Smoothen the video even more:
  15977. @example
  15978. vidstabtransform=smoothing=30
  15979. @end example
  15980. @end itemize
  15981. @section vflip
  15982. Flip the input video vertically.
  15983. For example, to vertically flip a video with @command{ffmpeg}:
  15984. @example
  15985. ffmpeg -i in.avi -vf "vflip" out.avi
  15986. @end example
  15987. @section vfrdet
  15988. Detect variable frame rate video.
  15989. This filter tries to detect if the input is variable or constant frame rate.
  15990. At end it will output number of frames detected as having variable delta pts,
  15991. and ones with constant delta pts.
  15992. If there was frames with variable delta, than it will also show min, max and
  15993. average delta encountered.
  15994. @section vibrance
  15995. Boost or alter saturation.
  15996. The filter accepts the following options:
  15997. @table @option
  15998. @item intensity
  15999. Set strength of boost if positive value or strength of alter if negative value.
  16000. Default is 0. Allowed range is from -2 to 2.
  16001. @item rbal
  16002. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  16003. @item gbal
  16004. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  16005. @item bbal
  16006. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  16007. @item rlum
  16008. Set the red luma coefficient.
  16009. @item glum
  16010. Set the green luma coefficient.
  16011. @item blum
  16012. Set the blue luma coefficient.
  16013. @item alternate
  16014. If @code{intensity} is negative and this is set to 1, colors will change,
  16015. otherwise colors will be less saturated, more towards gray.
  16016. @end table
  16017. @subsection Commands
  16018. This filter supports the all above options as @ref{commands}.
  16019. @anchor{vignette}
  16020. @section vignette
  16021. Make or reverse a natural vignetting effect.
  16022. The filter accepts the following options:
  16023. @table @option
  16024. @item angle, a
  16025. Set lens angle expression as a number of radians.
  16026. The value is clipped in the @code{[0,PI/2]} range.
  16027. Default value: @code{"PI/5"}
  16028. @item x0
  16029. @item y0
  16030. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  16031. by default.
  16032. @item mode
  16033. Set forward/backward mode.
  16034. Available modes are:
  16035. @table @samp
  16036. @item forward
  16037. The larger the distance from the central point, the darker the image becomes.
  16038. @item backward
  16039. The larger the distance from the central point, the brighter the image becomes.
  16040. This can be used to reverse a vignette effect, though there is no automatic
  16041. detection to extract the lens @option{angle} and other settings (yet). It can
  16042. also be used to create a burning effect.
  16043. @end table
  16044. Default value is @samp{forward}.
  16045. @item eval
  16046. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  16047. It accepts the following values:
  16048. @table @samp
  16049. @item init
  16050. Evaluate expressions only once during the filter initialization.
  16051. @item frame
  16052. Evaluate expressions for each incoming frame. This is way slower than the
  16053. @samp{init} mode since it requires all the scalers to be re-computed, but it
  16054. allows advanced dynamic expressions.
  16055. @end table
  16056. Default value is @samp{init}.
  16057. @item dither
  16058. Set dithering to reduce the circular banding effects. Default is @code{1}
  16059. (enabled).
  16060. @item aspect
  16061. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  16062. Setting this value to the SAR of the input will make a rectangular vignetting
  16063. following the dimensions of the video.
  16064. Default is @code{1/1}.
  16065. @end table
  16066. @subsection Expressions
  16067. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  16068. following parameters.
  16069. @table @option
  16070. @item w
  16071. @item h
  16072. input width and height
  16073. @item n
  16074. the number of input frame, starting from 0
  16075. @item pts
  16076. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  16077. @var{TB} units, NAN if undefined
  16078. @item r
  16079. frame rate of the input video, NAN if the input frame rate is unknown
  16080. @item t
  16081. the PTS (Presentation TimeStamp) of the filtered video frame,
  16082. expressed in seconds, NAN if undefined
  16083. @item tb
  16084. time base of the input video
  16085. @end table
  16086. @subsection Examples
  16087. @itemize
  16088. @item
  16089. Apply simple strong vignetting effect:
  16090. @example
  16091. vignette=PI/4
  16092. @end example
  16093. @item
  16094. Make a flickering vignetting:
  16095. @example
  16096. vignette='PI/4+random(1)*PI/50':eval=frame
  16097. @end example
  16098. @end itemize
  16099. @section vmafmotion
  16100. Obtain the average VMAF motion score of a video.
  16101. It is one of the component metrics of VMAF.
  16102. The obtained average motion score is printed through the logging system.
  16103. The filter accepts the following options:
  16104. @table @option
  16105. @item stats_file
  16106. If specified, the filter will use the named file to save the motion score of
  16107. each frame with respect to the previous frame.
  16108. When filename equals "-" the data is sent to standard output.
  16109. @end table
  16110. Example:
  16111. @example
  16112. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  16113. @end example
  16114. @section vstack
  16115. Stack input videos vertically.
  16116. All streams must be of same pixel format and of same width.
  16117. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  16118. to create same output.
  16119. The filter accepts the following options:
  16120. @table @option
  16121. @item inputs
  16122. Set number of input streams. Default is 2.
  16123. @item shortest
  16124. If set to 1, force the output to terminate when the shortest input
  16125. terminates. Default value is 0.
  16126. @end table
  16127. @section w3fdif
  16128. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  16129. Deinterlacing Filter").
  16130. Based on the process described by Martin Weston for BBC R&D, and
  16131. implemented based on the de-interlace algorithm written by Jim
  16132. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  16133. uses filter coefficients calculated by BBC R&D.
  16134. This filter uses field-dominance information in frame to decide which
  16135. of each pair of fields to place first in the output.
  16136. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  16137. There are two sets of filter coefficients, so called "simple"
  16138. and "complex". Which set of filter coefficients is used can
  16139. be set by passing an optional parameter:
  16140. @table @option
  16141. @item filter
  16142. Set the interlacing filter coefficients. Accepts one of the following values:
  16143. @table @samp
  16144. @item simple
  16145. Simple filter coefficient set.
  16146. @item complex
  16147. More-complex filter coefficient set.
  16148. @end table
  16149. Default value is @samp{complex}.
  16150. @item mode
  16151. The interlacing mode to adopt. It accepts one of the following values:
  16152. @table @option
  16153. @item frame
  16154. Output one frame for each frame.
  16155. @item field
  16156. Output one frame for each field.
  16157. @end table
  16158. The default value is @code{field}.
  16159. @item parity
  16160. The picture field parity assumed for the input interlaced video. It accepts one
  16161. of the following values:
  16162. @table @option
  16163. @item tff
  16164. Assume the top field is first.
  16165. @item bff
  16166. Assume the bottom field is first.
  16167. @item auto
  16168. Enable automatic detection of field parity.
  16169. @end table
  16170. The default value is @code{auto}.
  16171. If the interlacing is unknown or the decoder does not export this information,
  16172. top field first will be assumed.
  16173. @item deint
  16174. Specify which frames to deinterlace. Accepts one of the following values:
  16175. @table @samp
  16176. @item all
  16177. Deinterlace all frames,
  16178. @item interlaced
  16179. Only deinterlace frames marked as interlaced.
  16180. @end table
  16181. Default value is @samp{all}.
  16182. @end table
  16183. @subsection Commands
  16184. This filter supports same @ref{commands} as options.
  16185. @section waveform
  16186. Video waveform monitor.
  16187. The waveform monitor plots color component intensity. By default luminance
  16188. only. Each column of the waveform corresponds to a column of pixels in the
  16189. source video.
  16190. It accepts the following options:
  16191. @table @option
  16192. @item mode, m
  16193. Can be either @code{row}, or @code{column}. Default is @code{column}.
  16194. In row mode, the graph on the left side represents color component value 0 and
  16195. the right side represents value = 255. In column mode, the top side represents
  16196. color component value = 0 and bottom side represents value = 255.
  16197. @item intensity, i
  16198. Set intensity. Smaller values are useful to find out how many values of the same
  16199. luminance are distributed across input rows/columns.
  16200. Default value is @code{0.04}. Allowed range is [0, 1].
  16201. @item mirror, r
  16202. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  16203. In mirrored mode, higher values will be represented on the left
  16204. side for @code{row} mode and at the top for @code{column} mode. Default is
  16205. @code{1} (mirrored).
  16206. @item display, d
  16207. Set display mode.
  16208. It accepts the following values:
  16209. @table @samp
  16210. @item overlay
  16211. Presents information identical to that in the @code{parade}, except
  16212. that the graphs representing color components are superimposed directly
  16213. over one another.
  16214. This display mode makes it easier to spot relative differences or similarities
  16215. in overlapping areas of the color components that are supposed to be identical,
  16216. such as neutral whites, grays, or blacks.
  16217. @item stack
  16218. Display separate graph for the color components side by side in
  16219. @code{row} mode or one below the other in @code{column} mode.
  16220. @item parade
  16221. Display separate graph for the color components side by side in
  16222. @code{column} mode or one below the other in @code{row} mode.
  16223. Using this display mode makes it easy to spot color casts in the highlights
  16224. and shadows of an image, by comparing the contours of the top and the bottom
  16225. graphs of each waveform. Since whites, grays, and blacks are characterized
  16226. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  16227. should display three waveforms of roughly equal width/height. If not, the
  16228. correction is easy to perform by making level adjustments the three waveforms.
  16229. @end table
  16230. Default is @code{stack}.
  16231. @item components, c
  16232. Set which color components to display. Default is 1, which means only luminance
  16233. or red color component if input is in RGB colorspace. If is set for example to
  16234. 7 it will display all 3 (if) available color components.
  16235. @item envelope, e
  16236. @table @samp
  16237. @item none
  16238. No envelope, this is default.
  16239. @item instant
  16240. Instant envelope, minimum and maximum values presented in graph will be easily
  16241. visible even with small @code{step} value.
  16242. @item peak
  16243. Hold minimum and maximum values presented in graph across time. This way you
  16244. can still spot out of range values without constantly looking at waveforms.
  16245. @item peak+instant
  16246. Peak and instant envelope combined together.
  16247. @end table
  16248. @item filter, f
  16249. @table @samp
  16250. @item lowpass
  16251. No filtering, this is default.
  16252. @item flat
  16253. Luma and chroma combined together.
  16254. @item aflat
  16255. Similar as above, but shows difference between blue and red chroma.
  16256. @item xflat
  16257. Similar as above, but use different colors.
  16258. @item yflat
  16259. Similar as above, but again with different colors.
  16260. @item chroma
  16261. Displays only chroma.
  16262. @item color
  16263. Displays actual color value on waveform.
  16264. @item acolor
  16265. Similar as above, but with luma showing frequency of chroma values.
  16266. @end table
  16267. @item graticule, g
  16268. Set which graticule to display.
  16269. @table @samp
  16270. @item none
  16271. Do not display graticule.
  16272. @item green
  16273. Display green graticule showing legal broadcast ranges.
  16274. @item orange
  16275. Display orange graticule showing legal broadcast ranges.
  16276. @item invert
  16277. Display invert graticule showing legal broadcast ranges.
  16278. @end table
  16279. @item opacity, o
  16280. Set graticule opacity.
  16281. @item flags, fl
  16282. Set graticule flags.
  16283. @table @samp
  16284. @item numbers
  16285. Draw numbers above lines. By default enabled.
  16286. @item dots
  16287. Draw dots instead of lines.
  16288. @end table
  16289. @item scale, s
  16290. Set scale used for displaying graticule.
  16291. @table @samp
  16292. @item digital
  16293. @item millivolts
  16294. @item ire
  16295. @end table
  16296. Default is digital.
  16297. @item bgopacity, b
  16298. Set background opacity.
  16299. @item tint0, t0
  16300. @item tint1, t1
  16301. Set tint for output.
  16302. Only used with lowpass filter and when display is not overlay and input
  16303. pixel formats are not RGB.
  16304. @end table
  16305. @section weave, doubleweave
  16306. The @code{weave} takes a field-based video input and join
  16307. each two sequential fields into single frame, producing a new double
  16308. height clip with half the frame rate and half the frame count.
  16309. The @code{doubleweave} works same as @code{weave} but without
  16310. halving frame rate and frame count.
  16311. It accepts the following option:
  16312. @table @option
  16313. @item first_field
  16314. Set first field. Available values are:
  16315. @table @samp
  16316. @item top, t
  16317. Set the frame as top-field-first.
  16318. @item bottom, b
  16319. Set the frame as bottom-field-first.
  16320. @end table
  16321. @end table
  16322. @subsection Examples
  16323. @itemize
  16324. @item
  16325. Interlace video using @ref{select} and @ref{separatefields} filter:
  16326. @example
  16327. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  16328. @end example
  16329. @end itemize
  16330. @section xbr
  16331. Apply the xBR high-quality magnification filter which is designed for pixel
  16332. art. It follows a set of edge-detection rules, see
  16333. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  16334. It accepts the following option:
  16335. @table @option
  16336. @item n
  16337. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  16338. @code{3xBR} and @code{4} for @code{4xBR}.
  16339. Default is @code{3}.
  16340. @end table
  16341. @section xfade
  16342. Apply cross fade from one input video stream to another input video stream.
  16343. The cross fade is applied for specified duration.
  16344. The filter accepts the following options:
  16345. @table @option
  16346. @item transition
  16347. Set one of available transition effects:
  16348. @table @samp
  16349. @item custom
  16350. @item fade
  16351. @item wipeleft
  16352. @item wiperight
  16353. @item wipeup
  16354. @item wipedown
  16355. @item slideleft
  16356. @item slideright
  16357. @item slideup
  16358. @item slidedown
  16359. @item circlecrop
  16360. @item rectcrop
  16361. @item distance
  16362. @item fadeblack
  16363. @item fadewhite
  16364. @item radial
  16365. @item smoothleft
  16366. @item smoothright
  16367. @item smoothup
  16368. @item smoothdown
  16369. @item circleopen
  16370. @item circleclose
  16371. @item vertopen
  16372. @item vertclose
  16373. @item horzopen
  16374. @item horzclose
  16375. @item dissolve
  16376. @item pixelize
  16377. @item diagtl
  16378. @item diagtr
  16379. @item diagbl
  16380. @item diagbr
  16381. @item hlslice
  16382. @item hrslice
  16383. @item vuslice
  16384. @item vdslice
  16385. @item hblur
  16386. @item fadegrays
  16387. @item wipetl
  16388. @item wipetr
  16389. @item wipebl
  16390. @item wipebr
  16391. @item squeezeh
  16392. @item squeezev
  16393. @end table
  16394. Default transition effect is fade.
  16395. @item duration
  16396. Set cross fade duration in seconds.
  16397. Default duration is 1 second.
  16398. @item offset
  16399. Set cross fade start relative to first input stream in seconds.
  16400. Default offset is 0.
  16401. @item expr
  16402. Set expression for custom transition effect.
  16403. The expressions can use the following variables and functions:
  16404. @table @option
  16405. @item X
  16406. @item Y
  16407. The coordinates of the current sample.
  16408. @item W
  16409. @item H
  16410. The width and height of the image.
  16411. @item P
  16412. Progress of transition effect.
  16413. @item PLANE
  16414. Currently processed plane.
  16415. @item A
  16416. Return value of first input at current location and plane.
  16417. @item B
  16418. Return value of second input at current location and plane.
  16419. @item a0(x, y)
  16420. @item a1(x, y)
  16421. @item a2(x, y)
  16422. @item a3(x, y)
  16423. Return the value of the pixel at location (@var{x},@var{y}) of the
  16424. first/second/third/fourth component of first input.
  16425. @item b0(x, y)
  16426. @item b1(x, y)
  16427. @item b2(x, y)
  16428. @item b3(x, y)
  16429. Return the value of the pixel at location (@var{x},@var{y}) of the
  16430. first/second/third/fourth component of second input.
  16431. @end table
  16432. @end table
  16433. @subsection Examples
  16434. @itemize
  16435. @item
  16436. Cross fade from one input video to another input video, with fade transition and duration of transition
  16437. of 2 seconds starting at offset of 5 seconds:
  16438. @example
  16439. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  16440. @end example
  16441. @end itemize
  16442. @section xmedian
  16443. Pick median pixels from several input videos.
  16444. The filter accepts the following options:
  16445. @table @option
  16446. @item inputs
  16447. Set number of inputs.
  16448. Default is 3. Allowed range is from 3 to 255.
  16449. If number of inputs is even number, than result will be mean value between two median values.
  16450. @item planes
  16451. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  16452. @item percentile
  16453. Set median percentile. Default value is @code{0.5}.
  16454. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  16455. minimum values, and @code{1} maximum values.
  16456. @end table
  16457. @subsection Commands
  16458. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  16459. @section xstack
  16460. Stack video inputs into custom layout.
  16461. All streams must be of same pixel format.
  16462. The filter accepts the following options:
  16463. @table @option
  16464. @item inputs
  16465. Set number of input streams. Default is 2.
  16466. @item layout
  16467. Specify layout of inputs.
  16468. This option requires the desired layout configuration to be explicitly set by the user.
  16469. This sets position of each video input in output. Each input
  16470. is separated by '|'.
  16471. The first number represents the column, and the second number represents the row.
  16472. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  16473. where X is video input from which to take width or height.
  16474. Multiple values can be used when separated by '+'. In such
  16475. case values are summed together.
  16476. Note that if inputs are of different sizes gaps may appear, as not all of
  16477. the output video frame will be filled. Similarly, videos can overlap each
  16478. other if their position doesn't leave enough space for the full frame of
  16479. adjoining videos.
  16480. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  16481. a layout must be set by the user.
  16482. @item shortest
  16483. If set to 1, force the output to terminate when the shortest input
  16484. terminates. Default value is 0.
  16485. @item fill
  16486. If set to valid color, all unused pixels will be filled with that color.
  16487. By default fill is set to none, so it is disabled.
  16488. @end table
  16489. @subsection Examples
  16490. @itemize
  16491. @item
  16492. Display 4 inputs into 2x2 grid.
  16493. Layout:
  16494. @example
  16495. input1(0, 0) | input3(w0, 0)
  16496. input2(0, h0) | input4(w0, h0)
  16497. @end example
  16498. @example
  16499. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  16500. @end example
  16501. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16502. @item
  16503. Display 4 inputs into 1x4 grid.
  16504. Layout:
  16505. @example
  16506. input1(0, 0)
  16507. input2(0, h0)
  16508. input3(0, h0+h1)
  16509. input4(0, h0+h1+h2)
  16510. @end example
  16511. @example
  16512. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  16513. @end example
  16514. Note that if inputs are of different widths, unused space will appear.
  16515. @item
  16516. Display 9 inputs into 3x3 grid.
  16517. Layout:
  16518. @example
  16519. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  16520. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  16521. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  16522. @end example
  16523. @example
  16524. 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
  16525. @end example
  16526. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16527. @item
  16528. Display 16 inputs into 4x4 grid.
  16529. Layout:
  16530. @example
  16531. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  16532. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  16533. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  16534. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  16535. @end example
  16536. @example
  16537. 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|
  16538. 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
  16539. @end example
  16540. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16541. @end itemize
  16542. @anchor{yadif}
  16543. @section yadif
  16544. Deinterlace the input video ("yadif" means "yet another deinterlacing
  16545. filter").
  16546. It accepts the following parameters:
  16547. @table @option
  16548. @item mode
  16549. The interlacing mode to adopt. It accepts one of the following values:
  16550. @table @option
  16551. @item 0, send_frame
  16552. Output one frame for each frame.
  16553. @item 1, send_field
  16554. Output one frame for each field.
  16555. @item 2, send_frame_nospatial
  16556. Like @code{send_frame}, but it skips the spatial interlacing check.
  16557. @item 3, send_field_nospatial
  16558. Like @code{send_field}, but it skips the spatial interlacing check.
  16559. @end table
  16560. The default value is @code{send_frame}.
  16561. @item parity
  16562. The picture field parity assumed for the input interlaced video. It accepts one
  16563. of the following values:
  16564. @table @option
  16565. @item 0, tff
  16566. Assume the top field is first.
  16567. @item 1, bff
  16568. Assume the bottom field is first.
  16569. @item -1, auto
  16570. Enable automatic detection of field parity.
  16571. @end table
  16572. The default value is @code{auto}.
  16573. If the interlacing is unknown or the decoder does not export this information,
  16574. top field first will be assumed.
  16575. @item deint
  16576. Specify which frames to deinterlace. Accepts one of the following
  16577. values:
  16578. @table @option
  16579. @item 0, all
  16580. Deinterlace all frames.
  16581. @item 1, interlaced
  16582. Only deinterlace frames marked as interlaced.
  16583. @end table
  16584. The default value is @code{all}.
  16585. @end table
  16586. @section yadif_cuda
  16587. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  16588. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  16589. and/or nvenc.
  16590. It accepts the following parameters:
  16591. @table @option
  16592. @item mode
  16593. The interlacing mode to adopt. It accepts one of the following values:
  16594. @table @option
  16595. @item 0, send_frame
  16596. Output one frame for each frame.
  16597. @item 1, send_field
  16598. Output one frame for each field.
  16599. @item 2, send_frame_nospatial
  16600. Like @code{send_frame}, but it skips the spatial interlacing check.
  16601. @item 3, send_field_nospatial
  16602. Like @code{send_field}, but it skips the spatial interlacing check.
  16603. @end table
  16604. The default value is @code{send_frame}.
  16605. @item parity
  16606. The picture field parity assumed for the input interlaced video. It accepts one
  16607. of the following values:
  16608. @table @option
  16609. @item 0, tff
  16610. Assume the top field is first.
  16611. @item 1, bff
  16612. Assume the bottom field is first.
  16613. @item -1, auto
  16614. Enable automatic detection of field parity.
  16615. @end table
  16616. The default value is @code{auto}.
  16617. If the interlacing is unknown or the decoder does not export this information,
  16618. top field first will be assumed.
  16619. @item deint
  16620. Specify which frames to deinterlace. Accepts one of the following
  16621. values:
  16622. @table @option
  16623. @item 0, all
  16624. Deinterlace all frames.
  16625. @item 1, interlaced
  16626. Only deinterlace frames marked as interlaced.
  16627. @end table
  16628. The default value is @code{all}.
  16629. @end table
  16630. @section yaepblur
  16631. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  16632. The algorithm is described in
  16633. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  16634. It accepts the following parameters:
  16635. @table @option
  16636. @item radius, r
  16637. Set the window radius. Default value is 3.
  16638. @item planes, p
  16639. Set which planes to filter. Default is only the first plane.
  16640. @item sigma, s
  16641. Set blur strength. Default value is 128.
  16642. @end table
  16643. @subsection Commands
  16644. This filter supports same @ref{commands} as options.
  16645. @section zoompan
  16646. Apply Zoom & Pan effect.
  16647. This filter accepts the following options:
  16648. @table @option
  16649. @item zoom, z
  16650. Set the zoom expression. Range is 1-10. Default is 1.
  16651. @item x
  16652. @item y
  16653. Set the x and y expression. Default is 0.
  16654. @item d
  16655. Set the duration expression in number of frames.
  16656. This sets for how many number of frames effect will last for
  16657. single input image.
  16658. @item s
  16659. Set the output image size, default is 'hd720'.
  16660. @item fps
  16661. Set the output frame rate, default is '25'.
  16662. @end table
  16663. Each expression can contain the following constants:
  16664. @table @option
  16665. @item in_w, iw
  16666. Input width.
  16667. @item in_h, ih
  16668. Input height.
  16669. @item out_w, ow
  16670. Output width.
  16671. @item out_h, oh
  16672. Output height.
  16673. @item in
  16674. Input frame count.
  16675. @item on
  16676. Output frame count.
  16677. @item in_time, it
  16678. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16679. @item out_time, time, ot
  16680. The output timestamp expressed in seconds.
  16681. @item x
  16682. @item y
  16683. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  16684. for current input frame.
  16685. @item px
  16686. @item py
  16687. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16688. not yet such frame (first input frame).
  16689. @item zoom
  16690. Last calculated zoom from 'z' expression for current input frame.
  16691. @item pzoom
  16692. Last calculated zoom of last output frame of previous input frame.
  16693. @item duration
  16694. Number of output frames for current input frame. Calculated from 'd' expression
  16695. for each input frame.
  16696. @item pduration
  16697. number of output frames created for previous input frame
  16698. @item a
  16699. Rational number: input width / input height
  16700. @item sar
  16701. sample aspect ratio
  16702. @item dar
  16703. display aspect ratio
  16704. @end table
  16705. @subsection Examples
  16706. @itemize
  16707. @item
  16708. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16709. @example
  16710. 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
  16711. @end example
  16712. @item
  16713. Zoom in up to 1.5x and pan always at center of picture:
  16714. @example
  16715. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16716. @end example
  16717. @item
  16718. Same as above but without pausing:
  16719. @example
  16720. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16721. @end example
  16722. @item
  16723. Zoom in 2x into center of picture only for the first second of the input video:
  16724. @example
  16725. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16726. @end example
  16727. @end itemize
  16728. @anchor{zscale}
  16729. @section zscale
  16730. Scale (resize) the input video, using the z.lib library:
  16731. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16732. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16733. The zscale filter forces the output display aspect ratio to be the same
  16734. as the input, by changing the output sample aspect ratio.
  16735. If the input image format is different from the format requested by
  16736. the next filter, the zscale filter will convert the input to the
  16737. requested format.
  16738. @subsection Options
  16739. The filter accepts the following options.
  16740. @table @option
  16741. @item width, w
  16742. @item height, h
  16743. Set the output video dimension expression. Default value is the input
  16744. dimension.
  16745. If the @var{width} or @var{w} value is 0, the input width is used for
  16746. the output. If the @var{height} or @var{h} value is 0, the input height
  16747. is used for the output.
  16748. If one and only one of the values is -n with n >= 1, the zscale filter
  16749. will use a value that maintains the aspect ratio of the input image,
  16750. calculated from the other specified dimension. After that it will,
  16751. however, make sure that the calculated dimension is divisible by n and
  16752. adjust the value if necessary.
  16753. If both values are -n with n >= 1, the behavior will be identical to
  16754. both values being set to 0 as previously detailed.
  16755. See below for the list of accepted constants for use in the dimension
  16756. expression.
  16757. @item size, s
  16758. Set the video size. For the syntax of this option, check the
  16759. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16760. @item dither, d
  16761. Set the dither type.
  16762. Possible values are:
  16763. @table @var
  16764. @item none
  16765. @item ordered
  16766. @item random
  16767. @item error_diffusion
  16768. @end table
  16769. Default is none.
  16770. @item filter, f
  16771. Set the resize filter type.
  16772. Possible values are:
  16773. @table @var
  16774. @item point
  16775. @item bilinear
  16776. @item bicubic
  16777. @item spline16
  16778. @item spline36
  16779. @item lanczos
  16780. @end table
  16781. Default is bilinear.
  16782. @item range, r
  16783. Set the color range.
  16784. Possible values are:
  16785. @table @var
  16786. @item input
  16787. @item limited
  16788. @item full
  16789. @end table
  16790. Default is same as input.
  16791. @item primaries, p
  16792. Set the color primaries.
  16793. Possible values are:
  16794. @table @var
  16795. @item input
  16796. @item 709
  16797. @item unspecified
  16798. @item 170m
  16799. @item 240m
  16800. @item 2020
  16801. @end table
  16802. Default is same as input.
  16803. @item transfer, t
  16804. Set the transfer characteristics.
  16805. Possible values are:
  16806. @table @var
  16807. @item input
  16808. @item 709
  16809. @item unspecified
  16810. @item 601
  16811. @item linear
  16812. @item 2020_10
  16813. @item 2020_12
  16814. @item smpte2084
  16815. @item iec61966-2-1
  16816. @item arib-std-b67
  16817. @end table
  16818. Default is same as input.
  16819. @item matrix, m
  16820. Set the colorspace matrix.
  16821. Possible value are:
  16822. @table @var
  16823. @item input
  16824. @item 709
  16825. @item unspecified
  16826. @item 470bg
  16827. @item 170m
  16828. @item 2020_ncl
  16829. @item 2020_cl
  16830. @end table
  16831. Default is same as input.
  16832. @item rangein, rin
  16833. Set the input color range.
  16834. Possible values are:
  16835. @table @var
  16836. @item input
  16837. @item limited
  16838. @item full
  16839. @end table
  16840. Default is same as input.
  16841. @item primariesin, pin
  16842. Set the input color primaries.
  16843. Possible values are:
  16844. @table @var
  16845. @item input
  16846. @item 709
  16847. @item unspecified
  16848. @item 170m
  16849. @item 240m
  16850. @item 2020
  16851. @end table
  16852. Default is same as input.
  16853. @item transferin, tin
  16854. Set the input transfer characteristics.
  16855. Possible values are:
  16856. @table @var
  16857. @item input
  16858. @item 709
  16859. @item unspecified
  16860. @item 601
  16861. @item linear
  16862. @item 2020_10
  16863. @item 2020_12
  16864. @end table
  16865. Default is same as input.
  16866. @item matrixin, min
  16867. Set the input colorspace matrix.
  16868. Possible value are:
  16869. @table @var
  16870. @item input
  16871. @item 709
  16872. @item unspecified
  16873. @item 470bg
  16874. @item 170m
  16875. @item 2020_ncl
  16876. @item 2020_cl
  16877. @end table
  16878. @item chromal, c
  16879. Set the output chroma location.
  16880. Possible values are:
  16881. @table @var
  16882. @item input
  16883. @item left
  16884. @item center
  16885. @item topleft
  16886. @item top
  16887. @item bottomleft
  16888. @item bottom
  16889. @end table
  16890. @item chromalin, cin
  16891. Set the input chroma location.
  16892. Possible values are:
  16893. @table @var
  16894. @item input
  16895. @item left
  16896. @item center
  16897. @item topleft
  16898. @item top
  16899. @item bottomleft
  16900. @item bottom
  16901. @end table
  16902. @item npl
  16903. Set the nominal peak luminance.
  16904. @end table
  16905. The values of the @option{w} and @option{h} options are expressions
  16906. containing the following constants:
  16907. @table @var
  16908. @item in_w
  16909. @item in_h
  16910. The input width and height
  16911. @item iw
  16912. @item ih
  16913. These are the same as @var{in_w} and @var{in_h}.
  16914. @item out_w
  16915. @item out_h
  16916. The output (scaled) width and height
  16917. @item ow
  16918. @item oh
  16919. These are the same as @var{out_w} and @var{out_h}
  16920. @item a
  16921. The same as @var{iw} / @var{ih}
  16922. @item sar
  16923. input sample aspect ratio
  16924. @item dar
  16925. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16926. @item hsub
  16927. @item vsub
  16928. horizontal and vertical input chroma subsample values. For example for the
  16929. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16930. @item ohsub
  16931. @item ovsub
  16932. horizontal and vertical output chroma subsample values. For example for the
  16933. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16934. @end table
  16935. @subsection Commands
  16936. This filter supports the following commands:
  16937. @table @option
  16938. @item width, w
  16939. @item height, h
  16940. Set the output video dimension expression.
  16941. The command accepts the same syntax of the corresponding option.
  16942. If the specified expression is not valid, it is kept at its current
  16943. value.
  16944. @end table
  16945. @c man end VIDEO FILTERS
  16946. @chapter OpenCL Video Filters
  16947. @c man begin OPENCL VIDEO FILTERS
  16948. Below is a description of the currently available OpenCL video filters.
  16949. To enable compilation of these filters you need to configure FFmpeg with
  16950. @code{--enable-opencl}.
  16951. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16952. @table @option
  16953. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16954. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16955. given device parameters.
  16956. @item -filter_hw_device @var{name}
  16957. Pass the hardware device called @var{name} to all filters in any filter graph.
  16958. @end table
  16959. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16960. @itemize
  16961. @item
  16962. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16963. @example
  16964. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16965. @end example
  16966. @end itemize
  16967. 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.
  16968. @section avgblur_opencl
  16969. Apply average blur filter.
  16970. The filter accepts the following options:
  16971. @table @option
  16972. @item sizeX
  16973. Set horizontal radius size.
  16974. Range is @code{[1, 1024]} and default value is @code{1}.
  16975. @item planes
  16976. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16977. @item sizeY
  16978. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16979. @end table
  16980. @subsection Example
  16981. @itemize
  16982. @item
  16983. 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.
  16984. @example
  16985. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16986. @end example
  16987. @end itemize
  16988. @section boxblur_opencl
  16989. Apply a boxblur algorithm to the input video.
  16990. It accepts the following parameters:
  16991. @table @option
  16992. @item luma_radius, lr
  16993. @item luma_power, lp
  16994. @item chroma_radius, cr
  16995. @item chroma_power, cp
  16996. @item alpha_radius, ar
  16997. @item alpha_power, ap
  16998. @end table
  16999. A description of the accepted options follows.
  17000. @table @option
  17001. @item luma_radius, lr
  17002. @item chroma_radius, cr
  17003. @item alpha_radius, ar
  17004. Set an expression for the box radius in pixels used for blurring the
  17005. corresponding input plane.
  17006. The radius value must be a non-negative number, and must not be
  17007. greater than the value of the expression @code{min(w,h)/2} for the
  17008. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  17009. planes.
  17010. Default value for @option{luma_radius} is "2". If not specified,
  17011. @option{chroma_radius} and @option{alpha_radius} default to the
  17012. corresponding value set for @option{luma_radius}.
  17013. The expressions can contain the following constants:
  17014. @table @option
  17015. @item w
  17016. @item h
  17017. The input width and height in pixels.
  17018. @item cw
  17019. @item ch
  17020. The input chroma image width and height in pixels.
  17021. @item hsub
  17022. @item vsub
  17023. The horizontal and vertical chroma subsample values. For example, for the
  17024. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  17025. @end table
  17026. @item luma_power, lp
  17027. @item chroma_power, cp
  17028. @item alpha_power, ap
  17029. Specify how many times the boxblur filter is applied to the
  17030. corresponding plane.
  17031. Default value for @option{luma_power} is 2. If not specified,
  17032. @option{chroma_power} and @option{alpha_power} default to the
  17033. corresponding value set for @option{luma_power}.
  17034. A value of 0 will disable the effect.
  17035. @end table
  17036. @subsection Examples
  17037. 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.
  17038. @itemize
  17039. @item
  17040. Apply a boxblur filter with the luma, chroma, and alpha radius
  17041. 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.
  17042. @example
  17043. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  17044. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  17045. @end example
  17046. @item
  17047. 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.
  17048. For the luma plane, a 2x2 box radius will be run once.
  17049. For the chroma plane, a 4x4 box radius will be run 5 times.
  17050. For the alpha plane, a 3x3 box radius will be run 7 times.
  17051. @example
  17052. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  17053. @end example
  17054. @end itemize
  17055. @section colorkey_opencl
  17056. RGB colorspace color keying.
  17057. The filter accepts the following options:
  17058. @table @option
  17059. @item color
  17060. The color which will be replaced with transparency.
  17061. @item similarity
  17062. Similarity percentage with the key color.
  17063. 0.01 matches only the exact key color, while 1.0 matches everything.
  17064. @item blend
  17065. Blend percentage.
  17066. 0.0 makes pixels either fully transparent, or not transparent at all.
  17067. Higher values result in semi-transparent pixels, with a higher transparency
  17068. the more similar the pixels color is to the key color.
  17069. @end table
  17070. @subsection Examples
  17071. @itemize
  17072. @item
  17073. Make every semi-green pixel in the input transparent with some slight blending:
  17074. @example
  17075. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  17076. @end example
  17077. @end itemize
  17078. @section convolution_opencl
  17079. Apply convolution of 3x3, 5x5, 7x7 matrix.
  17080. The filter accepts the following options:
  17081. @table @option
  17082. @item 0m
  17083. @item 1m
  17084. @item 2m
  17085. @item 3m
  17086. Set matrix for each plane.
  17087. Matrix is sequence of 9, 25 or 49 signed numbers.
  17088. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  17089. @item 0rdiv
  17090. @item 1rdiv
  17091. @item 2rdiv
  17092. @item 3rdiv
  17093. Set multiplier for calculated value for each plane.
  17094. If unset or 0, it will be sum of all matrix elements.
  17095. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  17096. @item 0bias
  17097. @item 1bias
  17098. @item 2bias
  17099. @item 3bias
  17100. Set bias for each plane. This value is added to the result of the multiplication.
  17101. Useful for making the overall image brighter or darker.
  17102. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  17103. @end table
  17104. @subsection Examples
  17105. @itemize
  17106. @item
  17107. Apply sharpen:
  17108. @example
  17109. -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
  17110. @end example
  17111. @item
  17112. Apply blur:
  17113. @example
  17114. -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
  17115. @end example
  17116. @item
  17117. Apply edge enhance:
  17118. @example
  17119. -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
  17120. @end example
  17121. @item
  17122. Apply edge detect:
  17123. @example
  17124. -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
  17125. @end example
  17126. @item
  17127. Apply laplacian edge detector which includes diagonals:
  17128. @example
  17129. -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
  17130. @end example
  17131. @item
  17132. Apply emboss:
  17133. @example
  17134. -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
  17135. @end example
  17136. @end itemize
  17137. @section erosion_opencl
  17138. Apply erosion effect to the video.
  17139. This filter replaces the pixel by the local(3x3) minimum.
  17140. It accepts the following options:
  17141. @table @option
  17142. @item threshold0
  17143. @item threshold1
  17144. @item threshold2
  17145. @item threshold3
  17146. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  17147. If @code{0}, plane will remain unchanged.
  17148. @item coordinates
  17149. Flag which specifies the pixel to refer to.
  17150. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  17151. Flags to local 3x3 coordinates region centered on @code{x}:
  17152. 1 2 3
  17153. 4 x 5
  17154. 6 7 8
  17155. @end table
  17156. @subsection Example
  17157. @itemize
  17158. @item
  17159. 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.
  17160. @example
  17161. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  17162. @end example
  17163. @end itemize
  17164. @section deshake_opencl
  17165. Feature-point based video stabilization filter.
  17166. The filter accepts the following options:
  17167. @table @option
  17168. @item tripod
  17169. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  17170. @item debug
  17171. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  17172. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  17173. Viewing point matches in the output video is only supported for RGB input.
  17174. Defaults to @code{0}.
  17175. @item adaptive_crop
  17176. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  17177. Defaults to @code{1}.
  17178. @item refine_features
  17179. Whether or not feature points should be refined at a sub-pixel level.
  17180. This can be turned off for a slight performance gain at the cost of precision.
  17181. Defaults to @code{1}.
  17182. @item smooth_strength
  17183. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  17184. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  17185. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  17186. Defaults to @code{0.0}.
  17187. @item smooth_window_multiplier
  17188. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  17189. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  17190. Acceptable values range from @code{0.1} to @code{10.0}.
  17191. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  17192. potentially improving smoothness, but also increase latency and memory usage.
  17193. Defaults to @code{2.0}.
  17194. @end table
  17195. @subsection Examples
  17196. @itemize
  17197. @item
  17198. Stabilize a video with a fixed, medium smoothing strength:
  17199. @example
  17200. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  17201. @end example
  17202. @item
  17203. Stabilize a video with debugging (both in console and in rendered video):
  17204. @example
  17205. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  17206. @end example
  17207. @end itemize
  17208. @section dilation_opencl
  17209. Apply dilation effect to the video.
  17210. This filter replaces the pixel by the local(3x3) maximum.
  17211. It accepts the following options:
  17212. @table @option
  17213. @item threshold0
  17214. @item threshold1
  17215. @item threshold2
  17216. @item threshold3
  17217. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  17218. If @code{0}, plane will remain unchanged.
  17219. @item coordinates
  17220. Flag which specifies the pixel to refer to.
  17221. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  17222. Flags to local 3x3 coordinates region centered on @code{x}:
  17223. 1 2 3
  17224. 4 x 5
  17225. 6 7 8
  17226. @end table
  17227. @subsection Example
  17228. @itemize
  17229. @item
  17230. 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.
  17231. @example
  17232. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  17233. @end example
  17234. @end itemize
  17235. @section nlmeans_opencl
  17236. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  17237. @section overlay_opencl
  17238. Overlay one video on top of another.
  17239. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  17240. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  17241. The filter accepts the following options:
  17242. @table @option
  17243. @item x
  17244. Set the x coordinate of the overlaid video on the main video.
  17245. Default value is @code{0}.
  17246. @item y
  17247. Set the y coordinate of the overlaid video on the main video.
  17248. Default value is @code{0}.
  17249. @end table
  17250. @subsection Examples
  17251. @itemize
  17252. @item
  17253. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  17254. @example
  17255. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  17256. @end example
  17257. @item
  17258. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  17259. @example
  17260. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  17261. @end example
  17262. @end itemize
  17263. @section pad_opencl
  17264. Add paddings to the input image, and place the original input at the
  17265. provided @var{x}, @var{y} coordinates.
  17266. It accepts the following options:
  17267. @table @option
  17268. @item width, w
  17269. @item height, h
  17270. Specify an expression for the size of the output image with the
  17271. paddings added. If the value for @var{width} or @var{height} is 0, the
  17272. corresponding input size is used for the output.
  17273. The @var{width} expression can reference the value set by the
  17274. @var{height} expression, and vice versa.
  17275. The default value of @var{width} and @var{height} is 0.
  17276. @item x
  17277. @item y
  17278. Specify the offsets to place the input image at within the padded area,
  17279. with respect to the top/left border of the output image.
  17280. The @var{x} expression can reference the value set by the @var{y}
  17281. expression, and vice versa.
  17282. The default value of @var{x} and @var{y} is 0.
  17283. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  17284. so the input image is centered on the padded area.
  17285. @item color
  17286. Specify the color of the padded area. For the syntax of this option,
  17287. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  17288. manual,ffmpeg-utils}.
  17289. @item aspect
  17290. Pad to an aspect instead to a resolution.
  17291. @end table
  17292. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  17293. options are expressions containing the following constants:
  17294. @table @option
  17295. @item in_w
  17296. @item in_h
  17297. The input video width and height.
  17298. @item iw
  17299. @item ih
  17300. These are the same as @var{in_w} and @var{in_h}.
  17301. @item out_w
  17302. @item out_h
  17303. The output width and height (the size of the padded area), as
  17304. specified by the @var{width} and @var{height} expressions.
  17305. @item ow
  17306. @item oh
  17307. These are the same as @var{out_w} and @var{out_h}.
  17308. @item x
  17309. @item y
  17310. The x and y offsets as specified by the @var{x} and @var{y}
  17311. expressions, or NAN if not yet specified.
  17312. @item a
  17313. same as @var{iw} / @var{ih}
  17314. @item sar
  17315. input sample aspect ratio
  17316. @item dar
  17317. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  17318. @end table
  17319. @section prewitt_opencl
  17320. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  17321. The filter accepts the following option:
  17322. @table @option
  17323. @item planes
  17324. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17325. @item scale
  17326. Set value which will be multiplied with filtered result.
  17327. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17328. @item delta
  17329. Set value which will be added to filtered result.
  17330. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17331. @end table
  17332. @subsection Example
  17333. @itemize
  17334. @item
  17335. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  17336. @example
  17337. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17338. @end example
  17339. @end itemize
  17340. @anchor{program_opencl}
  17341. @section program_opencl
  17342. Filter video using an OpenCL program.
  17343. @table @option
  17344. @item source
  17345. OpenCL program source file.
  17346. @item kernel
  17347. Kernel name in program.
  17348. @item inputs
  17349. Number of inputs to the filter. Defaults to 1.
  17350. @item size, s
  17351. Size of output frames. Defaults to the same as the first input.
  17352. @end table
  17353. The @code{program_opencl} filter also supports the @ref{framesync} options.
  17354. The program source file must contain a kernel function with the given name,
  17355. which will be run once for each plane of the output. Each run on a plane
  17356. gets enqueued as a separate 2D global NDRange with one work-item for each
  17357. pixel to be generated. The global ID offset for each work-item is therefore
  17358. the coordinates of a pixel in the destination image.
  17359. The kernel function needs to take the following arguments:
  17360. @itemize
  17361. @item
  17362. Destination image, @var{__write_only image2d_t}.
  17363. This image will become the output; the kernel should write all of it.
  17364. @item
  17365. Frame index, @var{unsigned int}.
  17366. This is a counter starting from zero and increasing by one for each frame.
  17367. @item
  17368. Source images, @var{__read_only image2d_t}.
  17369. These are the most recent images on each input. The kernel may read from
  17370. them to generate the output, but they can't be written to.
  17371. @end itemize
  17372. Example programs:
  17373. @itemize
  17374. @item
  17375. Copy the input to the output (output must be the same size as the input).
  17376. @verbatim
  17377. __kernel void copy(__write_only image2d_t destination,
  17378. unsigned int index,
  17379. __read_only image2d_t source)
  17380. {
  17381. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  17382. int2 location = (int2)(get_global_id(0), get_global_id(1));
  17383. float4 value = read_imagef(source, sampler, location);
  17384. write_imagef(destination, location, value);
  17385. }
  17386. @end verbatim
  17387. @item
  17388. Apply a simple transformation, rotating the input by an amount increasing
  17389. with the index counter. Pixel values are linearly interpolated by the
  17390. sampler, and the output need not have the same dimensions as the input.
  17391. @verbatim
  17392. __kernel void rotate_image(__write_only image2d_t dst,
  17393. unsigned int index,
  17394. __read_only image2d_t src)
  17395. {
  17396. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17397. CLK_FILTER_LINEAR);
  17398. float angle = (float)index / 100.0f;
  17399. float2 dst_dim = convert_float2(get_image_dim(dst));
  17400. float2 src_dim = convert_float2(get_image_dim(src));
  17401. float2 dst_cen = dst_dim / 2.0f;
  17402. float2 src_cen = src_dim / 2.0f;
  17403. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17404. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  17405. float2 src_pos = {
  17406. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  17407. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  17408. };
  17409. src_pos = src_pos * src_dim / dst_dim;
  17410. float2 src_loc = src_pos + src_cen;
  17411. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  17412. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  17413. write_imagef(dst, dst_loc, 0.5f);
  17414. else
  17415. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  17416. }
  17417. @end verbatim
  17418. @item
  17419. Blend two inputs together, with the amount of each input used varying
  17420. with the index counter.
  17421. @verbatim
  17422. __kernel void blend_images(__write_only image2d_t dst,
  17423. unsigned int index,
  17424. __read_only image2d_t src1,
  17425. __read_only image2d_t src2)
  17426. {
  17427. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17428. CLK_FILTER_LINEAR);
  17429. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  17430. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17431. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  17432. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  17433. float4 val1 = read_imagef(src1, sampler, src1_loc);
  17434. float4 val2 = read_imagef(src2, sampler, src2_loc);
  17435. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  17436. }
  17437. @end verbatim
  17438. @end itemize
  17439. @section roberts_opencl
  17440. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  17441. The filter accepts the following option:
  17442. @table @option
  17443. @item planes
  17444. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17445. @item scale
  17446. Set value which will be multiplied with filtered result.
  17447. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17448. @item delta
  17449. Set value which will be added to filtered result.
  17450. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17451. @end table
  17452. @subsection Example
  17453. @itemize
  17454. @item
  17455. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  17456. @example
  17457. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17458. @end example
  17459. @end itemize
  17460. @section sobel_opencl
  17461. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  17462. The filter accepts the following option:
  17463. @table @option
  17464. @item planes
  17465. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17466. @item scale
  17467. Set value which will be multiplied with filtered result.
  17468. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17469. @item delta
  17470. Set value which will be added to filtered result.
  17471. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17472. @end table
  17473. @subsection Example
  17474. @itemize
  17475. @item
  17476. Apply sobel operator with scale set to 2 and delta set to 10
  17477. @example
  17478. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17479. @end example
  17480. @end itemize
  17481. @section tonemap_opencl
  17482. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  17483. It accepts the following parameters:
  17484. @table @option
  17485. @item tonemap
  17486. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  17487. @item param
  17488. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  17489. @item desat
  17490. Apply desaturation for highlights that exceed this level of brightness. The
  17491. higher the parameter, the more color information will be preserved. This
  17492. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17493. (smoothly) turning into white instead. This makes images feel more natural,
  17494. at the cost of reducing information about out-of-range colors.
  17495. The default value is 0.5, and the algorithm here is a little different from
  17496. the cpu version tonemap currently. A setting of 0.0 disables this option.
  17497. @item threshold
  17498. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  17499. is used to detect whether the scene has changed or not. If the distance between
  17500. the current frame average brightness and the current running average exceeds
  17501. a threshold value, we would re-calculate scene average and peak brightness.
  17502. The default value is 0.2.
  17503. @item format
  17504. Specify the output pixel format.
  17505. Currently supported formats are:
  17506. @table @var
  17507. @item p010
  17508. @item nv12
  17509. @end table
  17510. @item range, r
  17511. Set the output color range.
  17512. Possible values are:
  17513. @table @var
  17514. @item tv/mpeg
  17515. @item pc/jpeg
  17516. @end table
  17517. Default is same as input.
  17518. @item primaries, p
  17519. Set the output color primaries.
  17520. Possible values are:
  17521. @table @var
  17522. @item bt709
  17523. @item bt2020
  17524. @end table
  17525. Default is same as input.
  17526. @item transfer, t
  17527. Set the output transfer characteristics.
  17528. Possible values are:
  17529. @table @var
  17530. @item bt709
  17531. @item bt2020
  17532. @end table
  17533. Default is bt709.
  17534. @item matrix, m
  17535. Set the output colorspace matrix.
  17536. Possible value are:
  17537. @table @var
  17538. @item bt709
  17539. @item bt2020
  17540. @end table
  17541. Default is same as input.
  17542. @end table
  17543. @subsection Example
  17544. @itemize
  17545. @item
  17546. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  17547. @example
  17548. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  17549. @end example
  17550. @end itemize
  17551. @section unsharp_opencl
  17552. Sharpen or blur the input video.
  17553. It accepts the following parameters:
  17554. @table @option
  17555. @item luma_msize_x, lx
  17556. Set the luma matrix horizontal size.
  17557. Range is @code{[1, 23]} and default value is @code{5}.
  17558. @item luma_msize_y, ly
  17559. Set the luma matrix vertical size.
  17560. Range is @code{[1, 23]} and default value is @code{5}.
  17561. @item luma_amount, la
  17562. Set the luma effect strength.
  17563. Range is @code{[-10, 10]} and default value is @code{1.0}.
  17564. Negative values will blur the input video, while positive values will
  17565. sharpen it, a value of zero will disable the effect.
  17566. @item chroma_msize_x, cx
  17567. Set the chroma matrix horizontal size.
  17568. Range is @code{[1, 23]} and default value is @code{5}.
  17569. @item chroma_msize_y, cy
  17570. Set the chroma matrix vertical size.
  17571. Range is @code{[1, 23]} and default value is @code{5}.
  17572. @item chroma_amount, ca
  17573. Set the chroma effect strength.
  17574. Range is @code{[-10, 10]} and default value is @code{0.0}.
  17575. Negative values will blur the input video, while positive values will
  17576. sharpen it, a value of zero will disable the effect.
  17577. @end table
  17578. All parameters are optional and default to the equivalent of the
  17579. string '5:5:1.0:5:5:0.0'.
  17580. @subsection Examples
  17581. @itemize
  17582. @item
  17583. Apply strong luma sharpen effect:
  17584. @example
  17585. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  17586. @end example
  17587. @item
  17588. Apply a strong blur of both luma and chroma parameters:
  17589. @example
  17590. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  17591. @end example
  17592. @end itemize
  17593. @section xfade_opencl
  17594. Cross fade two videos with custom transition effect by using OpenCL.
  17595. It accepts the following options:
  17596. @table @option
  17597. @item transition
  17598. Set one of possible transition effects.
  17599. @table @option
  17600. @item custom
  17601. Select custom transition effect, the actual transition description
  17602. will be picked from source and kernel options.
  17603. @item fade
  17604. @item wipeleft
  17605. @item wiperight
  17606. @item wipeup
  17607. @item wipedown
  17608. @item slideleft
  17609. @item slideright
  17610. @item slideup
  17611. @item slidedown
  17612. Default transition is fade.
  17613. @end table
  17614. @item source
  17615. OpenCL program source file for custom transition.
  17616. @item kernel
  17617. Set name of kernel to use for custom transition from program source file.
  17618. @item duration
  17619. Set duration of video transition.
  17620. @item offset
  17621. Set time of start of transition relative to first video.
  17622. @end table
  17623. The program source file must contain a kernel function with the given name,
  17624. which will be run once for each plane of the output. Each run on a plane
  17625. gets enqueued as a separate 2D global NDRange with one work-item for each
  17626. pixel to be generated. The global ID offset for each work-item is therefore
  17627. the coordinates of a pixel in the destination image.
  17628. The kernel function needs to take the following arguments:
  17629. @itemize
  17630. @item
  17631. Destination image, @var{__write_only image2d_t}.
  17632. This image will become the output; the kernel should write all of it.
  17633. @item
  17634. First Source image, @var{__read_only image2d_t}.
  17635. Second Source image, @var{__read_only image2d_t}.
  17636. These are the most recent images on each input. The kernel may read from
  17637. them to generate the output, but they can't be written to.
  17638. @item
  17639. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  17640. @end itemize
  17641. Example programs:
  17642. @itemize
  17643. @item
  17644. Apply dots curtain transition effect:
  17645. @verbatim
  17646. __kernel void blend_images(__write_only image2d_t dst,
  17647. __read_only image2d_t src1,
  17648. __read_only image2d_t src2,
  17649. float progress)
  17650. {
  17651. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17652. CLK_FILTER_LINEAR);
  17653. int2 p = (int2)(get_global_id(0), get_global_id(1));
  17654. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  17655. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  17656. rp = rp / dim;
  17657. float2 dots = (float2)(20.0, 20.0);
  17658. float2 center = (float2)(0,0);
  17659. float2 unused;
  17660. float4 val1 = read_imagef(src1, sampler, p);
  17661. float4 val2 = read_imagef(src2, sampler, p);
  17662. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  17663. write_imagef(dst, p, next ? val1 : val2);
  17664. }
  17665. @end verbatim
  17666. @end itemize
  17667. @c man end OPENCL VIDEO FILTERS
  17668. @chapter VAAPI Video Filters
  17669. @c man begin VAAPI VIDEO FILTERS
  17670. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  17671. To enable compilation of these filters you need to configure FFmpeg with
  17672. @code{--enable-vaapi}.
  17673. 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}
  17674. @section tonemap_vaapi
  17675. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  17676. It maps the dynamic range of HDR10 content to the SDR content.
  17677. It currently only accepts HDR10 as input.
  17678. It accepts the following parameters:
  17679. @table @option
  17680. @item format
  17681. Specify the output pixel format.
  17682. Currently supported formats are:
  17683. @table @var
  17684. @item p010
  17685. @item nv12
  17686. @end table
  17687. Default is nv12.
  17688. @item primaries, p
  17689. Set the output color primaries.
  17690. Default is same as input.
  17691. @item transfer, t
  17692. Set the output transfer characteristics.
  17693. Default is bt709.
  17694. @item matrix, m
  17695. Set the output colorspace matrix.
  17696. Default is same as input.
  17697. @end table
  17698. @subsection Example
  17699. @itemize
  17700. @item
  17701. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17702. @example
  17703. tonemap_vaapi=format=p010:t=bt2020-10
  17704. @end example
  17705. @end itemize
  17706. @c man end VAAPI VIDEO FILTERS
  17707. @chapter Video Sources
  17708. @c man begin VIDEO SOURCES
  17709. Below is a description of the currently available video sources.
  17710. @section buffer
  17711. Buffer video frames, and make them available to the filter chain.
  17712. This source is mainly intended for a programmatic use, in particular
  17713. through the interface defined in @file{libavfilter/buffersrc.h}.
  17714. It accepts the following parameters:
  17715. @table @option
  17716. @item video_size
  17717. Specify the size (width and height) of the buffered video frames. For the
  17718. syntax of this option, check the
  17719. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17720. @item width
  17721. The input video width.
  17722. @item height
  17723. The input video height.
  17724. @item pix_fmt
  17725. A string representing the pixel format of the buffered video frames.
  17726. It may be a number corresponding to a pixel format, or a pixel format
  17727. name.
  17728. @item time_base
  17729. Specify the timebase assumed by the timestamps of the buffered frames.
  17730. @item frame_rate
  17731. Specify the frame rate expected for the video stream.
  17732. @item pixel_aspect, sar
  17733. The sample (pixel) aspect ratio of the input video.
  17734. @item sws_param
  17735. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17736. to the filtergraph description to specify swscale flags for automatically
  17737. inserted scalers. See @ref{Filtergraph syntax}.
  17738. @item hw_frames_ctx
  17739. When using a hardware pixel format, this should be a reference to an
  17740. AVHWFramesContext describing input frames.
  17741. @end table
  17742. For example:
  17743. @example
  17744. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17745. @end example
  17746. will instruct the source to accept video frames with size 320x240 and
  17747. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17748. square pixels (1:1 sample aspect ratio).
  17749. Since the pixel format with name "yuv410p" corresponds to the number 6
  17750. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17751. this example corresponds to:
  17752. @example
  17753. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17754. @end example
  17755. Alternatively, the options can be specified as a flat string, but this
  17756. syntax is deprecated:
  17757. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17758. @section cellauto
  17759. Create a pattern generated by an elementary cellular automaton.
  17760. The initial state of the cellular automaton can be defined through the
  17761. @option{filename} and @option{pattern} options. If such options are
  17762. not specified an initial state is created randomly.
  17763. At each new frame a new row in the video is filled with the result of
  17764. the cellular automaton next generation. The behavior when the whole
  17765. frame is filled is defined by the @option{scroll} option.
  17766. This source accepts the following options:
  17767. @table @option
  17768. @item filename, f
  17769. Read the initial cellular automaton state, i.e. the starting row, from
  17770. the specified file.
  17771. In the file, each non-whitespace character is considered an alive
  17772. cell, a newline will terminate the row, and further characters in the
  17773. file will be ignored.
  17774. @item pattern, p
  17775. Read the initial cellular automaton state, i.e. the starting row, from
  17776. the specified string.
  17777. Each non-whitespace character in the string is considered an alive
  17778. cell, a newline will terminate the row, and further characters in the
  17779. string will be ignored.
  17780. @item rate, r
  17781. Set the video rate, that is the number of frames generated per second.
  17782. Default is 25.
  17783. @item random_fill_ratio, ratio
  17784. Set the random fill ratio for the initial cellular automaton row. It
  17785. is a floating point number value ranging from 0 to 1, defaults to
  17786. 1/PHI.
  17787. This option is ignored when a file or a pattern is specified.
  17788. @item random_seed, seed
  17789. Set the seed for filling randomly the initial row, must be an integer
  17790. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17791. set to -1, the filter will try to use a good random seed on a best
  17792. effort basis.
  17793. @item rule
  17794. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17795. Default value is 110.
  17796. @item size, s
  17797. Set the size of the output video. For the syntax of this option, check the
  17798. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17799. If @option{filename} or @option{pattern} is specified, the size is set
  17800. by default to the width of the specified initial state row, and the
  17801. height is set to @var{width} * PHI.
  17802. If @option{size} is set, it must contain the width of the specified
  17803. pattern string, and the specified pattern will be centered in the
  17804. larger row.
  17805. If a filename or a pattern string is not specified, the size value
  17806. defaults to "320x518" (used for a randomly generated initial state).
  17807. @item scroll
  17808. If set to 1, scroll the output upward when all the rows in the output
  17809. have been already filled. If set to 0, the new generated row will be
  17810. written over the top row just after the bottom row is filled.
  17811. Defaults to 1.
  17812. @item start_full, full
  17813. If set to 1, completely fill the output with generated rows before
  17814. outputting the first frame.
  17815. This is the default behavior, for disabling set the value to 0.
  17816. @item stitch
  17817. If set to 1, stitch the left and right row edges together.
  17818. This is the default behavior, for disabling set the value to 0.
  17819. @end table
  17820. @subsection Examples
  17821. @itemize
  17822. @item
  17823. Read the initial state from @file{pattern}, and specify an output of
  17824. size 200x400.
  17825. @example
  17826. cellauto=f=pattern:s=200x400
  17827. @end example
  17828. @item
  17829. Generate a random initial row with a width of 200 cells, with a fill
  17830. ratio of 2/3:
  17831. @example
  17832. cellauto=ratio=2/3:s=200x200
  17833. @end example
  17834. @item
  17835. Create a pattern generated by rule 18 starting by a single alive cell
  17836. centered on an initial row with width 100:
  17837. @example
  17838. cellauto=p=@@:s=100x400:full=0:rule=18
  17839. @end example
  17840. @item
  17841. Specify a more elaborated initial pattern:
  17842. @example
  17843. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17844. @end example
  17845. @end itemize
  17846. @anchor{coreimagesrc}
  17847. @section coreimagesrc
  17848. Video source generated on GPU using Apple's CoreImage API on OSX.
  17849. This video source is a specialized version of the @ref{coreimage} video filter.
  17850. Use a core image generator at the beginning of the applied filterchain to
  17851. generate the content.
  17852. The coreimagesrc video source accepts the following options:
  17853. @table @option
  17854. @item list_generators
  17855. List all available generators along with all their respective options as well as
  17856. possible minimum and maximum values along with the default values.
  17857. @example
  17858. list_generators=true
  17859. @end example
  17860. @item size, s
  17861. Specify the size of the sourced video. For the syntax of this option, check the
  17862. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17863. The default value is @code{320x240}.
  17864. @item rate, r
  17865. Specify the frame rate of the sourced video, as the number of frames
  17866. generated per second. It has to be a string in the format
  17867. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17868. number or a valid video frame rate abbreviation. The default value is
  17869. "25".
  17870. @item sar
  17871. Set the sample aspect ratio of the sourced video.
  17872. @item duration, d
  17873. Set the duration of the sourced video. See
  17874. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17875. for the accepted syntax.
  17876. If not specified, or the expressed duration is negative, the video is
  17877. supposed to be generated forever.
  17878. @end table
  17879. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17880. A complete filterchain can be used for further processing of the
  17881. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17882. and examples for details.
  17883. @subsection Examples
  17884. @itemize
  17885. @item
  17886. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17887. given as complete and escaped command-line for Apple's standard bash shell:
  17888. @example
  17889. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17890. @end example
  17891. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17892. need for a nullsrc video source.
  17893. @end itemize
  17894. @section gradients
  17895. Generate several gradients.
  17896. @table @option
  17897. @item size, s
  17898. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17899. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17900. @item rate, r
  17901. Set frame rate, expressed as number of frames per second. Default
  17902. value is "25".
  17903. @item c0, c1, c2, c3, c4, c5, c6, c7
  17904. Set 8 colors. Default values for colors is to pick random one.
  17905. @item x0, y0, y0, y1
  17906. Set gradient line source and destination points. If negative or out of range, random ones
  17907. are picked.
  17908. @item nb_colors, n
  17909. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17910. @item seed
  17911. Set seed for picking gradient line points.
  17912. @item duration, d
  17913. Set the duration of the sourced video. See
  17914. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17915. for the accepted syntax.
  17916. If not specified, or the expressed duration is negative, the video is
  17917. supposed to be generated forever.
  17918. @item speed
  17919. Set speed of gradients rotation.
  17920. @end table
  17921. @section mandelbrot
  17922. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17923. point specified with @var{start_x} and @var{start_y}.
  17924. This source accepts the following options:
  17925. @table @option
  17926. @item end_pts
  17927. Set the terminal pts value. Default value is 400.
  17928. @item end_scale
  17929. Set the terminal scale value.
  17930. Must be a floating point value. Default value is 0.3.
  17931. @item inner
  17932. Set the inner coloring mode, that is the algorithm used to draw the
  17933. Mandelbrot fractal internal region.
  17934. It shall assume one of the following values:
  17935. @table @option
  17936. @item black
  17937. Set black mode.
  17938. @item convergence
  17939. Show time until convergence.
  17940. @item mincol
  17941. Set color based on point closest to the origin of the iterations.
  17942. @item period
  17943. Set period mode.
  17944. @end table
  17945. Default value is @var{mincol}.
  17946. @item bailout
  17947. Set the bailout value. Default value is 10.0.
  17948. @item maxiter
  17949. Set the maximum of iterations performed by the rendering
  17950. algorithm. Default value is 7189.
  17951. @item outer
  17952. Set outer coloring mode.
  17953. It shall assume one of following values:
  17954. @table @option
  17955. @item iteration_count
  17956. Set iteration count mode.
  17957. @item normalized_iteration_count
  17958. set normalized iteration count mode.
  17959. @end table
  17960. Default value is @var{normalized_iteration_count}.
  17961. @item rate, r
  17962. Set frame rate, expressed as number of frames per second. Default
  17963. value is "25".
  17964. @item size, s
  17965. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17966. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17967. @item start_scale
  17968. Set the initial scale value. Default value is 3.0.
  17969. @item start_x
  17970. Set the initial x position. Must be a floating point value between
  17971. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17972. @item start_y
  17973. Set the initial y position. Must be a floating point value between
  17974. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17975. @end table
  17976. @section mptestsrc
  17977. Generate various test patterns, as generated by the MPlayer test filter.
  17978. The size of the generated video is fixed, and is 256x256.
  17979. This source is useful in particular for testing encoding features.
  17980. This source accepts the following options:
  17981. @table @option
  17982. @item rate, r
  17983. Specify the frame rate of the sourced video, as the number of frames
  17984. generated per second. It has to be a string in the format
  17985. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17986. number or a valid video frame rate abbreviation. The default value is
  17987. "25".
  17988. @item duration, d
  17989. Set the duration of the sourced video. See
  17990. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17991. for the accepted syntax.
  17992. If not specified, or the expressed duration is negative, the video is
  17993. supposed to be generated forever.
  17994. @item test, t
  17995. Set the number or the name of the test to perform. Supported tests are:
  17996. @table @option
  17997. @item dc_luma
  17998. @item dc_chroma
  17999. @item freq_luma
  18000. @item freq_chroma
  18001. @item amp_luma
  18002. @item amp_chroma
  18003. @item cbp
  18004. @item mv
  18005. @item ring1
  18006. @item ring2
  18007. @item all
  18008. @item max_frames, m
  18009. Set the maximum number of frames generated for each test, default value is 30.
  18010. @end table
  18011. Default value is "all", which will cycle through the list of all tests.
  18012. @end table
  18013. Some examples:
  18014. @example
  18015. mptestsrc=t=dc_luma
  18016. @end example
  18017. will generate a "dc_luma" test pattern.
  18018. @section frei0r_src
  18019. Provide a frei0r source.
  18020. To enable compilation of this filter you need to install the frei0r
  18021. header and configure FFmpeg with @code{--enable-frei0r}.
  18022. This source accepts the following parameters:
  18023. @table @option
  18024. @item size
  18025. The size of the video to generate. For the syntax of this option, check the
  18026. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18027. @item framerate
  18028. The framerate of the generated video. It may be a string of the form
  18029. @var{num}/@var{den} or a frame rate abbreviation.
  18030. @item filter_name
  18031. The name to the frei0r source to load. For more information regarding frei0r and
  18032. how to set the parameters, read the @ref{frei0r} section in the video filters
  18033. documentation.
  18034. @item filter_params
  18035. A '|'-separated list of parameters to pass to the frei0r source.
  18036. @end table
  18037. For example, to generate a frei0r partik0l source with size 200x200
  18038. and frame rate 10 which is overlaid on the overlay filter main input:
  18039. @example
  18040. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  18041. @end example
  18042. @section life
  18043. Generate a life pattern.
  18044. This source is based on a generalization of John Conway's life game.
  18045. The sourced input represents a life grid, each pixel represents a cell
  18046. which can be in one of two possible states, alive or dead. Every cell
  18047. interacts with its eight neighbours, which are the cells that are
  18048. horizontally, vertically, or diagonally adjacent.
  18049. At each interaction the grid evolves according to the adopted rule,
  18050. which specifies the number of neighbor alive cells which will make a
  18051. cell stay alive or born. The @option{rule} option allows one to specify
  18052. the rule to adopt.
  18053. This source accepts the following options:
  18054. @table @option
  18055. @item filename, f
  18056. Set the file from which to read the initial grid state. In the file,
  18057. each non-whitespace character is considered an alive cell, and newline
  18058. is used to delimit the end of each row.
  18059. If this option is not specified, the initial grid is generated
  18060. randomly.
  18061. @item rate, r
  18062. Set the video rate, that is the number of frames generated per second.
  18063. Default is 25.
  18064. @item random_fill_ratio, ratio
  18065. Set the random fill ratio for the initial random grid. It is a
  18066. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  18067. It is ignored when a file is specified.
  18068. @item random_seed, seed
  18069. Set the seed for filling the initial random grid, must be an integer
  18070. included between 0 and UINT32_MAX. If not specified, or if explicitly
  18071. set to -1, the filter will try to use a good random seed on a best
  18072. effort basis.
  18073. @item rule
  18074. Set the life rule.
  18075. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  18076. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  18077. @var{NS} specifies the number of alive neighbor cells which make a
  18078. live cell stay alive, and @var{NB} the number of alive neighbor cells
  18079. which make a dead cell to become alive (i.e. to "born").
  18080. "s" and "b" can be used in place of "S" and "B", respectively.
  18081. Alternatively a rule can be specified by an 18-bits integer. The 9
  18082. high order bits are used to encode the next cell state if it is alive
  18083. for each number of neighbor alive cells, the low order bits specify
  18084. the rule for "borning" new cells. Higher order bits encode for an
  18085. higher number of neighbor cells.
  18086. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  18087. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  18088. Default value is "S23/B3", which is the original Conway's game of life
  18089. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  18090. cells, and will born a new cell if there are three alive cells around
  18091. a dead cell.
  18092. @item size, s
  18093. Set the size of the output video. For the syntax of this option, check the
  18094. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18095. If @option{filename} is specified, the size is set by default to the
  18096. same size of the input file. If @option{size} is set, it must contain
  18097. the size specified in the input file, and the initial grid defined in
  18098. that file is centered in the larger resulting area.
  18099. If a filename is not specified, the size value defaults to "320x240"
  18100. (used for a randomly generated initial grid).
  18101. @item stitch
  18102. If set to 1, stitch the left and right grid edges together, and the
  18103. top and bottom edges also. Defaults to 1.
  18104. @item mold
  18105. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  18106. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  18107. value from 0 to 255.
  18108. @item life_color
  18109. Set the color of living (or new born) cells.
  18110. @item death_color
  18111. Set the color of dead cells. If @option{mold} is set, this is the first color
  18112. used to represent a dead cell.
  18113. @item mold_color
  18114. Set mold color, for definitely dead and moldy cells.
  18115. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  18116. ffmpeg-utils manual,ffmpeg-utils}.
  18117. @end table
  18118. @subsection Examples
  18119. @itemize
  18120. @item
  18121. Read a grid from @file{pattern}, and center it on a grid of size
  18122. 300x300 pixels:
  18123. @example
  18124. life=f=pattern:s=300x300
  18125. @end example
  18126. @item
  18127. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  18128. @example
  18129. life=ratio=2/3:s=200x200
  18130. @end example
  18131. @item
  18132. Specify a custom rule for evolving a randomly generated grid:
  18133. @example
  18134. life=rule=S14/B34
  18135. @end example
  18136. @item
  18137. Full example with slow death effect (mold) using @command{ffplay}:
  18138. @example
  18139. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  18140. @end example
  18141. @end itemize
  18142. @anchor{allrgb}
  18143. @anchor{allyuv}
  18144. @anchor{color}
  18145. @anchor{haldclutsrc}
  18146. @anchor{nullsrc}
  18147. @anchor{pal75bars}
  18148. @anchor{pal100bars}
  18149. @anchor{rgbtestsrc}
  18150. @anchor{smptebars}
  18151. @anchor{smptehdbars}
  18152. @anchor{testsrc}
  18153. @anchor{testsrc2}
  18154. @anchor{yuvtestsrc}
  18155. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  18156. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  18157. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  18158. The @code{color} source provides an uniformly colored input.
  18159. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  18160. @ref{haldclut} filter.
  18161. The @code{nullsrc} source returns unprocessed video frames. It is
  18162. mainly useful to be employed in analysis / debugging tools, or as the
  18163. source for filters which ignore the input data.
  18164. The @code{pal75bars} source generates a color bars pattern, based on
  18165. EBU PAL recommendations with 75% color levels.
  18166. The @code{pal100bars} source generates a color bars pattern, based on
  18167. EBU PAL recommendations with 100% color levels.
  18168. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  18169. detecting RGB vs BGR issues. You should see a red, green and blue
  18170. stripe from top to bottom.
  18171. The @code{smptebars} source generates a color bars pattern, based on
  18172. the SMPTE Engineering Guideline EG 1-1990.
  18173. The @code{smptehdbars} source generates a color bars pattern, based on
  18174. the SMPTE RP 219-2002.
  18175. The @code{testsrc} source generates a test video pattern, showing a
  18176. color pattern, a scrolling gradient and a timestamp. This is mainly
  18177. intended for testing purposes.
  18178. The @code{testsrc2} source is similar to testsrc, but supports more
  18179. pixel formats instead of just @code{rgb24}. This allows using it as an
  18180. input for other tests without requiring a format conversion.
  18181. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  18182. see a y, cb and cr stripe from top to bottom.
  18183. The sources accept the following parameters:
  18184. @table @option
  18185. @item level
  18186. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  18187. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  18188. pixels to be used as identity matrix for 3D lookup tables. Each component is
  18189. coded on a @code{1/(N*N)} scale.
  18190. @item color, c
  18191. Specify the color of the source, only available in the @code{color}
  18192. source. For the syntax of this option, check the
  18193. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18194. @item size, s
  18195. Specify the size of the sourced video. For the syntax of this option, check the
  18196. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18197. The default value is @code{320x240}.
  18198. This option is not available with the @code{allrgb}, @code{allyuv}, and
  18199. @code{haldclutsrc} filters.
  18200. @item rate, r
  18201. Specify the frame rate of the sourced video, as the number of frames
  18202. generated per second. It has to be a string in the format
  18203. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  18204. number or a valid video frame rate abbreviation. The default value is
  18205. "25".
  18206. @item duration, d
  18207. Set the duration of the sourced video. See
  18208. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18209. for the accepted syntax.
  18210. If not specified, or the expressed duration is negative, the video is
  18211. supposed to be generated forever.
  18212. Since the frame rate is used as time base, all frames including the last one
  18213. will have their full duration. If the specified duration is not a multiple
  18214. of the frame duration, it will be rounded up.
  18215. @item sar
  18216. Set the sample aspect ratio of the sourced video.
  18217. @item alpha
  18218. Specify the alpha (opacity) of the background, only available in the
  18219. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  18220. 255 (fully opaque, the default).
  18221. @item decimals, n
  18222. Set the number of decimals to show in the timestamp, only available in the
  18223. @code{testsrc} source.
  18224. The displayed timestamp value will correspond to the original
  18225. timestamp value multiplied by the power of 10 of the specified
  18226. value. Default value is 0.
  18227. @end table
  18228. @subsection Examples
  18229. @itemize
  18230. @item
  18231. Generate a video with a duration of 5.3 seconds, with size
  18232. 176x144 and a frame rate of 10 frames per second:
  18233. @example
  18234. testsrc=duration=5.3:size=qcif:rate=10
  18235. @end example
  18236. @item
  18237. The following graph description will generate a red source
  18238. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  18239. frames per second:
  18240. @example
  18241. color=c=red@@0.2:s=qcif:r=10
  18242. @end example
  18243. @item
  18244. If the input content is to be ignored, @code{nullsrc} can be used. The
  18245. following command generates noise in the luminance plane by employing
  18246. the @code{geq} filter:
  18247. @example
  18248. nullsrc=s=256x256, geq=random(1)*255:128:128
  18249. @end example
  18250. @end itemize
  18251. @subsection Commands
  18252. The @code{color} source supports the following commands:
  18253. @table @option
  18254. @item c, color
  18255. Set the color of the created image. Accepts the same syntax of the
  18256. corresponding @option{color} option.
  18257. @end table
  18258. @section openclsrc
  18259. Generate video using an OpenCL program.
  18260. @table @option
  18261. @item source
  18262. OpenCL program source file.
  18263. @item kernel
  18264. Kernel name in program.
  18265. @item size, s
  18266. Size of frames to generate. This must be set.
  18267. @item format
  18268. Pixel format to use for the generated frames. This must be set.
  18269. @item rate, r
  18270. Number of frames generated every second. Default value is '25'.
  18271. @end table
  18272. For details of how the program loading works, see the @ref{program_opencl}
  18273. filter.
  18274. Example programs:
  18275. @itemize
  18276. @item
  18277. Generate a colour ramp by setting pixel values from the position of the pixel
  18278. in the output image. (Note that this will work with all pixel formats, but
  18279. the generated output will not be the same.)
  18280. @verbatim
  18281. __kernel void ramp(__write_only image2d_t dst,
  18282. unsigned int index)
  18283. {
  18284. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  18285. float4 val;
  18286. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  18287. write_imagef(dst, loc, val);
  18288. }
  18289. @end verbatim
  18290. @item
  18291. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  18292. @verbatim
  18293. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  18294. unsigned int index)
  18295. {
  18296. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  18297. float4 value = 0.0f;
  18298. int x = loc.x + index;
  18299. int y = loc.y + index;
  18300. while (x > 0 || y > 0) {
  18301. if (x % 3 == 1 && y % 3 == 1) {
  18302. value = 1.0f;
  18303. break;
  18304. }
  18305. x /= 3;
  18306. y /= 3;
  18307. }
  18308. write_imagef(dst, loc, value);
  18309. }
  18310. @end verbatim
  18311. @end itemize
  18312. @section sierpinski
  18313. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  18314. This source accepts the following options:
  18315. @table @option
  18316. @item size, s
  18317. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  18318. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  18319. @item rate, r
  18320. Set frame rate, expressed as number of frames per second. Default
  18321. value is "25".
  18322. @item seed
  18323. Set seed which is used for random panning.
  18324. @item jump
  18325. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  18326. @item type
  18327. Set fractal type, can be default @code{carpet} or @code{triangle}.
  18328. @end table
  18329. @c man end VIDEO SOURCES
  18330. @chapter Video Sinks
  18331. @c man begin VIDEO SINKS
  18332. Below is a description of the currently available video sinks.
  18333. @section buffersink
  18334. Buffer video frames, and make them available to the end of the filter
  18335. graph.
  18336. This sink is mainly intended for programmatic use, in particular
  18337. through the interface defined in @file{libavfilter/buffersink.h}
  18338. or the options system.
  18339. It accepts a pointer to an AVBufferSinkContext structure, which
  18340. defines the incoming buffers' formats, to be passed as the opaque
  18341. parameter to @code{avfilter_init_filter} for initialization.
  18342. @section nullsink
  18343. Null video sink: do absolutely nothing with the input video. It is
  18344. mainly useful as a template and for use in analysis / debugging
  18345. tools.
  18346. @c man end VIDEO SINKS
  18347. @chapter Multimedia Filters
  18348. @c man begin MULTIMEDIA FILTERS
  18349. Below is a description of the currently available multimedia filters.
  18350. @section abitscope
  18351. Convert input audio to a video output, displaying the audio bit scope.
  18352. The filter accepts the following options:
  18353. @table @option
  18354. @item rate, r
  18355. Set frame rate, expressed as number of frames per second. Default
  18356. value is "25".
  18357. @item size, s
  18358. Specify the video size for the output. For the syntax of this option, check the
  18359. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18360. Default value is @code{1024x256}.
  18361. @item colors
  18362. Specify list of colors separated by space or by '|' which will be used to
  18363. draw channels. Unrecognized or missing colors will be replaced
  18364. by white color.
  18365. @end table
  18366. @section adrawgraph
  18367. Draw a graph using input audio metadata.
  18368. See @ref{drawgraph}
  18369. @section agraphmonitor
  18370. See @ref{graphmonitor}.
  18371. @section ahistogram
  18372. Convert input audio to a video output, displaying the volume histogram.
  18373. The filter accepts the following options:
  18374. @table @option
  18375. @item dmode
  18376. Specify how histogram is calculated.
  18377. It accepts the following values:
  18378. @table @samp
  18379. @item single
  18380. Use single histogram for all channels.
  18381. @item separate
  18382. Use separate histogram for each channel.
  18383. @end table
  18384. Default is @code{single}.
  18385. @item rate, r
  18386. Set frame rate, expressed as number of frames per second. Default
  18387. value is "25".
  18388. @item size, s
  18389. Specify the video size for the output. For the syntax of this option, check the
  18390. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18391. Default value is @code{hd720}.
  18392. @item scale
  18393. Set display scale.
  18394. It accepts the following values:
  18395. @table @samp
  18396. @item log
  18397. logarithmic
  18398. @item sqrt
  18399. square root
  18400. @item cbrt
  18401. cubic root
  18402. @item lin
  18403. linear
  18404. @item rlog
  18405. reverse logarithmic
  18406. @end table
  18407. Default is @code{log}.
  18408. @item ascale
  18409. Set amplitude scale.
  18410. It accepts the following values:
  18411. @table @samp
  18412. @item log
  18413. logarithmic
  18414. @item lin
  18415. linear
  18416. @end table
  18417. Default is @code{log}.
  18418. @item acount
  18419. Set how much frames to accumulate in histogram.
  18420. Default is 1. Setting this to -1 accumulates all frames.
  18421. @item rheight
  18422. Set histogram ratio of window height.
  18423. @item slide
  18424. Set sonogram sliding.
  18425. It accepts the following values:
  18426. @table @samp
  18427. @item replace
  18428. replace old rows with new ones.
  18429. @item scroll
  18430. scroll from top to bottom.
  18431. @end table
  18432. Default is @code{replace}.
  18433. @end table
  18434. @section aphasemeter
  18435. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  18436. representing mean phase of current audio frame. A video output can also be produced and is
  18437. enabled by default. The audio is passed through as first output.
  18438. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  18439. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  18440. and @code{1} means channels are in phase.
  18441. The filter accepts the following options, all related to its video output:
  18442. @table @option
  18443. @item rate, r
  18444. Set the output frame rate. Default value is @code{25}.
  18445. @item size, s
  18446. Set the video size for the output. For the syntax of this option, check the
  18447. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18448. Default value is @code{800x400}.
  18449. @item rc
  18450. @item gc
  18451. @item bc
  18452. Specify the red, green, blue contrast. Default values are @code{2},
  18453. @code{7} and @code{1}.
  18454. Allowed range is @code{[0, 255]}.
  18455. @item mpc
  18456. Set color which will be used for drawing median phase. If color is
  18457. @code{none} which is default, no median phase value will be drawn.
  18458. @item video
  18459. Enable video output. Default is enabled.
  18460. @end table
  18461. @subsection phasing detection
  18462. The filter also detects out of phase and mono sequences in stereo streams.
  18463. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  18464. The filter accepts the following options for this detection:
  18465. @table @option
  18466. @item phasing
  18467. Enable mono and out of phase detection. Default is disabled.
  18468. @item tolerance, t
  18469. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  18470. Allowed range is @code{[0, 1]}.
  18471. @item angle, a
  18472. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  18473. Allowed range is @code{[90, 180]}.
  18474. @item duration, d
  18475. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  18476. @end table
  18477. @subsection Examples
  18478. @itemize
  18479. @item
  18480. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  18481. @example
  18482. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  18483. @end example
  18484. @end itemize
  18485. @section avectorscope
  18486. Convert input audio to a video output, representing the audio vector
  18487. scope.
  18488. The filter is used to measure the difference between channels of stereo
  18489. audio stream. A monaural signal, consisting of identical left and right
  18490. signal, results in straight vertical line. Any stereo separation is visible
  18491. as a deviation from this line, creating a Lissajous figure.
  18492. If the straight (or deviation from it) but horizontal line appears this
  18493. indicates that the left and right channels are out of phase.
  18494. The filter accepts the following options:
  18495. @table @option
  18496. @item mode, m
  18497. Set the vectorscope mode.
  18498. Available values are:
  18499. @table @samp
  18500. @item lissajous
  18501. Lissajous rotated by 45 degrees.
  18502. @item lissajous_xy
  18503. Same as above but not rotated.
  18504. @item polar
  18505. Shape resembling half of circle.
  18506. @end table
  18507. Default value is @samp{lissajous}.
  18508. @item size, s
  18509. Set the video size for the output. For the syntax of this option, check the
  18510. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18511. Default value is @code{400x400}.
  18512. @item rate, r
  18513. Set the output frame rate. Default value is @code{25}.
  18514. @item rc
  18515. @item gc
  18516. @item bc
  18517. @item ac
  18518. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  18519. @code{160}, @code{80} and @code{255}.
  18520. Allowed range is @code{[0, 255]}.
  18521. @item rf
  18522. @item gf
  18523. @item bf
  18524. @item af
  18525. Specify the red, green, blue and alpha fade. Default values are @code{15},
  18526. @code{10}, @code{5} and @code{5}.
  18527. Allowed range is @code{[0, 255]}.
  18528. @item zoom
  18529. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  18530. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  18531. @item draw
  18532. Set the vectorscope drawing mode.
  18533. Available values are:
  18534. @table @samp
  18535. @item dot
  18536. Draw dot for each sample.
  18537. @item line
  18538. Draw line between previous and current sample.
  18539. @end table
  18540. Default value is @samp{dot}.
  18541. @item scale
  18542. Specify amplitude scale of audio samples.
  18543. Available values are:
  18544. @table @samp
  18545. @item lin
  18546. Linear.
  18547. @item sqrt
  18548. Square root.
  18549. @item cbrt
  18550. Cubic root.
  18551. @item log
  18552. Logarithmic.
  18553. @end table
  18554. @item swap
  18555. Swap left channel axis with right channel axis.
  18556. @item mirror
  18557. Mirror axis.
  18558. @table @samp
  18559. @item none
  18560. No mirror.
  18561. @item x
  18562. Mirror only x axis.
  18563. @item y
  18564. Mirror only y axis.
  18565. @item xy
  18566. Mirror both axis.
  18567. @end table
  18568. @end table
  18569. @subsection Examples
  18570. @itemize
  18571. @item
  18572. Complete example using @command{ffplay}:
  18573. @example
  18574. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18575. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  18576. @end example
  18577. @end itemize
  18578. @section bench, abench
  18579. Benchmark part of a filtergraph.
  18580. The filter accepts the following options:
  18581. @table @option
  18582. @item action
  18583. Start or stop a timer.
  18584. Available values are:
  18585. @table @samp
  18586. @item start
  18587. Get the current time, set it as frame metadata (using the key
  18588. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  18589. @item stop
  18590. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  18591. the input frame metadata to get the time difference. Time difference, average,
  18592. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  18593. @code{min}) are then printed. The timestamps are expressed in seconds.
  18594. @end table
  18595. @end table
  18596. @subsection Examples
  18597. @itemize
  18598. @item
  18599. Benchmark @ref{selectivecolor} filter:
  18600. @example
  18601. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  18602. @end example
  18603. @end itemize
  18604. @section concat
  18605. Concatenate audio and video streams, joining them together one after the
  18606. other.
  18607. The filter works on segments of synchronized video and audio streams. All
  18608. segments must have the same number of streams of each type, and that will
  18609. also be the number of streams at output.
  18610. The filter accepts the following options:
  18611. @table @option
  18612. @item n
  18613. Set the number of segments. Default is 2.
  18614. @item v
  18615. Set the number of output video streams, that is also the number of video
  18616. streams in each segment. Default is 1.
  18617. @item a
  18618. Set the number of output audio streams, that is also the number of audio
  18619. streams in each segment. Default is 0.
  18620. @item unsafe
  18621. Activate unsafe mode: do not fail if segments have a different format.
  18622. @end table
  18623. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  18624. @var{a} audio outputs.
  18625. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  18626. segment, in the same order as the outputs, then the inputs for the second
  18627. segment, etc.
  18628. Related streams do not always have exactly the same duration, for various
  18629. reasons including codec frame size or sloppy authoring. For that reason,
  18630. related synchronized streams (e.g. a video and its audio track) should be
  18631. concatenated at once. The concat filter will use the duration of the longest
  18632. stream in each segment (except the last one), and if necessary pad shorter
  18633. audio streams with silence.
  18634. For this filter to work correctly, all segments must start at timestamp 0.
  18635. All corresponding streams must have the same parameters in all segments; the
  18636. filtering system will automatically select a common pixel format for video
  18637. streams, and a common sample format, sample rate and channel layout for
  18638. audio streams, but other settings, such as resolution, must be converted
  18639. explicitly by the user.
  18640. Different frame rates are acceptable but will result in variable frame rate
  18641. at output; be sure to configure the output file to handle it.
  18642. @subsection Examples
  18643. @itemize
  18644. @item
  18645. Concatenate an opening, an episode and an ending, all in bilingual version
  18646. (video in stream 0, audio in streams 1 and 2):
  18647. @example
  18648. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  18649. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  18650. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  18651. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  18652. @end example
  18653. @item
  18654. Concatenate two parts, handling audio and video separately, using the
  18655. (a)movie sources, and adjusting the resolution:
  18656. @example
  18657. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  18658. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  18659. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  18660. @end example
  18661. Note that a desync will happen at the stitch if the audio and video streams
  18662. do not have exactly the same duration in the first file.
  18663. @end itemize
  18664. @subsection Commands
  18665. This filter supports the following commands:
  18666. @table @option
  18667. @item next
  18668. Close the current segment and step to the next one
  18669. @end table
  18670. @anchor{ebur128}
  18671. @section ebur128
  18672. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  18673. level. By default, it logs a message at a frequency of 10Hz with the
  18674. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  18675. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  18676. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  18677. sample format is double-precision floating point. The input stream will be converted to
  18678. this specification, if needed. Users may need to insert aformat and/or aresample filters
  18679. after this filter to obtain the original parameters.
  18680. The filter also has a video output (see the @var{video} option) with a real
  18681. time graph to observe the loudness evolution. The graphic contains the logged
  18682. message mentioned above, so it is not printed anymore when this option is set,
  18683. unless the verbose logging is set. The main graphing area contains the
  18684. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  18685. the momentary loudness (400 milliseconds), but can optionally be configured
  18686. to instead display short-term loudness (see @var{gauge}).
  18687. The green area marks a +/- 1LU target range around the target loudness
  18688. (-23LUFS by default, unless modified through @var{target}).
  18689. More information about the Loudness Recommendation EBU R128 on
  18690. @url{http://tech.ebu.ch/loudness}.
  18691. The filter accepts the following options:
  18692. @table @option
  18693. @item video
  18694. Activate the video output. The audio stream is passed unchanged whether this
  18695. option is set or no. The video stream will be the first output stream if
  18696. activated. Default is @code{0}.
  18697. @item size
  18698. Set the video size. This option is for video only. For the syntax of this
  18699. option, check the
  18700. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18701. Default and minimum resolution is @code{640x480}.
  18702. @item meter
  18703. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18704. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18705. other integer value between this range is allowed.
  18706. @item metadata
  18707. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18708. into 100ms output frames, each of them containing various loudness information
  18709. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18710. Default is @code{0}.
  18711. @item framelog
  18712. Force the frame logging level.
  18713. Available values are:
  18714. @table @samp
  18715. @item info
  18716. information logging level
  18717. @item verbose
  18718. verbose logging level
  18719. @end table
  18720. By default, the logging level is set to @var{info}. If the @option{video} or
  18721. the @option{metadata} options are set, it switches to @var{verbose}.
  18722. @item peak
  18723. Set peak mode(s).
  18724. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18725. values are:
  18726. @table @samp
  18727. @item none
  18728. Disable any peak mode (default).
  18729. @item sample
  18730. Enable sample-peak mode.
  18731. Simple peak mode looking for the higher sample value. It logs a message
  18732. for sample-peak (identified by @code{SPK}).
  18733. @item true
  18734. Enable true-peak mode.
  18735. If enabled, the peak lookup is done on an over-sampled version of the input
  18736. stream for better peak accuracy. It logs a message for true-peak.
  18737. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18738. This mode requires a build with @code{libswresample}.
  18739. @end table
  18740. @item dualmono
  18741. Treat mono input files as "dual mono". If a mono file is intended for playback
  18742. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18743. If set to @code{true}, this option will compensate for this effect.
  18744. Multi-channel input files are not affected by this option.
  18745. @item panlaw
  18746. Set a specific pan law to be used for the measurement of dual mono files.
  18747. This parameter is optional, and has a default value of -3.01dB.
  18748. @item target
  18749. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18750. This parameter is optional and has a default value of -23LUFS as specified
  18751. by EBU R128. However, material published online may prefer a level of -16LUFS
  18752. (e.g. for use with podcasts or video platforms).
  18753. @item gauge
  18754. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18755. @code{shortterm}. By default the momentary value will be used, but in certain
  18756. scenarios it may be more useful to observe the short term value instead (e.g.
  18757. live mixing).
  18758. @item scale
  18759. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18760. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18761. video output, not the summary or continuous log output.
  18762. @end table
  18763. @subsection Examples
  18764. @itemize
  18765. @item
  18766. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18767. @example
  18768. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18769. @end example
  18770. @item
  18771. Run an analysis with @command{ffmpeg}:
  18772. @example
  18773. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18774. @end example
  18775. @end itemize
  18776. @section interleave, ainterleave
  18777. Temporally interleave frames from several inputs.
  18778. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18779. These filters read frames from several inputs and send the oldest
  18780. queued frame to the output.
  18781. Input streams must have well defined, monotonically increasing frame
  18782. timestamp values.
  18783. In order to submit one frame to output, these filters need to enqueue
  18784. at least one frame for each input, so they cannot work in case one
  18785. input is not yet terminated and will not receive incoming frames.
  18786. For example consider the case when one input is a @code{select} filter
  18787. which always drops input frames. The @code{interleave} filter will keep
  18788. reading from that input, but it will never be able to send new frames
  18789. to output until the input sends an end-of-stream signal.
  18790. Also, depending on inputs synchronization, the filters will drop
  18791. frames in case one input receives more frames than the other ones, and
  18792. the queue is already filled.
  18793. These filters accept the following options:
  18794. @table @option
  18795. @item nb_inputs, n
  18796. Set the number of different inputs, it is 2 by default.
  18797. @item duration
  18798. How to determine the end-of-stream.
  18799. @table @option
  18800. @item longest
  18801. The duration of the longest input. (default)
  18802. @item shortest
  18803. The duration of the shortest input.
  18804. @item first
  18805. The duration of the first input.
  18806. @end table
  18807. @end table
  18808. @subsection Examples
  18809. @itemize
  18810. @item
  18811. Interleave frames belonging to different streams using @command{ffmpeg}:
  18812. @example
  18813. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18814. @end example
  18815. @item
  18816. Add flickering blur effect:
  18817. @example
  18818. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18819. @end example
  18820. @end itemize
  18821. @section metadata, ametadata
  18822. Manipulate frame metadata.
  18823. This filter accepts the following options:
  18824. @table @option
  18825. @item mode
  18826. Set mode of operation of the filter.
  18827. Can be one of the following:
  18828. @table @samp
  18829. @item select
  18830. If both @code{value} and @code{key} is set, select frames
  18831. which have such metadata. If only @code{key} is set, select
  18832. every frame that has such key in metadata.
  18833. @item add
  18834. Add new metadata @code{key} and @code{value}. If key is already available
  18835. do nothing.
  18836. @item modify
  18837. Modify value of already present key.
  18838. @item delete
  18839. If @code{value} is set, delete only keys that have such value.
  18840. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18841. the frame.
  18842. @item print
  18843. Print key and its value if metadata was found. If @code{key} is not set print all
  18844. metadata values available in frame.
  18845. @end table
  18846. @item key
  18847. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18848. @item value
  18849. Set metadata value which will be used. This option is mandatory for
  18850. @code{modify} and @code{add} mode.
  18851. @item function
  18852. Which function to use when comparing metadata value and @code{value}.
  18853. Can be one of following:
  18854. @table @samp
  18855. @item same_str
  18856. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18857. @item starts_with
  18858. Values are interpreted as strings, returns true if metadata value starts with
  18859. the @code{value} option string.
  18860. @item less
  18861. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18862. @item equal
  18863. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18864. @item greater
  18865. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18866. @item expr
  18867. Values are interpreted as floats, returns true if expression from option @code{expr}
  18868. evaluates to true.
  18869. @item ends_with
  18870. Values are interpreted as strings, returns true if metadata value ends with
  18871. the @code{value} option string.
  18872. @end table
  18873. @item expr
  18874. Set expression which is used when @code{function} is set to @code{expr}.
  18875. The expression is evaluated through the eval API and can contain the following
  18876. constants:
  18877. @table @option
  18878. @item VALUE1
  18879. Float representation of @code{value} from metadata key.
  18880. @item VALUE2
  18881. Float representation of @code{value} as supplied by user in @code{value} option.
  18882. @end table
  18883. @item file
  18884. If specified in @code{print} mode, output is written to the named file. Instead of
  18885. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18886. for standard output. If @code{file} option is not set, output is written to the log
  18887. with AV_LOG_INFO loglevel.
  18888. @item direct
  18889. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18890. @end table
  18891. @subsection Examples
  18892. @itemize
  18893. @item
  18894. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18895. between 0 and 1.
  18896. @example
  18897. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18898. @end example
  18899. @item
  18900. Print silencedetect output to file @file{metadata.txt}.
  18901. @example
  18902. silencedetect,ametadata=mode=print:file=metadata.txt
  18903. @end example
  18904. @item
  18905. Direct all metadata to a pipe with file descriptor 4.
  18906. @example
  18907. metadata=mode=print:file='pipe\:4'
  18908. @end example
  18909. @end itemize
  18910. @section perms, aperms
  18911. Set read/write permissions for the output frames.
  18912. These filters are mainly aimed at developers to test direct path in the
  18913. following filter in the filtergraph.
  18914. The filters accept the following options:
  18915. @table @option
  18916. @item mode
  18917. Select the permissions mode.
  18918. It accepts the following values:
  18919. @table @samp
  18920. @item none
  18921. Do nothing. This is the default.
  18922. @item ro
  18923. Set all the output frames read-only.
  18924. @item rw
  18925. Set all the output frames directly writable.
  18926. @item toggle
  18927. Make the frame read-only if writable, and writable if read-only.
  18928. @item random
  18929. Set each output frame read-only or writable randomly.
  18930. @end table
  18931. @item seed
  18932. Set the seed for the @var{random} mode, must be an integer included between
  18933. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18934. @code{-1}, the filter will try to use a good random seed on a best effort
  18935. basis.
  18936. @end table
  18937. Note: in case of auto-inserted filter between the permission filter and the
  18938. following one, the permission might not be received as expected in that
  18939. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18940. perms/aperms filter can avoid this problem.
  18941. @section realtime, arealtime
  18942. Slow down filtering to match real time approximately.
  18943. These filters will pause the filtering for a variable amount of time to
  18944. match the output rate with the input timestamps.
  18945. They are similar to the @option{re} option to @code{ffmpeg}.
  18946. They accept the following options:
  18947. @table @option
  18948. @item limit
  18949. Time limit for the pauses. Any pause longer than that will be considered
  18950. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18951. @item speed
  18952. Speed factor for processing. The value must be a float larger than zero.
  18953. Values larger than 1.0 will result in faster than realtime processing,
  18954. smaller will slow processing down. The @var{limit} is automatically adapted
  18955. accordingly. Default is 1.0.
  18956. A processing speed faster than what is possible without these filters cannot
  18957. be achieved.
  18958. @end table
  18959. @anchor{select}
  18960. @section select, aselect
  18961. Select frames to pass in output.
  18962. This filter accepts the following options:
  18963. @table @option
  18964. @item expr, e
  18965. Set expression, which is evaluated for each input frame.
  18966. If the expression is evaluated to zero, the frame is discarded.
  18967. If the evaluation result is negative or NaN, the frame is sent to the
  18968. first output; otherwise it is sent to the output with index
  18969. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18970. For example a value of @code{1.2} corresponds to the output with index
  18971. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18972. @item outputs, n
  18973. Set the number of outputs. The output to which to send the selected
  18974. frame is based on the result of the evaluation. Default value is 1.
  18975. @end table
  18976. The expression can contain the following constants:
  18977. @table @option
  18978. @item n
  18979. The (sequential) number of the filtered frame, starting from 0.
  18980. @item selected_n
  18981. The (sequential) number of the selected frame, starting from 0.
  18982. @item prev_selected_n
  18983. The sequential number of the last selected frame. It's NAN if undefined.
  18984. @item TB
  18985. The timebase of the input timestamps.
  18986. @item pts
  18987. The PTS (Presentation TimeStamp) of the filtered video frame,
  18988. expressed in @var{TB} units. It's NAN if undefined.
  18989. @item t
  18990. The PTS of the filtered video frame,
  18991. expressed in seconds. It's NAN if undefined.
  18992. @item prev_pts
  18993. The PTS of the previously filtered video frame. It's NAN if undefined.
  18994. @item prev_selected_pts
  18995. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18996. @item prev_selected_t
  18997. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18998. @item start_pts
  18999. The PTS of the first video frame in the video. It's NAN if undefined.
  19000. @item start_t
  19001. The time of the first video frame in the video. It's NAN if undefined.
  19002. @item pict_type @emph{(video only)}
  19003. The type of the filtered frame. It can assume one of the following
  19004. values:
  19005. @table @option
  19006. @item I
  19007. @item P
  19008. @item B
  19009. @item S
  19010. @item SI
  19011. @item SP
  19012. @item BI
  19013. @end table
  19014. @item interlace_type @emph{(video only)}
  19015. The frame interlace type. It can assume one of the following values:
  19016. @table @option
  19017. @item PROGRESSIVE
  19018. The frame is progressive (not interlaced).
  19019. @item TOPFIRST
  19020. The frame is top-field-first.
  19021. @item BOTTOMFIRST
  19022. The frame is bottom-field-first.
  19023. @end table
  19024. @item consumed_sample_n @emph{(audio only)}
  19025. the number of selected samples before the current frame
  19026. @item samples_n @emph{(audio only)}
  19027. the number of samples in the current frame
  19028. @item sample_rate @emph{(audio only)}
  19029. the input sample rate
  19030. @item key
  19031. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  19032. @item pos
  19033. the position in the file of the filtered frame, -1 if the information
  19034. is not available (e.g. for synthetic video)
  19035. @item scene @emph{(video only)}
  19036. value between 0 and 1 to indicate a new scene; a low value reflects a low
  19037. probability for the current frame to introduce a new scene, while a higher
  19038. value means the current frame is more likely to be one (see the example below)
  19039. @item concatdec_select
  19040. The concat demuxer can select only part of a concat input file by setting an
  19041. inpoint and an outpoint, but the output packets may not be entirely contained
  19042. in the selected interval. By using this variable, it is possible to skip frames
  19043. generated by the concat demuxer which are not exactly contained in the selected
  19044. interval.
  19045. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  19046. and the @var{lavf.concat.duration} packet metadata values which are also
  19047. present in the decoded frames.
  19048. The @var{concatdec_select} variable is -1 if the frame pts is at least
  19049. start_time and either the duration metadata is missing or the frame pts is less
  19050. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  19051. missing.
  19052. That basically means that an input frame is selected if its pts is within the
  19053. interval set by the concat demuxer.
  19054. @end table
  19055. The default value of the select expression is "1".
  19056. @subsection Examples
  19057. @itemize
  19058. @item
  19059. Select all frames in input:
  19060. @example
  19061. select
  19062. @end example
  19063. The example above is the same as:
  19064. @example
  19065. select=1
  19066. @end example
  19067. @item
  19068. Skip all frames:
  19069. @example
  19070. select=0
  19071. @end example
  19072. @item
  19073. Select only I-frames:
  19074. @example
  19075. select='eq(pict_type\,I)'
  19076. @end example
  19077. @item
  19078. Select one frame every 100:
  19079. @example
  19080. select='not(mod(n\,100))'
  19081. @end example
  19082. @item
  19083. Select only frames contained in the 10-20 time interval:
  19084. @example
  19085. select=between(t\,10\,20)
  19086. @end example
  19087. @item
  19088. Select only I-frames contained in the 10-20 time interval:
  19089. @example
  19090. select=between(t\,10\,20)*eq(pict_type\,I)
  19091. @end example
  19092. @item
  19093. Select frames with a minimum distance of 10 seconds:
  19094. @example
  19095. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  19096. @end example
  19097. @item
  19098. Use aselect to select only audio frames with samples number > 100:
  19099. @example
  19100. aselect='gt(samples_n\,100)'
  19101. @end example
  19102. @item
  19103. Create a mosaic of the first scenes:
  19104. @example
  19105. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  19106. @end example
  19107. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  19108. choice.
  19109. @item
  19110. Send even and odd frames to separate outputs, and compose them:
  19111. @example
  19112. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  19113. @end example
  19114. @item
  19115. Select useful frames from an ffconcat file which is using inpoints and
  19116. outpoints but where the source files are not intra frame only.
  19117. @example
  19118. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  19119. @end example
  19120. @end itemize
  19121. @section sendcmd, asendcmd
  19122. Send commands to filters in the filtergraph.
  19123. These filters read commands to be sent to other filters in the
  19124. filtergraph.
  19125. @code{sendcmd} must be inserted between two video filters,
  19126. @code{asendcmd} must be inserted between two audio filters, but apart
  19127. from that they act the same way.
  19128. The specification of commands can be provided in the filter arguments
  19129. with the @var{commands} option, or in a file specified by the
  19130. @var{filename} option.
  19131. These filters accept the following options:
  19132. @table @option
  19133. @item commands, c
  19134. Set the commands to be read and sent to the other filters.
  19135. @item filename, f
  19136. Set the filename of the commands to be read and sent to the other
  19137. filters.
  19138. @end table
  19139. @subsection Commands syntax
  19140. A commands description consists of a sequence of interval
  19141. specifications, comprising a list of commands to be executed when a
  19142. particular event related to that interval occurs. The occurring event
  19143. is typically the current frame time entering or leaving a given time
  19144. interval.
  19145. An interval is specified by the following syntax:
  19146. @example
  19147. @var{START}[-@var{END}] @var{COMMANDS};
  19148. @end example
  19149. The time interval is specified by the @var{START} and @var{END} times.
  19150. @var{END} is optional and defaults to the maximum time.
  19151. The current frame time is considered within the specified interval if
  19152. it is included in the interval [@var{START}, @var{END}), that is when
  19153. the time is greater or equal to @var{START} and is lesser than
  19154. @var{END}.
  19155. @var{COMMANDS} consists of a sequence of one or more command
  19156. specifications, separated by ",", relating to that interval. The
  19157. syntax of a command specification is given by:
  19158. @example
  19159. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  19160. @end example
  19161. @var{FLAGS} is optional and specifies the type of events relating to
  19162. the time interval which enable sending the specified command, and must
  19163. be a non-null sequence of identifier flags separated by "+" or "|" and
  19164. enclosed between "[" and "]".
  19165. The following flags are recognized:
  19166. @table @option
  19167. @item enter
  19168. The command is sent when the current frame timestamp enters the
  19169. specified interval. In other words, the command is sent when the
  19170. previous frame timestamp was not in the given interval, and the
  19171. current is.
  19172. @item leave
  19173. The command is sent when the current frame timestamp leaves the
  19174. specified interval. In other words, the command is sent when the
  19175. previous frame timestamp was in the given interval, and the
  19176. current is not.
  19177. @item expr
  19178. The command @var{ARG} is interpreted as expression and result of
  19179. expression is passed as @var{ARG}.
  19180. The expression is evaluated through the eval API and can contain the following
  19181. constants:
  19182. @table @option
  19183. @item POS
  19184. Original position in the file of the frame, or undefined if undefined
  19185. for the current frame.
  19186. @item PTS
  19187. The presentation timestamp in input.
  19188. @item N
  19189. The count of the input frame for video or audio, starting from 0.
  19190. @item T
  19191. The time in seconds of the current frame.
  19192. @item TS
  19193. The start time in seconds of the current command interval.
  19194. @item TE
  19195. The end time in seconds of the current command interval.
  19196. @item TI
  19197. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  19198. @end table
  19199. @end table
  19200. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  19201. assumed.
  19202. @var{TARGET} specifies the target of the command, usually the name of
  19203. the filter class or a specific filter instance name.
  19204. @var{COMMAND} specifies the name of the command for the target filter.
  19205. @var{ARG} is optional and specifies the optional list of argument for
  19206. the given @var{COMMAND}.
  19207. Between one interval specification and another, whitespaces, or
  19208. sequences of characters starting with @code{#} until the end of line,
  19209. are ignored and can be used to annotate comments.
  19210. A simplified BNF description of the commands specification syntax
  19211. follows:
  19212. @example
  19213. @var{COMMAND_FLAG} ::= "enter" | "leave"
  19214. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  19215. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  19216. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  19217. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  19218. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  19219. @end example
  19220. @subsection Examples
  19221. @itemize
  19222. @item
  19223. Specify audio tempo change at second 4:
  19224. @example
  19225. asendcmd=c='4.0 atempo tempo 1.5',atempo
  19226. @end example
  19227. @item
  19228. Target a specific filter instance:
  19229. @example
  19230. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  19231. @end example
  19232. @item
  19233. Specify a list of drawtext and hue commands in a file.
  19234. @example
  19235. # show text in the interval 5-10
  19236. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  19237. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  19238. # desaturate the image in the interval 15-20
  19239. 15.0-20.0 [enter] hue s 0,
  19240. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  19241. [leave] hue s 1,
  19242. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  19243. # apply an exponential saturation fade-out effect, starting from time 25
  19244. 25 [enter] hue s exp(25-t)
  19245. @end example
  19246. A filtergraph allowing to read and process the above command list
  19247. stored in a file @file{test.cmd}, can be specified with:
  19248. @example
  19249. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  19250. @end example
  19251. @end itemize
  19252. @anchor{setpts}
  19253. @section setpts, asetpts
  19254. Change the PTS (presentation timestamp) of the input frames.
  19255. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  19256. This filter accepts the following options:
  19257. @table @option
  19258. @item expr
  19259. The expression which is evaluated for each frame to construct its timestamp.
  19260. @end table
  19261. The expression is evaluated through the eval API and can contain the following
  19262. constants:
  19263. @table @option
  19264. @item FRAME_RATE, FR
  19265. frame rate, only defined for constant frame-rate video
  19266. @item PTS
  19267. The presentation timestamp in input
  19268. @item N
  19269. The count of the input frame for video or the number of consumed samples,
  19270. not including the current frame for audio, starting from 0.
  19271. @item NB_CONSUMED_SAMPLES
  19272. The number of consumed samples, not including the current frame (only
  19273. audio)
  19274. @item NB_SAMPLES, S
  19275. The number of samples in the current frame (only audio)
  19276. @item SAMPLE_RATE, SR
  19277. The audio sample rate.
  19278. @item STARTPTS
  19279. The PTS of the first frame.
  19280. @item STARTT
  19281. the time in seconds of the first frame
  19282. @item INTERLACED
  19283. State whether the current frame is interlaced.
  19284. @item T
  19285. the time in seconds of the current frame
  19286. @item POS
  19287. original position in the file of the frame, or undefined if undefined
  19288. for the current frame
  19289. @item PREV_INPTS
  19290. The previous input PTS.
  19291. @item PREV_INT
  19292. previous input time in seconds
  19293. @item PREV_OUTPTS
  19294. The previous output PTS.
  19295. @item PREV_OUTT
  19296. previous output time in seconds
  19297. @item RTCTIME
  19298. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  19299. instead.
  19300. @item RTCSTART
  19301. The wallclock (RTC) time at the start of the movie in microseconds.
  19302. @item TB
  19303. The timebase of the input timestamps.
  19304. @end table
  19305. @subsection Examples
  19306. @itemize
  19307. @item
  19308. Start counting PTS from zero
  19309. @example
  19310. setpts=PTS-STARTPTS
  19311. @end example
  19312. @item
  19313. Apply fast motion effect:
  19314. @example
  19315. setpts=0.5*PTS
  19316. @end example
  19317. @item
  19318. Apply slow motion effect:
  19319. @example
  19320. setpts=2.0*PTS
  19321. @end example
  19322. @item
  19323. Set fixed rate of 25 frames per second:
  19324. @example
  19325. setpts=N/(25*TB)
  19326. @end example
  19327. @item
  19328. Set fixed rate 25 fps with some jitter:
  19329. @example
  19330. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  19331. @end example
  19332. @item
  19333. Apply an offset of 10 seconds to the input PTS:
  19334. @example
  19335. setpts=PTS+10/TB
  19336. @end example
  19337. @item
  19338. Generate timestamps from a "live source" and rebase onto the current timebase:
  19339. @example
  19340. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  19341. @end example
  19342. @item
  19343. Generate timestamps by counting samples:
  19344. @example
  19345. asetpts=N/SR/TB
  19346. @end example
  19347. @end itemize
  19348. @section setrange
  19349. Force color range for the output video frame.
  19350. The @code{setrange} filter marks the color range property for the
  19351. output frames. It does not change the input frame, but only sets the
  19352. corresponding property, which affects how the frame is treated by
  19353. following filters.
  19354. The filter accepts the following options:
  19355. @table @option
  19356. @item range
  19357. Available values are:
  19358. @table @samp
  19359. @item auto
  19360. Keep the same color range property.
  19361. @item unspecified, unknown
  19362. Set the color range as unspecified.
  19363. @item limited, tv, mpeg
  19364. Set the color range as limited.
  19365. @item full, pc, jpeg
  19366. Set the color range as full.
  19367. @end table
  19368. @end table
  19369. @section settb, asettb
  19370. Set the timebase to use for the output frames timestamps.
  19371. It is mainly useful for testing timebase configuration.
  19372. It accepts the following parameters:
  19373. @table @option
  19374. @item expr, tb
  19375. The expression which is evaluated into the output timebase.
  19376. @end table
  19377. The value for @option{tb} is an arithmetic expression representing a
  19378. rational. The expression can contain the constants "AVTB" (the default
  19379. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  19380. audio only). Default value is "intb".
  19381. @subsection Examples
  19382. @itemize
  19383. @item
  19384. Set the timebase to 1/25:
  19385. @example
  19386. settb=expr=1/25
  19387. @end example
  19388. @item
  19389. Set the timebase to 1/10:
  19390. @example
  19391. settb=expr=0.1
  19392. @end example
  19393. @item
  19394. Set the timebase to 1001/1000:
  19395. @example
  19396. settb=1+0.001
  19397. @end example
  19398. @item
  19399. Set the timebase to 2*intb:
  19400. @example
  19401. settb=2*intb
  19402. @end example
  19403. @item
  19404. Set the default timebase value:
  19405. @example
  19406. settb=AVTB
  19407. @end example
  19408. @end itemize
  19409. @section showcqt
  19410. Convert input audio to a video output representing frequency spectrum
  19411. logarithmically using Brown-Puckette constant Q transform algorithm with
  19412. direct frequency domain coefficient calculation (but the transform itself
  19413. is not really constant Q, instead the Q factor is actually variable/clamped),
  19414. with musical tone scale, from E0 to D#10.
  19415. The filter accepts the following options:
  19416. @table @option
  19417. @item size, s
  19418. Specify the video size for the output. It must be even. For the syntax of this option,
  19419. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19420. Default value is @code{1920x1080}.
  19421. @item fps, rate, r
  19422. Set the output frame rate. Default value is @code{25}.
  19423. @item bar_h
  19424. Set the bargraph height. It must be even. Default value is @code{-1} which
  19425. computes the bargraph height automatically.
  19426. @item axis_h
  19427. Set the axis height. It must be even. Default value is @code{-1} which computes
  19428. the axis height automatically.
  19429. @item sono_h
  19430. Set the sonogram height. It must be even. Default value is @code{-1} which
  19431. computes the sonogram height automatically.
  19432. @item fullhd
  19433. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  19434. instead. Default value is @code{1}.
  19435. @item sono_v, volume
  19436. Specify the sonogram volume expression. It can contain variables:
  19437. @table @option
  19438. @item bar_v
  19439. the @var{bar_v} evaluated expression
  19440. @item frequency, freq, f
  19441. the frequency where it is evaluated
  19442. @item timeclamp, tc
  19443. the value of @var{timeclamp} option
  19444. @end table
  19445. and functions:
  19446. @table @option
  19447. @item a_weighting(f)
  19448. A-weighting of equal loudness
  19449. @item b_weighting(f)
  19450. B-weighting of equal loudness
  19451. @item c_weighting(f)
  19452. C-weighting of equal loudness.
  19453. @end table
  19454. Default value is @code{16}.
  19455. @item bar_v, volume2
  19456. Specify the bargraph volume expression. It can contain variables:
  19457. @table @option
  19458. @item sono_v
  19459. the @var{sono_v} evaluated expression
  19460. @item frequency, freq, f
  19461. the frequency where it is evaluated
  19462. @item timeclamp, tc
  19463. the value of @var{timeclamp} option
  19464. @end table
  19465. and functions:
  19466. @table @option
  19467. @item a_weighting(f)
  19468. A-weighting of equal loudness
  19469. @item b_weighting(f)
  19470. B-weighting of equal loudness
  19471. @item c_weighting(f)
  19472. C-weighting of equal loudness.
  19473. @end table
  19474. Default value is @code{sono_v}.
  19475. @item sono_g, gamma
  19476. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  19477. higher gamma makes the spectrum having more range. Default value is @code{3}.
  19478. Acceptable range is @code{[1, 7]}.
  19479. @item bar_g, gamma2
  19480. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  19481. @code{[1, 7]}.
  19482. @item bar_t
  19483. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  19484. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  19485. @item timeclamp, tc
  19486. Specify the transform timeclamp. At low frequency, there is trade-off between
  19487. accuracy in time domain and frequency domain. If timeclamp is lower,
  19488. event in time domain is represented more accurately (such as fast bass drum),
  19489. otherwise event in frequency domain is represented more accurately
  19490. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  19491. @item attack
  19492. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  19493. limits future samples by applying asymmetric windowing in time domain, useful
  19494. when low latency is required. Accepted range is @code{[0, 1]}.
  19495. @item basefreq
  19496. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  19497. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  19498. @item endfreq
  19499. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  19500. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  19501. @item coeffclamp
  19502. This option is deprecated and ignored.
  19503. @item tlength
  19504. Specify the transform length in time domain. Use this option to control accuracy
  19505. trade-off between time domain and frequency domain at every frequency sample.
  19506. It can contain variables:
  19507. @table @option
  19508. @item frequency, freq, f
  19509. the frequency where it is evaluated
  19510. @item timeclamp, tc
  19511. the value of @var{timeclamp} option.
  19512. @end table
  19513. Default value is @code{384*tc/(384+tc*f)}.
  19514. @item count
  19515. Specify the transform count for every video frame. Default value is @code{6}.
  19516. Acceptable range is @code{[1, 30]}.
  19517. @item fcount
  19518. Specify the transform count for every single pixel. Default value is @code{0},
  19519. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  19520. @item fontfile
  19521. Specify font file for use with freetype to draw the axis. If not specified,
  19522. use embedded font. Note that drawing with font file or embedded font is not
  19523. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  19524. option instead.
  19525. @item font
  19526. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  19527. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  19528. escaping.
  19529. @item fontcolor
  19530. Specify font color expression. This is arithmetic expression that should return
  19531. integer value 0xRRGGBB. It can contain variables:
  19532. @table @option
  19533. @item frequency, freq, f
  19534. the frequency where it is evaluated
  19535. @item timeclamp, tc
  19536. the value of @var{timeclamp} option
  19537. @end table
  19538. and functions:
  19539. @table @option
  19540. @item midi(f)
  19541. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  19542. @item r(x), g(x), b(x)
  19543. red, green, and blue value of intensity x.
  19544. @end table
  19545. Default value is @code{st(0, (midi(f)-59.5)/12);
  19546. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  19547. r(1-ld(1)) + b(ld(1))}.
  19548. @item axisfile
  19549. Specify image file to draw the axis. This option override @var{fontfile} and
  19550. @var{fontcolor} option.
  19551. @item axis, text
  19552. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  19553. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  19554. Default value is @code{1}.
  19555. @item csp
  19556. Set colorspace. The accepted values are:
  19557. @table @samp
  19558. @item unspecified
  19559. Unspecified (default)
  19560. @item bt709
  19561. BT.709
  19562. @item fcc
  19563. FCC
  19564. @item bt470bg
  19565. BT.470BG or BT.601-6 625
  19566. @item smpte170m
  19567. SMPTE-170M or BT.601-6 525
  19568. @item smpte240m
  19569. SMPTE-240M
  19570. @item bt2020ncl
  19571. BT.2020 with non-constant luminance
  19572. @end table
  19573. @item cscheme
  19574. Set spectrogram color scheme. This is list of floating point values with format
  19575. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  19576. The default is @code{1|0.5|0|0|0.5|1}.
  19577. @end table
  19578. @subsection Examples
  19579. @itemize
  19580. @item
  19581. Playing audio while showing the spectrum:
  19582. @example
  19583. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  19584. @end example
  19585. @item
  19586. Same as above, but with frame rate 30 fps:
  19587. @example
  19588. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  19589. @end example
  19590. @item
  19591. Playing at 1280x720:
  19592. @example
  19593. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  19594. @end example
  19595. @item
  19596. Disable sonogram display:
  19597. @example
  19598. sono_h=0
  19599. @end example
  19600. @item
  19601. A1 and its harmonics: A1, A2, (near)E3, A3:
  19602. @example
  19603. 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),
  19604. asplit[a][out1]; [a] showcqt [out0]'
  19605. @end example
  19606. @item
  19607. Same as above, but with more accuracy in frequency domain:
  19608. @example
  19609. 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),
  19610. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  19611. @end example
  19612. @item
  19613. Custom volume:
  19614. @example
  19615. bar_v=10:sono_v=bar_v*a_weighting(f)
  19616. @end example
  19617. @item
  19618. Custom gamma, now spectrum is linear to the amplitude.
  19619. @example
  19620. bar_g=2:sono_g=2
  19621. @end example
  19622. @item
  19623. Custom tlength equation:
  19624. @example
  19625. 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)))'
  19626. @end example
  19627. @item
  19628. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  19629. @example
  19630. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  19631. @end example
  19632. @item
  19633. Custom font using fontconfig:
  19634. @example
  19635. font='Courier New,Monospace,mono|bold'
  19636. @end example
  19637. @item
  19638. Custom frequency range with custom axis using image file:
  19639. @example
  19640. axisfile=myaxis.png:basefreq=40:endfreq=10000
  19641. @end example
  19642. @end itemize
  19643. @section showfreqs
  19644. Convert input audio to video output representing the audio power spectrum.
  19645. Audio amplitude is on Y-axis while frequency is on X-axis.
  19646. The filter accepts the following options:
  19647. @table @option
  19648. @item size, s
  19649. Specify size of video. For the syntax of this option, check the
  19650. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19651. Default is @code{1024x512}.
  19652. @item mode
  19653. Set display mode.
  19654. This set how each frequency bin will be represented.
  19655. It accepts the following values:
  19656. @table @samp
  19657. @item line
  19658. @item bar
  19659. @item dot
  19660. @end table
  19661. Default is @code{bar}.
  19662. @item ascale
  19663. Set amplitude scale.
  19664. It accepts the following values:
  19665. @table @samp
  19666. @item lin
  19667. Linear scale.
  19668. @item sqrt
  19669. Square root scale.
  19670. @item cbrt
  19671. Cubic root scale.
  19672. @item log
  19673. Logarithmic scale.
  19674. @end table
  19675. Default is @code{log}.
  19676. @item fscale
  19677. Set frequency scale.
  19678. It accepts the following values:
  19679. @table @samp
  19680. @item lin
  19681. Linear scale.
  19682. @item log
  19683. Logarithmic scale.
  19684. @item rlog
  19685. Reverse logarithmic scale.
  19686. @end table
  19687. Default is @code{lin}.
  19688. @item win_size
  19689. Set window size. Allowed range is from 16 to 65536.
  19690. Default is @code{2048}
  19691. @item win_func
  19692. Set windowing function.
  19693. It accepts the following values:
  19694. @table @samp
  19695. @item rect
  19696. @item bartlett
  19697. @item hanning
  19698. @item hamming
  19699. @item blackman
  19700. @item welch
  19701. @item flattop
  19702. @item bharris
  19703. @item bnuttall
  19704. @item bhann
  19705. @item sine
  19706. @item nuttall
  19707. @item lanczos
  19708. @item gauss
  19709. @item tukey
  19710. @item dolph
  19711. @item cauchy
  19712. @item parzen
  19713. @item poisson
  19714. @item bohman
  19715. @end table
  19716. Default is @code{hanning}.
  19717. @item overlap
  19718. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19719. which means optimal overlap for selected window function will be picked.
  19720. @item averaging
  19721. Set time averaging. Setting this to 0 will display current maximal peaks.
  19722. Default is @code{1}, which means time averaging is disabled.
  19723. @item colors
  19724. Specify list of colors separated by space or by '|' which will be used to
  19725. draw channel frequencies. Unrecognized or missing colors will be replaced
  19726. by white color.
  19727. @item cmode
  19728. Set channel display mode.
  19729. It accepts the following values:
  19730. @table @samp
  19731. @item combined
  19732. @item separate
  19733. @end table
  19734. Default is @code{combined}.
  19735. @item minamp
  19736. Set minimum amplitude used in @code{log} amplitude scaler.
  19737. @item data
  19738. Set data display mode.
  19739. It accepts the following values:
  19740. @table @samp
  19741. @item magnitude
  19742. @item phase
  19743. @item delay
  19744. @end table
  19745. Default is @code{magnitude}.
  19746. @end table
  19747. @section showspatial
  19748. Convert stereo input audio to a video output, representing the spatial relationship
  19749. between two channels.
  19750. The filter accepts the following options:
  19751. @table @option
  19752. @item size, s
  19753. Specify the video size for the output. For the syntax of this option, check the
  19754. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19755. Default value is @code{512x512}.
  19756. @item win_size
  19757. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19758. @item win_func
  19759. Set window function.
  19760. It accepts the following values:
  19761. @table @samp
  19762. @item rect
  19763. @item bartlett
  19764. @item hann
  19765. @item hanning
  19766. @item hamming
  19767. @item blackman
  19768. @item welch
  19769. @item flattop
  19770. @item bharris
  19771. @item bnuttall
  19772. @item bhann
  19773. @item sine
  19774. @item nuttall
  19775. @item lanczos
  19776. @item gauss
  19777. @item tukey
  19778. @item dolph
  19779. @item cauchy
  19780. @item parzen
  19781. @item poisson
  19782. @item bohman
  19783. @end table
  19784. Default value is @code{hann}.
  19785. @item overlap
  19786. Set ratio of overlap window. Default value is @code{0.5}.
  19787. When value is @code{1} overlap is set to recommended size for specific
  19788. window function currently used.
  19789. @end table
  19790. @anchor{showspectrum}
  19791. @section showspectrum
  19792. Convert input audio to a video output, representing the audio frequency
  19793. spectrum.
  19794. The filter accepts the following options:
  19795. @table @option
  19796. @item size, s
  19797. Specify the video size for the output. For the syntax of this option, check the
  19798. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19799. Default value is @code{640x512}.
  19800. @item slide
  19801. Specify how the spectrum should slide along the window.
  19802. It accepts the following values:
  19803. @table @samp
  19804. @item replace
  19805. the samples start again on the left when they reach the right
  19806. @item scroll
  19807. the samples scroll from right to left
  19808. @item fullframe
  19809. frames are only produced when the samples reach the right
  19810. @item rscroll
  19811. the samples scroll from left to right
  19812. @end table
  19813. Default value is @code{replace}.
  19814. @item mode
  19815. Specify display mode.
  19816. It accepts the following values:
  19817. @table @samp
  19818. @item combined
  19819. all channels are displayed in the same row
  19820. @item separate
  19821. all channels are displayed in separate rows
  19822. @end table
  19823. Default value is @samp{combined}.
  19824. @item color
  19825. Specify display color mode.
  19826. It accepts the following values:
  19827. @table @samp
  19828. @item channel
  19829. each channel is displayed in a separate color
  19830. @item intensity
  19831. each channel is displayed using the same color scheme
  19832. @item rainbow
  19833. each channel is displayed using the rainbow color scheme
  19834. @item moreland
  19835. each channel is displayed using the moreland color scheme
  19836. @item nebulae
  19837. each channel is displayed using the nebulae color scheme
  19838. @item fire
  19839. each channel is displayed using the fire color scheme
  19840. @item fiery
  19841. each channel is displayed using the fiery color scheme
  19842. @item fruit
  19843. each channel is displayed using the fruit color scheme
  19844. @item cool
  19845. each channel is displayed using the cool color scheme
  19846. @item magma
  19847. each channel is displayed using the magma color scheme
  19848. @item green
  19849. each channel is displayed using the green color scheme
  19850. @item viridis
  19851. each channel is displayed using the viridis color scheme
  19852. @item plasma
  19853. each channel is displayed using the plasma color scheme
  19854. @item cividis
  19855. each channel is displayed using the cividis color scheme
  19856. @item terrain
  19857. each channel is displayed using the terrain color scheme
  19858. @end table
  19859. Default value is @samp{channel}.
  19860. @item scale
  19861. Specify scale used for calculating intensity color values.
  19862. It accepts the following values:
  19863. @table @samp
  19864. @item lin
  19865. linear
  19866. @item sqrt
  19867. square root, default
  19868. @item cbrt
  19869. cubic root
  19870. @item log
  19871. logarithmic
  19872. @item 4thrt
  19873. 4th root
  19874. @item 5thrt
  19875. 5th root
  19876. @end table
  19877. Default value is @samp{sqrt}.
  19878. @item fscale
  19879. Specify frequency scale.
  19880. It accepts the following values:
  19881. @table @samp
  19882. @item lin
  19883. linear
  19884. @item log
  19885. logarithmic
  19886. @end table
  19887. Default value is @samp{lin}.
  19888. @item saturation
  19889. Set saturation modifier for displayed colors. Negative values provide
  19890. alternative color scheme. @code{0} is no saturation at all.
  19891. Saturation must be in [-10.0, 10.0] range.
  19892. Default value is @code{1}.
  19893. @item win_func
  19894. Set window function.
  19895. It accepts the following values:
  19896. @table @samp
  19897. @item rect
  19898. @item bartlett
  19899. @item hann
  19900. @item hanning
  19901. @item hamming
  19902. @item blackman
  19903. @item welch
  19904. @item flattop
  19905. @item bharris
  19906. @item bnuttall
  19907. @item bhann
  19908. @item sine
  19909. @item nuttall
  19910. @item lanczos
  19911. @item gauss
  19912. @item tukey
  19913. @item dolph
  19914. @item cauchy
  19915. @item parzen
  19916. @item poisson
  19917. @item bohman
  19918. @end table
  19919. Default value is @code{hann}.
  19920. @item orientation
  19921. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19922. @code{horizontal}. Default is @code{vertical}.
  19923. @item overlap
  19924. Set ratio of overlap window. Default value is @code{0}.
  19925. When value is @code{1} overlap is set to recommended size for specific
  19926. window function currently used.
  19927. @item gain
  19928. Set scale gain for calculating intensity color values.
  19929. Default value is @code{1}.
  19930. @item data
  19931. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19932. @item rotation
  19933. Set color rotation, must be in [-1.0, 1.0] range.
  19934. Default value is @code{0}.
  19935. @item start
  19936. Set start frequency from which to display spectrogram. Default is @code{0}.
  19937. @item stop
  19938. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19939. @item fps
  19940. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19941. @item legend
  19942. Draw time and frequency axes and legends. Default is disabled.
  19943. @end table
  19944. The usage is very similar to the showwaves filter; see the examples in that
  19945. section.
  19946. @subsection Examples
  19947. @itemize
  19948. @item
  19949. Large window with logarithmic color scaling:
  19950. @example
  19951. showspectrum=s=1280x480:scale=log
  19952. @end example
  19953. @item
  19954. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19955. @example
  19956. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19957. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19958. @end example
  19959. @end itemize
  19960. @section showspectrumpic
  19961. Convert input audio to a single video frame, representing the audio frequency
  19962. spectrum.
  19963. The filter accepts the following options:
  19964. @table @option
  19965. @item size, s
  19966. Specify the video size for the output. For the syntax of this option, check the
  19967. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19968. Default value is @code{4096x2048}.
  19969. @item mode
  19970. Specify display mode.
  19971. It accepts the following values:
  19972. @table @samp
  19973. @item combined
  19974. all channels are displayed in the same row
  19975. @item separate
  19976. all channels are displayed in separate rows
  19977. @end table
  19978. Default value is @samp{combined}.
  19979. @item color
  19980. Specify display color mode.
  19981. It accepts the following values:
  19982. @table @samp
  19983. @item channel
  19984. each channel is displayed in a separate color
  19985. @item intensity
  19986. each channel is displayed using the same color scheme
  19987. @item rainbow
  19988. each channel is displayed using the rainbow color scheme
  19989. @item moreland
  19990. each channel is displayed using the moreland color scheme
  19991. @item nebulae
  19992. each channel is displayed using the nebulae color scheme
  19993. @item fire
  19994. each channel is displayed using the fire color scheme
  19995. @item fiery
  19996. each channel is displayed using the fiery color scheme
  19997. @item fruit
  19998. each channel is displayed using the fruit color scheme
  19999. @item cool
  20000. each channel is displayed using the cool color scheme
  20001. @item magma
  20002. each channel is displayed using the magma color scheme
  20003. @item green
  20004. each channel is displayed using the green color scheme
  20005. @item viridis
  20006. each channel is displayed using the viridis color scheme
  20007. @item plasma
  20008. each channel is displayed using the plasma color scheme
  20009. @item cividis
  20010. each channel is displayed using the cividis color scheme
  20011. @item terrain
  20012. each channel is displayed using the terrain color scheme
  20013. @end table
  20014. Default value is @samp{intensity}.
  20015. @item scale
  20016. Specify scale used for calculating intensity color values.
  20017. It accepts the following values:
  20018. @table @samp
  20019. @item lin
  20020. linear
  20021. @item sqrt
  20022. square root, default
  20023. @item cbrt
  20024. cubic root
  20025. @item log
  20026. logarithmic
  20027. @item 4thrt
  20028. 4th root
  20029. @item 5thrt
  20030. 5th root
  20031. @end table
  20032. Default value is @samp{log}.
  20033. @item fscale
  20034. Specify frequency scale.
  20035. It accepts the following values:
  20036. @table @samp
  20037. @item lin
  20038. linear
  20039. @item log
  20040. logarithmic
  20041. @end table
  20042. Default value is @samp{lin}.
  20043. @item saturation
  20044. Set saturation modifier for displayed colors. Negative values provide
  20045. alternative color scheme. @code{0} is no saturation at all.
  20046. Saturation must be in [-10.0, 10.0] range.
  20047. Default value is @code{1}.
  20048. @item win_func
  20049. Set window function.
  20050. It accepts the following values:
  20051. @table @samp
  20052. @item rect
  20053. @item bartlett
  20054. @item hann
  20055. @item hanning
  20056. @item hamming
  20057. @item blackman
  20058. @item welch
  20059. @item flattop
  20060. @item bharris
  20061. @item bnuttall
  20062. @item bhann
  20063. @item sine
  20064. @item nuttall
  20065. @item lanczos
  20066. @item gauss
  20067. @item tukey
  20068. @item dolph
  20069. @item cauchy
  20070. @item parzen
  20071. @item poisson
  20072. @item bohman
  20073. @end table
  20074. Default value is @code{hann}.
  20075. @item orientation
  20076. Set orientation of time vs frequency axis. Can be @code{vertical} or
  20077. @code{horizontal}. Default is @code{vertical}.
  20078. @item gain
  20079. Set scale gain for calculating intensity color values.
  20080. Default value is @code{1}.
  20081. @item legend
  20082. Draw time and frequency axes and legends. Default is enabled.
  20083. @item rotation
  20084. Set color rotation, must be in [-1.0, 1.0] range.
  20085. Default value is @code{0}.
  20086. @item start
  20087. Set start frequency from which to display spectrogram. Default is @code{0}.
  20088. @item stop
  20089. Set stop frequency to which to display spectrogram. Default is @code{0}.
  20090. @end table
  20091. @subsection Examples
  20092. @itemize
  20093. @item
  20094. Extract an audio spectrogram of a whole audio track
  20095. in a 1024x1024 picture using @command{ffmpeg}:
  20096. @example
  20097. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  20098. @end example
  20099. @end itemize
  20100. @section showvolume
  20101. Convert input audio volume to a video output.
  20102. The filter accepts the following options:
  20103. @table @option
  20104. @item rate, r
  20105. Set video rate.
  20106. @item b
  20107. Set border width, allowed range is [0, 5]. Default is 1.
  20108. @item w
  20109. Set channel width, allowed range is [80, 8192]. Default is 400.
  20110. @item h
  20111. Set channel height, allowed range is [1, 900]. Default is 20.
  20112. @item f
  20113. Set fade, allowed range is [0, 1]. Default is 0.95.
  20114. @item c
  20115. Set volume color expression.
  20116. The expression can use the following variables:
  20117. @table @option
  20118. @item VOLUME
  20119. Current max volume of channel in dB.
  20120. @item PEAK
  20121. Current peak.
  20122. @item CHANNEL
  20123. Current channel number, starting from 0.
  20124. @end table
  20125. @item t
  20126. If set, displays channel names. Default is enabled.
  20127. @item v
  20128. If set, displays volume values. Default is enabled.
  20129. @item o
  20130. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  20131. default is @code{h}.
  20132. @item s
  20133. Set step size, allowed range is [0, 5]. Default is 0, which means
  20134. step is disabled.
  20135. @item p
  20136. Set background opacity, allowed range is [0, 1]. Default is 0.
  20137. @item m
  20138. Set metering mode, can be peak: @code{p} or rms: @code{r},
  20139. default is @code{p}.
  20140. @item ds
  20141. Set display scale, can be linear: @code{lin} or log: @code{log},
  20142. default is @code{lin}.
  20143. @item dm
  20144. In second.
  20145. If set to > 0., display a line for the max level
  20146. in the previous seconds.
  20147. default is disabled: @code{0.}
  20148. @item dmc
  20149. The color of the max line. Use when @code{dm} option is set to > 0.
  20150. default is: @code{orange}
  20151. @end table
  20152. @section showwaves
  20153. Convert input audio to a video output, representing the samples waves.
  20154. The filter accepts the following options:
  20155. @table @option
  20156. @item size, s
  20157. Specify the video size for the output. For the syntax of this option, check the
  20158. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20159. Default value is @code{600x240}.
  20160. @item mode
  20161. Set display mode.
  20162. Available values are:
  20163. @table @samp
  20164. @item point
  20165. Draw a point for each sample.
  20166. @item line
  20167. Draw a vertical line for each sample.
  20168. @item p2p
  20169. Draw a point for each sample and a line between them.
  20170. @item cline
  20171. Draw a centered vertical line for each sample.
  20172. @end table
  20173. Default value is @code{point}.
  20174. @item n
  20175. Set the number of samples which are printed on the same column. A
  20176. larger value will decrease the frame rate. Must be a positive
  20177. integer. This option can be set only if the value for @var{rate}
  20178. is not explicitly specified.
  20179. @item rate, r
  20180. Set the (approximate) output frame rate. This is done by setting the
  20181. option @var{n}. Default value is "25".
  20182. @item split_channels
  20183. Set if channels should be drawn separately or overlap. Default value is 0.
  20184. @item colors
  20185. Set colors separated by '|' which are going to be used for drawing of each channel.
  20186. @item scale
  20187. Set amplitude scale.
  20188. Available values are:
  20189. @table @samp
  20190. @item lin
  20191. Linear.
  20192. @item log
  20193. Logarithmic.
  20194. @item sqrt
  20195. Square root.
  20196. @item cbrt
  20197. Cubic root.
  20198. @end table
  20199. Default is linear.
  20200. @item draw
  20201. Set the draw mode. This is mostly useful to set for high @var{n}.
  20202. Available values are:
  20203. @table @samp
  20204. @item scale
  20205. Scale pixel values for each drawn sample.
  20206. @item full
  20207. Draw every sample directly.
  20208. @end table
  20209. Default value is @code{scale}.
  20210. @end table
  20211. @subsection Examples
  20212. @itemize
  20213. @item
  20214. Output the input file audio and the corresponding video representation
  20215. at the same time:
  20216. @example
  20217. amovie=a.mp3,asplit[out0],showwaves[out1]
  20218. @end example
  20219. @item
  20220. Create a synthetic signal and show it with showwaves, forcing a
  20221. frame rate of 30 frames per second:
  20222. @example
  20223. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  20224. @end example
  20225. @end itemize
  20226. @section showwavespic
  20227. Convert input audio to a single video frame, representing the samples waves.
  20228. The filter accepts the following options:
  20229. @table @option
  20230. @item size, s
  20231. Specify the video size for the output. For the syntax of this option, check the
  20232. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20233. Default value is @code{600x240}.
  20234. @item split_channels
  20235. Set if channels should be drawn separately or overlap. Default value is 0.
  20236. @item colors
  20237. Set colors separated by '|' which are going to be used for drawing of each channel.
  20238. @item scale
  20239. Set amplitude scale.
  20240. Available values are:
  20241. @table @samp
  20242. @item lin
  20243. Linear.
  20244. @item log
  20245. Logarithmic.
  20246. @item sqrt
  20247. Square root.
  20248. @item cbrt
  20249. Cubic root.
  20250. @end table
  20251. Default is linear.
  20252. @item draw
  20253. Set the draw mode.
  20254. Available values are:
  20255. @table @samp
  20256. @item scale
  20257. Scale pixel values for each drawn sample.
  20258. @item full
  20259. Draw every sample directly.
  20260. @end table
  20261. Default value is @code{scale}.
  20262. @item filter
  20263. Set the filter mode.
  20264. Available values are:
  20265. @table @samp
  20266. @item average
  20267. Use average samples values for each drawn sample.
  20268. @item peak
  20269. Use peak samples values for each drawn sample.
  20270. @end table
  20271. Default value is @code{average}.
  20272. @end table
  20273. @subsection Examples
  20274. @itemize
  20275. @item
  20276. Extract a channel split representation of the wave form of a whole audio track
  20277. in a 1024x800 picture using @command{ffmpeg}:
  20278. @example
  20279. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  20280. @end example
  20281. @end itemize
  20282. @section sidedata, asidedata
  20283. Delete frame side data, or select frames based on it.
  20284. This filter accepts the following options:
  20285. @table @option
  20286. @item mode
  20287. Set mode of operation of the filter.
  20288. Can be one of the following:
  20289. @table @samp
  20290. @item select
  20291. Select every frame with side data of @code{type}.
  20292. @item delete
  20293. Delete side data of @code{type}. If @code{type} is not set, delete all side
  20294. data in the frame.
  20295. @end table
  20296. @item type
  20297. Set side data type used with all modes. Must be set for @code{select} mode. For
  20298. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  20299. in @file{libavutil/frame.h}. For example, to choose
  20300. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  20301. @end table
  20302. @section spectrumsynth
  20303. Synthesize audio from 2 input video spectrums, first input stream represents
  20304. magnitude across time and second represents phase across time.
  20305. The filter will transform from frequency domain as displayed in videos back
  20306. to time domain as presented in audio output.
  20307. This filter is primarily created for reversing processed @ref{showspectrum}
  20308. filter outputs, but can synthesize sound from other spectrograms too.
  20309. But in such case results are going to be poor if the phase data is not
  20310. available, because in such cases phase data need to be recreated, usually
  20311. it's just recreated from random noise.
  20312. For best results use gray only output (@code{channel} color mode in
  20313. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  20314. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  20315. @code{data} option. Inputs videos should generally use @code{fullframe}
  20316. slide mode as that saves resources needed for decoding video.
  20317. The filter accepts the following options:
  20318. @table @option
  20319. @item sample_rate
  20320. Specify sample rate of output audio, the sample rate of audio from which
  20321. spectrum was generated may differ.
  20322. @item channels
  20323. Set number of channels represented in input video spectrums.
  20324. @item scale
  20325. Set scale which was used when generating magnitude input spectrum.
  20326. Can be @code{lin} or @code{log}. Default is @code{log}.
  20327. @item slide
  20328. Set slide which was used when generating inputs spectrums.
  20329. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  20330. Default is @code{fullframe}.
  20331. @item win_func
  20332. Set window function used for resynthesis.
  20333. @item overlap
  20334. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  20335. which means optimal overlap for selected window function will be picked.
  20336. @item orientation
  20337. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  20338. Default is @code{vertical}.
  20339. @end table
  20340. @subsection Examples
  20341. @itemize
  20342. @item
  20343. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  20344. then resynthesize videos back to audio with spectrumsynth:
  20345. @example
  20346. 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
  20347. 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
  20348. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  20349. @end example
  20350. @end itemize
  20351. @section split, asplit
  20352. Split input into several identical outputs.
  20353. @code{asplit} works with audio input, @code{split} with video.
  20354. The filter accepts a single parameter which specifies the number of outputs. If
  20355. unspecified, it defaults to 2.
  20356. @subsection Examples
  20357. @itemize
  20358. @item
  20359. Create two separate outputs from the same input:
  20360. @example
  20361. [in] split [out0][out1]
  20362. @end example
  20363. @item
  20364. To create 3 or more outputs, you need to specify the number of
  20365. outputs, like in:
  20366. @example
  20367. [in] asplit=3 [out0][out1][out2]
  20368. @end example
  20369. @item
  20370. Create two separate outputs from the same input, one cropped and
  20371. one padded:
  20372. @example
  20373. [in] split [splitout1][splitout2];
  20374. [splitout1] crop=100:100:0:0 [cropout];
  20375. [splitout2] pad=200:200:100:100 [padout];
  20376. @end example
  20377. @item
  20378. Create 5 copies of the input audio with @command{ffmpeg}:
  20379. @example
  20380. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  20381. @end example
  20382. @end itemize
  20383. @section zmq, azmq
  20384. Receive commands sent through a libzmq client, and forward them to
  20385. filters in the filtergraph.
  20386. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  20387. must be inserted between two video filters, @code{azmq} between two
  20388. audio filters. Both are capable to send messages to any filter type.
  20389. To enable these filters you need to install the libzmq library and
  20390. headers and configure FFmpeg with @code{--enable-libzmq}.
  20391. For more information about libzmq see:
  20392. @url{http://www.zeromq.org/}
  20393. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  20394. receives messages sent through a network interface defined by the
  20395. @option{bind_address} (or the abbreviation "@option{b}") option.
  20396. Default value of this option is @file{tcp://localhost:5555}. You may
  20397. want to alter this value to your needs, but do not forget to escape any
  20398. ':' signs (see @ref{filtergraph escaping}).
  20399. The received message must be in the form:
  20400. @example
  20401. @var{TARGET} @var{COMMAND} [@var{ARG}]
  20402. @end example
  20403. @var{TARGET} specifies the target of the command, usually the name of
  20404. the filter class or a specific filter instance name. The default
  20405. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  20406. but you can override this by using the @samp{filter_name@@id} syntax
  20407. (see @ref{Filtergraph syntax}).
  20408. @var{COMMAND} specifies the name of the command for the target filter.
  20409. @var{ARG} is optional and specifies the optional argument list for the
  20410. given @var{COMMAND}.
  20411. Upon reception, the message is processed and the corresponding command
  20412. is injected into the filtergraph. Depending on the result, the filter
  20413. will send a reply to the client, adopting the format:
  20414. @example
  20415. @var{ERROR_CODE} @var{ERROR_REASON}
  20416. @var{MESSAGE}
  20417. @end example
  20418. @var{MESSAGE} is optional.
  20419. @subsection Examples
  20420. Look at @file{tools/zmqsend} for an example of a zmq client which can
  20421. be used to send commands processed by these filters.
  20422. Consider the following filtergraph generated by @command{ffplay}.
  20423. In this example the last overlay filter has an instance name. All other
  20424. filters will have default instance names.
  20425. @example
  20426. ffplay -dumpgraph 1 -f lavfi "
  20427. color=s=100x100:c=red [l];
  20428. color=s=100x100:c=blue [r];
  20429. nullsrc=s=200x100, zmq [bg];
  20430. [bg][l] overlay [bg+l];
  20431. [bg+l][r] overlay@@my=x=100 "
  20432. @end example
  20433. To change the color of the left side of the video, the following
  20434. command can be used:
  20435. @example
  20436. echo Parsed_color_0 c yellow | tools/zmqsend
  20437. @end example
  20438. To change the right side:
  20439. @example
  20440. echo Parsed_color_1 c pink | tools/zmqsend
  20441. @end example
  20442. To change the position of the right side:
  20443. @example
  20444. echo overlay@@my x 150 | tools/zmqsend
  20445. @end example
  20446. @c man end MULTIMEDIA FILTERS
  20447. @chapter Multimedia Sources
  20448. @c man begin MULTIMEDIA SOURCES
  20449. Below is a description of the currently available multimedia sources.
  20450. @section amovie
  20451. This is the same as @ref{movie} source, except it selects an audio
  20452. stream by default.
  20453. @anchor{movie}
  20454. @section movie
  20455. Read audio and/or video stream(s) from a movie container.
  20456. It accepts the following parameters:
  20457. @table @option
  20458. @item filename
  20459. The name of the resource to read (not necessarily a file; it can also be a
  20460. device or a stream accessed through some protocol).
  20461. @item format_name, f
  20462. Specifies the format assumed for the movie to read, and can be either
  20463. the name of a container or an input device. If not specified, the
  20464. format is guessed from @var{movie_name} or by probing.
  20465. @item seek_point, sp
  20466. Specifies the seek point in seconds. The frames will be output
  20467. starting from this seek point. The parameter is evaluated with
  20468. @code{av_strtod}, so the numerical value may be suffixed by an IS
  20469. postfix. The default value is "0".
  20470. @item streams, s
  20471. Specifies the streams to read. Several streams can be specified,
  20472. separated by "+". The source will then have as many outputs, in the
  20473. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  20474. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  20475. respectively the default (best suited) video and audio stream. Default
  20476. is "dv", or "da" if the filter is called as "amovie".
  20477. @item stream_index, si
  20478. Specifies the index of the video stream to read. If the value is -1,
  20479. the most suitable video stream will be automatically selected. The default
  20480. value is "-1". Deprecated. If the filter is called "amovie", it will select
  20481. audio instead of video.
  20482. @item loop
  20483. Specifies how many times to read the stream in sequence.
  20484. If the value is 0, the stream will be looped infinitely.
  20485. Default value is "1".
  20486. Note that when the movie is looped the source timestamps are not
  20487. changed, so it will generate non monotonically increasing timestamps.
  20488. @item discontinuity
  20489. Specifies the time difference between frames above which the point is
  20490. considered a timestamp discontinuity which is removed by adjusting the later
  20491. timestamps.
  20492. @end table
  20493. It allows overlaying a second video on top of the main input of
  20494. a filtergraph, as shown in this graph:
  20495. @example
  20496. input -----------> deltapts0 --> overlay --> output
  20497. ^
  20498. |
  20499. movie --> scale--> deltapts1 -------+
  20500. @end example
  20501. @subsection Examples
  20502. @itemize
  20503. @item
  20504. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  20505. on top of the input labelled "in":
  20506. @example
  20507. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20508. [in] setpts=PTS-STARTPTS [main];
  20509. [main][over] overlay=16:16 [out]
  20510. @end example
  20511. @item
  20512. Read from a video4linux2 device, and overlay it on top of the input
  20513. labelled "in":
  20514. @example
  20515. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20516. [in] setpts=PTS-STARTPTS [main];
  20517. [main][over] overlay=16:16 [out]
  20518. @end example
  20519. @item
  20520. Read the first video stream and the audio stream with id 0x81 from
  20521. dvd.vob; the video is connected to the pad named "video" and the audio is
  20522. connected to the pad named "audio":
  20523. @example
  20524. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  20525. @end example
  20526. @end itemize
  20527. @subsection Commands
  20528. Both movie and amovie support the following commands:
  20529. @table @option
  20530. @item seek
  20531. Perform seek using "av_seek_frame".
  20532. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  20533. @itemize
  20534. @item
  20535. @var{stream_index}: If stream_index is -1, a default
  20536. stream is selected, and @var{timestamp} is automatically converted
  20537. from AV_TIME_BASE units to the stream specific time_base.
  20538. @item
  20539. @var{timestamp}: Timestamp in AVStream.time_base units
  20540. or, if no stream is specified, in AV_TIME_BASE units.
  20541. @item
  20542. @var{flags}: Flags which select direction and seeking mode.
  20543. @end itemize
  20544. @item get_duration
  20545. Get movie duration in AV_TIME_BASE units.
  20546. @end table
  20547. @c man end MULTIMEDIA SOURCES