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.

24747 lines
659KB

  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. @section acontrast
  356. Simple audio dynamic range compression/expansion filter.
  357. The filter accepts the following options:
  358. @table @option
  359. @item contrast
  360. Set contrast. Default is 33. Allowed range is between 0 and 100.
  361. @end table
  362. @section acopy
  363. Copy the input audio source unchanged to the output. This is mainly useful for
  364. testing purposes.
  365. @section acrossfade
  366. Apply cross fade from one input audio stream to another input audio stream.
  367. The cross fade is applied for specified duration near the end of first stream.
  368. The filter accepts the following options:
  369. @table @option
  370. @item nb_samples, ns
  371. Specify the number of samples for which the cross fade effect has to last.
  372. At the end of the cross fade effect the first input audio will be completely
  373. silent. Default is 44100.
  374. @item duration, d
  375. Specify the duration of the cross fade effect. See
  376. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  377. for the accepted syntax.
  378. By default the duration is determined by @var{nb_samples}.
  379. If set this option is used instead of @var{nb_samples}.
  380. @item overlap, o
  381. Should first stream end overlap with second stream start. Default is enabled.
  382. @item curve1
  383. Set curve for cross fade transition for first stream.
  384. @item curve2
  385. Set curve for cross fade transition for second stream.
  386. For description of available curve types see @ref{afade} filter description.
  387. @end table
  388. @subsection Examples
  389. @itemize
  390. @item
  391. Cross fade from one input to another:
  392. @example
  393. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  394. @end example
  395. @item
  396. Cross fade from one input to another but without overlapping:
  397. @example
  398. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  399. @end example
  400. @end itemize
  401. @section acrossover
  402. Split audio stream into several bands.
  403. This filter splits audio stream into two or more frequency ranges.
  404. Summing all streams back will give flat output.
  405. The filter accepts the following options:
  406. @table @option
  407. @item split
  408. Set split frequencies. Those must be positive and increasing.
  409. @item order
  410. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  411. Default is @var{4th}.
  412. @end table
  413. @section acrusher
  414. Reduce audio bit resolution.
  415. This filter is bit crusher with enhanced functionality. A bit crusher
  416. is used to audibly reduce number of bits an audio signal is sampled
  417. with. This doesn't change the bit depth at all, it just produces the
  418. effect. Material reduced in bit depth sounds more harsh and "digital".
  419. This filter is able to even round to continuous values instead of discrete
  420. bit depths.
  421. Additionally it has a D/C offset which results in different crushing of
  422. the lower and the upper half of the signal.
  423. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  424. Another feature of this filter is the logarithmic mode.
  425. This setting switches from linear distances between bits to logarithmic ones.
  426. The result is a much more "natural" sounding crusher which doesn't gate low
  427. signals for example. The human ear has a logarithmic perception,
  428. so this kind of crushing is much more pleasant.
  429. Logarithmic crushing is also able to get anti-aliased.
  430. The filter accepts the following options:
  431. @table @option
  432. @item level_in
  433. Set level in.
  434. @item level_out
  435. Set level out.
  436. @item bits
  437. Set bit reduction.
  438. @item mix
  439. Set mixing amount.
  440. @item mode
  441. Can be linear: @code{lin} or logarithmic: @code{log}.
  442. @item dc
  443. Set DC.
  444. @item aa
  445. Set anti-aliasing.
  446. @item samples
  447. Set sample reduction.
  448. @item lfo
  449. Enable LFO. By default disabled.
  450. @item lforange
  451. Set LFO range.
  452. @item lforate
  453. Set LFO rate.
  454. @end table
  455. @section acue
  456. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  457. filter.
  458. @section adeclick
  459. Remove impulsive noise from input audio.
  460. Samples detected as impulsive noise are replaced by interpolated samples using
  461. autoregressive modelling.
  462. @table @option
  463. @item w
  464. Set window size, in milliseconds. Allowed range is from @code{10} to
  465. @code{100}. Default value is @code{55} milliseconds.
  466. This sets size of window which will be processed at once.
  467. @item o
  468. Set window overlap, in percentage of window size. Allowed range is from
  469. @code{50} to @code{95}. Default value is @code{75} percent.
  470. Setting this to a very high value increases impulsive noise removal but makes
  471. whole process much slower.
  472. @item a
  473. Set autoregression order, in percentage of window size. Allowed range is from
  474. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  475. controls quality of interpolated samples using neighbour good samples.
  476. @item t
  477. Set threshold value. Allowed range is from @code{1} to @code{100}.
  478. Default value is @code{2}.
  479. This controls the strength of impulsive noise which is going to be removed.
  480. The lower value, the more samples will be detected as impulsive noise.
  481. @item b
  482. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  483. @code{10}. Default value is @code{2}.
  484. If any two samples detected as noise are spaced less than this value then any
  485. sample between those two samples will be also detected as noise.
  486. @item m
  487. Set overlap method.
  488. It accepts the following values:
  489. @table @option
  490. @item a
  491. Select overlap-add method. Even not interpolated samples are slightly
  492. changed with this method.
  493. @item s
  494. Select overlap-save method. Not interpolated samples remain unchanged.
  495. @end table
  496. Default value is @code{a}.
  497. @end table
  498. @section adeclip
  499. Remove clipped samples from input audio.
  500. Samples detected as clipped are replaced by interpolated samples using
  501. autoregressive modelling.
  502. @table @option
  503. @item w
  504. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  505. Default value is @code{55} milliseconds.
  506. This sets size of window which will be processed at once.
  507. @item o
  508. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  509. to @code{95}. Default value is @code{75} percent.
  510. @item a
  511. Set autoregression order, in percentage of window size. Allowed range is from
  512. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  513. quality of interpolated samples using neighbour good samples.
  514. @item t
  515. Set threshold value. Allowed range is from @code{1} to @code{100}.
  516. Default value is @code{10}. Higher values make clip detection less aggressive.
  517. @item n
  518. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  519. Default value is @code{1000}. Higher values make clip detection less aggressive.
  520. @item m
  521. Set overlap method.
  522. It accepts the following values:
  523. @table @option
  524. @item a
  525. Select overlap-add method. Even not interpolated samples are slightly changed
  526. with this method.
  527. @item s
  528. Select overlap-save method. Not interpolated samples remain unchanged.
  529. @end table
  530. Default value is @code{a}.
  531. @end table
  532. @section adelay
  533. Delay one or more audio channels.
  534. Samples in delayed channel are filled with silence.
  535. The filter accepts the following option:
  536. @table @option
  537. @item delays
  538. Set list of delays in milliseconds for each channel separated by '|'.
  539. Unused delays will be silently ignored. If number of given delays is
  540. smaller than number of channels all remaining channels will not be delayed.
  541. If you want to delay exact number of samples, append 'S' to number.
  542. If you want instead to delay in seconds, append 's' to number.
  543. @item all
  544. Use last set delay for all remaining channels. By default is disabled.
  545. This option if enabled changes how option @code{delays} is interpreted.
  546. @end table
  547. @subsection Examples
  548. @itemize
  549. @item
  550. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  551. the second channel (and any other channels that may be present) unchanged.
  552. @example
  553. adelay=1500|0|500
  554. @end example
  555. @item
  556. Delay second channel by 500 samples, the third channel by 700 samples and leave
  557. the first channel (and any other channels that may be present) unchanged.
  558. @example
  559. adelay=0|500S|700S
  560. @end example
  561. @item
  562. Delay all channels by same number of samples:
  563. @example
  564. adelay=delays=64S:all=1
  565. @end example
  566. @end itemize
  567. @section aderivative, aintegral
  568. Compute derivative/integral of audio stream.
  569. Applying both filters one after another produces original audio.
  570. @section aecho
  571. Apply echoing to the input audio.
  572. Echoes are reflected sound and can occur naturally amongst mountains
  573. (and sometimes large buildings) when talking or shouting; digital echo
  574. effects emulate this behaviour and are often used to help fill out the
  575. sound of a single instrument or vocal. The time difference between the
  576. original signal and the reflection is the @code{delay}, and the
  577. loudness of the reflected signal is the @code{decay}.
  578. Multiple echoes can have different delays and decays.
  579. A description of the accepted parameters follows.
  580. @table @option
  581. @item in_gain
  582. Set input gain of reflected signal. Default is @code{0.6}.
  583. @item out_gain
  584. Set output gain of reflected signal. Default is @code{0.3}.
  585. @item delays
  586. Set list of time intervals in milliseconds between original signal and reflections
  587. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  588. Default is @code{1000}.
  589. @item decays
  590. Set list of loudness of reflected signals separated by '|'.
  591. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  592. Default is @code{0.5}.
  593. @end table
  594. @subsection Examples
  595. @itemize
  596. @item
  597. Make it sound as if there are twice as many instruments as are actually playing:
  598. @example
  599. aecho=0.8:0.88:60:0.4
  600. @end example
  601. @item
  602. If delay is very short, then it sounds like a (metallic) robot playing music:
  603. @example
  604. aecho=0.8:0.88:6:0.4
  605. @end example
  606. @item
  607. A longer delay will sound like an open air concert in the mountains:
  608. @example
  609. aecho=0.8:0.9:1000:0.3
  610. @end example
  611. @item
  612. Same as above but with one more mountain:
  613. @example
  614. aecho=0.8:0.9:1000|1800:0.3|0.25
  615. @end example
  616. @end itemize
  617. @section aemphasis
  618. Audio emphasis filter creates or restores material directly taken from LPs or
  619. emphased CDs with different filter curves. E.g. to store music on vinyl the
  620. signal has to be altered by a filter first to even out the disadvantages of
  621. this recording medium.
  622. Once the material is played back the inverse filter has to be applied to
  623. restore the distortion of the frequency response.
  624. The filter accepts the following options:
  625. @table @option
  626. @item level_in
  627. Set input gain.
  628. @item level_out
  629. Set output gain.
  630. @item mode
  631. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  632. use @code{production} mode. Default is @code{reproduction} mode.
  633. @item type
  634. Set filter type. Selects medium. Can be one of the following:
  635. @table @option
  636. @item col
  637. select Columbia.
  638. @item emi
  639. select EMI.
  640. @item bsi
  641. select BSI (78RPM).
  642. @item riaa
  643. select RIAA.
  644. @item cd
  645. select Compact Disc (CD).
  646. @item 50fm
  647. select 50µs (FM).
  648. @item 75fm
  649. select 75µs (FM).
  650. @item 50kf
  651. select 50µs (FM-KF).
  652. @item 75kf
  653. select 75µs (FM-KF).
  654. @end table
  655. @end table
  656. @section aeval
  657. Modify an audio signal according to the specified expressions.
  658. This filter accepts one or more expressions (one for each channel),
  659. which are evaluated and used to modify a corresponding audio signal.
  660. It accepts the following parameters:
  661. @table @option
  662. @item exprs
  663. Set the '|'-separated expressions list for each separate channel. If
  664. the number of input channels is greater than the number of
  665. expressions, the last specified expression is used for the remaining
  666. output channels.
  667. @item channel_layout, c
  668. Set output channel layout. If not specified, the channel layout is
  669. specified by the number of expressions. If set to @samp{same}, it will
  670. use by default the same input channel layout.
  671. @end table
  672. Each expression in @var{exprs} can contain the following constants and functions:
  673. @table @option
  674. @item ch
  675. channel number of the current expression
  676. @item n
  677. number of the evaluated sample, starting from 0
  678. @item s
  679. sample rate
  680. @item t
  681. time of the evaluated sample expressed in seconds
  682. @item nb_in_channels
  683. @item nb_out_channels
  684. input and output number of channels
  685. @item val(CH)
  686. the value of input channel with number @var{CH}
  687. @end table
  688. Note: this filter is slow. For faster processing you should use a
  689. dedicated filter.
  690. @subsection Examples
  691. @itemize
  692. @item
  693. Half volume:
  694. @example
  695. aeval=val(ch)/2:c=same
  696. @end example
  697. @item
  698. Invert phase of the second channel:
  699. @example
  700. aeval=val(0)|-val(1)
  701. @end example
  702. @end itemize
  703. @anchor{afade}
  704. @section afade
  705. Apply fade-in/out effect to input audio.
  706. A description of the accepted parameters follows.
  707. @table @option
  708. @item type, t
  709. Specify the effect type, can be either @code{in} for fade-in, or
  710. @code{out} for a fade-out effect. Default is @code{in}.
  711. @item start_sample, ss
  712. Specify the number of the start sample for starting to apply the fade
  713. effect. Default is 0.
  714. @item nb_samples, ns
  715. Specify the number of samples for which the fade effect has to last. At
  716. the end of the fade-in effect the output audio will have the same
  717. volume as the input audio, at the end of the fade-out transition
  718. the output audio will be silence. Default is 44100.
  719. @item start_time, st
  720. Specify the start time of the fade effect. Default is 0.
  721. The value must be specified as a time duration; see
  722. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  723. for the accepted syntax.
  724. If set this option is used instead of @var{start_sample}.
  725. @item duration, d
  726. Specify the duration of the fade effect. See
  727. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  728. for the accepted syntax.
  729. At the end of the fade-in effect the output audio will have the same
  730. volume as the input audio, at the end of the fade-out transition
  731. the output audio will be silence.
  732. By default the duration is determined by @var{nb_samples}.
  733. If set this option is used instead of @var{nb_samples}.
  734. @item curve
  735. Set curve for fade transition.
  736. It accepts the following values:
  737. @table @option
  738. @item tri
  739. select triangular, linear slope (default)
  740. @item qsin
  741. select quarter of sine wave
  742. @item hsin
  743. select half of sine wave
  744. @item esin
  745. select exponential sine wave
  746. @item log
  747. select logarithmic
  748. @item ipar
  749. select inverted parabola
  750. @item qua
  751. select quadratic
  752. @item cub
  753. select cubic
  754. @item squ
  755. select square root
  756. @item cbr
  757. select cubic root
  758. @item par
  759. select parabola
  760. @item exp
  761. select exponential
  762. @item iqsin
  763. select inverted quarter of sine wave
  764. @item ihsin
  765. select inverted half of sine wave
  766. @item dese
  767. select double-exponential seat
  768. @item desi
  769. select double-exponential sigmoid
  770. @item losi
  771. select logistic sigmoid
  772. @item nofade
  773. no fade applied
  774. @end table
  775. @end table
  776. @subsection Examples
  777. @itemize
  778. @item
  779. Fade in first 15 seconds of audio:
  780. @example
  781. afade=t=in:ss=0:d=15
  782. @end example
  783. @item
  784. Fade out last 25 seconds of a 900 seconds audio:
  785. @example
  786. afade=t=out:st=875:d=25
  787. @end example
  788. @end itemize
  789. @section afftdn
  790. Denoise audio samples with FFT.
  791. A description of the accepted parameters follows.
  792. @table @option
  793. @item nr
  794. Set the noise reduction in dB, allowed range is 0.01 to 97.
  795. Default value is 12 dB.
  796. @item nf
  797. Set the noise floor in dB, allowed range is -80 to -20.
  798. Default value is -50 dB.
  799. @item nt
  800. Set the noise type.
  801. It accepts the following values:
  802. @table @option
  803. @item w
  804. Select white noise.
  805. @item v
  806. Select vinyl noise.
  807. @item s
  808. Select shellac noise.
  809. @item c
  810. Select custom noise, defined in @code{bn} option.
  811. Default value is white noise.
  812. @end table
  813. @item bn
  814. Set custom band noise for every one of 15 bands.
  815. Bands are separated by ' ' or '|'.
  816. @item rf
  817. Set the residual floor in dB, allowed range is -80 to -20.
  818. Default value is -38 dB.
  819. @item tn
  820. Enable noise tracking. By default is disabled.
  821. With this enabled, noise floor is automatically adjusted.
  822. @item tr
  823. Enable residual tracking. By default is disabled.
  824. @item om
  825. Set the output mode.
  826. It accepts the following values:
  827. @table @option
  828. @item i
  829. Pass input unchanged.
  830. @item o
  831. Pass noise filtered out.
  832. @item n
  833. Pass only noise.
  834. Default value is @var{o}.
  835. @end table
  836. @end table
  837. @subsection Commands
  838. This filter supports the following commands:
  839. @table @option
  840. @item sample_noise, sn
  841. Start or stop measuring noise profile.
  842. Syntax for the command is : "start" or "stop" string.
  843. After measuring noise profile is stopped it will be
  844. automatically applied in filtering.
  845. @item noise_reduction, nr
  846. Change noise reduction. Argument is single float number.
  847. Syntax for the command is : "@var{noise_reduction}"
  848. @item noise_floor, nf
  849. Change noise floor. Argument is single float number.
  850. Syntax for the command is : "@var{noise_floor}"
  851. @item output_mode, om
  852. Change output mode operation.
  853. Syntax for the command is : "i", "o" or "n" string.
  854. @end table
  855. @section afftfilt
  856. Apply arbitrary expressions to samples in frequency domain.
  857. @table @option
  858. @item real
  859. Set frequency domain real expression for each separate channel separated
  860. by '|'. Default is "re".
  861. If the number of input channels is greater than the number of
  862. expressions, the last specified expression is used for the remaining
  863. output channels.
  864. @item imag
  865. Set frequency domain imaginary expression for each separate channel
  866. separated by '|'. Default is "im".
  867. Each expression in @var{real} and @var{imag} can contain the following
  868. constants and functions:
  869. @table @option
  870. @item sr
  871. sample rate
  872. @item b
  873. current frequency bin number
  874. @item nb
  875. number of available bins
  876. @item ch
  877. channel number of the current expression
  878. @item chs
  879. number of channels
  880. @item pts
  881. current frame pts
  882. @item re
  883. current real part of frequency bin of current channel
  884. @item im
  885. current imaginary part of frequency bin of current channel
  886. @item real(b, ch)
  887. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  888. @item imag(b, ch)
  889. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  890. @end table
  891. @item win_size
  892. Set window size. Allowed range is from 16 to 131072.
  893. Default is @code{4096}
  894. @item win_func
  895. Set window function. Default is @code{hann}.
  896. @item overlap
  897. Set window overlap. If set to 1, the recommended overlap for selected
  898. window function will be picked. Default is @code{0.75}.
  899. @end table
  900. @subsection Examples
  901. @itemize
  902. @item
  903. Leave almost only low frequencies in audio:
  904. @example
  905. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  906. @end example
  907. @item
  908. Apply robotize effect:
  909. @example
  910. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  911. @end example
  912. @item
  913. Apply whisper effect:
  914. @example
  915. 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"
  916. @end example
  917. @end itemize
  918. @anchor{afir}
  919. @section afir
  920. Apply an arbitrary Frequency Impulse Response filter.
  921. This filter is designed for applying long FIR filters,
  922. up to 60 seconds long.
  923. It can be used as component for digital crossover filters,
  924. room equalization, cross talk cancellation, wavefield synthesis,
  925. auralization, ambiophonics, ambisonics and spatialization.
  926. This filter uses the second stream as FIR coefficients.
  927. If the second stream holds a single channel, it will be used
  928. for all input channels in the first stream, otherwise
  929. the number of channels in the second stream must be same as
  930. the number of channels in the first stream.
  931. It accepts the following parameters:
  932. @table @option
  933. @item dry
  934. Set dry gain. This sets input gain.
  935. @item wet
  936. Set wet gain. This sets final output gain.
  937. @item length
  938. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  939. @item gtype
  940. Enable applying gain measured from power of IR.
  941. Set which approach to use for auto gain measurement.
  942. @table @option
  943. @item none
  944. Do not apply any gain.
  945. @item peak
  946. select peak gain, very conservative approach. This is default value.
  947. @item dc
  948. select DC gain, limited application.
  949. @item gn
  950. select gain to noise approach, this is most popular one.
  951. @end table
  952. @item irgain
  953. Set gain to be applied to IR coefficients before filtering.
  954. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  955. @item irfmt
  956. Set format of IR stream. Can be @code{mono} or @code{input}.
  957. Default is @code{input}.
  958. @item maxir
  959. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  960. Allowed range is 0.1 to 60 seconds.
  961. @item response
  962. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  963. By default it is disabled.
  964. @item channel
  965. Set for which IR channel to display frequency response. By default is first channel
  966. displayed. This option is used only when @var{response} is enabled.
  967. @item size
  968. Set video stream size. This option is used only when @var{response} is enabled.
  969. @item rate
  970. Set video stream frame rate. This option is used only when @var{response} is enabled.
  971. @item minp
  972. Set minimal partition size used for convolution. Default is @var{8192}.
  973. Allowed range is from @var{8} to @var{32768}.
  974. Lower values decreases latency at cost of higher CPU usage.
  975. @item maxp
  976. Set maximal partition size used for convolution. Default is @var{8192}.
  977. Allowed range is from @var{8} to @var{32768}.
  978. Lower values may increase CPU usage.
  979. @end table
  980. @subsection Examples
  981. @itemize
  982. @item
  983. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  984. @example
  985. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  986. @end example
  987. @end itemize
  988. @anchor{aformat}
  989. @section aformat
  990. Set output format constraints for the input audio. The framework will
  991. negotiate the most appropriate format to minimize conversions.
  992. It accepts the following parameters:
  993. @table @option
  994. @item sample_fmts
  995. A '|'-separated list of requested sample formats.
  996. @item sample_rates
  997. A '|'-separated list of requested sample rates.
  998. @item channel_layouts
  999. A '|'-separated list of requested channel layouts.
  1000. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1001. for the required syntax.
  1002. @end table
  1003. If a parameter is omitted, all values are allowed.
  1004. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1005. @example
  1006. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1007. @end example
  1008. @section agate
  1009. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1010. processing reduces disturbing noise between useful signals.
  1011. Gating is done by detecting the volume below a chosen level @var{threshold}
  1012. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1013. floor is set via @var{range}. Because an exact manipulation of the signal
  1014. would cause distortion of the waveform the reduction can be levelled over
  1015. time. This is done by setting @var{attack} and @var{release}.
  1016. @var{attack} determines how long the signal has to fall below the threshold
  1017. before any reduction will occur and @var{release} sets the time the signal
  1018. has to rise above the threshold to reduce the reduction again.
  1019. Shorter signals than the chosen attack time will be left untouched.
  1020. @table @option
  1021. @item level_in
  1022. Set input level before filtering.
  1023. Default is 1. Allowed range is from 0.015625 to 64.
  1024. @item mode
  1025. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1026. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1027. will be amplified, expanding dynamic range in upward direction.
  1028. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1029. @item range
  1030. Set the level of gain reduction when the signal is below the threshold.
  1031. Default is 0.06125. Allowed range is from 0 to 1.
  1032. Setting this to 0 disables reduction and then filter behaves like expander.
  1033. @item threshold
  1034. If a signal rises above this level the gain reduction is released.
  1035. Default is 0.125. Allowed range is from 0 to 1.
  1036. @item ratio
  1037. Set a ratio by which the signal is reduced.
  1038. Default is 2. Allowed range is from 1 to 9000.
  1039. @item attack
  1040. Amount of milliseconds the signal has to rise above the threshold before gain
  1041. reduction stops.
  1042. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1043. @item release
  1044. Amount of milliseconds the signal has to fall below the threshold before the
  1045. reduction is increased again. Default is 250 milliseconds.
  1046. Allowed range is from 0.01 to 9000.
  1047. @item makeup
  1048. Set amount of amplification of signal after processing.
  1049. Default is 1. Allowed range is from 1 to 64.
  1050. @item knee
  1051. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1052. Default is 2.828427125. Allowed range is from 1 to 8.
  1053. @item detection
  1054. Choose if exact signal should be taken for detection or an RMS like one.
  1055. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1056. @item link
  1057. Choose if the average level between all channels or the louder channel affects
  1058. the reduction.
  1059. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1060. @end table
  1061. @section aiir
  1062. Apply an arbitrary Infinite Impulse Response filter.
  1063. It accepts the following parameters:
  1064. @table @option
  1065. @item z
  1066. Set numerator/zeros coefficients.
  1067. @item p
  1068. Set denominator/poles coefficients.
  1069. @item k
  1070. Set channels gains.
  1071. @item dry_gain
  1072. Set input gain.
  1073. @item wet_gain
  1074. Set output gain.
  1075. @item f
  1076. Set coefficients format.
  1077. @table @samp
  1078. @item tf
  1079. transfer function
  1080. @item zp
  1081. Z-plane zeros/poles, cartesian (default)
  1082. @item pr
  1083. Z-plane zeros/poles, polar radians
  1084. @item pd
  1085. Z-plane zeros/poles, polar degrees
  1086. @end table
  1087. @item r
  1088. Set kind of processing.
  1089. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1090. @item e
  1091. Set filtering precision.
  1092. @table @samp
  1093. @item dbl
  1094. double-precision floating-point (default)
  1095. @item flt
  1096. single-precision floating-point
  1097. @item i32
  1098. 32-bit integers
  1099. @item i16
  1100. 16-bit integers
  1101. @end table
  1102. @item mix
  1103. How much to use filtered signal in output. Default is 1.
  1104. Range is between 0 and 1.
  1105. @item response
  1106. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1107. By default it is disabled.
  1108. @item channel
  1109. Set for which IR channel to display frequency response. By default is first channel
  1110. displayed. This option is used only when @var{response} is enabled.
  1111. @item size
  1112. Set video stream size. This option is used only when @var{response} is enabled.
  1113. @end table
  1114. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1115. order.
  1116. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1117. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1118. imaginary unit.
  1119. Different coefficients and gains can be provided for every channel, in such case
  1120. use '|' to separate coefficients or gains. Last provided coefficients will be
  1121. used for all remaining channels.
  1122. @subsection Examples
  1123. @itemize
  1124. @item
  1125. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1126. @example
  1127. 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
  1128. @end example
  1129. @item
  1130. Same as above but in @code{zp} format:
  1131. @example
  1132. 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
  1133. @end example
  1134. @end itemize
  1135. @section alimiter
  1136. The limiter prevents an input signal from rising over a desired threshold.
  1137. This limiter uses lookahead technology to prevent your signal from distorting.
  1138. It means that there is a small delay after the signal is processed. Keep in mind
  1139. that the delay it produces is the attack time you set.
  1140. The filter accepts the following options:
  1141. @table @option
  1142. @item level_in
  1143. Set input gain. Default is 1.
  1144. @item level_out
  1145. Set output gain. Default is 1.
  1146. @item limit
  1147. Don't let signals above this level pass the limiter. Default is 1.
  1148. @item attack
  1149. The limiter will reach its attenuation level in this amount of time in
  1150. milliseconds. Default is 5 milliseconds.
  1151. @item release
  1152. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1153. Default is 50 milliseconds.
  1154. @item asc
  1155. When gain reduction is always needed ASC takes care of releasing to an
  1156. average reduction level rather than reaching a reduction of 0 in the release
  1157. time.
  1158. @item asc_level
  1159. Select how much the release time is affected by ASC, 0 means nearly no changes
  1160. in release time while 1 produces higher release times.
  1161. @item level
  1162. Auto level output signal. Default is enabled.
  1163. This normalizes audio back to 0dB if enabled.
  1164. @end table
  1165. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1166. with @ref{aresample} before applying this filter.
  1167. @section allpass
  1168. Apply a two-pole all-pass filter with central frequency (in Hz)
  1169. @var{frequency}, and filter-width @var{width}.
  1170. An all-pass filter changes the audio's frequency to phase relationship
  1171. without changing its frequency to amplitude relationship.
  1172. The filter accepts the following options:
  1173. @table @option
  1174. @item frequency, f
  1175. Set frequency in Hz.
  1176. @item width_type, t
  1177. Set method to specify band-width of filter.
  1178. @table @option
  1179. @item h
  1180. Hz
  1181. @item q
  1182. Q-Factor
  1183. @item o
  1184. octave
  1185. @item s
  1186. slope
  1187. @item k
  1188. kHz
  1189. @end table
  1190. @item width, w
  1191. Specify the band-width of a filter in width_type units.
  1192. @item mix, m
  1193. How much to use filtered signal in output. Default is 1.
  1194. Range is between 0 and 1.
  1195. @item channels, c
  1196. Specify which channels to filter, by default all available are filtered.
  1197. @item normalize, n
  1198. Normalize biquad coefficients, by default is disabled.
  1199. Enabling it will normalize magnitude response at DC to 0dB.
  1200. @end table
  1201. @subsection Commands
  1202. This filter supports the following commands:
  1203. @table @option
  1204. @item frequency, f
  1205. Change allpass frequency.
  1206. Syntax for the command is : "@var{frequency}"
  1207. @item width_type, t
  1208. Change allpass width_type.
  1209. Syntax for the command is : "@var{width_type}"
  1210. @item width, w
  1211. Change allpass width.
  1212. Syntax for the command is : "@var{width}"
  1213. @item mix, m
  1214. Change allpass mix.
  1215. Syntax for the command is : "@var{mix}"
  1216. @end table
  1217. @section aloop
  1218. Loop audio samples.
  1219. The filter accepts the following options:
  1220. @table @option
  1221. @item loop
  1222. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1223. Default is 0.
  1224. @item size
  1225. Set maximal number of samples. Default is 0.
  1226. @item start
  1227. Set first sample of loop. Default is 0.
  1228. @end table
  1229. @anchor{amerge}
  1230. @section amerge
  1231. Merge two or more audio streams into a single multi-channel stream.
  1232. The filter accepts the following options:
  1233. @table @option
  1234. @item inputs
  1235. Set the number of inputs. Default is 2.
  1236. @end table
  1237. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1238. the channel layout of the output will be set accordingly and the channels
  1239. will be reordered as necessary. If the channel layouts of the inputs are not
  1240. disjoint, the output will have all the channels of the first input then all
  1241. the channels of the second input, in that order, and the channel layout of
  1242. the output will be the default value corresponding to the total number of
  1243. channels.
  1244. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1245. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1246. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1247. first input, b1 is the first channel of the second input).
  1248. On the other hand, if both input are in stereo, the output channels will be
  1249. in the default order: a1, a2, b1, b2, and the channel layout will be
  1250. arbitrarily set to 4.0, which may or may not be the expected value.
  1251. All inputs must have the same sample rate, and format.
  1252. If inputs do not have the same duration, the output will stop with the
  1253. shortest.
  1254. @subsection Examples
  1255. @itemize
  1256. @item
  1257. Merge two mono files into a stereo stream:
  1258. @example
  1259. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1260. @end example
  1261. @item
  1262. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1263. @example
  1264. 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
  1265. @end example
  1266. @end itemize
  1267. @section amix
  1268. Mixes multiple audio inputs into a single output.
  1269. Note that this filter only supports float samples (the @var{amerge}
  1270. and @var{pan} audio filters support many formats). If the @var{amix}
  1271. input has integer samples then @ref{aresample} will be automatically
  1272. inserted to perform the conversion to float samples.
  1273. For example
  1274. @example
  1275. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1276. @end example
  1277. will mix 3 input audio streams to a single output with the same duration as the
  1278. first input and a dropout transition time of 3 seconds.
  1279. It accepts the following parameters:
  1280. @table @option
  1281. @item inputs
  1282. The number of inputs. If unspecified, it defaults to 2.
  1283. @item duration
  1284. How to determine the end-of-stream.
  1285. @table @option
  1286. @item longest
  1287. The duration of the longest input. (default)
  1288. @item shortest
  1289. The duration of the shortest input.
  1290. @item first
  1291. The duration of the first input.
  1292. @end table
  1293. @item dropout_transition
  1294. The transition time, in seconds, for volume renormalization when an input
  1295. stream ends. The default value is 2 seconds.
  1296. @item weights
  1297. Specify weight of each input audio stream as sequence.
  1298. Each weight is separated by space. By default all inputs have same weight.
  1299. @end table
  1300. @section amultiply
  1301. Multiply first audio stream with second audio stream and store result
  1302. in output audio stream. Multiplication is done by multiplying each
  1303. sample from first stream with sample at same position from second stream.
  1304. With this element-wise multiplication one can create amplitude fades and
  1305. amplitude modulations.
  1306. @section anequalizer
  1307. High-order parametric multiband equalizer for each channel.
  1308. It accepts the following parameters:
  1309. @table @option
  1310. @item params
  1311. This option string is in format:
  1312. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1313. Each equalizer band is separated by '|'.
  1314. @table @option
  1315. @item chn
  1316. Set channel number to which equalization will be applied.
  1317. If input doesn't have that channel the entry is ignored.
  1318. @item f
  1319. Set central frequency for band.
  1320. If input doesn't have that frequency the entry is ignored.
  1321. @item w
  1322. Set band width in hertz.
  1323. @item g
  1324. Set band gain in dB.
  1325. @item t
  1326. Set filter type for band, optional, can be:
  1327. @table @samp
  1328. @item 0
  1329. Butterworth, this is default.
  1330. @item 1
  1331. Chebyshev type 1.
  1332. @item 2
  1333. Chebyshev type 2.
  1334. @end table
  1335. @end table
  1336. @item curves
  1337. With this option activated frequency response of anequalizer is displayed
  1338. in video stream.
  1339. @item size
  1340. Set video stream size. Only useful if curves option is activated.
  1341. @item mgain
  1342. Set max gain that will be displayed. Only useful if curves option is activated.
  1343. Setting this to a reasonable value makes it possible to display gain which is derived from
  1344. neighbour bands which are too close to each other and thus produce higher gain
  1345. when both are activated.
  1346. @item fscale
  1347. Set frequency scale used to draw frequency response in video output.
  1348. Can be linear or logarithmic. Default is logarithmic.
  1349. @item colors
  1350. Set color for each channel curve which is going to be displayed in video stream.
  1351. This is list of color names separated by space or by '|'.
  1352. Unrecognised or missing colors will be replaced by white color.
  1353. @end table
  1354. @subsection Examples
  1355. @itemize
  1356. @item
  1357. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1358. for first 2 channels using Chebyshev type 1 filter:
  1359. @example
  1360. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1361. @end example
  1362. @end itemize
  1363. @subsection Commands
  1364. This filter supports the following commands:
  1365. @table @option
  1366. @item change
  1367. Alter existing filter parameters.
  1368. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1369. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1370. error is returned.
  1371. @var{freq} set new frequency parameter.
  1372. @var{width} set new width parameter in herz.
  1373. @var{gain} set new gain parameter in dB.
  1374. Full filter invocation with asendcmd may look like this:
  1375. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1376. @end table
  1377. @section anlmdn
  1378. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1379. Each sample is adjusted by looking for other samples with similar contexts. This
  1380. context similarity is defined by comparing their surrounding patches of size
  1381. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1382. The filter accepts the following options:
  1383. @table @option
  1384. @item s
  1385. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1386. @item p
  1387. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1388. Default value is 2 milliseconds.
  1389. @item r
  1390. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1391. Default value is 6 milliseconds.
  1392. @item o
  1393. Set the output mode.
  1394. It accepts the following values:
  1395. @table @option
  1396. @item i
  1397. Pass input unchanged.
  1398. @item o
  1399. Pass noise filtered out.
  1400. @item n
  1401. Pass only noise.
  1402. Default value is @var{o}.
  1403. @end table
  1404. @item m
  1405. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1406. @end table
  1407. @subsection Commands
  1408. This filter supports the following commands:
  1409. @table @option
  1410. @item s
  1411. Change denoise strength. Argument is single float number.
  1412. Syntax for the command is : "@var{s}"
  1413. @item o
  1414. Change output mode.
  1415. Syntax for the command is : "i", "o" or "n" string.
  1416. @end table
  1417. @section anlms
  1418. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1419. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1420. relate to producing the least mean square of the error signal (difference between the desired,
  1421. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1422. A description of the accepted options follows.
  1423. @table @option
  1424. @item order
  1425. Set filter order.
  1426. @item mu
  1427. Set filter mu.
  1428. @item eps
  1429. Set the filter eps.
  1430. @item leakage
  1431. Set the filter leakage.
  1432. @item out_mode
  1433. It accepts the following values:
  1434. @table @option
  1435. @item i
  1436. Pass the 1st input.
  1437. @item d
  1438. Pass the 2nd input.
  1439. @item o
  1440. Pass filtered samples.
  1441. @item n
  1442. Pass difference between desired and filtered samples.
  1443. Default value is @var{o}.
  1444. @end table
  1445. @end table
  1446. @subsection Examples
  1447. @itemize
  1448. @item
  1449. One of many usages of this filter is noise reduction, input audio is filtered
  1450. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1451. @example
  1452. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1453. @end example
  1454. @end itemize
  1455. @subsection Commands
  1456. This filter supports the same commands as options, excluding option @code{order}.
  1457. @section anull
  1458. Pass the audio source unchanged to the output.
  1459. @section apad
  1460. Pad the end of an audio stream with silence.
  1461. This can be used together with @command{ffmpeg} @option{-shortest} to
  1462. extend audio streams to the same length as the video stream.
  1463. A description of the accepted options follows.
  1464. @table @option
  1465. @item packet_size
  1466. Set silence packet size. Default value is 4096.
  1467. @item pad_len
  1468. Set the number of samples of silence to add to the end. After the
  1469. value is reached, the stream is terminated. This option is mutually
  1470. exclusive with @option{whole_len}.
  1471. @item whole_len
  1472. Set the minimum total number of samples in the output audio stream. If
  1473. the value is longer than the input audio length, silence is added to
  1474. the end, until the value is reached. This option is mutually exclusive
  1475. with @option{pad_len}.
  1476. @item pad_dur
  1477. Specify the duration of samples of silence to add. See
  1478. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1479. for the accepted syntax. Used only if set to non-zero value.
  1480. @item whole_dur
  1481. Specify the minimum total duration in the output audio stream. See
  1482. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1483. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1484. the input audio length, silence is added to the end, until the value is reached.
  1485. This option is mutually exclusive with @option{pad_dur}
  1486. @end table
  1487. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1488. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1489. the input stream indefinitely.
  1490. @subsection Examples
  1491. @itemize
  1492. @item
  1493. Add 1024 samples of silence to the end of the input:
  1494. @example
  1495. apad=pad_len=1024
  1496. @end example
  1497. @item
  1498. Make sure the audio output will contain at least 10000 samples, pad
  1499. the input with silence if required:
  1500. @example
  1501. apad=whole_len=10000
  1502. @end example
  1503. @item
  1504. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1505. video stream will always result the shortest and will be converted
  1506. until the end in the output file when using the @option{shortest}
  1507. option:
  1508. @example
  1509. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1510. @end example
  1511. @end itemize
  1512. @section aphaser
  1513. Add a phasing effect to the input audio.
  1514. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1515. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1516. A description of the accepted parameters follows.
  1517. @table @option
  1518. @item in_gain
  1519. Set input gain. Default is 0.4.
  1520. @item out_gain
  1521. Set output gain. Default is 0.74
  1522. @item delay
  1523. Set delay in milliseconds. Default is 3.0.
  1524. @item decay
  1525. Set decay. Default is 0.4.
  1526. @item speed
  1527. Set modulation speed in Hz. Default is 0.5.
  1528. @item type
  1529. Set modulation type. Default is triangular.
  1530. It accepts the following values:
  1531. @table @samp
  1532. @item triangular, t
  1533. @item sinusoidal, s
  1534. @end table
  1535. @end table
  1536. @section apulsator
  1537. Audio pulsator is something between an autopanner and a tremolo.
  1538. But it can produce funny stereo effects as well. Pulsator changes the volume
  1539. of the left and right channel based on a LFO (low frequency oscillator) with
  1540. different waveforms and shifted phases.
  1541. This filter have the ability to define an offset between left and right
  1542. channel. An offset of 0 means that both LFO shapes match each other.
  1543. The left and right channel are altered equally - a conventional tremolo.
  1544. An offset of 50% means that the shape of the right channel is exactly shifted
  1545. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1546. an autopanner. At 1 both curves match again. Every setting in between moves the
  1547. phase shift gapless between all stages and produces some "bypassing" sounds with
  1548. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1549. the 0.5) the faster the signal passes from the left to the right speaker.
  1550. The filter accepts the following options:
  1551. @table @option
  1552. @item level_in
  1553. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1554. @item level_out
  1555. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1556. @item mode
  1557. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1558. sawup or sawdown. Default is sine.
  1559. @item amount
  1560. Set modulation. Define how much of original signal is affected by the LFO.
  1561. @item offset_l
  1562. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1563. @item offset_r
  1564. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1565. @item width
  1566. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1567. @item timing
  1568. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1569. @item bpm
  1570. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1571. is set to bpm.
  1572. @item ms
  1573. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1574. is set to ms.
  1575. @item hz
  1576. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1577. if timing is set to hz.
  1578. @end table
  1579. @anchor{aresample}
  1580. @section aresample
  1581. Resample the input audio to the specified parameters, using the
  1582. libswresample library. If none are specified then the filter will
  1583. automatically convert between its input and output.
  1584. This filter is also able to stretch/squeeze the audio data to make it match
  1585. the timestamps or to inject silence / cut out audio to make it match the
  1586. timestamps, do a combination of both or do neither.
  1587. The filter accepts the syntax
  1588. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1589. expresses a sample rate and @var{resampler_options} is a list of
  1590. @var{key}=@var{value} pairs, separated by ":". See the
  1591. @ref{Resampler Options,,"Resampler Options" section in the
  1592. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1593. for the complete list of supported options.
  1594. @subsection Examples
  1595. @itemize
  1596. @item
  1597. Resample the input audio to 44100Hz:
  1598. @example
  1599. aresample=44100
  1600. @end example
  1601. @item
  1602. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1603. samples per second compensation:
  1604. @example
  1605. aresample=async=1000
  1606. @end example
  1607. @end itemize
  1608. @section areverse
  1609. Reverse an audio clip.
  1610. Warning: This filter requires memory to buffer the entire clip, so trimming
  1611. is suggested.
  1612. @subsection Examples
  1613. @itemize
  1614. @item
  1615. Take the first 5 seconds of a clip, and reverse it.
  1616. @example
  1617. atrim=end=5,areverse
  1618. @end example
  1619. @end itemize
  1620. @section arnndn
  1621. Reduce noise from speech using Recurrent Neural Networks.
  1622. This filter accepts the following options:
  1623. @table @option
  1624. @item model, m
  1625. Set train model file to load. This option is always required.
  1626. @end table
  1627. @section asetnsamples
  1628. Set the number of samples per each output audio frame.
  1629. The last output packet may contain a different number of samples, as
  1630. the filter will flush all the remaining samples when the input audio
  1631. signals its end.
  1632. The filter accepts the following options:
  1633. @table @option
  1634. @item nb_out_samples, n
  1635. Set the number of frames per each output audio frame. The number is
  1636. intended as the number of samples @emph{per each channel}.
  1637. Default value is 1024.
  1638. @item pad, p
  1639. If set to 1, the filter will pad the last audio frame with zeroes, so
  1640. that the last frame will contain the same number of samples as the
  1641. previous ones. Default value is 1.
  1642. @end table
  1643. For example, to set the number of per-frame samples to 1234 and
  1644. disable padding for the last frame, use:
  1645. @example
  1646. asetnsamples=n=1234:p=0
  1647. @end example
  1648. @section asetrate
  1649. Set the sample rate without altering the PCM data.
  1650. This will result in a change of speed and pitch.
  1651. The filter accepts the following options:
  1652. @table @option
  1653. @item sample_rate, r
  1654. Set the output sample rate. Default is 44100 Hz.
  1655. @end table
  1656. @section ashowinfo
  1657. Show a line containing various information for each input audio frame.
  1658. The input audio is not modified.
  1659. The shown line contains a sequence of key/value pairs of the form
  1660. @var{key}:@var{value}.
  1661. The following values are shown in the output:
  1662. @table @option
  1663. @item n
  1664. The (sequential) number of the input frame, starting from 0.
  1665. @item pts
  1666. The presentation timestamp of the input frame, in time base units; the time base
  1667. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1668. @item pts_time
  1669. The presentation timestamp of the input frame in seconds.
  1670. @item pos
  1671. position of the frame in the input stream, -1 if this information in
  1672. unavailable and/or meaningless (for example in case of synthetic audio)
  1673. @item fmt
  1674. The sample format.
  1675. @item chlayout
  1676. The channel layout.
  1677. @item rate
  1678. The sample rate for the audio frame.
  1679. @item nb_samples
  1680. The number of samples (per channel) in the frame.
  1681. @item checksum
  1682. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1683. audio, the data is treated as if all the planes were concatenated.
  1684. @item plane_checksums
  1685. A list of Adler-32 checksums for each data plane.
  1686. @end table
  1687. @section asoftclip
  1688. Apply audio soft clipping.
  1689. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1690. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1691. This filter accepts the following options:
  1692. @table @option
  1693. @item type
  1694. Set type of soft-clipping.
  1695. It accepts the following values:
  1696. @table @option
  1697. @item tanh
  1698. @item atan
  1699. @item cubic
  1700. @item exp
  1701. @item alg
  1702. @item quintic
  1703. @item sin
  1704. @end table
  1705. @item param
  1706. Set additional parameter which controls sigmoid function.
  1707. @end table
  1708. @section asr
  1709. Automatic Speech Recognition
  1710. This filter uses PocketSphinx for speech recognition. To enable
  1711. compilation of this filter, you need to configure FFmpeg with
  1712. @code{--enable-pocketsphinx}.
  1713. It accepts the following options:
  1714. @table @option
  1715. @item rate
  1716. Set sampling rate of input audio. Defaults is @code{16000}.
  1717. This need to match speech models, otherwise one will get poor results.
  1718. @item hmm
  1719. Set dictionary containing acoustic model files.
  1720. @item dict
  1721. Set pronunciation dictionary.
  1722. @item lm
  1723. Set language model file.
  1724. @item lmctl
  1725. Set language model set.
  1726. @item lmname
  1727. Set which language model to use.
  1728. @item logfn
  1729. Set output for log messages.
  1730. @end table
  1731. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1732. @anchor{astats}
  1733. @section astats
  1734. Display time domain statistical information about the audio channels.
  1735. Statistics are calculated and displayed for each audio channel and,
  1736. where applicable, an overall figure is also given.
  1737. It accepts the following option:
  1738. @table @option
  1739. @item length
  1740. Short window length in seconds, used for peak and trough RMS measurement.
  1741. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1742. @item metadata
  1743. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1744. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1745. disabled.
  1746. Available keys for each channel are:
  1747. DC_offset
  1748. Min_level
  1749. Max_level
  1750. Min_difference
  1751. Max_difference
  1752. Mean_difference
  1753. RMS_difference
  1754. Peak_level
  1755. RMS_peak
  1756. RMS_trough
  1757. Crest_factor
  1758. Flat_factor
  1759. Peak_count
  1760. Bit_depth
  1761. Dynamic_range
  1762. Zero_crossings
  1763. Zero_crossings_rate
  1764. Number_of_NaNs
  1765. Number_of_Infs
  1766. Number_of_denormals
  1767. and for Overall:
  1768. DC_offset
  1769. Min_level
  1770. Max_level
  1771. Min_difference
  1772. Max_difference
  1773. Mean_difference
  1774. RMS_difference
  1775. Peak_level
  1776. RMS_level
  1777. RMS_peak
  1778. RMS_trough
  1779. Flat_factor
  1780. Peak_count
  1781. Bit_depth
  1782. Number_of_samples
  1783. Number_of_NaNs
  1784. Number_of_Infs
  1785. Number_of_denormals
  1786. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1787. this @code{lavfi.astats.Overall.Peak_count}.
  1788. For description what each key means read below.
  1789. @item reset
  1790. Set number of frame after which stats are going to be recalculated.
  1791. Default is disabled.
  1792. @item measure_perchannel
  1793. Select the entries which need to be measured per channel. The metadata keys can
  1794. be used as flags, default is @option{all} which measures everything.
  1795. @option{none} disables all per channel measurement.
  1796. @item measure_overall
  1797. Select the entries which need to be measured overall. The metadata keys can
  1798. be used as flags, default is @option{all} which measures everything.
  1799. @option{none} disables all overall measurement.
  1800. @end table
  1801. A description of each shown parameter follows:
  1802. @table @option
  1803. @item DC offset
  1804. Mean amplitude displacement from zero.
  1805. @item Min level
  1806. Minimal sample level.
  1807. @item Max level
  1808. Maximal sample level.
  1809. @item Min difference
  1810. Minimal difference between two consecutive samples.
  1811. @item Max difference
  1812. Maximal difference between two consecutive samples.
  1813. @item Mean difference
  1814. Mean difference between two consecutive samples.
  1815. The average of each difference between two consecutive samples.
  1816. @item RMS difference
  1817. Root Mean Square difference between two consecutive samples.
  1818. @item Peak level dB
  1819. @item RMS level dB
  1820. Standard peak and RMS level measured in dBFS.
  1821. @item RMS peak dB
  1822. @item RMS trough dB
  1823. Peak and trough values for RMS level measured over a short window.
  1824. @item Crest factor
  1825. Standard ratio of peak to RMS level (note: not in dB).
  1826. @item Flat factor
  1827. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1828. (i.e. either @var{Min level} or @var{Max level}).
  1829. @item Peak count
  1830. Number of occasions (not the number of samples) that the signal attained either
  1831. @var{Min level} or @var{Max level}.
  1832. @item Bit depth
  1833. Overall bit depth of audio. Number of bits used for each sample.
  1834. @item Dynamic range
  1835. Measured dynamic range of audio in dB.
  1836. @item Zero crossings
  1837. Number of points where the waveform crosses the zero level axis.
  1838. @item Zero crossings rate
  1839. Rate of Zero crossings and number of audio samples.
  1840. @end table
  1841. @section atempo
  1842. Adjust audio tempo.
  1843. The filter accepts exactly one parameter, the audio tempo. If not
  1844. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1845. be in the [0.5, 100.0] range.
  1846. Note that tempo greater than 2 will skip some samples rather than
  1847. blend them in. If for any reason this is a concern it is always
  1848. possible to daisy-chain several instances of atempo to achieve the
  1849. desired product tempo.
  1850. @subsection Examples
  1851. @itemize
  1852. @item
  1853. Slow down audio to 80% tempo:
  1854. @example
  1855. atempo=0.8
  1856. @end example
  1857. @item
  1858. To speed up audio to 300% tempo:
  1859. @example
  1860. atempo=3
  1861. @end example
  1862. @item
  1863. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1864. @example
  1865. atempo=sqrt(3),atempo=sqrt(3)
  1866. @end example
  1867. @end itemize
  1868. @subsection Commands
  1869. This filter supports the following commands:
  1870. @table @option
  1871. @item tempo
  1872. Change filter tempo scale factor.
  1873. Syntax for the command is : "@var{tempo}"
  1874. @end table
  1875. @section atrim
  1876. Trim the input so that the output contains one continuous subpart of the input.
  1877. It accepts the following parameters:
  1878. @table @option
  1879. @item start
  1880. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1881. sample with the timestamp @var{start} will be the first sample in the output.
  1882. @item end
  1883. Specify time of the first audio sample that will be dropped, i.e. the
  1884. audio sample immediately preceding the one with the timestamp @var{end} will be
  1885. the last sample in the output.
  1886. @item start_pts
  1887. Same as @var{start}, except this option sets the start timestamp in samples
  1888. instead of seconds.
  1889. @item end_pts
  1890. Same as @var{end}, except this option sets the end timestamp in samples instead
  1891. of seconds.
  1892. @item duration
  1893. The maximum duration of the output in seconds.
  1894. @item start_sample
  1895. The number of the first sample that should be output.
  1896. @item end_sample
  1897. The number of the first sample that should be dropped.
  1898. @end table
  1899. @option{start}, @option{end}, and @option{duration} are expressed as time
  1900. duration specifications; see
  1901. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1902. Note that the first two sets of the start/end options and the @option{duration}
  1903. option look at the frame timestamp, while the _sample options simply count the
  1904. samples that pass through the filter. So start/end_pts and start/end_sample will
  1905. give different results when the timestamps are wrong, inexact or do not start at
  1906. zero. Also note that this filter does not modify the timestamps. If you wish
  1907. to have the output timestamps start at zero, insert the asetpts filter after the
  1908. atrim filter.
  1909. If multiple start or end options are set, this filter tries to be greedy and
  1910. keep all samples that match at least one of the specified constraints. To keep
  1911. only the part that matches all the constraints at once, chain multiple atrim
  1912. filters.
  1913. The defaults are such that all the input is kept. So it is possible to set e.g.
  1914. just the end values to keep everything before the specified time.
  1915. Examples:
  1916. @itemize
  1917. @item
  1918. Drop everything except the second minute of input:
  1919. @example
  1920. ffmpeg -i INPUT -af atrim=60:120
  1921. @end example
  1922. @item
  1923. Keep only the first 1000 samples:
  1924. @example
  1925. ffmpeg -i INPUT -af atrim=end_sample=1000
  1926. @end example
  1927. @end itemize
  1928. @section axcorrelate
  1929. Calculate normalized cross-correlation between two input audio streams.
  1930. Resulted samples are always between -1 and 1 inclusive.
  1931. If result is 1 it means two input samples are highly correlated in that selected segment.
  1932. Result 0 means they are not correlated at all.
  1933. If result is -1 it means two input samples are out of phase, which means they cancel each
  1934. other.
  1935. The filter accepts the following options:
  1936. @table @option
  1937. @item size
  1938. Set size of segment over which cross-correlation is calculated.
  1939. Default is 256. Allowed range is from 2 to 131072.
  1940. @item algo
  1941. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  1942. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  1943. are always zero and thus need much less calculations to make.
  1944. This is generally not true, but is valid for typical audio streams.
  1945. @end table
  1946. @subsection Examples
  1947. @itemize
  1948. @item
  1949. Calculate correlation between channels in stereo audio stream:
  1950. @example
  1951. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  1952. @end example
  1953. @end itemize
  1954. @section bandpass
  1955. Apply a two-pole Butterworth band-pass filter with central
  1956. frequency @var{frequency}, and (3dB-point) band-width width.
  1957. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1958. instead of the default: constant 0dB peak gain.
  1959. The filter roll off at 6dB per octave (20dB per decade).
  1960. The filter accepts the following options:
  1961. @table @option
  1962. @item frequency, f
  1963. Set the filter's central frequency. Default is @code{3000}.
  1964. @item csg
  1965. Constant skirt gain if set to 1. Defaults to 0.
  1966. @item width_type, t
  1967. Set method to specify band-width of filter.
  1968. @table @option
  1969. @item h
  1970. Hz
  1971. @item q
  1972. Q-Factor
  1973. @item o
  1974. octave
  1975. @item s
  1976. slope
  1977. @item k
  1978. kHz
  1979. @end table
  1980. @item width, w
  1981. Specify the band-width of a filter in width_type units.
  1982. @item mix, m
  1983. How much to use filtered signal in output. Default is 1.
  1984. Range is between 0 and 1.
  1985. @item channels, c
  1986. Specify which channels to filter, by default all available are filtered.
  1987. @item normalize, n
  1988. Normalize biquad coefficients, by default is disabled.
  1989. Enabling it will normalize magnitude response at DC to 0dB.
  1990. @end table
  1991. @subsection Commands
  1992. This filter supports the following commands:
  1993. @table @option
  1994. @item frequency, f
  1995. Change bandpass frequency.
  1996. Syntax for the command is : "@var{frequency}"
  1997. @item width_type, t
  1998. Change bandpass width_type.
  1999. Syntax for the command is : "@var{width_type}"
  2000. @item width, w
  2001. Change bandpass width.
  2002. Syntax for the command is : "@var{width}"
  2003. @item mix, m
  2004. Change bandpass mix.
  2005. Syntax for the command is : "@var{mix}"
  2006. @end table
  2007. @section bandreject
  2008. Apply a two-pole Butterworth band-reject filter with central
  2009. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2010. The filter roll off at 6dB per octave (20dB per decade).
  2011. The filter accepts the following options:
  2012. @table @option
  2013. @item frequency, f
  2014. Set the filter's central frequency. Default is @code{3000}.
  2015. @item width_type, t
  2016. Set method to specify band-width of filter.
  2017. @table @option
  2018. @item h
  2019. Hz
  2020. @item q
  2021. Q-Factor
  2022. @item o
  2023. octave
  2024. @item s
  2025. slope
  2026. @item k
  2027. kHz
  2028. @end table
  2029. @item width, w
  2030. Specify the band-width of a filter in width_type units.
  2031. @item mix, m
  2032. How much to use filtered signal in output. Default is 1.
  2033. Range is between 0 and 1.
  2034. @item channels, c
  2035. Specify which channels to filter, by default all available are filtered.
  2036. @item normalize, n
  2037. Normalize biquad coefficients, by default is disabled.
  2038. Enabling it will normalize magnitude response at DC to 0dB.
  2039. @end table
  2040. @subsection Commands
  2041. This filter supports the following commands:
  2042. @table @option
  2043. @item frequency, f
  2044. Change bandreject frequency.
  2045. Syntax for the command is : "@var{frequency}"
  2046. @item width_type, t
  2047. Change bandreject width_type.
  2048. Syntax for the command is : "@var{width_type}"
  2049. @item width, w
  2050. Change bandreject width.
  2051. Syntax for the command is : "@var{width}"
  2052. @item mix, m
  2053. Change bandreject mix.
  2054. Syntax for the command is : "@var{mix}"
  2055. @end table
  2056. @section bass, lowshelf
  2057. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2058. shelving filter with a response similar to that of a standard
  2059. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2060. The filter accepts the following options:
  2061. @table @option
  2062. @item gain, g
  2063. Give the gain at 0 Hz. Its useful range is about -20
  2064. (for a large cut) to +20 (for a large boost).
  2065. Beware of clipping when using a positive gain.
  2066. @item frequency, f
  2067. Set the filter's central frequency and so can be used
  2068. to extend or reduce the frequency range to be boosted or cut.
  2069. The default value is @code{100} Hz.
  2070. @item width_type, t
  2071. Set method to specify band-width of filter.
  2072. @table @option
  2073. @item h
  2074. Hz
  2075. @item q
  2076. Q-Factor
  2077. @item o
  2078. octave
  2079. @item s
  2080. slope
  2081. @item k
  2082. kHz
  2083. @end table
  2084. @item width, w
  2085. Determine how steep is the filter's shelf transition.
  2086. @item mix, m
  2087. How much to use filtered signal in output. Default is 1.
  2088. Range is between 0 and 1.
  2089. @item channels, c
  2090. Specify which channels to filter, by default all available are filtered.
  2091. @item normalize, n
  2092. Normalize biquad coefficients, by default is disabled.
  2093. Enabling it will normalize magnitude response at DC to 0dB.
  2094. @end table
  2095. @subsection Commands
  2096. This filter supports the following commands:
  2097. @table @option
  2098. @item frequency, f
  2099. Change bass frequency.
  2100. Syntax for the command is : "@var{frequency}"
  2101. @item width_type, t
  2102. Change bass width_type.
  2103. Syntax for the command is : "@var{width_type}"
  2104. @item width, w
  2105. Change bass width.
  2106. Syntax for the command is : "@var{width}"
  2107. @item gain, g
  2108. Change bass gain.
  2109. Syntax for the command is : "@var{gain}"
  2110. @item mix, m
  2111. Change bass mix.
  2112. Syntax for the command is : "@var{mix}"
  2113. @end table
  2114. @section biquad
  2115. Apply a biquad IIR filter with the given coefficients.
  2116. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2117. are the numerator and denominator coefficients respectively.
  2118. and @var{channels}, @var{c} specify which channels to filter, by default all
  2119. available are filtered.
  2120. @subsection Commands
  2121. This filter supports the following commands:
  2122. @table @option
  2123. @item a0
  2124. @item a1
  2125. @item a2
  2126. @item b0
  2127. @item b1
  2128. @item b2
  2129. Change biquad parameter.
  2130. Syntax for the command is : "@var{value}"
  2131. @item mix, m
  2132. How much to use filtered signal in output. Default is 1.
  2133. Range is between 0 and 1.
  2134. @item channels, c
  2135. Specify which channels to filter, by default all available are filtered.
  2136. @item normalize, n
  2137. Normalize biquad coefficients, by default is disabled.
  2138. Enabling it will normalize magnitude response at DC to 0dB.
  2139. @end table
  2140. @section bs2b
  2141. Bauer stereo to binaural transformation, which improves headphone listening of
  2142. stereo audio records.
  2143. To enable compilation of this filter you need to configure FFmpeg with
  2144. @code{--enable-libbs2b}.
  2145. It accepts the following parameters:
  2146. @table @option
  2147. @item profile
  2148. Pre-defined crossfeed level.
  2149. @table @option
  2150. @item default
  2151. Default level (fcut=700, feed=50).
  2152. @item cmoy
  2153. Chu Moy circuit (fcut=700, feed=60).
  2154. @item jmeier
  2155. Jan Meier circuit (fcut=650, feed=95).
  2156. @end table
  2157. @item fcut
  2158. Cut frequency (in Hz).
  2159. @item feed
  2160. Feed level (in Hz).
  2161. @end table
  2162. @section channelmap
  2163. Remap input channels to new locations.
  2164. It accepts the following parameters:
  2165. @table @option
  2166. @item map
  2167. Map channels from input to output. The argument is a '|'-separated list of
  2168. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2169. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2170. channel (e.g. FL for front left) or its index in the input channel layout.
  2171. @var{out_channel} is the name of the output channel or its index in the output
  2172. channel layout. If @var{out_channel} is not given then it is implicitly an
  2173. index, starting with zero and increasing by one for each mapping.
  2174. @item channel_layout
  2175. The channel layout of the output stream.
  2176. @end table
  2177. If no mapping is present, the filter will implicitly map input channels to
  2178. output channels, preserving indices.
  2179. @subsection Examples
  2180. @itemize
  2181. @item
  2182. For example, assuming a 5.1+downmix input MOV file,
  2183. @example
  2184. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2185. @end example
  2186. will create an output WAV file tagged as stereo from the downmix channels of
  2187. the input.
  2188. @item
  2189. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2190. @example
  2191. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2192. @end example
  2193. @end itemize
  2194. @section channelsplit
  2195. Split each channel from an input audio stream into a separate output stream.
  2196. It accepts the following parameters:
  2197. @table @option
  2198. @item channel_layout
  2199. The channel layout of the input stream. The default is "stereo".
  2200. @item channels
  2201. A channel layout describing the channels to be extracted as separate output streams
  2202. or "all" to extract each input channel as a separate stream. The default is "all".
  2203. Choosing channels not present in channel layout in the input will result in an error.
  2204. @end table
  2205. @subsection Examples
  2206. @itemize
  2207. @item
  2208. For example, assuming a stereo input MP3 file,
  2209. @example
  2210. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2211. @end example
  2212. will create an output Matroska file with two audio streams, one containing only
  2213. the left channel and the other the right channel.
  2214. @item
  2215. Split a 5.1 WAV file into per-channel files:
  2216. @example
  2217. ffmpeg -i in.wav -filter_complex
  2218. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2219. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2220. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2221. side_right.wav
  2222. @end example
  2223. @item
  2224. Extract only LFE from a 5.1 WAV file:
  2225. @example
  2226. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2227. -map '[LFE]' lfe.wav
  2228. @end example
  2229. @end itemize
  2230. @section chorus
  2231. Add a chorus effect to the audio.
  2232. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2233. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2234. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2235. The modulation depth defines the range the modulated delay is played before or after
  2236. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2237. sound tuned around the original one, like in a chorus where some vocals are slightly
  2238. off key.
  2239. It accepts the following parameters:
  2240. @table @option
  2241. @item in_gain
  2242. Set input gain. Default is 0.4.
  2243. @item out_gain
  2244. Set output gain. Default is 0.4.
  2245. @item delays
  2246. Set delays. A typical delay is around 40ms to 60ms.
  2247. @item decays
  2248. Set decays.
  2249. @item speeds
  2250. Set speeds.
  2251. @item depths
  2252. Set depths.
  2253. @end table
  2254. @subsection Examples
  2255. @itemize
  2256. @item
  2257. A single delay:
  2258. @example
  2259. chorus=0.7:0.9:55:0.4:0.25:2
  2260. @end example
  2261. @item
  2262. Two delays:
  2263. @example
  2264. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2265. @end example
  2266. @item
  2267. Fuller sounding chorus with three delays:
  2268. @example
  2269. 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
  2270. @end example
  2271. @end itemize
  2272. @section compand
  2273. Compress or expand the audio's dynamic range.
  2274. It accepts the following parameters:
  2275. @table @option
  2276. @item attacks
  2277. @item decays
  2278. A list of times in seconds for each channel over which the instantaneous level
  2279. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2280. increase of volume and @var{decays} refers to decrease of volume. For most
  2281. situations, the attack time (response to the audio getting louder) should be
  2282. shorter than the decay time, because the human ear is more sensitive to sudden
  2283. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2284. a typical value for decay is 0.8 seconds.
  2285. If specified number of attacks & decays is lower than number of channels, the last
  2286. set attack/decay will be used for all remaining channels.
  2287. @item points
  2288. A list of points for the transfer function, specified in dB relative to the
  2289. maximum possible signal amplitude. Each key points list must be defined using
  2290. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2291. @code{x0/y0 x1/y1 x2/y2 ....}
  2292. The input values must be in strictly increasing order but the transfer function
  2293. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2294. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2295. function are @code{-70/-70|-60/-20|1/0}.
  2296. @item soft-knee
  2297. Set the curve radius in dB for all joints. It defaults to 0.01.
  2298. @item gain
  2299. Set the additional gain in dB to be applied at all points on the transfer
  2300. function. This allows for easy adjustment of the overall gain.
  2301. It defaults to 0.
  2302. @item volume
  2303. Set an initial volume, in dB, to be assumed for each channel when filtering
  2304. starts. This permits the user to supply a nominal level initially, so that, for
  2305. example, a very large gain is not applied to initial signal levels before the
  2306. companding has begun to operate. A typical value for audio which is initially
  2307. quiet is -90 dB. It defaults to 0.
  2308. @item delay
  2309. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2310. delayed before being fed to the volume adjuster. Specifying a delay
  2311. approximately equal to the attack/decay times allows the filter to effectively
  2312. operate in predictive rather than reactive mode. It defaults to 0.
  2313. @end table
  2314. @subsection Examples
  2315. @itemize
  2316. @item
  2317. Make music with both quiet and loud passages suitable for listening to in a
  2318. noisy environment:
  2319. @example
  2320. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2321. @end example
  2322. Another example for audio with whisper and explosion parts:
  2323. @example
  2324. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2325. @end example
  2326. @item
  2327. A noise gate for when the noise is at a lower level than the signal:
  2328. @example
  2329. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2330. @end example
  2331. @item
  2332. Here is another noise gate, this time for when the noise is at a higher level
  2333. than the signal (making it, in some ways, similar to squelch):
  2334. @example
  2335. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2336. @end example
  2337. @item
  2338. 2:1 compression starting at -6dB:
  2339. @example
  2340. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2341. @end example
  2342. @item
  2343. 2:1 compression starting at -9dB:
  2344. @example
  2345. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2346. @end example
  2347. @item
  2348. 2:1 compression starting at -12dB:
  2349. @example
  2350. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2351. @end example
  2352. @item
  2353. 2:1 compression starting at -18dB:
  2354. @example
  2355. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2356. @end example
  2357. @item
  2358. 3:1 compression starting at -15dB:
  2359. @example
  2360. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2361. @end example
  2362. @item
  2363. Compressor/Gate:
  2364. @example
  2365. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2366. @end example
  2367. @item
  2368. Expander:
  2369. @example
  2370. 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
  2371. @end example
  2372. @item
  2373. Hard limiter at -6dB:
  2374. @example
  2375. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2376. @end example
  2377. @item
  2378. Hard limiter at -12dB:
  2379. @example
  2380. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2381. @end example
  2382. @item
  2383. Hard noise gate at -35 dB:
  2384. @example
  2385. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2386. @end example
  2387. @item
  2388. Soft limiter:
  2389. @example
  2390. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2391. @end example
  2392. @end itemize
  2393. @section compensationdelay
  2394. Compensation Delay Line is a metric based delay to compensate differing
  2395. positions of microphones or speakers.
  2396. For example, you have recorded guitar with two microphones placed in
  2397. different locations. Because the front of sound wave has fixed speed in
  2398. normal conditions, the phasing of microphones can vary and depends on
  2399. their location and interposition. The best sound mix can be achieved when
  2400. these microphones are in phase (synchronized). Note that a distance of
  2401. ~30 cm between microphones makes one microphone capture the signal in
  2402. antiphase to the other microphone. That makes the final mix sound moody.
  2403. This filter helps to solve phasing problems by adding different delays
  2404. to each microphone track and make them synchronized.
  2405. The best result can be reached when you take one track as base and
  2406. synchronize other tracks one by one with it.
  2407. Remember that synchronization/delay tolerance depends on sample rate, too.
  2408. Higher sample rates will give more tolerance.
  2409. The filter accepts the following parameters:
  2410. @table @option
  2411. @item mm
  2412. Set millimeters distance. This is compensation distance for fine tuning.
  2413. Default is 0.
  2414. @item cm
  2415. Set cm distance. This is compensation distance for tightening distance setup.
  2416. Default is 0.
  2417. @item m
  2418. Set meters distance. This is compensation distance for hard distance setup.
  2419. Default is 0.
  2420. @item dry
  2421. Set dry amount. Amount of unprocessed (dry) signal.
  2422. Default is 0.
  2423. @item wet
  2424. Set wet amount. Amount of processed (wet) signal.
  2425. Default is 1.
  2426. @item temp
  2427. Set temperature in degrees Celsius. This is the temperature of the environment.
  2428. Default is 20.
  2429. @end table
  2430. @section crossfeed
  2431. Apply headphone crossfeed filter.
  2432. Crossfeed is the process of blending the left and right channels of stereo
  2433. audio recording.
  2434. It is mainly used to reduce extreme stereo separation of low frequencies.
  2435. The intent is to produce more speaker like sound to the listener.
  2436. The filter accepts the following options:
  2437. @table @option
  2438. @item strength
  2439. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2440. This sets gain of low shelf filter for side part of stereo image.
  2441. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2442. @item range
  2443. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2444. This sets cut off frequency of low shelf filter. Default is cut off near
  2445. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2446. @item level_in
  2447. Set input gain. Default is 0.9.
  2448. @item level_out
  2449. Set output gain. Default is 1.
  2450. @end table
  2451. @section crystalizer
  2452. Simple algorithm to expand audio dynamic range.
  2453. The filter accepts the following options:
  2454. @table @option
  2455. @item i
  2456. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2457. (unchanged sound) to 10.0 (maximum effect).
  2458. @item c
  2459. Enable clipping. By default is enabled.
  2460. @end table
  2461. @section dcshift
  2462. Apply a DC shift to the audio.
  2463. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2464. in the recording chain) from the audio. The effect of a DC offset is reduced
  2465. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2466. a signal has a DC offset.
  2467. @table @option
  2468. @item shift
  2469. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2470. the audio.
  2471. @item limitergain
  2472. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2473. used to prevent clipping.
  2474. @end table
  2475. @section deesser
  2476. Apply de-essing to the audio samples.
  2477. @table @option
  2478. @item i
  2479. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2480. Default is 0.
  2481. @item m
  2482. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2483. Default is 0.5.
  2484. @item f
  2485. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2486. Default is 0.5.
  2487. @item s
  2488. Set the output mode.
  2489. It accepts the following values:
  2490. @table @option
  2491. @item i
  2492. Pass input unchanged.
  2493. @item o
  2494. Pass ess filtered out.
  2495. @item e
  2496. Pass only ess.
  2497. Default value is @var{o}.
  2498. @end table
  2499. @end table
  2500. @section drmeter
  2501. Measure audio dynamic range.
  2502. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2503. is found in transition material. And anything less that 8 have very poor dynamics
  2504. and is very compressed.
  2505. The filter accepts the following options:
  2506. @table @option
  2507. @item length
  2508. Set window length in seconds used to split audio into segments of equal length.
  2509. Default is 3 seconds.
  2510. @end table
  2511. @section dynaudnorm
  2512. Dynamic Audio Normalizer.
  2513. This filter applies a certain amount of gain to the input audio in order
  2514. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2515. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2516. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2517. This allows for applying extra gain to the "quiet" sections of the audio
  2518. while avoiding distortions or clipping the "loud" sections. In other words:
  2519. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2520. sections, in the sense that the volume of each section is brought to the
  2521. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2522. this goal *without* applying "dynamic range compressing". It will retain 100%
  2523. of the dynamic range *within* each section of the audio file.
  2524. @table @option
  2525. @item framelen, f
  2526. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2527. Default is 500 milliseconds.
  2528. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2529. referred to as frames. This is required, because a peak magnitude has no
  2530. meaning for just a single sample value. Instead, we need to determine the
  2531. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2532. normalizer would simply use the peak magnitude of the complete file, the
  2533. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2534. frame. The length of a frame is specified in milliseconds. By default, the
  2535. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2536. been found to give good results with most files.
  2537. Note that the exact frame length, in number of samples, will be determined
  2538. automatically, based on the sampling rate of the individual input audio file.
  2539. @item gausssize, g
  2540. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2541. number. Default is 31.
  2542. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2543. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2544. is specified in frames, centered around the current frame. For the sake of
  2545. simplicity, this must be an odd number. Consequently, the default value of 31
  2546. takes into account the current frame, as well as the 15 preceding frames and
  2547. the 15 subsequent frames. Using a larger window results in a stronger
  2548. smoothing effect and thus in less gain variation, i.e. slower gain
  2549. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2550. effect and thus in more gain variation, i.e. faster gain adaptation.
  2551. In other words, the more you increase this value, the more the Dynamic Audio
  2552. Normalizer will behave like a "traditional" normalization filter. On the
  2553. contrary, the more you decrease this value, the more the Dynamic Audio
  2554. Normalizer will behave like a dynamic range compressor.
  2555. @item peak, p
  2556. Set the target peak value. This specifies the highest permissible magnitude
  2557. level for the normalized audio input. This filter will try to approach the
  2558. target peak magnitude as closely as possible, but at the same time it also
  2559. makes sure that the normalized signal will never exceed the peak magnitude.
  2560. A frame's maximum local gain factor is imposed directly by the target peak
  2561. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2562. It is not recommended to go above this value.
  2563. @item maxgain, m
  2564. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2565. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2566. factor for each input frame, i.e. the maximum gain factor that does not
  2567. result in clipping or distortion. The maximum gain factor is determined by
  2568. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2569. additionally bounds the frame's maximum gain factor by a predetermined
  2570. (global) maximum gain factor. This is done in order to avoid excessive gain
  2571. factors in "silent" or almost silent frames. By default, the maximum gain
  2572. factor is 10.0, For most inputs the default value should be sufficient and
  2573. it usually is not recommended to increase this value. Though, for input
  2574. with an extremely low overall volume level, it may be necessary to allow even
  2575. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2576. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2577. Instead, a "sigmoid" threshold function will be applied. This way, the
  2578. gain factors will smoothly approach the threshold value, but never exceed that
  2579. value.
  2580. @item targetrms, r
  2581. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2582. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2583. This means that the maximum local gain factor for each frame is defined
  2584. (only) by the frame's highest magnitude sample. This way, the samples can
  2585. be amplified as much as possible without exceeding the maximum signal
  2586. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2587. Normalizer can also take into account the frame's root mean square,
  2588. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2589. determine the power of a time-varying signal. It is therefore considered
  2590. that the RMS is a better approximation of the "perceived loudness" than
  2591. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2592. frames to a constant RMS value, a uniform "perceived loudness" can be
  2593. established. If a target RMS value has been specified, a frame's local gain
  2594. factor is defined as the factor that would result in exactly that RMS value.
  2595. Note, however, that the maximum local gain factor is still restricted by the
  2596. frame's highest magnitude sample, in order to prevent clipping.
  2597. @item coupling, n
  2598. Enable channels coupling. By default is enabled.
  2599. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2600. amount. This means the same gain factor will be applied to all channels, i.e.
  2601. the maximum possible gain factor is determined by the "loudest" channel.
  2602. However, in some recordings, it may happen that the volume of the different
  2603. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2604. In this case, this option can be used to disable the channel coupling. This way,
  2605. the gain factor will be determined independently for each channel, depending
  2606. only on the individual channel's highest magnitude sample. This allows for
  2607. harmonizing the volume of the different channels.
  2608. @item correctdc, c
  2609. Enable DC bias correction. By default is disabled.
  2610. An audio signal (in the time domain) is a sequence of sample values.
  2611. In the Dynamic Audio Normalizer these sample values are represented in the
  2612. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2613. audio signal, or "waveform", should be centered around the zero point.
  2614. That means if we calculate the mean value of all samples in a file, or in a
  2615. single frame, then the result should be 0.0 or at least very close to that
  2616. value. If, however, there is a significant deviation of the mean value from
  2617. 0.0, in either positive or negative direction, this is referred to as a
  2618. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2619. Audio Normalizer provides optional DC bias correction.
  2620. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2621. the mean value, or "DC correction" offset, of each input frame and subtract
  2622. that value from all of the frame's sample values which ensures those samples
  2623. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2624. boundaries, the DC correction offset values will be interpolated smoothly
  2625. between neighbouring frames.
  2626. @item altboundary, b
  2627. Enable alternative boundary mode. By default is disabled.
  2628. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2629. around each frame. This includes the preceding frames as well as the
  2630. subsequent frames. However, for the "boundary" frames, located at the very
  2631. beginning and at the very end of the audio file, not all neighbouring
  2632. frames are available. In particular, for the first few frames in the audio
  2633. file, the preceding frames are not known. And, similarly, for the last few
  2634. frames in the audio file, the subsequent frames are not known. Thus, the
  2635. question arises which gain factors should be assumed for the missing frames
  2636. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2637. to deal with this situation. The default boundary mode assumes a gain factor
  2638. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2639. "fade out" at the beginning and at the end of the input, respectively.
  2640. @item compress, s
  2641. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2642. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2643. compression. This means that signal peaks will not be pruned and thus the
  2644. full dynamic range will be retained within each local neighbourhood. However,
  2645. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2646. normalization algorithm with a more "traditional" compression.
  2647. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2648. (thresholding) function. If (and only if) the compression feature is enabled,
  2649. all input frames will be processed by a soft knee thresholding function prior
  2650. to the actual normalization process. Put simply, the thresholding function is
  2651. going to prune all samples whose magnitude exceeds a certain threshold value.
  2652. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2653. value. Instead, the threshold value will be adjusted for each individual
  2654. frame.
  2655. In general, smaller parameters result in stronger compression, and vice versa.
  2656. Values below 3.0 are not recommended, because audible distortion may appear.
  2657. @item threshold, t
  2658. Set the target threshold value. This specifies the lowest permissible
  2659. magnitude level for the audio input which will be normalized.
  2660. If input frame volume is above this value frame will be normalized.
  2661. Otherwise frame may not be normalized at all. The default value is set
  2662. to 0, which means all input frames will be normalized.
  2663. This option is mostly useful if digital noise is not wanted to be amplified.
  2664. @end table
  2665. @subsection Commands
  2666. This filter supports the all above options as @ref{commands}.
  2667. @section earwax
  2668. Make audio easier to listen to on headphones.
  2669. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2670. so that when listened to on headphones the stereo image is moved from
  2671. inside your head (standard for headphones) to outside and in front of
  2672. the listener (standard for speakers).
  2673. Ported from SoX.
  2674. @section equalizer
  2675. Apply a two-pole peaking equalisation (EQ) filter. With this
  2676. filter, the signal-level at and around a selected frequency can
  2677. be increased or decreased, whilst (unlike bandpass and bandreject
  2678. filters) that at all other frequencies is unchanged.
  2679. In order to produce complex equalisation curves, this filter can
  2680. be given several times, each with a different central frequency.
  2681. The filter accepts the following options:
  2682. @table @option
  2683. @item frequency, f
  2684. Set the filter's central frequency in Hz.
  2685. @item width_type, t
  2686. Set method to specify band-width of filter.
  2687. @table @option
  2688. @item h
  2689. Hz
  2690. @item q
  2691. Q-Factor
  2692. @item o
  2693. octave
  2694. @item s
  2695. slope
  2696. @item k
  2697. kHz
  2698. @end table
  2699. @item width, w
  2700. Specify the band-width of a filter in width_type units.
  2701. @item gain, g
  2702. Set the required gain or attenuation in dB.
  2703. Beware of clipping when using a positive gain.
  2704. @item mix, m
  2705. How much to use filtered signal in output. Default is 1.
  2706. Range is between 0 and 1.
  2707. @item channels, c
  2708. Specify which channels to filter, by default all available are filtered.
  2709. @item normalize, n
  2710. Normalize biquad coefficients, by default is disabled.
  2711. Enabling it will normalize magnitude response at DC to 0dB.
  2712. @end table
  2713. @subsection Examples
  2714. @itemize
  2715. @item
  2716. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2717. @example
  2718. equalizer=f=1000:t=h:width=200:g=-10
  2719. @end example
  2720. @item
  2721. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2722. @example
  2723. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2724. @end example
  2725. @end itemize
  2726. @subsection Commands
  2727. This filter supports the following commands:
  2728. @table @option
  2729. @item frequency, f
  2730. Change equalizer frequency.
  2731. Syntax for the command is : "@var{frequency}"
  2732. @item width_type, t
  2733. Change equalizer width_type.
  2734. Syntax for the command is : "@var{width_type}"
  2735. @item width, w
  2736. Change equalizer width.
  2737. Syntax for the command is : "@var{width}"
  2738. @item gain, g
  2739. Change equalizer gain.
  2740. Syntax for the command is : "@var{gain}"
  2741. @item mix, m
  2742. Change equalizer mix.
  2743. Syntax for the command is : "@var{mix}"
  2744. @end table
  2745. @section extrastereo
  2746. Linearly increases the difference between left and right channels which
  2747. adds some sort of "live" effect to playback.
  2748. The filter accepts the following options:
  2749. @table @option
  2750. @item m
  2751. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2752. (average of both channels), with 1.0 sound will be unchanged, with
  2753. -1.0 left and right channels will be swapped.
  2754. @item c
  2755. Enable clipping. By default is enabled.
  2756. @end table
  2757. @subsection Commands
  2758. This filter supports the all above options as @ref{commands}.
  2759. @section firequalizer
  2760. Apply FIR Equalization using arbitrary frequency response.
  2761. The filter accepts the following option:
  2762. @table @option
  2763. @item gain
  2764. Set gain curve equation (in dB). The expression can contain variables:
  2765. @table @option
  2766. @item f
  2767. the evaluated frequency
  2768. @item sr
  2769. sample rate
  2770. @item ch
  2771. channel number, set to 0 when multichannels evaluation is disabled
  2772. @item chid
  2773. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2774. multichannels evaluation is disabled
  2775. @item chs
  2776. number of channels
  2777. @item chlayout
  2778. channel_layout, see libavutil/channel_layout.h
  2779. @end table
  2780. and functions:
  2781. @table @option
  2782. @item gain_interpolate(f)
  2783. interpolate gain on frequency f based on gain_entry
  2784. @item cubic_interpolate(f)
  2785. same as gain_interpolate, but smoother
  2786. @end table
  2787. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2788. @item gain_entry
  2789. Set gain entry for gain_interpolate function. The expression can
  2790. contain functions:
  2791. @table @option
  2792. @item entry(f, g)
  2793. store gain entry at frequency f with value g
  2794. @end table
  2795. This option is also available as command.
  2796. @item delay
  2797. Set filter delay in seconds. Higher value means more accurate.
  2798. Default is @code{0.01}.
  2799. @item accuracy
  2800. Set filter accuracy in Hz. Lower value means more accurate.
  2801. Default is @code{5}.
  2802. @item wfunc
  2803. Set window function. Acceptable values are:
  2804. @table @option
  2805. @item rectangular
  2806. rectangular window, useful when gain curve is already smooth
  2807. @item hann
  2808. hann window (default)
  2809. @item hamming
  2810. hamming window
  2811. @item blackman
  2812. blackman window
  2813. @item nuttall3
  2814. 3-terms continuous 1st derivative nuttall window
  2815. @item mnuttall3
  2816. minimum 3-terms discontinuous nuttall window
  2817. @item nuttall
  2818. 4-terms continuous 1st derivative nuttall window
  2819. @item bnuttall
  2820. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2821. @item bharris
  2822. blackman-harris window
  2823. @item tukey
  2824. tukey window
  2825. @end table
  2826. @item fixed
  2827. If enabled, use fixed number of audio samples. This improves speed when
  2828. filtering with large delay. Default is disabled.
  2829. @item multi
  2830. Enable multichannels evaluation on gain. Default is disabled.
  2831. @item zero_phase
  2832. Enable zero phase mode by subtracting timestamp to compensate delay.
  2833. Default is disabled.
  2834. @item scale
  2835. Set scale used by gain. Acceptable values are:
  2836. @table @option
  2837. @item linlin
  2838. linear frequency, linear gain
  2839. @item linlog
  2840. linear frequency, logarithmic (in dB) gain (default)
  2841. @item loglin
  2842. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2843. @item loglog
  2844. logarithmic frequency, logarithmic gain
  2845. @end table
  2846. @item dumpfile
  2847. Set file for dumping, suitable for gnuplot.
  2848. @item dumpscale
  2849. Set scale for dumpfile. Acceptable values are same with scale option.
  2850. Default is linlog.
  2851. @item fft2
  2852. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2853. Default is disabled.
  2854. @item min_phase
  2855. Enable minimum phase impulse response. Default is disabled.
  2856. @end table
  2857. @subsection Examples
  2858. @itemize
  2859. @item
  2860. lowpass at 1000 Hz:
  2861. @example
  2862. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2863. @end example
  2864. @item
  2865. lowpass at 1000 Hz with gain_entry:
  2866. @example
  2867. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2868. @end example
  2869. @item
  2870. custom equalization:
  2871. @example
  2872. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2873. @end example
  2874. @item
  2875. higher delay with zero phase to compensate delay:
  2876. @example
  2877. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2878. @end example
  2879. @item
  2880. lowpass on left channel, highpass on right channel:
  2881. @example
  2882. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2883. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2884. @end example
  2885. @end itemize
  2886. @section flanger
  2887. Apply a flanging effect to the audio.
  2888. The filter accepts the following options:
  2889. @table @option
  2890. @item delay
  2891. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2892. @item depth
  2893. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2894. @item regen
  2895. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2896. Default value is 0.
  2897. @item width
  2898. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2899. Default value is 71.
  2900. @item speed
  2901. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2902. @item shape
  2903. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2904. Default value is @var{sinusoidal}.
  2905. @item phase
  2906. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2907. Default value is 25.
  2908. @item interp
  2909. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2910. Default is @var{linear}.
  2911. @end table
  2912. @section haas
  2913. Apply Haas effect to audio.
  2914. Note that this makes most sense to apply on mono signals.
  2915. With this filter applied to mono signals it give some directionality and
  2916. stretches its stereo image.
  2917. The filter accepts the following options:
  2918. @table @option
  2919. @item level_in
  2920. Set input level. By default is @var{1}, or 0dB
  2921. @item level_out
  2922. Set output level. By default is @var{1}, or 0dB.
  2923. @item side_gain
  2924. Set gain applied to side part of signal. By default is @var{1}.
  2925. @item middle_source
  2926. Set kind of middle source. Can be one of the following:
  2927. @table @samp
  2928. @item left
  2929. Pick left channel.
  2930. @item right
  2931. Pick right channel.
  2932. @item mid
  2933. Pick middle part signal of stereo image.
  2934. @item side
  2935. Pick side part signal of stereo image.
  2936. @end table
  2937. @item middle_phase
  2938. Change middle phase. By default is disabled.
  2939. @item left_delay
  2940. Set left channel delay. By default is @var{2.05} milliseconds.
  2941. @item left_balance
  2942. Set left channel balance. By default is @var{-1}.
  2943. @item left_gain
  2944. Set left channel gain. By default is @var{1}.
  2945. @item left_phase
  2946. Change left phase. By default is disabled.
  2947. @item right_delay
  2948. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2949. @item right_balance
  2950. Set right channel balance. By default is @var{1}.
  2951. @item right_gain
  2952. Set right channel gain. By default is @var{1}.
  2953. @item right_phase
  2954. Change right phase. By default is enabled.
  2955. @end table
  2956. @section hdcd
  2957. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2958. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2959. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2960. of HDCD, and detects the Transient Filter flag.
  2961. @example
  2962. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2963. @end example
  2964. When using the filter with wav, note the default encoding for wav is 16-bit,
  2965. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2966. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2967. @example
  2968. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2969. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2970. @end example
  2971. The filter accepts the following options:
  2972. @table @option
  2973. @item disable_autoconvert
  2974. Disable any automatic format conversion or resampling in the filter graph.
  2975. @item process_stereo
  2976. Process the stereo channels together. If target_gain does not match between
  2977. channels, consider it invalid and use the last valid target_gain.
  2978. @item cdt_ms
  2979. Set the code detect timer period in ms.
  2980. @item force_pe
  2981. Always extend peaks above -3dBFS even if PE isn't signaled.
  2982. @item analyze_mode
  2983. Replace audio with a solid tone and adjust the amplitude to signal some
  2984. specific aspect of the decoding process. The output file can be loaded in
  2985. an audio editor alongside the original to aid analysis.
  2986. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2987. Modes are:
  2988. @table @samp
  2989. @item 0, off
  2990. Disabled
  2991. @item 1, lle
  2992. Gain adjustment level at each sample
  2993. @item 2, pe
  2994. Samples where peak extend occurs
  2995. @item 3, cdt
  2996. Samples where the code detect timer is active
  2997. @item 4, tgm
  2998. Samples where the target gain does not match between channels
  2999. @end table
  3000. @end table
  3001. @section headphone
  3002. Apply head-related transfer functions (HRTFs) to create virtual
  3003. loudspeakers around the user for binaural listening via headphones.
  3004. The HRIRs are provided via additional streams, for each channel
  3005. one stereo input stream is needed.
  3006. The filter accepts the following options:
  3007. @table @option
  3008. @item map
  3009. Set mapping of input streams for convolution.
  3010. The argument is a '|'-separated list of channel names in order as they
  3011. are given as additional stream inputs for filter.
  3012. This also specify number of input streams. Number of input streams
  3013. must be not less than number of channels in first stream plus one.
  3014. @item gain
  3015. Set gain applied to audio. Value is in dB. Default is 0.
  3016. @item type
  3017. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3018. processing audio in time domain which is slow.
  3019. @var{freq} is processing audio in frequency domain which is fast.
  3020. Default is @var{freq}.
  3021. @item lfe
  3022. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3023. @item size
  3024. Set size of frame in number of samples which will be processed at once.
  3025. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3026. @item hrir
  3027. Set format of hrir stream.
  3028. Default value is @var{stereo}. Alternative value is @var{multich}.
  3029. If value is set to @var{stereo}, number of additional streams should
  3030. be greater or equal to number of input channels in first input stream.
  3031. Also each additional stream should have stereo number of channels.
  3032. If value is set to @var{multich}, number of additional streams should
  3033. be exactly one. Also number of input channels of additional stream
  3034. should be equal or greater than twice number of channels of first input
  3035. stream.
  3036. @end table
  3037. @subsection Examples
  3038. @itemize
  3039. @item
  3040. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3041. each amovie filter use stereo file with IR coefficients as input.
  3042. The files give coefficients for each position of virtual loudspeaker:
  3043. @example
  3044. ffmpeg -i input.wav
  3045. -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"
  3046. output.wav
  3047. @end example
  3048. @item
  3049. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3050. but now in @var{multich} @var{hrir} format.
  3051. @example
  3052. 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"
  3053. output.wav
  3054. @end example
  3055. @end itemize
  3056. @section highpass
  3057. Apply a high-pass filter with 3dB point frequency.
  3058. The filter can be either single-pole, or double-pole (the default).
  3059. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3060. The filter accepts the following options:
  3061. @table @option
  3062. @item frequency, f
  3063. Set frequency in Hz. Default is 3000.
  3064. @item poles, p
  3065. Set number of poles. Default is 2.
  3066. @item width_type, t
  3067. Set method to specify band-width of filter.
  3068. @table @option
  3069. @item h
  3070. Hz
  3071. @item q
  3072. Q-Factor
  3073. @item o
  3074. octave
  3075. @item s
  3076. slope
  3077. @item k
  3078. kHz
  3079. @end table
  3080. @item width, w
  3081. Specify the band-width of a filter in width_type units.
  3082. Applies only to double-pole filter.
  3083. The default is 0.707q and gives a Butterworth response.
  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. @end table
  3093. @subsection Commands
  3094. This filter supports the following commands:
  3095. @table @option
  3096. @item frequency, f
  3097. Change highpass frequency.
  3098. Syntax for the command is : "@var{frequency}"
  3099. @item width_type, t
  3100. Change highpass width_type.
  3101. Syntax for the command is : "@var{width_type}"
  3102. @item width, w
  3103. Change highpass width.
  3104. Syntax for the command is : "@var{width}"
  3105. @item mix, m
  3106. Change highpass mix.
  3107. Syntax for the command is : "@var{mix}"
  3108. @end table
  3109. @section join
  3110. Join multiple input streams into one multi-channel stream.
  3111. It accepts the following parameters:
  3112. @table @option
  3113. @item inputs
  3114. The number of input streams. It defaults to 2.
  3115. @item channel_layout
  3116. The desired output channel layout. It defaults to stereo.
  3117. @item map
  3118. Map channels from inputs to output. The argument is a '|'-separated list of
  3119. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3120. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3121. can be either the name of the input channel (e.g. FL for front left) or its
  3122. index in the specified input stream. @var{out_channel} is the name of the output
  3123. channel.
  3124. @end table
  3125. The filter will attempt to guess the mappings when they are not specified
  3126. explicitly. It does so by first trying to find an unused matching input channel
  3127. and if that fails it picks the first unused input channel.
  3128. Join 3 inputs (with properly set channel layouts):
  3129. @example
  3130. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3131. @end example
  3132. Build a 5.1 output from 6 single-channel streams:
  3133. @example
  3134. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3135. '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'
  3136. out
  3137. @end example
  3138. @section ladspa
  3139. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3140. To enable compilation of this filter you need to configure FFmpeg with
  3141. @code{--enable-ladspa}.
  3142. @table @option
  3143. @item file, f
  3144. Specifies the name of LADSPA plugin library to load. If the environment
  3145. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3146. each one of the directories specified by the colon separated list in
  3147. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3148. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3149. @file{/usr/lib/ladspa/}.
  3150. @item plugin, p
  3151. Specifies the plugin within the library. Some libraries contain only
  3152. one plugin, but others contain many of them. If this is not set filter
  3153. will list all available plugins within the specified library.
  3154. @item controls, c
  3155. Set the '|' separated list of controls which are zero or more floating point
  3156. values that determine the behavior of the loaded plugin (for example delay,
  3157. threshold or gain).
  3158. Controls need to be defined using the following syntax:
  3159. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3160. @var{valuei} is the value set on the @var{i}-th control.
  3161. Alternatively they can be also defined using the following syntax:
  3162. @var{value0}|@var{value1}|@var{value2}|..., where
  3163. @var{valuei} is the value set on the @var{i}-th control.
  3164. If @option{controls} is set to @code{help}, all available controls and
  3165. their valid ranges are printed.
  3166. @item sample_rate, s
  3167. Specify the sample rate, default to 44100. Only used if plugin have
  3168. zero inputs.
  3169. @item nb_samples, n
  3170. Set the number of samples per channel per each output frame, default
  3171. is 1024. Only used if plugin have zero inputs.
  3172. @item duration, d
  3173. Set the minimum duration of the sourced audio. See
  3174. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3175. for the accepted syntax.
  3176. Note that the resulting duration may be greater than the specified duration,
  3177. as the generated audio is always cut at the end of a complete frame.
  3178. If not specified, or the expressed duration is negative, the audio is
  3179. supposed to be generated forever.
  3180. Only used if plugin have zero inputs.
  3181. @end table
  3182. @subsection Examples
  3183. @itemize
  3184. @item
  3185. List all available plugins within amp (LADSPA example plugin) library:
  3186. @example
  3187. ladspa=file=amp
  3188. @end example
  3189. @item
  3190. List all available controls and their valid ranges for @code{vcf_notch}
  3191. plugin from @code{VCF} library:
  3192. @example
  3193. ladspa=f=vcf:p=vcf_notch:c=help
  3194. @end example
  3195. @item
  3196. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3197. plugin library:
  3198. @example
  3199. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3200. @end example
  3201. @item
  3202. Add reverberation to the audio using TAP-plugins
  3203. (Tom's Audio Processing plugins):
  3204. @example
  3205. ladspa=file=tap_reverb:tap_reverb
  3206. @end example
  3207. @item
  3208. Generate white noise, with 0.2 amplitude:
  3209. @example
  3210. ladspa=file=cmt:noise_source_white:c=c0=.2
  3211. @end example
  3212. @item
  3213. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3214. @code{C* Audio Plugin Suite} (CAPS) library:
  3215. @example
  3216. ladspa=file=caps:Click:c=c1=20'
  3217. @end example
  3218. @item
  3219. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3220. @example
  3221. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3222. @end example
  3223. @item
  3224. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3225. @code{SWH Plugins} collection:
  3226. @example
  3227. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3228. @end example
  3229. @item
  3230. Attenuate low frequencies using Multiband EQ from Steve Harris
  3231. @code{SWH Plugins} collection:
  3232. @example
  3233. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3234. @end example
  3235. @item
  3236. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3237. (CAPS) library:
  3238. @example
  3239. ladspa=caps:Narrower
  3240. @end example
  3241. @item
  3242. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3243. @example
  3244. ladspa=caps:White:.2
  3245. @end example
  3246. @item
  3247. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3248. @example
  3249. ladspa=caps:Fractal:c=c1=1
  3250. @end example
  3251. @item
  3252. Dynamic volume normalization using @code{VLevel} plugin:
  3253. @example
  3254. ladspa=vlevel-ladspa:vlevel_mono
  3255. @end example
  3256. @end itemize
  3257. @subsection Commands
  3258. This filter supports the following commands:
  3259. @table @option
  3260. @item cN
  3261. Modify the @var{N}-th control value.
  3262. If the specified value is not valid, it is ignored and prior one is kept.
  3263. @end table
  3264. @section loudnorm
  3265. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3266. Support for both single pass (livestreams, files) and double pass (files) modes.
  3267. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3268. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3269. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3270. The filter accepts the following options:
  3271. @table @option
  3272. @item I, i
  3273. Set integrated loudness target.
  3274. Range is -70.0 - -5.0. Default value is -24.0.
  3275. @item LRA, lra
  3276. Set loudness range target.
  3277. Range is 1.0 - 20.0. Default value is 7.0.
  3278. @item TP, tp
  3279. Set maximum true peak.
  3280. Range is -9.0 - +0.0. Default value is -2.0.
  3281. @item measured_I, measured_i
  3282. Measured IL of input file.
  3283. Range is -99.0 - +0.0.
  3284. @item measured_LRA, measured_lra
  3285. Measured LRA of input file.
  3286. Range is 0.0 - 99.0.
  3287. @item measured_TP, measured_tp
  3288. Measured true peak of input file.
  3289. Range is -99.0 - +99.0.
  3290. @item measured_thresh
  3291. Measured threshold of input file.
  3292. Range is -99.0 - +0.0.
  3293. @item offset
  3294. Set offset gain. Gain is applied before the true-peak limiter.
  3295. Range is -99.0 - +99.0. Default is +0.0.
  3296. @item linear
  3297. Normalize linearly if possible.
  3298. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3299. to be specified in order to use this mode.
  3300. Options are true or false. Default is true.
  3301. @item dual_mono
  3302. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3303. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3304. If set to @code{true}, this option will compensate for this effect.
  3305. Multi-channel input files are not affected by this option.
  3306. Options are true or false. Default is false.
  3307. @item print_format
  3308. Set print format for stats. Options are summary, json, or none.
  3309. Default value is none.
  3310. @end table
  3311. @section lowpass
  3312. Apply a low-pass filter with 3dB point frequency.
  3313. The filter can be either single-pole or double-pole (the default).
  3314. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3315. The filter accepts the following options:
  3316. @table @option
  3317. @item frequency, f
  3318. Set frequency in Hz. Default is 500.
  3319. @item poles, p
  3320. Set number of poles. Default is 2.
  3321. @item width_type, t
  3322. Set method to specify band-width of filter.
  3323. @table @option
  3324. @item h
  3325. Hz
  3326. @item q
  3327. Q-Factor
  3328. @item o
  3329. octave
  3330. @item s
  3331. slope
  3332. @item k
  3333. kHz
  3334. @end table
  3335. @item width, w
  3336. Specify the band-width of a filter in width_type units.
  3337. Applies only to double-pole filter.
  3338. The default is 0.707q and gives a Butterworth response.
  3339. @item mix, m
  3340. How much to use filtered signal in output. Default is 1.
  3341. Range is between 0 and 1.
  3342. @item channels, c
  3343. Specify which channels to filter, by default all available are filtered.
  3344. @item normalize, n
  3345. Normalize biquad coefficients, by default is disabled.
  3346. Enabling it will normalize magnitude response at DC to 0dB.
  3347. @end table
  3348. @subsection Examples
  3349. @itemize
  3350. @item
  3351. Lowpass only LFE channel, it LFE is not present it does nothing:
  3352. @example
  3353. lowpass=c=LFE
  3354. @end example
  3355. @end itemize
  3356. @subsection Commands
  3357. This filter supports the following commands:
  3358. @table @option
  3359. @item frequency, f
  3360. Change lowpass frequency.
  3361. Syntax for the command is : "@var{frequency}"
  3362. @item width_type, t
  3363. Change lowpass width_type.
  3364. Syntax for the command is : "@var{width_type}"
  3365. @item width, w
  3366. Change lowpass width.
  3367. Syntax for the command is : "@var{width}"
  3368. @item mix, m
  3369. Change lowpass mix.
  3370. Syntax for the command is : "@var{mix}"
  3371. @end table
  3372. @section lv2
  3373. Load a LV2 (LADSPA Version 2) plugin.
  3374. To enable compilation of this filter you need to configure FFmpeg with
  3375. @code{--enable-lv2}.
  3376. @table @option
  3377. @item plugin, p
  3378. Specifies the plugin URI. You may need to escape ':'.
  3379. @item controls, c
  3380. Set the '|' separated list of controls which are zero or more floating point
  3381. values that determine the behavior of the loaded plugin (for example delay,
  3382. threshold or gain).
  3383. If @option{controls} is set to @code{help}, all available controls and
  3384. their valid ranges are printed.
  3385. @item sample_rate, s
  3386. Specify the sample rate, default to 44100. Only used if plugin have
  3387. zero inputs.
  3388. @item nb_samples, n
  3389. Set the number of samples per channel per each output frame, default
  3390. is 1024. Only used if plugin have zero inputs.
  3391. @item duration, d
  3392. Set the minimum duration of the sourced audio. See
  3393. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3394. for the accepted syntax.
  3395. Note that the resulting duration may be greater than the specified duration,
  3396. as the generated audio is always cut at the end of a complete frame.
  3397. If not specified, or the expressed duration is negative, the audio is
  3398. supposed to be generated forever.
  3399. Only used if plugin have zero inputs.
  3400. @end table
  3401. @subsection Examples
  3402. @itemize
  3403. @item
  3404. Apply bass enhancer plugin from Calf:
  3405. @example
  3406. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3407. @end example
  3408. @item
  3409. Apply vinyl plugin from Calf:
  3410. @example
  3411. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3412. @end example
  3413. @item
  3414. Apply bit crusher plugin from ArtyFX:
  3415. @example
  3416. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3417. @end example
  3418. @end itemize
  3419. @section mcompand
  3420. Multiband Compress or expand the audio's dynamic range.
  3421. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3422. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3423. response when absent compander action.
  3424. It accepts the following parameters:
  3425. @table @option
  3426. @item args
  3427. This option syntax is:
  3428. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3429. For explanation of each item refer to compand filter documentation.
  3430. @end table
  3431. @anchor{pan}
  3432. @section pan
  3433. Mix channels with specific gain levels. The filter accepts the output
  3434. channel layout followed by a set of channels definitions.
  3435. This filter is also designed to efficiently remap the channels of an audio
  3436. stream.
  3437. The filter accepts parameters of the form:
  3438. "@var{l}|@var{outdef}|@var{outdef}|..."
  3439. @table @option
  3440. @item l
  3441. output channel layout or number of channels
  3442. @item outdef
  3443. output channel specification, of the form:
  3444. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3445. @item out_name
  3446. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3447. number (c0, c1, etc.)
  3448. @item gain
  3449. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3450. @item in_name
  3451. input channel to use, see out_name for details; it is not possible to mix
  3452. named and numbered input channels
  3453. @end table
  3454. If the `=' in a channel specification is replaced by `<', then the gains for
  3455. that specification will be renormalized so that the total is 1, thus
  3456. avoiding clipping noise.
  3457. @subsection Mixing examples
  3458. For example, if you want to down-mix from stereo to mono, but with a bigger
  3459. factor for the left channel:
  3460. @example
  3461. pan=1c|c0=0.9*c0+0.1*c1
  3462. @end example
  3463. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3464. 7-channels surround:
  3465. @example
  3466. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3467. @end example
  3468. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3469. that should be preferred (see "-ac" option) unless you have very specific
  3470. needs.
  3471. @subsection Remapping examples
  3472. The channel remapping will be effective if, and only if:
  3473. @itemize
  3474. @item gain coefficients are zeroes or ones,
  3475. @item only one input per channel output,
  3476. @end itemize
  3477. If all these conditions are satisfied, the filter will notify the user ("Pure
  3478. channel mapping detected"), and use an optimized and lossless method to do the
  3479. remapping.
  3480. For example, if you have a 5.1 source and want a stereo audio stream by
  3481. dropping the extra channels:
  3482. @example
  3483. pan="stereo| c0=FL | c1=FR"
  3484. @end example
  3485. Given the same source, you can also switch front left and front right channels
  3486. and keep the input channel layout:
  3487. @example
  3488. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3489. @end example
  3490. If the input is a stereo audio stream, you can mute the front left channel (and
  3491. still keep the stereo channel layout) with:
  3492. @example
  3493. pan="stereo|c1=c1"
  3494. @end example
  3495. Still with a stereo audio stream input, you can copy the right channel in both
  3496. front left and right:
  3497. @example
  3498. pan="stereo| c0=FR | c1=FR"
  3499. @end example
  3500. @section replaygain
  3501. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3502. outputs it unchanged.
  3503. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3504. @section resample
  3505. Convert the audio sample format, sample rate and channel layout. It is
  3506. not meant to be used directly.
  3507. @section rubberband
  3508. Apply time-stretching and pitch-shifting with librubberband.
  3509. To enable compilation of this filter, you need to configure FFmpeg with
  3510. @code{--enable-librubberband}.
  3511. The filter accepts the following options:
  3512. @table @option
  3513. @item tempo
  3514. Set tempo scale factor.
  3515. @item pitch
  3516. Set pitch scale factor.
  3517. @item transients
  3518. Set transients detector.
  3519. Possible values are:
  3520. @table @var
  3521. @item crisp
  3522. @item mixed
  3523. @item smooth
  3524. @end table
  3525. @item detector
  3526. Set detector.
  3527. Possible values are:
  3528. @table @var
  3529. @item compound
  3530. @item percussive
  3531. @item soft
  3532. @end table
  3533. @item phase
  3534. Set phase.
  3535. Possible values are:
  3536. @table @var
  3537. @item laminar
  3538. @item independent
  3539. @end table
  3540. @item window
  3541. Set processing window size.
  3542. Possible values are:
  3543. @table @var
  3544. @item standard
  3545. @item short
  3546. @item long
  3547. @end table
  3548. @item smoothing
  3549. Set smoothing.
  3550. Possible values are:
  3551. @table @var
  3552. @item off
  3553. @item on
  3554. @end table
  3555. @item formant
  3556. Enable formant preservation when shift pitching.
  3557. Possible values are:
  3558. @table @var
  3559. @item shifted
  3560. @item preserved
  3561. @end table
  3562. @item pitchq
  3563. Set pitch quality.
  3564. Possible values are:
  3565. @table @var
  3566. @item quality
  3567. @item speed
  3568. @item consistency
  3569. @end table
  3570. @item channels
  3571. Set channels.
  3572. Possible values are:
  3573. @table @var
  3574. @item apart
  3575. @item together
  3576. @end table
  3577. @end table
  3578. @subsection Commands
  3579. This filter supports the following commands:
  3580. @table @option
  3581. @item tempo
  3582. Change filter tempo scale factor.
  3583. Syntax for the command is : "@var{tempo}"
  3584. @item pitch
  3585. Change filter pitch scale factor.
  3586. Syntax for the command is : "@var{pitch}"
  3587. @end table
  3588. @section sidechaincompress
  3589. This filter acts like normal compressor but has the ability to compress
  3590. detected signal using second input signal.
  3591. It needs two input streams and returns one output stream.
  3592. First input stream will be processed depending on second stream signal.
  3593. The filtered signal then can be filtered with other filters in later stages of
  3594. processing. See @ref{pan} and @ref{amerge} filter.
  3595. The filter accepts the following options:
  3596. @table @option
  3597. @item level_in
  3598. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3599. @item mode
  3600. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3601. Default is @code{downward}.
  3602. @item threshold
  3603. If a signal of second stream raises above this level it will affect the gain
  3604. reduction of first stream.
  3605. By default is 0.125. Range is between 0.00097563 and 1.
  3606. @item ratio
  3607. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3608. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3609. Default is 2. Range is between 1 and 20.
  3610. @item attack
  3611. Amount of milliseconds the signal has to rise above the threshold before gain
  3612. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3613. @item release
  3614. Amount of milliseconds the signal has to fall below the threshold before
  3615. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3616. @item makeup
  3617. Set the amount by how much signal will be amplified after processing.
  3618. Default is 1. Range is from 1 to 64.
  3619. @item knee
  3620. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3621. Default is 2.82843. Range is between 1 and 8.
  3622. @item link
  3623. Choose if the @code{average} level between all channels of side-chain stream
  3624. or the louder(@code{maximum}) channel of side-chain stream affects the
  3625. reduction. Default is @code{average}.
  3626. @item detection
  3627. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3628. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3629. @item level_sc
  3630. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3631. @item mix
  3632. How much to use compressed signal in output. Default is 1.
  3633. Range is between 0 and 1.
  3634. @end table
  3635. @subsection Examples
  3636. @itemize
  3637. @item
  3638. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3639. depending on the signal of 2nd input and later compressed signal to be
  3640. merged with 2nd input:
  3641. @example
  3642. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3643. @end example
  3644. @end itemize
  3645. @section sidechaingate
  3646. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3647. filter the detected signal before sending it to the gain reduction stage.
  3648. Normally a gate uses the full range signal to detect a level above the
  3649. threshold.
  3650. For example: If you cut all lower frequencies from your sidechain signal
  3651. the gate will decrease the volume of your track only if not enough highs
  3652. appear. With this technique you are able to reduce the resonation of a
  3653. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3654. guitar.
  3655. It needs two input streams and returns one output stream.
  3656. First input stream will be processed depending on second stream signal.
  3657. The filter accepts the following options:
  3658. @table @option
  3659. @item level_in
  3660. Set input level before filtering.
  3661. Default is 1. Allowed range is from 0.015625 to 64.
  3662. @item mode
  3663. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3664. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3665. will be amplified, expanding dynamic range in upward direction.
  3666. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3667. @item range
  3668. Set the level of gain reduction when the signal is below the threshold.
  3669. Default is 0.06125. Allowed range is from 0 to 1.
  3670. Setting this to 0 disables reduction and then filter behaves like expander.
  3671. @item threshold
  3672. If a signal rises above this level the gain reduction is released.
  3673. Default is 0.125. Allowed range is from 0 to 1.
  3674. @item ratio
  3675. Set a ratio about which the signal is reduced.
  3676. Default is 2. Allowed range is from 1 to 9000.
  3677. @item attack
  3678. Amount of milliseconds the signal has to rise above the threshold before gain
  3679. reduction stops.
  3680. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3681. @item release
  3682. Amount of milliseconds the signal has to fall below the threshold before the
  3683. reduction is increased again. Default is 250 milliseconds.
  3684. Allowed range is from 0.01 to 9000.
  3685. @item makeup
  3686. Set amount of amplification of signal after processing.
  3687. Default is 1. Allowed range is from 1 to 64.
  3688. @item knee
  3689. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3690. Default is 2.828427125. Allowed range is from 1 to 8.
  3691. @item detection
  3692. Choose if exact signal should be taken for detection or an RMS like one.
  3693. Default is rms. Can be peak or rms.
  3694. @item link
  3695. Choose if the average level between all channels or the louder channel affects
  3696. the reduction.
  3697. Default is average. Can be average or maximum.
  3698. @item level_sc
  3699. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3700. @end table
  3701. @section silencedetect
  3702. Detect silence in an audio stream.
  3703. This filter logs a message when it detects that the input audio volume is less
  3704. or equal to a noise tolerance value for a duration greater or equal to the
  3705. minimum detected noise duration.
  3706. The printed times and duration are expressed in seconds. The
  3707. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3708. is set on the first frame whose timestamp equals or exceeds the detection
  3709. duration and it contains the timestamp of the first frame of the silence.
  3710. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3711. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3712. keys are set on the first frame after the silence. If @option{mono} is
  3713. enabled, and each channel is evaluated separately, the @code{.X}
  3714. suffixed keys are used, and @code{X} corresponds to the channel number.
  3715. The filter accepts the following options:
  3716. @table @option
  3717. @item noise, n
  3718. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3719. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3720. @item duration, d
  3721. Set silence duration until notification (default is 2 seconds). See
  3722. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3723. for the accepted syntax.
  3724. @item mono, m
  3725. Process each channel separately, instead of combined. By default is disabled.
  3726. @end table
  3727. @subsection Examples
  3728. @itemize
  3729. @item
  3730. Detect 5 seconds of silence with -50dB noise tolerance:
  3731. @example
  3732. silencedetect=n=-50dB:d=5
  3733. @end example
  3734. @item
  3735. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3736. tolerance in @file{silence.mp3}:
  3737. @example
  3738. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3739. @end example
  3740. @end itemize
  3741. @section silenceremove
  3742. Remove silence from the beginning, middle or end of the audio.
  3743. The filter accepts the following options:
  3744. @table @option
  3745. @item start_periods
  3746. This value is used to indicate if audio should be trimmed at beginning of
  3747. the audio. A value of zero indicates no silence should be trimmed from the
  3748. beginning. When specifying a non-zero value, it trims audio up until it
  3749. finds non-silence. Normally, when trimming silence from beginning of audio
  3750. the @var{start_periods} will be @code{1} but it can be increased to higher
  3751. values to trim all audio up to specific count of non-silence periods.
  3752. Default value is @code{0}.
  3753. @item start_duration
  3754. Specify the amount of time that non-silence must be detected before it stops
  3755. trimming audio. By increasing the duration, bursts of noises can be treated
  3756. as silence and trimmed off. Default value is @code{0}.
  3757. @item start_threshold
  3758. This indicates what sample value should be treated as silence. For digital
  3759. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3760. you may wish to increase the value to account for background noise.
  3761. Can be specified in dB (in case "dB" is appended to the specified value)
  3762. or amplitude ratio. Default value is @code{0}.
  3763. @item start_silence
  3764. Specify max duration of silence at beginning that will be kept after
  3765. trimming. Default is 0, which is equal to trimming all samples detected
  3766. as silence.
  3767. @item start_mode
  3768. Specify mode of detection of silence end in start of multi-channel audio.
  3769. Can be @var{any} or @var{all}. Default is @var{any}.
  3770. With @var{any}, any sample that is detected as non-silence will cause
  3771. stopped trimming of silence.
  3772. With @var{all}, only if all channels are detected as non-silence will cause
  3773. stopped trimming of silence.
  3774. @item stop_periods
  3775. Set the count for trimming silence from the end of audio.
  3776. To remove silence from the middle of a file, specify a @var{stop_periods}
  3777. that is negative. This value is then treated as a positive value and is
  3778. used to indicate the effect should restart processing as specified by
  3779. @var{start_periods}, making it suitable for removing periods of silence
  3780. in the middle of the audio.
  3781. Default value is @code{0}.
  3782. @item stop_duration
  3783. Specify a duration of silence that must exist before audio is not copied any
  3784. more. By specifying a higher duration, silence that is wanted can be left in
  3785. the audio.
  3786. Default value is @code{0}.
  3787. @item stop_threshold
  3788. This is the same as @option{start_threshold} but for trimming silence from
  3789. the end of audio.
  3790. Can be specified in dB (in case "dB" is appended to the specified value)
  3791. or amplitude ratio. Default value is @code{0}.
  3792. @item stop_silence
  3793. Specify max duration of silence at end that will be kept after
  3794. trimming. Default is 0, which is equal to trimming all samples detected
  3795. as silence.
  3796. @item stop_mode
  3797. Specify mode of detection of silence start in end of multi-channel audio.
  3798. Can be @var{any} or @var{all}. Default is @var{any}.
  3799. With @var{any}, any sample that is detected as non-silence will cause
  3800. stopped trimming of silence.
  3801. With @var{all}, only if all channels are detected as non-silence will cause
  3802. stopped trimming of silence.
  3803. @item detection
  3804. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3805. and works better with digital silence which is exactly 0.
  3806. Default value is @code{rms}.
  3807. @item window
  3808. Set duration in number of seconds used to calculate size of window in number
  3809. of samples for detecting silence.
  3810. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3811. @end table
  3812. @subsection Examples
  3813. @itemize
  3814. @item
  3815. The following example shows how this filter can be used to start a recording
  3816. that does not contain the delay at the start which usually occurs between
  3817. pressing the record button and the start of the performance:
  3818. @example
  3819. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3820. @end example
  3821. @item
  3822. Trim all silence encountered from beginning to end where there is more than 1
  3823. second of silence in audio:
  3824. @example
  3825. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3826. @end example
  3827. @item
  3828. Trim all digital silence samples, using peak detection, from beginning to end
  3829. where there is more than 0 samples of digital silence in audio and digital
  3830. silence is detected in all channels at same positions in stream:
  3831. @example
  3832. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3833. @end example
  3834. @end itemize
  3835. @section sofalizer
  3836. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3837. loudspeakers around the user for binaural listening via headphones (audio
  3838. formats up to 9 channels supported).
  3839. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3840. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3841. Austrian Academy of Sciences.
  3842. To enable compilation of this filter you need to configure FFmpeg with
  3843. @code{--enable-libmysofa}.
  3844. The filter accepts the following options:
  3845. @table @option
  3846. @item sofa
  3847. Set the SOFA file used for rendering.
  3848. @item gain
  3849. Set gain applied to audio. Value is in dB. Default is 0.
  3850. @item rotation
  3851. Set rotation of virtual loudspeakers in deg. Default is 0.
  3852. @item elevation
  3853. Set elevation of virtual speakers in deg. Default is 0.
  3854. @item radius
  3855. Set distance in meters between loudspeakers and the listener with near-field
  3856. HRTFs. Default is 1.
  3857. @item type
  3858. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3859. processing audio in time domain which is slow.
  3860. @var{freq} is processing audio in frequency domain which is fast.
  3861. Default is @var{freq}.
  3862. @item speakers
  3863. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3864. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3865. Each virtual loudspeaker is described with short channel name following with
  3866. azimuth and elevation in degrees.
  3867. Each virtual loudspeaker description is separated by '|'.
  3868. For example to override front left and front right channel positions use:
  3869. 'speakers=FL 45 15|FR 345 15'.
  3870. Descriptions with unrecognised channel names are ignored.
  3871. @item lfegain
  3872. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3873. @item framesize
  3874. Set custom frame size in number of samples. Default is 1024.
  3875. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3876. is set to @var{freq}.
  3877. @item normalize
  3878. Should all IRs be normalized upon importing SOFA file.
  3879. By default is enabled.
  3880. @item interpolate
  3881. Should nearest IRs be interpolated with neighbor IRs if exact position
  3882. does not match. By default is disabled.
  3883. @item minphase
  3884. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3885. @item anglestep
  3886. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3887. @item radstep
  3888. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3889. @end table
  3890. @subsection Examples
  3891. @itemize
  3892. @item
  3893. Using ClubFritz6 sofa file:
  3894. @example
  3895. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3896. @end example
  3897. @item
  3898. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3899. @example
  3900. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3901. @end example
  3902. @item
  3903. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3904. and also with custom gain:
  3905. @example
  3906. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3907. @end example
  3908. @end itemize
  3909. @section stereotools
  3910. This filter has some handy utilities to manage stereo signals, for converting
  3911. M/S stereo recordings to L/R signal while having control over the parameters
  3912. or spreading the stereo image of master track.
  3913. The filter accepts the following options:
  3914. @table @option
  3915. @item level_in
  3916. Set input level before filtering for both channels. Defaults is 1.
  3917. Allowed range is from 0.015625 to 64.
  3918. @item level_out
  3919. Set output level after filtering for both channels. Defaults is 1.
  3920. Allowed range is from 0.015625 to 64.
  3921. @item balance_in
  3922. Set input balance between both channels. Default is 0.
  3923. Allowed range is from -1 to 1.
  3924. @item balance_out
  3925. Set output balance between both channels. Default is 0.
  3926. Allowed range is from -1 to 1.
  3927. @item softclip
  3928. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3929. clipping. Disabled by default.
  3930. @item mutel
  3931. Mute the left channel. Disabled by default.
  3932. @item muter
  3933. Mute the right channel. Disabled by default.
  3934. @item phasel
  3935. Change the phase of the left channel. Disabled by default.
  3936. @item phaser
  3937. Change the phase of the right channel. Disabled by default.
  3938. @item mode
  3939. Set stereo mode. Available values are:
  3940. @table @samp
  3941. @item lr>lr
  3942. Left/Right to Left/Right, this is default.
  3943. @item lr>ms
  3944. Left/Right to Mid/Side.
  3945. @item ms>lr
  3946. Mid/Side to Left/Right.
  3947. @item lr>ll
  3948. Left/Right to Left/Left.
  3949. @item lr>rr
  3950. Left/Right to Right/Right.
  3951. @item lr>l+r
  3952. Left/Right to Left + Right.
  3953. @item lr>rl
  3954. Left/Right to Right/Left.
  3955. @item ms>ll
  3956. Mid/Side to Left/Left.
  3957. @item ms>rr
  3958. Mid/Side to Right/Right.
  3959. @end table
  3960. @item slev
  3961. Set level of side signal. Default is 1.
  3962. Allowed range is from 0.015625 to 64.
  3963. @item sbal
  3964. Set balance of side signal. Default is 0.
  3965. Allowed range is from -1 to 1.
  3966. @item mlev
  3967. Set level of the middle signal. Default is 1.
  3968. Allowed range is from 0.015625 to 64.
  3969. @item mpan
  3970. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3971. @item base
  3972. Set stereo base between mono and inversed channels. Default is 0.
  3973. Allowed range is from -1 to 1.
  3974. @item delay
  3975. Set delay in milliseconds how much to delay left from right channel and
  3976. vice versa. Default is 0. Allowed range is from -20 to 20.
  3977. @item sclevel
  3978. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3979. @item phase
  3980. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3981. @item bmode_in, bmode_out
  3982. Set balance mode for balance_in/balance_out option.
  3983. Can be one of the following:
  3984. @table @samp
  3985. @item balance
  3986. Classic balance mode. Attenuate one channel at time.
  3987. Gain is raised up to 1.
  3988. @item amplitude
  3989. Similar as classic mode above but gain is raised up to 2.
  3990. @item power
  3991. Equal power distribution, from -6dB to +6dB range.
  3992. @end table
  3993. @end table
  3994. @subsection Examples
  3995. @itemize
  3996. @item
  3997. Apply karaoke like effect:
  3998. @example
  3999. stereotools=mlev=0.015625
  4000. @end example
  4001. @item
  4002. Convert M/S signal to L/R:
  4003. @example
  4004. "stereotools=mode=ms>lr"
  4005. @end example
  4006. @end itemize
  4007. @section stereowiden
  4008. This filter enhance the stereo effect by suppressing signal common to both
  4009. channels and by delaying the signal of left into right and vice versa,
  4010. thereby widening the stereo effect.
  4011. The filter accepts the following options:
  4012. @table @option
  4013. @item delay
  4014. Time in milliseconds of the delay of left signal into right and vice versa.
  4015. Default is 20 milliseconds.
  4016. @item feedback
  4017. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4018. effect of left signal in right output and vice versa which gives widening
  4019. effect. Default is 0.3.
  4020. @item crossfeed
  4021. Cross feed of left into right with inverted phase. This helps in suppressing
  4022. the mono. If the value is 1 it will cancel all the signal common to both
  4023. channels. Default is 0.3.
  4024. @item drymix
  4025. Set level of input signal of original channel. Default is 0.8.
  4026. @end table
  4027. @subsection Commands
  4028. This filter supports the all above options except @code{delay} as @ref{commands}.
  4029. @section superequalizer
  4030. Apply 18 band equalizer.
  4031. The filter accepts the following options:
  4032. @table @option
  4033. @item 1b
  4034. Set 65Hz band gain.
  4035. @item 2b
  4036. Set 92Hz band gain.
  4037. @item 3b
  4038. Set 131Hz band gain.
  4039. @item 4b
  4040. Set 185Hz band gain.
  4041. @item 5b
  4042. Set 262Hz band gain.
  4043. @item 6b
  4044. Set 370Hz band gain.
  4045. @item 7b
  4046. Set 523Hz band gain.
  4047. @item 8b
  4048. Set 740Hz band gain.
  4049. @item 9b
  4050. Set 1047Hz band gain.
  4051. @item 10b
  4052. Set 1480Hz band gain.
  4053. @item 11b
  4054. Set 2093Hz band gain.
  4055. @item 12b
  4056. Set 2960Hz band gain.
  4057. @item 13b
  4058. Set 4186Hz band gain.
  4059. @item 14b
  4060. Set 5920Hz band gain.
  4061. @item 15b
  4062. Set 8372Hz band gain.
  4063. @item 16b
  4064. Set 11840Hz band gain.
  4065. @item 17b
  4066. Set 16744Hz band gain.
  4067. @item 18b
  4068. Set 20000Hz band gain.
  4069. @end table
  4070. @section surround
  4071. Apply audio surround upmix filter.
  4072. This filter allows to produce multichannel output from audio stream.
  4073. The filter accepts the following options:
  4074. @table @option
  4075. @item chl_out
  4076. Set output channel layout. By default, this is @var{5.1}.
  4077. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4078. for the required syntax.
  4079. @item chl_in
  4080. Set input channel layout. By default, this is @var{stereo}.
  4081. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4082. for the required syntax.
  4083. @item level_in
  4084. Set input volume level. By default, this is @var{1}.
  4085. @item level_out
  4086. Set output volume level. By default, this is @var{1}.
  4087. @item lfe
  4088. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4089. @item lfe_low
  4090. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4091. @item lfe_high
  4092. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4093. @item lfe_mode
  4094. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4095. In @var{add} mode, LFE channel is created from input audio and added to output.
  4096. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4097. also all non-LFE output channels are subtracted with output LFE channel.
  4098. @item angle
  4099. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4100. Default is @var{90}.
  4101. @item fc_in
  4102. Set front center input volume. By default, this is @var{1}.
  4103. @item fc_out
  4104. Set front center output volume. By default, this is @var{1}.
  4105. @item fl_in
  4106. Set front left input volume. By default, this is @var{1}.
  4107. @item fl_out
  4108. Set front left output volume. By default, this is @var{1}.
  4109. @item fr_in
  4110. Set front right input volume. By default, this is @var{1}.
  4111. @item fr_out
  4112. Set front right output volume. By default, this is @var{1}.
  4113. @item sl_in
  4114. Set side left input volume. By default, this is @var{1}.
  4115. @item sl_out
  4116. Set side left output volume. By default, this is @var{1}.
  4117. @item sr_in
  4118. Set side right input volume. By default, this is @var{1}.
  4119. @item sr_out
  4120. Set side right output volume. By default, this is @var{1}.
  4121. @item bl_in
  4122. Set back left input volume. By default, this is @var{1}.
  4123. @item bl_out
  4124. Set back left output volume. By default, this is @var{1}.
  4125. @item br_in
  4126. Set back right input volume. By default, this is @var{1}.
  4127. @item br_out
  4128. Set back right output volume. By default, this is @var{1}.
  4129. @item bc_in
  4130. Set back center input volume. By default, this is @var{1}.
  4131. @item bc_out
  4132. Set back center output volume. By default, this is @var{1}.
  4133. @item lfe_in
  4134. Set LFE input volume. By default, this is @var{1}.
  4135. @item lfe_out
  4136. Set LFE output volume. By default, this is @var{1}.
  4137. @item allx
  4138. Set spread usage of stereo image across X axis for all channels.
  4139. @item ally
  4140. Set spread usage of stereo image across Y axis for all channels.
  4141. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4142. Set spread usage of stereo image across X axis for each channel.
  4143. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4144. Set spread usage of stereo image across Y axis for each channel.
  4145. @item win_size
  4146. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4147. @item win_func
  4148. Set window function.
  4149. It accepts the following values:
  4150. @table @samp
  4151. @item rect
  4152. @item bartlett
  4153. @item hann, hanning
  4154. @item hamming
  4155. @item blackman
  4156. @item welch
  4157. @item flattop
  4158. @item bharris
  4159. @item bnuttall
  4160. @item bhann
  4161. @item sine
  4162. @item nuttall
  4163. @item lanczos
  4164. @item gauss
  4165. @item tukey
  4166. @item dolph
  4167. @item cauchy
  4168. @item parzen
  4169. @item poisson
  4170. @item bohman
  4171. @end table
  4172. Default is @code{hann}.
  4173. @item overlap
  4174. Set window overlap. If set to 1, the recommended overlap for selected
  4175. window function will be picked. Default is @code{0.5}.
  4176. @end table
  4177. @section treble, highshelf
  4178. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4179. shelving filter with a response similar to that of a standard
  4180. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4181. The filter accepts the following options:
  4182. @table @option
  4183. @item gain, g
  4184. Give the gain at whichever is the lower of ~22 kHz and the
  4185. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4186. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4187. @item frequency, f
  4188. Set the filter's central frequency and so can be used
  4189. to extend or reduce the frequency range to be boosted or cut.
  4190. The default value is @code{3000} Hz.
  4191. @item width_type, t
  4192. Set method to specify band-width of filter.
  4193. @table @option
  4194. @item h
  4195. Hz
  4196. @item q
  4197. Q-Factor
  4198. @item o
  4199. octave
  4200. @item s
  4201. slope
  4202. @item k
  4203. kHz
  4204. @end table
  4205. @item width, w
  4206. Determine how steep is the filter's shelf transition.
  4207. @item mix, m
  4208. How much to use filtered signal in output. Default is 1.
  4209. Range is between 0 and 1.
  4210. @item channels, c
  4211. Specify which channels to filter, by default all available are filtered.
  4212. @item normalize, n
  4213. Normalize biquad coefficients, by default is disabled.
  4214. Enabling it will normalize magnitude response at DC to 0dB.
  4215. @end table
  4216. @subsection Commands
  4217. This filter supports the following commands:
  4218. @table @option
  4219. @item frequency, f
  4220. Change treble frequency.
  4221. Syntax for the command is : "@var{frequency}"
  4222. @item width_type, t
  4223. Change treble width_type.
  4224. Syntax for the command is : "@var{width_type}"
  4225. @item width, w
  4226. Change treble width.
  4227. Syntax for the command is : "@var{width}"
  4228. @item gain, g
  4229. Change treble gain.
  4230. Syntax for the command is : "@var{gain}"
  4231. @item mix, m
  4232. Change treble mix.
  4233. Syntax for the command is : "@var{mix}"
  4234. @end table
  4235. @section tremolo
  4236. Sinusoidal amplitude modulation.
  4237. The filter accepts the following options:
  4238. @table @option
  4239. @item f
  4240. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4241. (20 Hz or lower) will result in a tremolo effect.
  4242. This filter may also be used as a ring modulator by specifying
  4243. a modulation frequency higher than 20 Hz.
  4244. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4245. @item d
  4246. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4247. Default value is 0.5.
  4248. @end table
  4249. @section vibrato
  4250. Sinusoidal phase modulation.
  4251. The filter accepts the following options:
  4252. @table @option
  4253. @item f
  4254. Modulation frequency in Hertz.
  4255. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4256. @item d
  4257. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4258. Default value is 0.5.
  4259. @end table
  4260. @section volume
  4261. Adjust the input audio volume.
  4262. It accepts the following parameters:
  4263. @table @option
  4264. @item volume
  4265. Set audio volume expression.
  4266. Output values are clipped to the maximum value.
  4267. The output audio volume is given by the relation:
  4268. @example
  4269. @var{output_volume} = @var{volume} * @var{input_volume}
  4270. @end example
  4271. The default value for @var{volume} is "1.0".
  4272. @item precision
  4273. This parameter represents the mathematical precision.
  4274. It determines which input sample formats will be allowed, which affects the
  4275. precision of the volume scaling.
  4276. @table @option
  4277. @item fixed
  4278. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4279. @item float
  4280. 32-bit floating-point; this limits input sample format to FLT. (default)
  4281. @item double
  4282. 64-bit floating-point; this limits input sample format to DBL.
  4283. @end table
  4284. @item replaygain
  4285. Choose the behaviour on encountering ReplayGain side data in input frames.
  4286. @table @option
  4287. @item drop
  4288. Remove ReplayGain side data, ignoring its contents (the default).
  4289. @item ignore
  4290. Ignore ReplayGain side data, but leave it in the frame.
  4291. @item track
  4292. Prefer the track gain, if present.
  4293. @item album
  4294. Prefer the album gain, if present.
  4295. @end table
  4296. @item replaygain_preamp
  4297. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4298. Default value for @var{replaygain_preamp} is 0.0.
  4299. @item replaygain_noclip
  4300. Prevent clipping by limiting the gain applied.
  4301. Default value for @var{replaygain_noclip} is 1.
  4302. @item eval
  4303. Set when the volume expression is evaluated.
  4304. It accepts the following values:
  4305. @table @samp
  4306. @item once
  4307. only evaluate expression once during the filter initialization, or
  4308. when the @samp{volume} command is sent
  4309. @item frame
  4310. evaluate expression for each incoming frame
  4311. @end table
  4312. Default value is @samp{once}.
  4313. @end table
  4314. The volume expression can contain the following parameters.
  4315. @table @option
  4316. @item n
  4317. frame number (starting at zero)
  4318. @item nb_channels
  4319. number of channels
  4320. @item nb_consumed_samples
  4321. number of samples consumed by the filter
  4322. @item nb_samples
  4323. number of samples in the current frame
  4324. @item pos
  4325. original frame position in the file
  4326. @item pts
  4327. frame PTS
  4328. @item sample_rate
  4329. sample rate
  4330. @item startpts
  4331. PTS at start of stream
  4332. @item startt
  4333. time at start of stream
  4334. @item t
  4335. frame time
  4336. @item tb
  4337. timestamp timebase
  4338. @item volume
  4339. last set volume value
  4340. @end table
  4341. Note that when @option{eval} is set to @samp{once} only the
  4342. @var{sample_rate} and @var{tb} variables are available, all other
  4343. variables will evaluate to NAN.
  4344. @subsection Commands
  4345. This filter supports the following commands:
  4346. @table @option
  4347. @item volume
  4348. Modify the volume expression.
  4349. The command accepts the same syntax of the corresponding option.
  4350. If the specified expression is not valid, it is kept at its current
  4351. value.
  4352. @end table
  4353. @subsection Examples
  4354. @itemize
  4355. @item
  4356. Halve the input audio volume:
  4357. @example
  4358. volume=volume=0.5
  4359. volume=volume=1/2
  4360. volume=volume=-6.0206dB
  4361. @end example
  4362. In all the above example the named key for @option{volume} can be
  4363. omitted, for example like in:
  4364. @example
  4365. volume=0.5
  4366. @end example
  4367. @item
  4368. Increase input audio power by 6 decibels using fixed-point precision:
  4369. @example
  4370. volume=volume=6dB:precision=fixed
  4371. @end example
  4372. @item
  4373. Fade volume after time 10 with an annihilation period of 5 seconds:
  4374. @example
  4375. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4376. @end example
  4377. @end itemize
  4378. @section volumedetect
  4379. Detect the volume of the input video.
  4380. The filter has no parameters. The input is not modified. Statistics about
  4381. the volume will be printed in the log when the input stream end is reached.
  4382. In particular it will show the mean volume (root mean square), maximum
  4383. volume (on a per-sample basis), and the beginning of a histogram of the
  4384. registered volume values (from the maximum value to a cumulated 1/1000 of
  4385. the samples).
  4386. All volumes are in decibels relative to the maximum PCM value.
  4387. @subsection Examples
  4388. Here is an excerpt of the output:
  4389. @example
  4390. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4391. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4392. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4393. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4394. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4395. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4396. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4397. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4398. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4399. @end example
  4400. It means that:
  4401. @itemize
  4402. @item
  4403. The mean square energy is approximately -27 dB, or 10^-2.7.
  4404. @item
  4405. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4406. @item
  4407. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4408. @end itemize
  4409. In other words, raising the volume by +4 dB does not cause any clipping,
  4410. raising it by +5 dB causes clipping for 6 samples, etc.
  4411. @c man end AUDIO FILTERS
  4412. @chapter Audio Sources
  4413. @c man begin AUDIO SOURCES
  4414. Below is a description of the currently available audio sources.
  4415. @section abuffer
  4416. Buffer audio frames, and make them available to the filter chain.
  4417. This source is mainly intended for a programmatic use, in particular
  4418. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4419. It accepts the following parameters:
  4420. @table @option
  4421. @item time_base
  4422. The timebase which will be used for timestamps of submitted frames. It must be
  4423. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4424. @item sample_rate
  4425. The sample rate of the incoming audio buffers.
  4426. @item sample_fmt
  4427. The sample format of the incoming audio buffers.
  4428. Either a sample format name or its corresponding integer representation from
  4429. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4430. @item channel_layout
  4431. The channel layout of the incoming audio buffers.
  4432. Either a channel layout name from channel_layout_map in
  4433. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4434. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4435. @item channels
  4436. The number of channels of the incoming audio buffers.
  4437. If both @var{channels} and @var{channel_layout} are specified, then they
  4438. must be consistent.
  4439. @end table
  4440. @subsection Examples
  4441. @example
  4442. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4443. @end example
  4444. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4445. Since the sample format with name "s16p" corresponds to the number
  4446. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4447. equivalent to:
  4448. @example
  4449. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4450. @end example
  4451. @section aevalsrc
  4452. Generate an audio signal specified by an expression.
  4453. This source accepts in input one or more expressions (one for each
  4454. channel), which are evaluated and used to generate a corresponding
  4455. audio signal.
  4456. This source accepts the following options:
  4457. @table @option
  4458. @item exprs
  4459. Set the '|'-separated expressions list for each separate channel. In case the
  4460. @option{channel_layout} option is not specified, the selected channel layout
  4461. depends on the number of provided expressions. Otherwise the last
  4462. specified expression is applied to the remaining output channels.
  4463. @item channel_layout, c
  4464. Set the channel layout. The number of channels in the specified layout
  4465. must be equal to the number of specified expressions.
  4466. @item duration, d
  4467. Set the minimum duration of the sourced audio. See
  4468. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4469. for the accepted syntax.
  4470. Note that the resulting duration may be greater than the specified
  4471. duration, as the generated audio is always cut at the end of a
  4472. complete frame.
  4473. If not specified, or the expressed duration is negative, the audio is
  4474. supposed to be generated forever.
  4475. @item nb_samples, n
  4476. Set the number of samples per channel per each output frame,
  4477. default to 1024.
  4478. @item sample_rate, s
  4479. Specify the sample rate, default to 44100.
  4480. @end table
  4481. Each expression in @var{exprs} can contain the following constants:
  4482. @table @option
  4483. @item n
  4484. number of the evaluated sample, starting from 0
  4485. @item t
  4486. time of the evaluated sample expressed in seconds, starting from 0
  4487. @item s
  4488. sample rate
  4489. @end table
  4490. @subsection Examples
  4491. @itemize
  4492. @item
  4493. Generate silence:
  4494. @example
  4495. aevalsrc=0
  4496. @end example
  4497. @item
  4498. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4499. 8000 Hz:
  4500. @example
  4501. aevalsrc="sin(440*2*PI*t):s=8000"
  4502. @end example
  4503. @item
  4504. Generate a two channels signal, specify the channel layout (Front
  4505. Center + Back Center) explicitly:
  4506. @example
  4507. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4508. @end example
  4509. @item
  4510. Generate white noise:
  4511. @example
  4512. aevalsrc="-2+random(0)"
  4513. @end example
  4514. @item
  4515. Generate an amplitude modulated signal:
  4516. @example
  4517. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4518. @end example
  4519. @item
  4520. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4521. @example
  4522. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4523. @end example
  4524. @end itemize
  4525. @section anullsrc
  4526. The null audio source, return unprocessed audio frames. It is mainly useful
  4527. as a template and to be employed in analysis / debugging tools, or as
  4528. the source for filters which ignore the input data (for example the sox
  4529. synth filter).
  4530. This source accepts the following options:
  4531. @table @option
  4532. @item channel_layout, cl
  4533. Specifies the channel layout, and can be either an integer or a string
  4534. representing a channel layout. The default value of @var{channel_layout}
  4535. is "stereo".
  4536. Check the channel_layout_map definition in
  4537. @file{libavutil/channel_layout.c} for the mapping between strings and
  4538. channel layout values.
  4539. @item sample_rate, r
  4540. Specifies the sample rate, and defaults to 44100.
  4541. @item nb_samples, n
  4542. Set the number of samples per requested frames.
  4543. @end table
  4544. @subsection Examples
  4545. @itemize
  4546. @item
  4547. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4548. @example
  4549. anullsrc=r=48000:cl=4
  4550. @end example
  4551. @item
  4552. Do the same operation with a more obvious syntax:
  4553. @example
  4554. anullsrc=r=48000:cl=mono
  4555. @end example
  4556. @end itemize
  4557. All the parameters need to be explicitly defined.
  4558. @section flite
  4559. Synthesize a voice utterance using the libflite library.
  4560. To enable compilation of this filter you need to configure FFmpeg with
  4561. @code{--enable-libflite}.
  4562. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4563. The filter accepts the following options:
  4564. @table @option
  4565. @item list_voices
  4566. If set to 1, list the names of the available voices and exit
  4567. immediately. Default value is 0.
  4568. @item nb_samples, n
  4569. Set the maximum number of samples per frame. Default value is 512.
  4570. @item textfile
  4571. Set the filename containing the text to speak.
  4572. @item text
  4573. Set the text to speak.
  4574. @item voice, v
  4575. Set the voice to use for the speech synthesis. Default value is
  4576. @code{kal}. See also the @var{list_voices} option.
  4577. @end table
  4578. @subsection Examples
  4579. @itemize
  4580. @item
  4581. Read from file @file{speech.txt}, and synthesize the text using the
  4582. standard flite voice:
  4583. @example
  4584. flite=textfile=speech.txt
  4585. @end example
  4586. @item
  4587. Read the specified text selecting the @code{slt} voice:
  4588. @example
  4589. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4590. @end example
  4591. @item
  4592. Input text to ffmpeg:
  4593. @example
  4594. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4595. @end example
  4596. @item
  4597. Make @file{ffplay} speak the specified text, using @code{flite} and
  4598. the @code{lavfi} device:
  4599. @example
  4600. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4601. @end example
  4602. @end itemize
  4603. For more information about libflite, check:
  4604. @url{http://www.festvox.org/flite/}
  4605. @section anoisesrc
  4606. Generate a noise audio signal.
  4607. The filter accepts the following options:
  4608. @table @option
  4609. @item sample_rate, r
  4610. Specify the sample rate. Default value is 48000 Hz.
  4611. @item amplitude, a
  4612. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4613. is 1.0.
  4614. @item duration, d
  4615. Specify the duration of the generated audio stream. Not specifying this option
  4616. results in noise with an infinite length.
  4617. @item color, colour, c
  4618. Specify the color of noise. Available noise colors are white, pink, brown,
  4619. blue and violet. Default color is white.
  4620. @item seed, s
  4621. Specify a value used to seed the PRNG.
  4622. @item nb_samples, n
  4623. Set the number of samples per each output frame, default is 1024.
  4624. @end table
  4625. @subsection Examples
  4626. @itemize
  4627. @item
  4628. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4629. @example
  4630. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4631. @end example
  4632. @end itemize
  4633. @section hilbert
  4634. Generate odd-tap Hilbert transform FIR coefficients.
  4635. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4636. the signal by 90 degrees.
  4637. This is used in many matrix coding schemes and for analytic signal generation.
  4638. The process is often written as a multiplication by i (or j), the imaginary unit.
  4639. The filter accepts the following options:
  4640. @table @option
  4641. @item sample_rate, s
  4642. Set sample rate, default is 44100.
  4643. @item taps, t
  4644. Set length of FIR filter, default is 22051.
  4645. @item nb_samples, n
  4646. Set number of samples per each frame.
  4647. @item win_func, w
  4648. Set window function to be used when generating FIR coefficients.
  4649. @end table
  4650. @section sinc
  4651. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4652. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4653. The filter accepts the following options:
  4654. @table @option
  4655. @item sample_rate, r
  4656. Set sample rate, default is 44100.
  4657. @item nb_samples, n
  4658. Set number of samples per each frame. Default is 1024.
  4659. @item hp
  4660. Set high-pass frequency. Default is 0.
  4661. @item lp
  4662. Set low-pass frequency. Default is 0.
  4663. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4664. is higher than 0 then filter will create band-pass filter coefficients,
  4665. otherwise band-reject filter coefficients.
  4666. @item phase
  4667. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4668. @item beta
  4669. Set Kaiser window beta.
  4670. @item att
  4671. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4672. @item round
  4673. Enable rounding, by default is disabled.
  4674. @item hptaps
  4675. Set number of taps for high-pass filter.
  4676. @item lptaps
  4677. Set number of taps for low-pass filter.
  4678. @end table
  4679. @section sine
  4680. Generate an audio signal made of a sine wave with amplitude 1/8.
  4681. The audio signal is bit-exact.
  4682. The filter accepts the following options:
  4683. @table @option
  4684. @item frequency, f
  4685. Set the carrier frequency. Default is 440 Hz.
  4686. @item beep_factor, b
  4687. Enable a periodic beep every second with frequency @var{beep_factor} times
  4688. the carrier frequency. Default is 0, meaning the beep is disabled.
  4689. @item sample_rate, r
  4690. Specify the sample rate, default is 44100.
  4691. @item duration, d
  4692. Specify the duration of the generated audio stream.
  4693. @item samples_per_frame
  4694. Set the number of samples per output frame.
  4695. The expression can contain the following constants:
  4696. @table @option
  4697. @item n
  4698. The (sequential) number of the output audio frame, starting from 0.
  4699. @item pts
  4700. The PTS (Presentation TimeStamp) of the output audio frame,
  4701. expressed in @var{TB} units.
  4702. @item t
  4703. The PTS of the output audio frame, expressed in seconds.
  4704. @item TB
  4705. The timebase of the output audio frames.
  4706. @end table
  4707. Default is @code{1024}.
  4708. @end table
  4709. @subsection Examples
  4710. @itemize
  4711. @item
  4712. Generate a simple 440 Hz sine wave:
  4713. @example
  4714. sine
  4715. @end example
  4716. @item
  4717. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4718. @example
  4719. sine=220:4:d=5
  4720. sine=f=220:b=4:d=5
  4721. sine=frequency=220:beep_factor=4:duration=5
  4722. @end example
  4723. @item
  4724. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4725. pattern:
  4726. @example
  4727. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4728. @end example
  4729. @end itemize
  4730. @c man end AUDIO SOURCES
  4731. @chapter Audio Sinks
  4732. @c man begin AUDIO SINKS
  4733. Below is a description of the currently available audio sinks.
  4734. @section abuffersink
  4735. Buffer audio frames, and make them available to the end of filter chain.
  4736. This sink is mainly intended for programmatic use, in particular
  4737. through the interface defined in @file{libavfilter/buffersink.h}
  4738. or the options system.
  4739. It accepts a pointer to an AVABufferSinkContext structure, which
  4740. defines the incoming buffers' formats, to be passed as the opaque
  4741. parameter to @code{avfilter_init_filter} for initialization.
  4742. @section anullsink
  4743. Null audio sink; do absolutely nothing with the input audio. It is
  4744. mainly useful as a template and for use in analysis / debugging
  4745. tools.
  4746. @c man end AUDIO SINKS
  4747. @chapter Video Filters
  4748. @c man begin VIDEO FILTERS
  4749. When you configure your FFmpeg build, you can disable any of the
  4750. existing filters using @code{--disable-filters}.
  4751. The configure output will show the video filters included in your
  4752. build.
  4753. Below is a description of the currently available video filters.
  4754. @section addroi
  4755. Mark a region of interest in a video frame.
  4756. The frame data is passed through unchanged, but metadata is attached
  4757. to the frame indicating regions of interest which can affect the
  4758. behaviour of later encoding. Multiple regions can be marked by
  4759. applying the filter multiple times.
  4760. @table @option
  4761. @item x
  4762. Region distance in pixels from the left edge of the frame.
  4763. @item y
  4764. Region distance in pixels from the top edge of the frame.
  4765. @item w
  4766. Region width in pixels.
  4767. @item h
  4768. Region height in pixels.
  4769. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4770. and may contain the following variables:
  4771. @table @option
  4772. @item iw
  4773. Width of the input frame.
  4774. @item ih
  4775. Height of the input frame.
  4776. @end table
  4777. @item qoffset
  4778. Quantisation offset to apply within the region.
  4779. This must be a real value in the range -1 to +1. A value of zero
  4780. indicates no quality change. A negative value asks for better quality
  4781. (less quantisation), while a positive value asks for worse quality
  4782. (greater quantisation).
  4783. The range is calibrated so that the extreme values indicate the
  4784. largest possible offset - if the rest of the frame is encoded with the
  4785. worst possible quality, an offset of -1 indicates that this region
  4786. should be encoded with the best possible quality anyway. Intermediate
  4787. values are then interpolated in some codec-dependent way.
  4788. For example, in 10-bit H.264 the quantisation parameter varies between
  4789. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4790. this region should be encoded with a QP around one-tenth of the full
  4791. range better than the rest of the frame. So, if most of the frame
  4792. were to be encoded with a QP of around 30, this region would get a QP
  4793. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4794. An extreme value of -1 would indicate that this region should be
  4795. encoded with the best possible quality regardless of the treatment of
  4796. the rest of the frame - that is, should be encoded at a QP of -12.
  4797. @item clear
  4798. If set to true, remove any existing regions of interest marked on the
  4799. frame before adding the new one.
  4800. @end table
  4801. @subsection Examples
  4802. @itemize
  4803. @item
  4804. Mark the centre quarter of the frame as interesting.
  4805. @example
  4806. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4807. @end example
  4808. @item
  4809. Mark the 100-pixel-wide region on the left edge of the frame as very
  4810. uninteresting (to be encoded at much lower quality than the rest of
  4811. the frame).
  4812. @example
  4813. addroi=0:0:100:ih:+1/5
  4814. @end example
  4815. @end itemize
  4816. @section alphaextract
  4817. Extract the alpha component from the input as a grayscale video. This
  4818. is especially useful with the @var{alphamerge} filter.
  4819. @section alphamerge
  4820. Add or replace the alpha component of the primary input with the
  4821. grayscale value of a second input. This is intended for use with
  4822. @var{alphaextract} to allow the transmission or storage of frame
  4823. sequences that have alpha in a format that doesn't support an alpha
  4824. channel.
  4825. For example, to reconstruct full frames from a normal YUV-encoded video
  4826. and a separate video created with @var{alphaextract}, you might use:
  4827. @example
  4828. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4829. @end example
  4830. Since this filter is designed for reconstruction, it operates on frame
  4831. sequences without considering timestamps, and terminates when either
  4832. input reaches end of stream. This will cause problems if your encoding
  4833. pipeline drops frames. If you're trying to apply an image as an
  4834. overlay to a video stream, consider the @var{overlay} filter instead.
  4835. @section amplify
  4836. Amplify differences between current pixel and pixels of adjacent frames in
  4837. same pixel location.
  4838. This filter accepts the following options:
  4839. @table @option
  4840. @item radius
  4841. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4842. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4843. @item factor
  4844. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4845. @item threshold
  4846. Set threshold for difference amplification. Any difference greater or equal to
  4847. this value will not alter source pixel. Default is 10.
  4848. Allowed range is from 0 to 65535.
  4849. @item tolerance
  4850. Set tolerance for difference amplification. Any difference lower to
  4851. this value will not alter source pixel. Default is 0.
  4852. Allowed range is from 0 to 65535.
  4853. @item low
  4854. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4855. This option controls maximum possible value that will decrease source pixel value.
  4856. @item high
  4857. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4858. This option controls maximum possible value that will increase source pixel value.
  4859. @item planes
  4860. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4861. @end table
  4862. @subsection Commands
  4863. This filter supports the following @ref{commands} that corresponds to option of same name:
  4864. @table @option
  4865. @item factor
  4866. @item threshold
  4867. @item tolerance
  4868. @item low
  4869. @item high
  4870. @item planes
  4871. @end table
  4872. @section ass
  4873. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4874. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4875. Substation Alpha) subtitles files.
  4876. This filter accepts the following option in addition to the common options from
  4877. the @ref{subtitles} filter:
  4878. @table @option
  4879. @item shaping
  4880. Set the shaping engine
  4881. Available values are:
  4882. @table @samp
  4883. @item auto
  4884. The default libass shaping engine, which is the best available.
  4885. @item simple
  4886. Fast, font-agnostic shaper that can do only substitutions
  4887. @item complex
  4888. Slower shaper using OpenType for substitutions and positioning
  4889. @end table
  4890. The default is @code{auto}.
  4891. @end table
  4892. @section atadenoise
  4893. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4894. The filter accepts the following options:
  4895. @table @option
  4896. @item 0a
  4897. Set threshold A for 1st plane. Default is 0.02.
  4898. Valid range is 0 to 0.3.
  4899. @item 0b
  4900. Set threshold B for 1st plane. Default is 0.04.
  4901. Valid range is 0 to 5.
  4902. @item 1a
  4903. Set threshold A for 2nd plane. Default is 0.02.
  4904. Valid range is 0 to 0.3.
  4905. @item 1b
  4906. Set threshold B for 2nd plane. Default is 0.04.
  4907. Valid range is 0 to 5.
  4908. @item 2a
  4909. Set threshold A for 3rd plane. Default is 0.02.
  4910. Valid range is 0 to 0.3.
  4911. @item 2b
  4912. Set threshold B for 3rd plane. Default is 0.04.
  4913. Valid range is 0 to 5.
  4914. Threshold A is designed to react on abrupt changes in the input signal and
  4915. threshold B is designed to react on continuous changes in the input signal.
  4916. @item s
  4917. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4918. number in range [5, 129].
  4919. @item p
  4920. Set what planes of frame filter will use for averaging. Default is all.
  4921. @item a
  4922. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  4923. Alternatively can be set to @code{s} serial.
  4924. Parallel can be faster then serial, while other way around is never true.
  4925. Parallel will abort early on first change being greater then thresholds, while serial
  4926. will continue processing other side of frames if they are equal or bellow thresholds.
  4927. @end table
  4928. @subsection Commands
  4929. This filter supports same @ref{commands} as options except option @code{s}.
  4930. The command accepts the same syntax of the corresponding option.
  4931. @section avgblur
  4932. Apply average blur filter.
  4933. The filter accepts the following options:
  4934. @table @option
  4935. @item sizeX
  4936. Set horizontal radius size.
  4937. @item planes
  4938. Set which planes to filter. By default all planes are filtered.
  4939. @item sizeY
  4940. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4941. Default is @code{0}.
  4942. @end table
  4943. @subsection Commands
  4944. This filter supports same commands as options.
  4945. The command accepts the same syntax of the corresponding option.
  4946. If the specified expression is not valid, it is kept at its current
  4947. value.
  4948. @section bbox
  4949. Compute the bounding box for the non-black pixels in the input frame
  4950. luminance plane.
  4951. This filter computes the bounding box containing all the pixels with a
  4952. luminance value greater than the minimum allowed value.
  4953. The parameters describing the bounding box are printed on the filter
  4954. log.
  4955. The filter accepts the following option:
  4956. @table @option
  4957. @item min_val
  4958. Set the minimal luminance value. Default is @code{16}.
  4959. @end table
  4960. @section bilateral
  4961. Apply bilateral filter, spatial smoothing while preserving edges.
  4962. The filter accepts the following options:
  4963. @table @option
  4964. @item sigmaS
  4965. Set sigma of gaussian function to calculate spatial weight.
  4966. Allowed range is 0 to 10. Default is 0.1.
  4967. @item sigmaR
  4968. Set sigma of gaussian function to calculate range weight.
  4969. Allowed range is 0 to 1. Default is 0.1.
  4970. @item planes
  4971. Set planes to filter. Default is first only.
  4972. @end table
  4973. @section bitplanenoise
  4974. Show and measure bit plane noise.
  4975. The filter accepts the following options:
  4976. @table @option
  4977. @item bitplane
  4978. Set which plane to analyze. Default is @code{1}.
  4979. @item filter
  4980. Filter out noisy pixels from @code{bitplane} set above.
  4981. Default is disabled.
  4982. @end table
  4983. @section blackdetect
  4984. Detect video intervals that are (almost) completely black. Can be
  4985. useful to detect chapter transitions, commercials, or invalid
  4986. recordings. Output lines contains the time for the start, end and
  4987. duration of the detected black interval expressed in seconds.
  4988. In order to display the output lines, you need to set the loglevel at
  4989. least to the AV_LOG_INFO value.
  4990. The filter accepts the following options:
  4991. @table @option
  4992. @item black_min_duration, d
  4993. Set the minimum detected black duration expressed in seconds. It must
  4994. be a non-negative floating point number.
  4995. Default value is 2.0.
  4996. @item picture_black_ratio_th, pic_th
  4997. Set the threshold for considering a picture "black".
  4998. Express the minimum value for the ratio:
  4999. @example
  5000. @var{nb_black_pixels} / @var{nb_pixels}
  5001. @end example
  5002. for which a picture is considered black.
  5003. Default value is 0.98.
  5004. @item pixel_black_th, pix_th
  5005. Set the threshold for considering a pixel "black".
  5006. The threshold expresses the maximum pixel luminance value for which a
  5007. pixel is considered "black". The provided value is scaled according to
  5008. the following equation:
  5009. @example
  5010. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5011. @end example
  5012. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5013. the input video format, the range is [0-255] for YUV full-range
  5014. formats and [16-235] for YUV non full-range formats.
  5015. Default value is 0.10.
  5016. @end table
  5017. The following example sets the maximum pixel threshold to the minimum
  5018. value, and detects only black intervals of 2 or more seconds:
  5019. @example
  5020. blackdetect=d=2:pix_th=0.00
  5021. @end example
  5022. @section blackframe
  5023. Detect frames that are (almost) completely black. Can be useful to
  5024. detect chapter transitions or commercials. Output lines consist of
  5025. the frame number of the detected frame, the percentage of blackness,
  5026. the position in the file if known or -1 and the timestamp in seconds.
  5027. In order to display the output lines, you need to set the loglevel at
  5028. least to the AV_LOG_INFO value.
  5029. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5030. The value represents the percentage of pixels in the picture that
  5031. are below the threshold value.
  5032. It accepts the following parameters:
  5033. @table @option
  5034. @item amount
  5035. The percentage of the pixels that have to be below the threshold; it defaults to
  5036. @code{98}.
  5037. @item threshold, thresh
  5038. The threshold below which a pixel value is considered black; it defaults to
  5039. @code{32}.
  5040. @end table
  5041. @section blend, tblend
  5042. Blend two video frames into each other.
  5043. The @code{blend} filter takes two input streams and outputs one
  5044. stream, the first input is the "top" layer and second input is
  5045. "bottom" layer. By default, the output terminates when the longest input terminates.
  5046. The @code{tblend} (time blend) filter takes two consecutive frames
  5047. from one single stream, and outputs the result obtained by blending
  5048. the new frame on top of the old frame.
  5049. A description of the accepted options follows.
  5050. @table @option
  5051. @item c0_mode
  5052. @item c1_mode
  5053. @item c2_mode
  5054. @item c3_mode
  5055. @item all_mode
  5056. Set blend mode for specific pixel component or all pixel components in case
  5057. of @var{all_mode}. Default value is @code{normal}.
  5058. Available values for component modes are:
  5059. @table @samp
  5060. @item addition
  5061. @item grainmerge
  5062. @item and
  5063. @item average
  5064. @item burn
  5065. @item darken
  5066. @item difference
  5067. @item grainextract
  5068. @item divide
  5069. @item dodge
  5070. @item freeze
  5071. @item exclusion
  5072. @item extremity
  5073. @item glow
  5074. @item hardlight
  5075. @item hardmix
  5076. @item heat
  5077. @item lighten
  5078. @item linearlight
  5079. @item multiply
  5080. @item multiply128
  5081. @item negation
  5082. @item normal
  5083. @item or
  5084. @item overlay
  5085. @item phoenix
  5086. @item pinlight
  5087. @item reflect
  5088. @item screen
  5089. @item softlight
  5090. @item subtract
  5091. @item vividlight
  5092. @item xor
  5093. @end table
  5094. @item c0_opacity
  5095. @item c1_opacity
  5096. @item c2_opacity
  5097. @item c3_opacity
  5098. @item all_opacity
  5099. Set blend opacity for specific pixel component or all pixel components in case
  5100. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5101. @item c0_expr
  5102. @item c1_expr
  5103. @item c2_expr
  5104. @item c3_expr
  5105. @item all_expr
  5106. Set blend expression for specific pixel component or all pixel components in case
  5107. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5108. The expressions can use the following variables:
  5109. @table @option
  5110. @item N
  5111. The sequential number of the filtered frame, starting from @code{0}.
  5112. @item X
  5113. @item Y
  5114. the coordinates of the current sample
  5115. @item W
  5116. @item H
  5117. the width and height of currently filtered plane
  5118. @item SW
  5119. @item SH
  5120. Width and height scale for the plane being filtered. It is the
  5121. ratio between the dimensions of the current plane to the luma plane,
  5122. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5123. the luma plane and @code{0.5,0.5} for the chroma planes.
  5124. @item T
  5125. Time of the current frame, expressed in seconds.
  5126. @item TOP, A
  5127. Value of pixel component at current location for first video frame (top layer).
  5128. @item BOTTOM, B
  5129. Value of pixel component at current location for second video frame (bottom layer).
  5130. @end table
  5131. @end table
  5132. The @code{blend} filter also supports the @ref{framesync} options.
  5133. @subsection Examples
  5134. @itemize
  5135. @item
  5136. Apply transition from bottom layer to top layer in first 10 seconds:
  5137. @example
  5138. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5139. @end example
  5140. @item
  5141. Apply linear horizontal transition from top layer to bottom layer:
  5142. @example
  5143. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5144. @end example
  5145. @item
  5146. Apply 1x1 checkerboard effect:
  5147. @example
  5148. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5149. @end example
  5150. @item
  5151. Apply uncover left effect:
  5152. @example
  5153. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5154. @end example
  5155. @item
  5156. Apply uncover down effect:
  5157. @example
  5158. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5159. @end example
  5160. @item
  5161. Apply uncover up-left effect:
  5162. @example
  5163. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5164. @end example
  5165. @item
  5166. Split diagonally video and shows top and bottom layer on each side:
  5167. @example
  5168. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5169. @end example
  5170. @item
  5171. Display differences between the current and the previous frame:
  5172. @example
  5173. tblend=all_mode=grainextract
  5174. @end example
  5175. @end itemize
  5176. @section bm3d
  5177. Denoise frames using Block-Matching 3D algorithm.
  5178. The filter accepts the following options.
  5179. @table @option
  5180. @item sigma
  5181. Set denoising strength. Default value is 1.
  5182. Allowed range is from 0 to 999.9.
  5183. The denoising algorithm is very sensitive to sigma, so adjust it
  5184. according to the source.
  5185. @item block
  5186. Set local patch size. This sets dimensions in 2D.
  5187. @item bstep
  5188. Set sliding step for processing blocks. Default value is 4.
  5189. Allowed range is from 1 to 64.
  5190. Smaller values allows processing more reference blocks and is slower.
  5191. @item group
  5192. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5193. When set to 1, no block matching is done. Larger values allows more blocks
  5194. in single group.
  5195. Allowed range is from 1 to 256.
  5196. @item range
  5197. Set radius for search block matching. Default is 9.
  5198. Allowed range is from 1 to INT32_MAX.
  5199. @item mstep
  5200. Set step between two search locations for block matching. Default is 1.
  5201. Allowed range is from 1 to 64. Smaller is slower.
  5202. @item thmse
  5203. Set threshold of mean square error for block matching. Valid range is 0 to
  5204. INT32_MAX.
  5205. @item hdthr
  5206. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5207. Larger values results in stronger hard-thresholding filtering in frequency
  5208. domain.
  5209. @item estim
  5210. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5211. Default is @code{basic}.
  5212. @item ref
  5213. If enabled, filter will use 2nd stream for block matching.
  5214. Default is disabled for @code{basic} value of @var{estim} option,
  5215. and always enabled if value of @var{estim} is @code{final}.
  5216. @item planes
  5217. Set planes to filter. Default is all available except alpha.
  5218. @end table
  5219. @subsection Examples
  5220. @itemize
  5221. @item
  5222. Basic filtering with bm3d:
  5223. @example
  5224. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5225. @end example
  5226. @item
  5227. Same as above, but filtering only luma:
  5228. @example
  5229. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5230. @end example
  5231. @item
  5232. Same as above, but with both estimation modes:
  5233. @example
  5234. 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
  5235. @end example
  5236. @item
  5237. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5238. @example
  5239. 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
  5240. @end example
  5241. @end itemize
  5242. @section boxblur
  5243. Apply a boxblur algorithm to the input video.
  5244. It accepts the following parameters:
  5245. @table @option
  5246. @item luma_radius, lr
  5247. @item luma_power, lp
  5248. @item chroma_radius, cr
  5249. @item chroma_power, cp
  5250. @item alpha_radius, ar
  5251. @item alpha_power, ap
  5252. @end table
  5253. A description of the accepted options follows.
  5254. @table @option
  5255. @item luma_radius, lr
  5256. @item chroma_radius, cr
  5257. @item alpha_radius, ar
  5258. Set an expression for the box radius in pixels used for blurring the
  5259. corresponding input plane.
  5260. The radius value must be a non-negative number, and must not be
  5261. greater than the value of the expression @code{min(w,h)/2} for the
  5262. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5263. planes.
  5264. Default value for @option{luma_radius} is "2". If not specified,
  5265. @option{chroma_radius} and @option{alpha_radius} default to the
  5266. corresponding value set for @option{luma_radius}.
  5267. The expressions can contain the following constants:
  5268. @table @option
  5269. @item w
  5270. @item h
  5271. The input width and height in pixels.
  5272. @item cw
  5273. @item ch
  5274. The input chroma image width and height in pixels.
  5275. @item hsub
  5276. @item vsub
  5277. The horizontal and vertical chroma subsample values. For example, for the
  5278. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5279. @end table
  5280. @item luma_power, lp
  5281. @item chroma_power, cp
  5282. @item alpha_power, ap
  5283. Specify how many times the boxblur filter is applied to the
  5284. corresponding plane.
  5285. Default value for @option{luma_power} is 2. If not specified,
  5286. @option{chroma_power} and @option{alpha_power} default to the
  5287. corresponding value set for @option{luma_power}.
  5288. A value of 0 will disable the effect.
  5289. @end table
  5290. @subsection Examples
  5291. @itemize
  5292. @item
  5293. Apply a boxblur filter with the luma, chroma, and alpha radii
  5294. set to 2:
  5295. @example
  5296. boxblur=luma_radius=2:luma_power=1
  5297. boxblur=2:1
  5298. @end example
  5299. @item
  5300. Set the luma radius to 2, and alpha and chroma radius to 0:
  5301. @example
  5302. boxblur=2:1:cr=0:ar=0
  5303. @end example
  5304. @item
  5305. Set the luma and chroma radii to a fraction of the video dimension:
  5306. @example
  5307. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5308. @end example
  5309. @end itemize
  5310. @section bwdif
  5311. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5312. Deinterlacing Filter").
  5313. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5314. interpolation algorithms.
  5315. It accepts the following parameters:
  5316. @table @option
  5317. @item mode
  5318. The interlacing mode to adopt. It accepts one of the following values:
  5319. @table @option
  5320. @item 0, send_frame
  5321. Output one frame for each frame.
  5322. @item 1, send_field
  5323. Output one frame for each field.
  5324. @end table
  5325. The default value is @code{send_field}.
  5326. @item parity
  5327. The picture field parity assumed for the input interlaced video. It accepts one
  5328. of the following values:
  5329. @table @option
  5330. @item 0, tff
  5331. Assume the top field is first.
  5332. @item 1, bff
  5333. Assume the bottom field is first.
  5334. @item -1, auto
  5335. Enable automatic detection of field parity.
  5336. @end table
  5337. The default value is @code{auto}.
  5338. If the interlacing is unknown or the decoder does not export this information,
  5339. top field first will be assumed.
  5340. @item deint
  5341. Specify which frames to deinterlace. Accepts one of the following
  5342. values:
  5343. @table @option
  5344. @item 0, all
  5345. Deinterlace all frames.
  5346. @item 1, interlaced
  5347. Only deinterlace frames marked as interlaced.
  5348. @end table
  5349. The default value is @code{all}.
  5350. @end table
  5351. @section chromahold
  5352. Remove all color information for all colors except for certain one.
  5353. The filter accepts the following options:
  5354. @table @option
  5355. @item color
  5356. The color which will not be replaced with neutral chroma.
  5357. @item similarity
  5358. Similarity percentage with the above color.
  5359. 0.01 matches only the exact key color, while 1.0 matches everything.
  5360. @item blend
  5361. Blend percentage.
  5362. 0.0 makes pixels either fully gray, or not gray at all.
  5363. Higher values result in more preserved color.
  5364. @item yuv
  5365. Signals that the color passed is already in YUV instead of RGB.
  5366. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5367. This can be used to pass exact YUV values as hexadecimal numbers.
  5368. @end table
  5369. @subsection Commands
  5370. This filter supports same @ref{commands} as options.
  5371. The command accepts the same syntax of the corresponding option.
  5372. If the specified expression is not valid, it is kept at its current
  5373. value.
  5374. @section chromakey
  5375. YUV colorspace color/chroma keying.
  5376. The filter accepts the following options:
  5377. @table @option
  5378. @item color
  5379. The color which will be replaced with transparency.
  5380. @item similarity
  5381. Similarity percentage with the key color.
  5382. 0.01 matches only the exact key color, while 1.0 matches everything.
  5383. @item blend
  5384. Blend percentage.
  5385. 0.0 makes pixels either fully transparent, or not transparent at all.
  5386. Higher values result in semi-transparent pixels, with a higher transparency
  5387. the more similar the pixels color is to the key color.
  5388. @item yuv
  5389. Signals that the color passed is already in YUV instead of RGB.
  5390. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5391. This can be used to pass exact YUV values as hexadecimal numbers.
  5392. @end table
  5393. @subsection Commands
  5394. This filter supports same @ref{commands} as options.
  5395. The command accepts the same syntax of the corresponding option.
  5396. If the specified expression is not valid, it is kept at its current
  5397. value.
  5398. @subsection Examples
  5399. @itemize
  5400. @item
  5401. Make every green pixel in the input image transparent:
  5402. @example
  5403. ffmpeg -i input.png -vf chromakey=green out.png
  5404. @end example
  5405. @item
  5406. Overlay a greenscreen-video on top of a static black background.
  5407. @example
  5408. 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
  5409. @end example
  5410. @end itemize
  5411. @section chromashift
  5412. Shift chroma pixels horizontally and/or vertically.
  5413. The filter accepts the following options:
  5414. @table @option
  5415. @item cbh
  5416. Set amount to shift chroma-blue horizontally.
  5417. @item cbv
  5418. Set amount to shift chroma-blue vertically.
  5419. @item crh
  5420. Set amount to shift chroma-red horizontally.
  5421. @item crv
  5422. Set amount to shift chroma-red vertically.
  5423. @item edge
  5424. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5425. @end table
  5426. @subsection Commands
  5427. This filter supports the all above options as @ref{commands}.
  5428. @section ciescope
  5429. Display CIE color diagram with pixels overlaid onto it.
  5430. The filter accepts the following options:
  5431. @table @option
  5432. @item system
  5433. Set color system.
  5434. @table @samp
  5435. @item ntsc, 470m
  5436. @item ebu, 470bg
  5437. @item smpte
  5438. @item 240m
  5439. @item apple
  5440. @item widergb
  5441. @item cie1931
  5442. @item rec709, hdtv
  5443. @item uhdtv, rec2020
  5444. @item dcip3
  5445. @end table
  5446. @item cie
  5447. Set CIE system.
  5448. @table @samp
  5449. @item xyy
  5450. @item ucs
  5451. @item luv
  5452. @end table
  5453. @item gamuts
  5454. Set what gamuts to draw.
  5455. See @code{system} option for available values.
  5456. @item size, s
  5457. Set ciescope size, by default set to 512.
  5458. @item intensity, i
  5459. Set intensity used to map input pixel values to CIE diagram.
  5460. @item contrast
  5461. Set contrast used to draw tongue colors that are out of active color system gamut.
  5462. @item corrgamma
  5463. Correct gamma displayed on scope, by default enabled.
  5464. @item showwhite
  5465. Show white point on CIE diagram, by default disabled.
  5466. @item gamma
  5467. Set input gamma. Used only with XYZ input color space.
  5468. @end table
  5469. @section codecview
  5470. Visualize information exported by some codecs.
  5471. Some codecs can export information through frames using side-data or other
  5472. means. For example, some MPEG based codecs export motion vectors through the
  5473. @var{export_mvs} flag in the codec @option{flags2} option.
  5474. The filter accepts the following option:
  5475. @table @option
  5476. @item mv
  5477. Set motion vectors to visualize.
  5478. Available flags for @var{mv} are:
  5479. @table @samp
  5480. @item pf
  5481. forward predicted MVs of P-frames
  5482. @item bf
  5483. forward predicted MVs of B-frames
  5484. @item bb
  5485. backward predicted MVs of B-frames
  5486. @end table
  5487. @item qp
  5488. Display quantization parameters using the chroma planes.
  5489. @item mv_type, mvt
  5490. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5491. Available flags for @var{mv_type} are:
  5492. @table @samp
  5493. @item fp
  5494. forward predicted MVs
  5495. @item bp
  5496. backward predicted MVs
  5497. @end table
  5498. @item frame_type, ft
  5499. Set frame type to visualize motion vectors of.
  5500. Available flags for @var{frame_type} are:
  5501. @table @samp
  5502. @item if
  5503. intra-coded frames (I-frames)
  5504. @item pf
  5505. predicted frames (P-frames)
  5506. @item bf
  5507. bi-directionally predicted frames (B-frames)
  5508. @end table
  5509. @end table
  5510. @subsection Examples
  5511. @itemize
  5512. @item
  5513. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5514. @example
  5515. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5516. @end example
  5517. @item
  5518. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5519. @example
  5520. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5521. @end example
  5522. @end itemize
  5523. @section colorbalance
  5524. Modify intensity of primary colors (red, green and blue) of input frames.
  5525. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5526. regions for the red-cyan, green-magenta or blue-yellow balance.
  5527. A positive adjustment value shifts the balance towards the primary color, a negative
  5528. value towards the complementary color.
  5529. The filter accepts the following options:
  5530. @table @option
  5531. @item rs
  5532. @item gs
  5533. @item bs
  5534. Adjust red, green and blue shadows (darkest pixels).
  5535. @item rm
  5536. @item gm
  5537. @item bm
  5538. Adjust red, green and blue midtones (medium pixels).
  5539. @item rh
  5540. @item gh
  5541. @item bh
  5542. Adjust red, green and blue highlights (brightest pixels).
  5543. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5544. @item pl
  5545. Preserve lightness when changing color balance. Default is disabled.
  5546. @end table
  5547. @subsection Examples
  5548. @itemize
  5549. @item
  5550. Add red color cast to shadows:
  5551. @example
  5552. colorbalance=rs=.3
  5553. @end example
  5554. @end itemize
  5555. @subsection Commands
  5556. This filter supports the all above options as @ref{commands}.
  5557. @section colorchannelmixer
  5558. Adjust video input frames by re-mixing color channels.
  5559. This filter modifies a color channel by adding the values associated to
  5560. the other channels of the same pixels. For example if the value to
  5561. modify is red, the output value will be:
  5562. @example
  5563. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5564. @end example
  5565. The filter accepts the following options:
  5566. @table @option
  5567. @item rr
  5568. @item rg
  5569. @item rb
  5570. @item ra
  5571. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5572. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5573. @item gr
  5574. @item gg
  5575. @item gb
  5576. @item ga
  5577. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5578. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5579. @item br
  5580. @item bg
  5581. @item bb
  5582. @item ba
  5583. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5584. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5585. @item ar
  5586. @item ag
  5587. @item ab
  5588. @item aa
  5589. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5590. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5591. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5592. @end table
  5593. @subsection Examples
  5594. @itemize
  5595. @item
  5596. Convert source to grayscale:
  5597. @example
  5598. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5599. @end example
  5600. @item
  5601. Simulate sepia tones:
  5602. @example
  5603. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5604. @end example
  5605. @end itemize
  5606. @subsection Commands
  5607. This filter supports the all above options as @ref{commands}.
  5608. @section colorkey
  5609. RGB colorspace color keying.
  5610. The filter accepts the following options:
  5611. @table @option
  5612. @item color
  5613. The color which will be replaced with transparency.
  5614. @item similarity
  5615. Similarity percentage with the key color.
  5616. 0.01 matches only the exact key color, while 1.0 matches everything.
  5617. @item blend
  5618. Blend percentage.
  5619. 0.0 makes pixels either fully transparent, or not transparent at all.
  5620. Higher values result in semi-transparent pixels, with a higher transparency
  5621. the more similar the pixels color is to the key color.
  5622. @end table
  5623. @subsection Examples
  5624. @itemize
  5625. @item
  5626. Make every green pixel in the input image transparent:
  5627. @example
  5628. ffmpeg -i input.png -vf colorkey=green out.png
  5629. @end example
  5630. @item
  5631. Overlay a greenscreen-video on top of a static background image.
  5632. @example
  5633. 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
  5634. @end example
  5635. @end itemize
  5636. @section colorhold
  5637. Remove all color information for all RGB colors except for certain one.
  5638. The filter accepts the following options:
  5639. @table @option
  5640. @item color
  5641. The color which will not be replaced with neutral gray.
  5642. @item similarity
  5643. Similarity percentage with the above color.
  5644. 0.01 matches only the exact key color, while 1.0 matches everything.
  5645. @item blend
  5646. Blend percentage. 0.0 makes pixels fully gray.
  5647. Higher values result in more preserved color.
  5648. @end table
  5649. @section colorlevels
  5650. Adjust video input frames using levels.
  5651. The filter accepts the following options:
  5652. @table @option
  5653. @item rimin
  5654. @item gimin
  5655. @item bimin
  5656. @item aimin
  5657. Adjust red, green, blue and alpha input black point.
  5658. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5659. @item rimax
  5660. @item gimax
  5661. @item bimax
  5662. @item aimax
  5663. Adjust red, green, blue and alpha input white point.
  5664. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5665. Input levels are used to lighten highlights (bright tones), darken shadows
  5666. (dark tones), change the balance of bright and dark tones.
  5667. @item romin
  5668. @item gomin
  5669. @item bomin
  5670. @item aomin
  5671. Adjust red, green, blue and alpha output black point.
  5672. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5673. @item romax
  5674. @item gomax
  5675. @item bomax
  5676. @item aomax
  5677. Adjust red, green, blue and alpha output white point.
  5678. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5679. Output levels allows manual selection of a constrained output level range.
  5680. @end table
  5681. @subsection Examples
  5682. @itemize
  5683. @item
  5684. Make video output darker:
  5685. @example
  5686. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5687. @end example
  5688. @item
  5689. Increase contrast:
  5690. @example
  5691. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5692. @end example
  5693. @item
  5694. Make video output lighter:
  5695. @example
  5696. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5697. @end example
  5698. @item
  5699. Increase brightness:
  5700. @example
  5701. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5702. @end example
  5703. @end itemize
  5704. @section colormatrix
  5705. Convert color matrix.
  5706. The filter accepts the following options:
  5707. @table @option
  5708. @item src
  5709. @item dst
  5710. Specify the source and destination color matrix. Both values must be
  5711. specified.
  5712. The accepted values are:
  5713. @table @samp
  5714. @item bt709
  5715. BT.709
  5716. @item fcc
  5717. FCC
  5718. @item bt601
  5719. BT.601
  5720. @item bt470
  5721. BT.470
  5722. @item bt470bg
  5723. BT.470BG
  5724. @item smpte170m
  5725. SMPTE-170M
  5726. @item smpte240m
  5727. SMPTE-240M
  5728. @item bt2020
  5729. BT.2020
  5730. @end table
  5731. @end table
  5732. For example to convert from BT.601 to SMPTE-240M, use the command:
  5733. @example
  5734. colormatrix=bt601:smpte240m
  5735. @end example
  5736. @section colorspace
  5737. Convert colorspace, transfer characteristics or color primaries.
  5738. Input video needs to have an even size.
  5739. The filter accepts the following options:
  5740. @table @option
  5741. @anchor{all}
  5742. @item all
  5743. Specify all color properties at once.
  5744. The accepted values are:
  5745. @table @samp
  5746. @item bt470m
  5747. BT.470M
  5748. @item bt470bg
  5749. BT.470BG
  5750. @item bt601-6-525
  5751. BT.601-6 525
  5752. @item bt601-6-625
  5753. BT.601-6 625
  5754. @item bt709
  5755. BT.709
  5756. @item smpte170m
  5757. SMPTE-170M
  5758. @item smpte240m
  5759. SMPTE-240M
  5760. @item bt2020
  5761. BT.2020
  5762. @end table
  5763. @anchor{space}
  5764. @item space
  5765. Specify output colorspace.
  5766. The accepted values are:
  5767. @table @samp
  5768. @item bt709
  5769. BT.709
  5770. @item fcc
  5771. FCC
  5772. @item bt470bg
  5773. BT.470BG or BT.601-6 625
  5774. @item smpte170m
  5775. SMPTE-170M or BT.601-6 525
  5776. @item smpte240m
  5777. SMPTE-240M
  5778. @item ycgco
  5779. YCgCo
  5780. @item bt2020ncl
  5781. BT.2020 with non-constant luminance
  5782. @end table
  5783. @anchor{trc}
  5784. @item trc
  5785. Specify output transfer characteristics.
  5786. The accepted values are:
  5787. @table @samp
  5788. @item bt709
  5789. BT.709
  5790. @item bt470m
  5791. BT.470M
  5792. @item bt470bg
  5793. BT.470BG
  5794. @item gamma22
  5795. Constant gamma of 2.2
  5796. @item gamma28
  5797. Constant gamma of 2.8
  5798. @item smpte170m
  5799. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5800. @item smpte240m
  5801. SMPTE-240M
  5802. @item srgb
  5803. SRGB
  5804. @item iec61966-2-1
  5805. iec61966-2-1
  5806. @item iec61966-2-4
  5807. iec61966-2-4
  5808. @item xvycc
  5809. xvycc
  5810. @item bt2020-10
  5811. BT.2020 for 10-bits content
  5812. @item bt2020-12
  5813. BT.2020 for 12-bits content
  5814. @end table
  5815. @anchor{primaries}
  5816. @item primaries
  5817. Specify output color primaries.
  5818. The accepted values are:
  5819. @table @samp
  5820. @item bt709
  5821. BT.709
  5822. @item bt470m
  5823. BT.470M
  5824. @item bt470bg
  5825. BT.470BG or BT.601-6 625
  5826. @item smpte170m
  5827. SMPTE-170M or BT.601-6 525
  5828. @item smpte240m
  5829. SMPTE-240M
  5830. @item film
  5831. film
  5832. @item smpte431
  5833. SMPTE-431
  5834. @item smpte432
  5835. SMPTE-432
  5836. @item bt2020
  5837. BT.2020
  5838. @item jedec-p22
  5839. JEDEC P22 phosphors
  5840. @end table
  5841. @anchor{range}
  5842. @item range
  5843. Specify output color range.
  5844. The accepted values are:
  5845. @table @samp
  5846. @item tv
  5847. TV (restricted) range
  5848. @item mpeg
  5849. MPEG (restricted) range
  5850. @item pc
  5851. PC (full) range
  5852. @item jpeg
  5853. JPEG (full) range
  5854. @end table
  5855. @item format
  5856. Specify output color format.
  5857. The accepted values are:
  5858. @table @samp
  5859. @item yuv420p
  5860. YUV 4:2:0 planar 8-bits
  5861. @item yuv420p10
  5862. YUV 4:2:0 planar 10-bits
  5863. @item yuv420p12
  5864. YUV 4:2:0 planar 12-bits
  5865. @item yuv422p
  5866. YUV 4:2:2 planar 8-bits
  5867. @item yuv422p10
  5868. YUV 4:2:2 planar 10-bits
  5869. @item yuv422p12
  5870. YUV 4:2:2 planar 12-bits
  5871. @item yuv444p
  5872. YUV 4:4:4 planar 8-bits
  5873. @item yuv444p10
  5874. YUV 4:4:4 planar 10-bits
  5875. @item yuv444p12
  5876. YUV 4:4:4 planar 12-bits
  5877. @end table
  5878. @item fast
  5879. Do a fast conversion, which skips gamma/primary correction. This will take
  5880. significantly less CPU, but will be mathematically incorrect. To get output
  5881. compatible with that produced by the colormatrix filter, use fast=1.
  5882. @item dither
  5883. Specify dithering mode.
  5884. The accepted values are:
  5885. @table @samp
  5886. @item none
  5887. No dithering
  5888. @item fsb
  5889. Floyd-Steinberg dithering
  5890. @end table
  5891. @item wpadapt
  5892. Whitepoint adaptation mode.
  5893. The accepted values are:
  5894. @table @samp
  5895. @item bradford
  5896. Bradford whitepoint adaptation
  5897. @item vonkries
  5898. von Kries whitepoint adaptation
  5899. @item identity
  5900. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5901. @end table
  5902. @item iall
  5903. Override all input properties at once. Same accepted values as @ref{all}.
  5904. @item ispace
  5905. Override input colorspace. Same accepted values as @ref{space}.
  5906. @item iprimaries
  5907. Override input color primaries. Same accepted values as @ref{primaries}.
  5908. @item itrc
  5909. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5910. @item irange
  5911. Override input color range. Same accepted values as @ref{range}.
  5912. @end table
  5913. The filter converts the transfer characteristics, color space and color
  5914. primaries to the specified user values. The output value, if not specified,
  5915. is set to a default value based on the "all" property. If that property is
  5916. also not specified, the filter will log an error. The output color range and
  5917. format default to the same value as the input color range and format. The
  5918. input transfer characteristics, color space, color primaries and color range
  5919. should be set on the input data. If any of these are missing, the filter will
  5920. log an error and no conversion will take place.
  5921. For example to convert the input to SMPTE-240M, use the command:
  5922. @example
  5923. colorspace=smpte240m
  5924. @end example
  5925. @section convolution
  5926. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5927. The filter accepts the following options:
  5928. @table @option
  5929. @item 0m
  5930. @item 1m
  5931. @item 2m
  5932. @item 3m
  5933. Set matrix for each plane.
  5934. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5935. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5936. @item 0rdiv
  5937. @item 1rdiv
  5938. @item 2rdiv
  5939. @item 3rdiv
  5940. Set multiplier for calculated value for each plane.
  5941. If unset or 0, it will be sum of all matrix elements.
  5942. @item 0bias
  5943. @item 1bias
  5944. @item 2bias
  5945. @item 3bias
  5946. Set bias for each plane. This value is added to the result of the multiplication.
  5947. Useful for making the overall image brighter or darker. Default is 0.0.
  5948. @item 0mode
  5949. @item 1mode
  5950. @item 2mode
  5951. @item 3mode
  5952. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5953. Default is @var{square}.
  5954. @end table
  5955. @subsection Examples
  5956. @itemize
  5957. @item
  5958. Apply sharpen:
  5959. @example
  5960. 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"
  5961. @end example
  5962. @item
  5963. Apply blur:
  5964. @example
  5965. 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"
  5966. @end example
  5967. @item
  5968. Apply edge enhance:
  5969. @example
  5970. 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"
  5971. @end example
  5972. @item
  5973. Apply edge detect:
  5974. @example
  5975. 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"
  5976. @end example
  5977. @item
  5978. Apply laplacian edge detector which includes diagonals:
  5979. @example
  5980. 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"
  5981. @end example
  5982. @item
  5983. Apply emboss:
  5984. @example
  5985. 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"
  5986. @end example
  5987. @end itemize
  5988. @section convolve
  5989. Apply 2D convolution of video stream in frequency domain using second stream
  5990. as impulse.
  5991. The filter accepts the following options:
  5992. @table @option
  5993. @item planes
  5994. Set which planes to process.
  5995. @item impulse
  5996. Set which impulse video frames will be processed, can be @var{first}
  5997. or @var{all}. Default is @var{all}.
  5998. @end table
  5999. The @code{convolve} filter also supports the @ref{framesync} options.
  6000. @section copy
  6001. Copy the input video source unchanged to the output. This is mainly useful for
  6002. testing purposes.
  6003. @anchor{coreimage}
  6004. @section coreimage
  6005. Video filtering on GPU using Apple's CoreImage API on OSX.
  6006. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6007. processed by video hardware. However, software-based OpenGL implementations
  6008. exist which means there is no guarantee for hardware processing. It depends on
  6009. the respective OSX.
  6010. There are many filters and image generators provided by Apple that come with a
  6011. large variety of options. The filter has to be referenced by its name along
  6012. with its options.
  6013. The coreimage filter accepts the following options:
  6014. @table @option
  6015. @item list_filters
  6016. List all available filters and generators along with all their respective
  6017. options as well as possible minimum and maximum values along with the default
  6018. values.
  6019. @example
  6020. list_filters=true
  6021. @end example
  6022. @item filter
  6023. Specify all filters by their respective name and options.
  6024. Use @var{list_filters} to determine all valid filter names and options.
  6025. Numerical options are specified by a float value and are automatically clamped
  6026. to their respective value range. Vector and color options have to be specified
  6027. by a list of space separated float values. Character escaping has to be done.
  6028. A special option name @code{default} is available to use default options for a
  6029. filter.
  6030. It is required to specify either @code{default} or at least one of the filter options.
  6031. All omitted options are used with their default values.
  6032. The syntax of the filter string is as follows:
  6033. @example
  6034. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6035. @end example
  6036. @item output_rect
  6037. Specify a rectangle where the output of the filter chain is copied into the
  6038. input image. It is given by a list of space separated float values:
  6039. @example
  6040. output_rect=x\ y\ width\ height
  6041. @end example
  6042. If not given, the output rectangle equals the dimensions of the input image.
  6043. The output rectangle is automatically cropped at the borders of the input
  6044. image. Negative values are valid for each component.
  6045. @example
  6046. output_rect=25\ 25\ 100\ 100
  6047. @end example
  6048. @end table
  6049. Several filters can be chained for successive processing without GPU-HOST
  6050. transfers allowing for fast processing of complex filter chains.
  6051. Currently, only filters with zero (generators) or exactly one (filters) input
  6052. image and one output image are supported. Also, transition filters are not yet
  6053. usable as intended.
  6054. Some filters generate output images with additional padding depending on the
  6055. respective filter kernel. The padding is automatically removed to ensure the
  6056. filter output has the same size as the input image.
  6057. For image generators, the size of the output image is determined by the
  6058. previous output image of the filter chain or the input image of the whole
  6059. filterchain, respectively. The generators do not use the pixel information of
  6060. this image to generate their output. However, the generated output is
  6061. blended onto this image, resulting in partial or complete coverage of the
  6062. output image.
  6063. The @ref{coreimagesrc} video source can be used for generating input images
  6064. which are directly fed into the filter chain. By using it, providing input
  6065. images by another video source or an input video is not required.
  6066. @subsection Examples
  6067. @itemize
  6068. @item
  6069. List all filters available:
  6070. @example
  6071. coreimage=list_filters=true
  6072. @end example
  6073. @item
  6074. Use the CIBoxBlur filter with default options to blur an image:
  6075. @example
  6076. coreimage=filter=CIBoxBlur@@default
  6077. @end example
  6078. @item
  6079. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6080. its center at 100x100 and a radius of 50 pixels:
  6081. @example
  6082. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6083. @end example
  6084. @item
  6085. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6086. given as complete and escaped command-line for Apple's standard bash shell:
  6087. @example
  6088. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6089. @end example
  6090. @end itemize
  6091. @section cover_rect
  6092. Cover a rectangular object
  6093. It accepts the following options:
  6094. @table @option
  6095. @item cover
  6096. Filepath of the optional cover image, needs to be in yuv420.
  6097. @item mode
  6098. Set covering mode.
  6099. It accepts the following values:
  6100. @table @samp
  6101. @item cover
  6102. cover it by the supplied image
  6103. @item blur
  6104. cover it by interpolating the surrounding pixels
  6105. @end table
  6106. Default value is @var{blur}.
  6107. @end table
  6108. @subsection Examples
  6109. @itemize
  6110. @item
  6111. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6112. @example
  6113. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6114. @end example
  6115. @end itemize
  6116. @section crop
  6117. Crop the input video to given dimensions.
  6118. It accepts the following parameters:
  6119. @table @option
  6120. @item w, out_w
  6121. The width of the output video. It defaults to @code{iw}.
  6122. This expression is evaluated only once during the filter
  6123. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6124. @item h, out_h
  6125. The height of the output video. It defaults to @code{ih}.
  6126. This expression is evaluated only once during the filter
  6127. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6128. @item x
  6129. The horizontal position, in the input video, of the left edge of the output
  6130. video. It defaults to @code{(in_w-out_w)/2}.
  6131. This expression is evaluated per-frame.
  6132. @item y
  6133. The vertical position, in the input video, of the top edge of the output video.
  6134. It defaults to @code{(in_h-out_h)/2}.
  6135. This expression is evaluated per-frame.
  6136. @item keep_aspect
  6137. If set to 1 will force the output display aspect ratio
  6138. to be the same of the input, by changing the output sample aspect
  6139. ratio. It defaults to 0.
  6140. @item exact
  6141. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6142. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6143. It defaults to 0.
  6144. @end table
  6145. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6146. expressions containing the following constants:
  6147. @table @option
  6148. @item x
  6149. @item y
  6150. The computed values for @var{x} and @var{y}. They are evaluated for
  6151. each new frame.
  6152. @item in_w
  6153. @item in_h
  6154. The input width and height.
  6155. @item iw
  6156. @item ih
  6157. These are the same as @var{in_w} and @var{in_h}.
  6158. @item out_w
  6159. @item out_h
  6160. The output (cropped) width and height.
  6161. @item ow
  6162. @item oh
  6163. These are the same as @var{out_w} and @var{out_h}.
  6164. @item a
  6165. same as @var{iw} / @var{ih}
  6166. @item sar
  6167. input sample aspect ratio
  6168. @item dar
  6169. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6170. @item hsub
  6171. @item vsub
  6172. horizontal and vertical chroma subsample values. For example for the
  6173. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6174. @item n
  6175. The number of the input frame, starting from 0.
  6176. @item pos
  6177. the position in the file of the input frame, NAN if unknown
  6178. @item t
  6179. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6180. @end table
  6181. The expression for @var{out_w} may depend on the value of @var{out_h},
  6182. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6183. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6184. evaluated after @var{out_w} and @var{out_h}.
  6185. The @var{x} and @var{y} parameters specify the expressions for the
  6186. position of the top-left corner of the output (non-cropped) area. They
  6187. are evaluated for each frame. If the evaluated value is not valid, it
  6188. is approximated to the nearest valid value.
  6189. The expression for @var{x} may depend on @var{y}, and the expression
  6190. for @var{y} may depend on @var{x}.
  6191. @subsection Examples
  6192. @itemize
  6193. @item
  6194. Crop area with size 100x100 at position (12,34).
  6195. @example
  6196. crop=100:100:12:34
  6197. @end example
  6198. Using named options, the example above becomes:
  6199. @example
  6200. crop=w=100:h=100:x=12:y=34
  6201. @end example
  6202. @item
  6203. Crop the central input area with size 100x100:
  6204. @example
  6205. crop=100:100
  6206. @end example
  6207. @item
  6208. Crop the central input area with size 2/3 of the input video:
  6209. @example
  6210. crop=2/3*in_w:2/3*in_h
  6211. @end example
  6212. @item
  6213. Crop the input video central square:
  6214. @example
  6215. crop=out_w=in_h
  6216. crop=in_h
  6217. @end example
  6218. @item
  6219. Delimit the rectangle with the top-left corner placed at position
  6220. 100:100 and the right-bottom corner corresponding to the right-bottom
  6221. corner of the input image.
  6222. @example
  6223. crop=in_w-100:in_h-100:100:100
  6224. @end example
  6225. @item
  6226. Crop 10 pixels from the left and right borders, and 20 pixels from
  6227. the top and bottom borders
  6228. @example
  6229. crop=in_w-2*10:in_h-2*20
  6230. @end example
  6231. @item
  6232. Keep only the bottom right quarter of the input image:
  6233. @example
  6234. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6235. @end example
  6236. @item
  6237. Crop height for getting Greek harmony:
  6238. @example
  6239. crop=in_w:1/PHI*in_w
  6240. @end example
  6241. @item
  6242. Apply trembling effect:
  6243. @example
  6244. 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)
  6245. @end example
  6246. @item
  6247. Apply erratic camera effect depending on timestamp:
  6248. @example
  6249. 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)"
  6250. @end example
  6251. @item
  6252. Set x depending on the value of y:
  6253. @example
  6254. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6255. @end example
  6256. @end itemize
  6257. @subsection Commands
  6258. This filter supports the following commands:
  6259. @table @option
  6260. @item w, out_w
  6261. @item h, out_h
  6262. @item x
  6263. @item y
  6264. Set width/height of the output video and the horizontal/vertical position
  6265. in the input video.
  6266. The command accepts the same syntax of the corresponding option.
  6267. If the specified expression is not valid, it is kept at its current
  6268. value.
  6269. @end table
  6270. @section cropdetect
  6271. Auto-detect the crop size.
  6272. It calculates the necessary cropping parameters and prints the
  6273. recommended parameters via the logging system. The detected dimensions
  6274. correspond to the non-black area of the input video.
  6275. It accepts the following parameters:
  6276. @table @option
  6277. @item limit
  6278. Set higher black value threshold, which can be optionally specified
  6279. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6280. value greater to the set value is considered non-black. It defaults to 24.
  6281. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6282. on the bitdepth of the pixel format.
  6283. @item round
  6284. The value which the width/height should be divisible by. It defaults to
  6285. 16. The offset is automatically adjusted to center the video. Use 2 to
  6286. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6287. encoding to most video codecs.
  6288. @item reset_count, reset
  6289. Set the counter that determines after how many frames cropdetect will
  6290. reset the previously detected largest video area and start over to
  6291. detect the current optimal crop area. Default value is 0.
  6292. This can be useful when channel logos distort the video area. 0
  6293. indicates 'never reset', and returns the largest area encountered during
  6294. playback.
  6295. @end table
  6296. @anchor{cue}
  6297. @section cue
  6298. Delay video filtering until a given wallclock timestamp. The filter first
  6299. passes on @option{preroll} amount of frames, then it buffers at most
  6300. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6301. it forwards the buffered frames and also any subsequent frames coming in its
  6302. input.
  6303. The filter can be used synchronize the output of multiple ffmpeg processes for
  6304. realtime output devices like decklink. By putting the delay in the filtering
  6305. chain and pre-buffering frames the process can pass on data to output almost
  6306. immediately after the target wallclock timestamp is reached.
  6307. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6308. some use cases.
  6309. @table @option
  6310. @item cue
  6311. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6312. @item preroll
  6313. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6314. @item buffer
  6315. The maximum duration of content to buffer before waiting for the cue expressed
  6316. in seconds. Default is 0.
  6317. @end table
  6318. @anchor{curves}
  6319. @section curves
  6320. Apply color adjustments using curves.
  6321. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6322. component (red, green and blue) has its values defined by @var{N} key points
  6323. tied from each other using a smooth curve. The x-axis represents the pixel
  6324. values from the input frame, and the y-axis the new pixel values to be set for
  6325. the output frame.
  6326. By default, a component curve is defined by the two points @var{(0;0)} and
  6327. @var{(1;1)}. This creates a straight line where each original pixel value is
  6328. "adjusted" to its own value, which means no change to the image.
  6329. The filter allows you to redefine these two points and add some more. A new
  6330. curve (using a natural cubic spline interpolation) will be define to pass
  6331. smoothly through all these new coordinates. The new defined points needs to be
  6332. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6333. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6334. the vector spaces, the values will be clipped accordingly.
  6335. The filter accepts the following options:
  6336. @table @option
  6337. @item preset
  6338. Select one of the available color presets. This option can be used in addition
  6339. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6340. options takes priority on the preset values.
  6341. Available presets are:
  6342. @table @samp
  6343. @item none
  6344. @item color_negative
  6345. @item cross_process
  6346. @item darker
  6347. @item increase_contrast
  6348. @item lighter
  6349. @item linear_contrast
  6350. @item medium_contrast
  6351. @item negative
  6352. @item strong_contrast
  6353. @item vintage
  6354. @end table
  6355. Default is @code{none}.
  6356. @item master, m
  6357. Set the master key points. These points will define a second pass mapping. It
  6358. is sometimes called a "luminance" or "value" mapping. It can be used with
  6359. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6360. post-processing LUT.
  6361. @item red, r
  6362. Set the key points for the red component.
  6363. @item green, g
  6364. Set the key points for the green component.
  6365. @item blue, b
  6366. Set the key points for the blue component.
  6367. @item all
  6368. Set the key points for all components (not including master).
  6369. Can be used in addition to the other key points component
  6370. options. In this case, the unset component(s) will fallback on this
  6371. @option{all} setting.
  6372. @item psfile
  6373. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6374. @item plot
  6375. Save Gnuplot script of the curves in specified file.
  6376. @end table
  6377. To avoid some filtergraph syntax conflicts, each key points list need to be
  6378. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6379. @subsection Examples
  6380. @itemize
  6381. @item
  6382. Increase slightly the middle level of blue:
  6383. @example
  6384. curves=blue='0/0 0.5/0.58 1/1'
  6385. @end example
  6386. @item
  6387. Vintage effect:
  6388. @example
  6389. 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'
  6390. @end example
  6391. Here we obtain the following coordinates for each components:
  6392. @table @var
  6393. @item red
  6394. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6395. @item green
  6396. @code{(0;0) (0.50;0.48) (1;1)}
  6397. @item blue
  6398. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6399. @end table
  6400. @item
  6401. The previous example can also be achieved with the associated built-in preset:
  6402. @example
  6403. curves=preset=vintage
  6404. @end example
  6405. @item
  6406. Or simply:
  6407. @example
  6408. curves=vintage
  6409. @end example
  6410. @item
  6411. Use a Photoshop preset and redefine the points of the green component:
  6412. @example
  6413. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6414. @end example
  6415. @item
  6416. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6417. and @command{gnuplot}:
  6418. @example
  6419. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6420. gnuplot -p /tmp/curves.plt
  6421. @end example
  6422. @end itemize
  6423. @section datascope
  6424. Video data analysis filter.
  6425. This filter shows hexadecimal pixel values of part of video.
  6426. The filter accepts the following options:
  6427. @table @option
  6428. @item size, s
  6429. Set output video size.
  6430. @item x
  6431. Set x offset from where to pick pixels.
  6432. @item y
  6433. Set y offset from where to pick pixels.
  6434. @item mode
  6435. Set scope mode, can be one of the following:
  6436. @table @samp
  6437. @item mono
  6438. Draw hexadecimal pixel values with white color on black background.
  6439. @item color
  6440. Draw hexadecimal pixel values with input video pixel color on black
  6441. background.
  6442. @item color2
  6443. Draw hexadecimal pixel values on color background picked from input video,
  6444. the text color is picked in such way so its always visible.
  6445. @end table
  6446. @item axis
  6447. Draw rows and columns numbers on left and top of video.
  6448. @item opacity
  6449. Set background opacity.
  6450. @item format
  6451. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6452. @end table
  6453. @section dctdnoiz
  6454. Denoise frames using 2D DCT (frequency domain filtering).
  6455. This filter is not designed for real time.
  6456. The filter accepts the following options:
  6457. @table @option
  6458. @item sigma, s
  6459. Set the noise sigma constant.
  6460. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6461. coefficient (absolute value) below this threshold with be dropped.
  6462. If you need a more advanced filtering, see @option{expr}.
  6463. Default is @code{0}.
  6464. @item overlap
  6465. Set number overlapping pixels for each block. Since the filter can be slow, you
  6466. may want to reduce this value, at the cost of a less effective filter and the
  6467. risk of various artefacts.
  6468. If the overlapping value doesn't permit processing the whole input width or
  6469. height, a warning will be displayed and according borders won't be denoised.
  6470. Default value is @var{blocksize}-1, which is the best possible setting.
  6471. @item expr, e
  6472. Set the coefficient factor expression.
  6473. For each coefficient of a DCT block, this expression will be evaluated as a
  6474. multiplier value for the coefficient.
  6475. If this is option is set, the @option{sigma} option will be ignored.
  6476. The absolute value of the coefficient can be accessed through the @var{c}
  6477. variable.
  6478. @item n
  6479. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6480. @var{blocksize}, which is the width and height of the processed blocks.
  6481. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6482. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6483. on the speed processing. Also, a larger block size does not necessarily means a
  6484. better de-noising.
  6485. @end table
  6486. @subsection Examples
  6487. Apply a denoise with a @option{sigma} of @code{4.5}:
  6488. @example
  6489. dctdnoiz=4.5
  6490. @end example
  6491. The same operation can be achieved using the expression system:
  6492. @example
  6493. dctdnoiz=e='gte(c, 4.5*3)'
  6494. @end example
  6495. Violent denoise using a block size of @code{16x16}:
  6496. @example
  6497. dctdnoiz=15:n=4
  6498. @end example
  6499. @section deband
  6500. Remove banding artifacts from input video.
  6501. It works by replacing banded pixels with average value of referenced pixels.
  6502. The filter accepts the following options:
  6503. @table @option
  6504. @item 1thr
  6505. @item 2thr
  6506. @item 3thr
  6507. @item 4thr
  6508. Set banding detection threshold for each plane. Default is 0.02.
  6509. Valid range is 0.00003 to 0.5.
  6510. If difference between current pixel and reference pixel is less than threshold,
  6511. it will be considered as banded.
  6512. @item range, r
  6513. Banding detection range in pixels. Default is 16. If positive, random number
  6514. in range 0 to set value will be used. If negative, exact absolute value
  6515. will be used.
  6516. The range defines square of four pixels around current pixel.
  6517. @item direction, d
  6518. Set direction in radians from which four pixel will be compared. If positive,
  6519. random direction from 0 to set direction will be picked. If negative, exact of
  6520. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6521. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6522. column.
  6523. @item blur, b
  6524. If enabled, current pixel is compared with average value of all four
  6525. surrounding pixels. The default is enabled. If disabled current pixel is
  6526. compared with all four surrounding pixels. The pixel is considered banded
  6527. if only all four differences with surrounding pixels are less than threshold.
  6528. @item coupling, c
  6529. If enabled, current pixel is changed if and only if all pixel components are banded,
  6530. e.g. banding detection threshold is triggered for all color components.
  6531. The default is disabled.
  6532. @end table
  6533. @section deblock
  6534. Remove blocking artifacts from input video.
  6535. The filter accepts the following options:
  6536. @table @option
  6537. @item filter
  6538. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6539. This controls what kind of deblocking is applied.
  6540. @item block
  6541. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6542. @item alpha
  6543. @item beta
  6544. @item gamma
  6545. @item delta
  6546. Set blocking detection thresholds. Allowed range is 0 to 1.
  6547. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6548. Using higher threshold gives more deblocking strength.
  6549. Setting @var{alpha} controls threshold detection at exact edge of block.
  6550. Remaining options controls threshold detection near the edge. Each one for
  6551. below/above or left/right. Setting any of those to @var{0} disables
  6552. deblocking.
  6553. @item planes
  6554. Set planes to filter. Default is to filter all available planes.
  6555. @end table
  6556. @subsection Examples
  6557. @itemize
  6558. @item
  6559. Deblock using weak filter and block size of 4 pixels.
  6560. @example
  6561. deblock=filter=weak:block=4
  6562. @end example
  6563. @item
  6564. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6565. deblocking more edges.
  6566. @example
  6567. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6568. @end example
  6569. @item
  6570. Similar as above, but filter only first plane.
  6571. @example
  6572. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6573. @end example
  6574. @item
  6575. Similar as above, but filter only second and third plane.
  6576. @example
  6577. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6578. @end example
  6579. @end itemize
  6580. @anchor{decimate}
  6581. @section decimate
  6582. Drop duplicated frames at regular intervals.
  6583. The filter accepts the following options:
  6584. @table @option
  6585. @item cycle
  6586. Set the number of frames from which one will be dropped. Setting this to
  6587. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6588. Default is @code{5}.
  6589. @item dupthresh
  6590. Set the threshold for duplicate detection. If the difference metric for a frame
  6591. is less than or equal to this value, then it is declared as duplicate. Default
  6592. is @code{1.1}
  6593. @item scthresh
  6594. Set scene change threshold. Default is @code{15}.
  6595. @item blockx
  6596. @item blocky
  6597. Set the size of the x and y-axis blocks used during metric calculations.
  6598. Larger blocks give better noise suppression, but also give worse detection of
  6599. small movements. Must be a power of two. Default is @code{32}.
  6600. @item ppsrc
  6601. Mark main input as a pre-processed input and activate clean source input
  6602. stream. This allows the input to be pre-processed with various filters to help
  6603. the metrics calculation while keeping the frame selection lossless. When set to
  6604. @code{1}, the first stream is for the pre-processed input, and the second
  6605. stream is the clean source from where the kept frames are chosen. Default is
  6606. @code{0}.
  6607. @item chroma
  6608. Set whether or not chroma is considered in the metric calculations. Default is
  6609. @code{1}.
  6610. @end table
  6611. @section deconvolve
  6612. Apply 2D deconvolution of video stream in frequency domain using second stream
  6613. as impulse.
  6614. The filter accepts the following options:
  6615. @table @option
  6616. @item planes
  6617. Set which planes to process.
  6618. @item impulse
  6619. Set which impulse video frames will be processed, can be @var{first}
  6620. or @var{all}. Default is @var{all}.
  6621. @item noise
  6622. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6623. and height are not same and not power of 2 or if stream prior to convolving
  6624. had noise.
  6625. @end table
  6626. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6627. @section dedot
  6628. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6629. It accepts the following options:
  6630. @table @option
  6631. @item m
  6632. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6633. @var{rainbows} for cross-color reduction.
  6634. @item lt
  6635. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6636. @item tl
  6637. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6638. @item tc
  6639. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6640. @item ct
  6641. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6642. @end table
  6643. @section deflate
  6644. Apply deflate effect to the video.
  6645. This filter replaces the pixel by the local(3x3) average by taking into account
  6646. only values lower than the pixel.
  6647. It accepts the following options:
  6648. @table @option
  6649. @item threshold0
  6650. @item threshold1
  6651. @item threshold2
  6652. @item threshold3
  6653. Limit the maximum change for each plane, default is 65535.
  6654. If 0, plane will remain unchanged.
  6655. @end table
  6656. @subsection Commands
  6657. This filter supports the all above options as @ref{commands}.
  6658. @section deflicker
  6659. Remove temporal frame luminance variations.
  6660. It accepts the following options:
  6661. @table @option
  6662. @item size, s
  6663. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6664. @item mode, m
  6665. Set averaging mode to smooth temporal luminance variations.
  6666. Available values are:
  6667. @table @samp
  6668. @item am
  6669. Arithmetic mean
  6670. @item gm
  6671. Geometric mean
  6672. @item hm
  6673. Harmonic mean
  6674. @item qm
  6675. Quadratic mean
  6676. @item cm
  6677. Cubic mean
  6678. @item pm
  6679. Power mean
  6680. @item median
  6681. Median
  6682. @end table
  6683. @item bypass
  6684. Do not actually modify frame. Useful when one only wants metadata.
  6685. @end table
  6686. @section dejudder
  6687. Remove judder produced by partially interlaced telecined content.
  6688. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6689. source was partially telecined content then the output of @code{pullup,dejudder}
  6690. will have a variable frame rate. May change the recorded frame rate of the
  6691. container. Aside from that change, this filter will not affect constant frame
  6692. rate video.
  6693. The option available in this filter is:
  6694. @table @option
  6695. @item cycle
  6696. Specify the length of the window over which the judder repeats.
  6697. Accepts any integer greater than 1. Useful values are:
  6698. @table @samp
  6699. @item 4
  6700. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6701. @item 5
  6702. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6703. @item 20
  6704. If a mixture of the two.
  6705. @end table
  6706. The default is @samp{4}.
  6707. @end table
  6708. @section delogo
  6709. Suppress a TV station logo by a simple interpolation of the surrounding
  6710. pixels. Just set a rectangle covering the logo and watch it disappear
  6711. (and sometimes something even uglier appear - your mileage may vary).
  6712. It accepts the following parameters:
  6713. @table @option
  6714. @item x
  6715. @item y
  6716. Specify the top left corner coordinates of the logo. They must be
  6717. specified.
  6718. @item w
  6719. @item h
  6720. Specify the width and height of the logo to clear. They must be
  6721. specified.
  6722. @item band, t
  6723. Specify the thickness of the fuzzy edge of the rectangle (added to
  6724. @var{w} and @var{h}). The default value is 1. This option is
  6725. deprecated, setting higher values should no longer be necessary and
  6726. is not recommended.
  6727. @item show
  6728. When set to 1, a green rectangle is drawn on the screen to simplify
  6729. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6730. The default value is 0.
  6731. The rectangle is drawn on the outermost pixels which will be (partly)
  6732. replaced with interpolated values. The values of the next pixels
  6733. immediately outside this rectangle in each direction will be used to
  6734. compute the interpolated pixel values inside the rectangle.
  6735. @end table
  6736. @subsection Examples
  6737. @itemize
  6738. @item
  6739. Set a rectangle covering the area with top left corner coordinates 0,0
  6740. and size 100x77, and a band of size 10:
  6741. @example
  6742. delogo=x=0:y=0:w=100:h=77:band=10
  6743. @end example
  6744. @end itemize
  6745. @section derain
  6746. Remove the rain in the input image/video by applying the derain methods based on
  6747. convolutional neural networks. Supported models:
  6748. @itemize
  6749. @item
  6750. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6751. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6752. @end itemize
  6753. Training as well as model generation scripts are provided in
  6754. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6755. Native model files (.model) can be generated from TensorFlow model
  6756. files (.pb) by using tools/python/convert.py
  6757. The filter accepts the following options:
  6758. @table @option
  6759. @item filter_type
  6760. Specify which filter to use. This option accepts the following values:
  6761. @table @samp
  6762. @item derain
  6763. Derain filter. To conduct derain filter, you need to use a derain model.
  6764. @item dehaze
  6765. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6766. @end table
  6767. Default value is @samp{derain}.
  6768. @item dnn_backend
  6769. Specify which DNN backend to use for model loading and execution. This option accepts
  6770. the following values:
  6771. @table @samp
  6772. @item native
  6773. Native implementation of DNN loading and execution.
  6774. @item tensorflow
  6775. TensorFlow backend. To enable this backend you
  6776. need to install the TensorFlow for C library (see
  6777. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6778. @code{--enable-libtensorflow}
  6779. @end table
  6780. Default value is @samp{native}.
  6781. @item model
  6782. Set path to model file specifying network architecture and its parameters.
  6783. Note that different backends use different file formats. TensorFlow and native
  6784. backend can load files for only its format.
  6785. @end table
  6786. @section deshake
  6787. Attempt to fix small changes in horizontal and/or vertical shift. This
  6788. filter helps remove camera shake from hand-holding a camera, bumping a
  6789. tripod, moving on a vehicle, etc.
  6790. The filter accepts the following options:
  6791. @table @option
  6792. @item x
  6793. @item y
  6794. @item w
  6795. @item h
  6796. Specify a rectangular area where to limit the search for motion
  6797. vectors.
  6798. If desired the search for motion vectors can be limited to a
  6799. rectangular area of the frame defined by its top left corner, width
  6800. and height. These parameters have the same meaning as the drawbox
  6801. filter which can be used to visualise the position of the bounding
  6802. box.
  6803. This is useful when simultaneous movement of subjects within the frame
  6804. might be confused for camera motion by the motion vector search.
  6805. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6806. then the full frame is used. This allows later options to be set
  6807. without specifying the bounding box for the motion vector search.
  6808. Default - search the whole frame.
  6809. @item rx
  6810. @item ry
  6811. Specify the maximum extent of movement in x and y directions in the
  6812. range 0-64 pixels. Default 16.
  6813. @item edge
  6814. Specify how to generate pixels to fill blanks at the edge of the
  6815. frame. Available values are:
  6816. @table @samp
  6817. @item blank, 0
  6818. Fill zeroes at blank locations
  6819. @item original, 1
  6820. Original image at blank locations
  6821. @item clamp, 2
  6822. Extruded edge value at blank locations
  6823. @item mirror, 3
  6824. Mirrored edge at blank locations
  6825. @end table
  6826. Default value is @samp{mirror}.
  6827. @item blocksize
  6828. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6829. default 8.
  6830. @item contrast
  6831. Specify the contrast threshold for blocks. Only blocks with more than
  6832. the specified contrast (difference between darkest and lightest
  6833. pixels) will be considered. Range 1-255, default 125.
  6834. @item search
  6835. Specify the search strategy. Available values are:
  6836. @table @samp
  6837. @item exhaustive, 0
  6838. Set exhaustive search
  6839. @item less, 1
  6840. Set less exhaustive search.
  6841. @end table
  6842. Default value is @samp{exhaustive}.
  6843. @item filename
  6844. If set then a detailed log of the motion search is written to the
  6845. specified file.
  6846. @end table
  6847. @section despill
  6848. Remove unwanted contamination of foreground colors, caused by reflected color of
  6849. greenscreen or bluescreen.
  6850. This filter accepts the following options:
  6851. @table @option
  6852. @item type
  6853. Set what type of despill to use.
  6854. @item mix
  6855. Set how spillmap will be generated.
  6856. @item expand
  6857. Set how much to get rid of still remaining spill.
  6858. @item red
  6859. Controls amount of red in spill area.
  6860. @item green
  6861. Controls amount of green in spill area.
  6862. Should be -1 for greenscreen.
  6863. @item blue
  6864. Controls amount of blue in spill area.
  6865. Should be -1 for bluescreen.
  6866. @item brightness
  6867. Controls brightness of spill area, preserving colors.
  6868. @item alpha
  6869. Modify alpha from generated spillmap.
  6870. @end table
  6871. @section detelecine
  6872. Apply an exact inverse of the telecine operation. It requires a predefined
  6873. pattern specified using the pattern option which must be the same as that passed
  6874. to the telecine filter.
  6875. This filter accepts the following options:
  6876. @table @option
  6877. @item first_field
  6878. @table @samp
  6879. @item top, t
  6880. top field first
  6881. @item bottom, b
  6882. bottom field first
  6883. The default value is @code{top}.
  6884. @end table
  6885. @item pattern
  6886. A string of numbers representing the pulldown pattern you wish to apply.
  6887. The default value is @code{23}.
  6888. @item start_frame
  6889. A number representing position of the first frame with respect to the telecine
  6890. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6891. @end table
  6892. @section dilation
  6893. Apply dilation effect to the video.
  6894. This filter replaces the pixel by the local(3x3) maximum.
  6895. It accepts the following options:
  6896. @table @option
  6897. @item threshold0
  6898. @item threshold1
  6899. @item threshold2
  6900. @item threshold3
  6901. Limit the maximum change for each plane, default is 65535.
  6902. If 0, plane will remain unchanged.
  6903. @item coordinates
  6904. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6905. pixels are used.
  6906. Flags to local 3x3 coordinates maps like this:
  6907. 1 2 3
  6908. 4 5
  6909. 6 7 8
  6910. @end table
  6911. @subsection Commands
  6912. This filter supports the all above options as @ref{commands}.
  6913. @section displace
  6914. Displace pixels as indicated by second and third input stream.
  6915. It takes three input streams and outputs one stream, the first input is the
  6916. source, and second and third input are displacement maps.
  6917. The second input specifies how much to displace pixels along the
  6918. x-axis, while the third input specifies how much to displace pixels
  6919. along the y-axis.
  6920. If one of displacement map streams terminates, last frame from that
  6921. displacement map will be used.
  6922. Note that once generated, displacements maps can be reused over and over again.
  6923. A description of the accepted options follows.
  6924. @table @option
  6925. @item edge
  6926. Set displace behavior for pixels that are out of range.
  6927. Available values are:
  6928. @table @samp
  6929. @item blank
  6930. Missing pixels are replaced by black pixels.
  6931. @item smear
  6932. Adjacent pixels will spread out to replace missing pixels.
  6933. @item wrap
  6934. Out of range pixels are wrapped so they point to pixels of other side.
  6935. @item mirror
  6936. Out of range pixels will be replaced with mirrored pixels.
  6937. @end table
  6938. Default is @samp{smear}.
  6939. @end table
  6940. @subsection Examples
  6941. @itemize
  6942. @item
  6943. Add ripple effect to rgb input of video size hd720:
  6944. @example
  6945. 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
  6946. @end example
  6947. @item
  6948. Add wave effect to rgb input of video size hd720:
  6949. @example
  6950. 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
  6951. @end example
  6952. @end itemize
  6953. @section dnn_processing
  6954. Do image processing with deep neural networks. Currently only AVFrame with RGB24
  6955. and BGR24 are supported, more formats will be added later.
  6956. The filter accepts the following options:
  6957. @table @option
  6958. @item dnn_backend
  6959. Specify which DNN backend to use for model loading and execution. This option accepts
  6960. the following values:
  6961. @table @samp
  6962. @item native
  6963. Native implementation of DNN loading and execution.
  6964. @item tensorflow
  6965. TensorFlow backend. To enable this backend you
  6966. need to install the TensorFlow for C library (see
  6967. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6968. @code{--enable-libtensorflow}
  6969. @end table
  6970. Default value is @samp{native}.
  6971. @item model
  6972. Set path to model file specifying network architecture and its parameters.
  6973. Note that different backends use different file formats. TensorFlow and native
  6974. backend can load files for only its format.
  6975. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  6976. @item input
  6977. Set the input name of the dnn network.
  6978. @item output
  6979. Set the output name of the dnn network.
  6980. @item fmt
  6981. Set the pixel format for the Frame. Allowed values are @code{AV_PIX_FMT_RGB24}, and @code{AV_PIX_FMT_BGR24}.
  6982. Default value is @code{AV_PIX_FMT_RGB24}.
  6983. @end table
  6984. @section drawbox
  6985. Draw a colored box on the input image.
  6986. It accepts the following parameters:
  6987. @table @option
  6988. @item x
  6989. @item y
  6990. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6991. @item width, w
  6992. @item height, h
  6993. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6994. the input width and height. It defaults to 0.
  6995. @item color, c
  6996. Specify the color of the box to write. For the general syntax of this option,
  6997. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6998. value @code{invert} is used, the box edge color is the same as the
  6999. video with inverted luma.
  7000. @item thickness, t
  7001. The expression which sets the thickness of the box edge.
  7002. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7003. See below for the list of accepted constants.
  7004. @item replace
  7005. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7006. will overwrite the video's color and alpha pixels.
  7007. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7008. @end table
  7009. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7010. following constants:
  7011. @table @option
  7012. @item dar
  7013. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7014. @item hsub
  7015. @item vsub
  7016. horizontal and vertical chroma subsample values. For example for the
  7017. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7018. @item in_h, ih
  7019. @item in_w, iw
  7020. The input width and height.
  7021. @item sar
  7022. The input sample aspect ratio.
  7023. @item x
  7024. @item y
  7025. The x and y offset coordinates where the box is drawn.
  7026. @item w
  7027. @item h
  7028. The width and height of the drawn box.
  7029. @item t
  7030. The thickness of the drawn box.
  7031. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7032. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7033. @end table
  7034. @subsection Examples
  7035. @itemize
  7036. @item
  7037. Draw a black box around the edge of the input image:
  7038. @example
  7039. drawbox
  7040. @end example
  7041. @item
  7042. Draw a box with color red and an opacity of 50%:
  7043. @example
  7044. drawbox=10:20:200:60:red@@0.5
  7045. @end example
  7046. The previous example can be specified as:
  7047. @example
  7048. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7049. @end example
  7050. @item
  7051. Fill the box with pink color:
  7052. @example
  7053. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7054. @end example
  7055. @item
  7056. Draw a 2-pixel red 2.40:1 mask:
  7057. @example
  7058. 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
  7059. @end example
  7060. @end itemize
  7061. @subsection Commands
  7062. This filter supports same commands as options.
  7063. The command accepts the same syntax of the corresponding option.
  7064. If the specified expression is not valid, it is kept at its current
  7065. value.
  7066. @anchor{drawgraph}
  7067. @section drawgraph
  7068. Draw a graph using input video metadata.
  7069. It accepts the following parameters:
  7070. @table @option
  7071. @item m1
  7072. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7073. @item fg1
  7074. Set 1st foreground color expression.
  7075. @item m2
  7076. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7077. @item fg2
  7078. Set 2nd foreground color expression.
  7079. @item m3
  7080. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7081. @item fg3
  7082. Set 3rd foreground color expression.
  7083. @item m4
  7084. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7085. @item fg4
  7086. Set 4th foreground color expression.
  7087. @item min
  7088. Set minimal value of metadata value.
  7089. @item max
  7090. Set maximal value of metadata value.
  7091. @item bg
  7092. Set graph background color. Default is white.
  7093. @item mode
  7094. Set graph mode.
  7095. Available values for mode is:
  7096. @table @samp
  7097. @item bar
  7098. @item dot
  7099. @item line
  7100. @end table
  7101. Default is @code{line}.
  7102. @item slide
  7103. Set slide mode.
  7104. Available values for slide is:
  7105. @table @samp
  7106. @item frame
  7107. Draw new frame when right border is reached.
  7108. @item replace
  7109. Replace old columns with new ones.
  7110. @item scroll
  7111. Scroll from right to left.
  7112. @item rscroll
  7113. Scroll from left to right.
  7114. @item picture
  7115. Draw single picture.
  7116. @end table
  7117. Default is @code{frame}.
  7118. @item size
  7119. Set size of graph video. For the syntax of this option, check the
  7120. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7121. The default value is @code{900x256}.
  7122. The foreground color expressions can use the following variables:
  7123. @table @option
  7124. @item MIN
  7125. Minimal value of metadata value.
  7126. @item MAX
  7127. Maximal value of metadata value.
  7128. @item VAL
  7129. Current metadata key value.
  7130. @end table
  7131. The color is defined as 0xAABBGGRR.
  7132. @end table
  7133. Example using metadata from @ref{signalstats} filter:
  7134. @example
  7135. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7136. @end example
  7137. Example using metadata from @ref{ebur128} filter:
  7138. @example
  7139. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7140. @end example
  7141. @section drawgrid
  7142. Draw a grid on the input image.
  7143. It accepts the following parameters:
  7144. @table @option
  7145. @item x
  7146. @item y
  7147. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7148. @item width, w
  7149. @item height, h
  7150. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7151. input width and height, respectively, minus @code{thickness}, so image gets
  7152. framed. Default to 0.
  7153. @item color, c
  7154. Specify the color of the grid. For the general syntax of this option,
  7155. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7156. value @code{invert} is used, the grid color is the same as the
  7157. video with inverted luma.
  7158. @item thickness, t
  7159. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7160. See below for the list of accepted constants.
  7161. @item replace
  7162. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7163. will overwrite the video's color and alpha pixels.
  7164. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7165. @end table
  7166. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7167. following constants:
  7168. @table @option
  7169. @item dar
  7170. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7171. @item hsub
  7172. @item vsub
  7173. horizontal and vertical chroma subsample values. For example for the
  7174. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7175. @item in_h, ih
  7176. @item in_w, iw
  7177. The input grid cell width and height.
  7178. @item sar
  7179. The input sample aspect ratio.
  7180. @item x
  7181. @item y
  7182. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7183. @item w
  7184. @item h
  7185. The width and height of the drawn cell.
  7186. @item t
  7187. The thickness of the drawn cell.
  7188. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7189. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7190. @end table
  7191. @subsection Examples
  7192. @itemize
  7193. @item
  7194. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7195. @example
  7196. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7197. @end example
  7198. @item
  7199. Draw a white 3x3 grid with an opacity of 50%:
  7200. @example
  7201. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7202. @end example
  7203. @end itemize
  7204. @subsection Commands
  7205. This filter supports same commands as options.
  7206. The command accepts the same syntax of the corresponding option.
  7207. If the specified expression is not valid, it is kept at its current
  7208. value.
  7209. @anchor{drawtext}
  7210. @section drawtext
  7211. Draw a text string or text from a specified file on top of a video, using the
  7212. libfreetype library.
  7213. To enable compilation of this filter, you need to configure FFmpeg with
  7214. @code{--enable-libfreetype}.
  7215. To enable default font fallback and the @var{font} option you need to
  7216. configure FFmpeg with @code{--enable-libfontconfig}.
  7217. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7218. @code{--enable-libfribidi}.
  7219. @subsection Syntax
  7220. It accepts the following parameters:
  7221. @table @option
  7222. @item box
  7223. Used to draw a box around text using the background color.
  7224. The value must be either 1 (enable) or 0 (disable).
  7225. The default value of @var{box} is 0.
  7226. @item boxborderw
  7227. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7228. The default value of @var{boxborderw} is 0.
  7229. @item boxcolor
  7230. The color to be used for drawing box around text. For the syntax of this
  7231. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7232. The default value of @var{boxcolor} is "white".
  7233. @item line_spacing
  7234. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7235. The default value of @var{line_spacing} is 0.
  7236. @item borderw
  7237. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7238. The default value of @var{borderw} is 0.
  7239. @item bordercolor
  7240. Set the color to be used for drawing border around text. For the syntax of this
  7241. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7242. The default value of @var{bordercolor} is "black".
  7243. @item expansion
  7244. Select how the @var{text} is expanded. Can be either @code{none},
  7245. @code{strftime} (deprecated) or
  7246. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7247. below for details.
  7248. @item basetime
  7249. Set a start time for the count. Value is in microseconds. Only applied
  7250. in the deprecated strftime expansion mode. To emulate in normal expansion
  7251. mode use the @code{pts} function, supplying the start time (in seconds)
  7252. as the second argument.
  7253. @item fix_bounds
  7254. If true, check and fix text coords to avoid clipping.
  7255. @item fontcolor
  7256. The color to be used for drawing fonts. For the syntax of this option, check
  7257. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7258. The default value of @var{fontcolor} is "black".
  7259. @item fontcolor_expr
  7260. String which is expanded the same way as @var{text} to obtain dynamic
  7261. @var{fontcolor} value. By default this option has empty value and is not
  7262. processed. When this option is set, it overrides @var{fontcolor} option.
  7263. @item font
  7264. The font family to be used for drawing text. By default Sans.
  7265. @item fontfile
  7266. The font file to be used for drawing text. The path must be included.
  7267. This parameter is mandatory if the fontconfig support is disabled.
  7268. @item alpha
  7269. Draw the text applying alpha blending. The value can
  7270. be a number between 0.0 and 1.0.
  7271. The expression accepts the same variables @var{x, y} as well.
  7272. The default value is 1.
  7273. Please see @var{fontcolor_expr}.
  7274. @item fontsize
  7275. The font size to be used for drawing text.
  7276. The default value of @var{fontsize} is 16.
  7277. @item text_shaping
  7278. If set to 1, attempt to shape the text (for example, reverse the order of
  7279. right-to-left text and join Arabic characters) before drawing it.
  7280. Otherwise, just draw the text exactly as given.
  7281. By default 1 (if supported).
  7282. @item ft_load_flags
  7283. The flags to be used for loading the fonts.
  7284. The flags map the corresponding flags supported by libfreetype, and are
  7285. a combination of the following values:
  7286. @table @var
  7287. @item default
  7288. @item no_scale
  7289. @item no_hinting
  7290. @item render
  7291. @item no_bitmap
  7292. @item vertical_layout
  7293. @item force_autohint
  7294. @item crop_bitmap
  7295. @item pedantic
  7296. @item ignore_global_advance_width
  7297. @item no_recurse
  7298. @item ignore_transform
  7299. @item monochrome
  7300. @item linear_design
  7301. @item no_autohint
  7302. @end table
  7303. Default value is "default".
  7304. For more information consult the documentation for the FT_LOAD_*
  7305. libfreetype flags.
  7306. @item shadowcolor
  7307. The color to be used for drawing a shadow behind the drawn text. For the
  7308. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7309. ffmpeg-utils manual,ffmpeg-utils}.
  7310. The default value of @var{shadowcolor} is "black".
  7311. @item shadowx
  7312. @item shadowy
  7313. The x and y offsets for the text shadow position with respect to the
  7314. position of the text. They can be either positive or negative
  7315. values. The default value for both is "0".
  7316. @item start_number
  7317. The starting frame number for the n/frame_num variable. The default value
  7318. is "0".
  7319. @item tabsize
  7320. The size in number of spaces to use for rendering the tab.
  7321. Default value is 4.
  7322. @item timecode
  7323. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7324. format. It can be used with or without text parameter. @var{timecode_rate}
  7325. option must be specified.
  7326. @item timecode_rate, rate, r
  7327. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7328. integer. Minimum value is "1".
  7329. Drop-frame timecode is supported for frame rates 30 & 60.
  7330. @item tc24hmax
  7331. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7332. Default is 0 (disabled).
  7333. @item text
  7334. The text string to be drawn. The text must be a sequence of UTF-8
  7335. encoded characters.
  7336. This parameter is mandatory if no file is specified with the parameter
  7337. @var{textfile}.
  7338. @item textfile
  7339. A text file containing text to be drawn. The text must be a sequence
  7340. of UTF-8 encoded characters.
  7341. This parameter is mandatory if no text string is specified with the
  7342. parameter @var{text}.
  7343. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7344. @item reload
  7345. If set to 1, the @var{textfile} will be reloaded before each frame.
  7346. Be sure to update it atomically, or it may be read partially, or even fail.
  7347. @item x
  7348. @item y
  7349. The expressions which specify the offsets where text will be drawn
  7350. within the video frame. They are relative to the top/left border of the
  7351. output image.
  7352. The default value of @var{x} and @var{y} is "0".
  7353. See below for the list of accepted constants and functions.
  7354. @end table
  7355. The parameters for @var{x} and @var{y} are expressions containing the
  7356. following constants and functions:
  7357. @table @option
  7358. @item dar
  7359. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7360. @item hsub
  7361. @item vsub
  7362. horizontal and vertical chroma subsample values. For example for the
  7363. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7364. @item line_h, lh
  7365. the height of each text line
  7366. @item main_h, h, H
  7367. the input height
  7368. @item main_w, w, W
  7369. the input width
  7370. @item max_glyph_a, ascent
  7371. the maximum distance from the baseline to the highest/upper grid
  7372. coordinate used to place a glyph outline point, for all the rendered
  7373. glyphs.
  7374. It is a positive value, due to the grid's orientation with the Y axis
  7375. upwards.
  7376. @item max_glyph_d, descent
  7377. the maximum distance from the baseline to the lowest grid coordinate
  7378. used to place a glyph outline point, for all the rendered glyphs.
  7379. This is a negative value, due to the grid's orientation, with the Y axis
  7380. upwards.
  7381. @item max_glyph_h
  7382. maximum glyph height, that is the maximum height for all the glyphs
  7383. contained in the rendered text, it is equivalent to @var{ascent} -
  7384. @var{descent}.
  7385. @item max_glyph_w
  7386. maximum glyph width, that is the maximum width for all the glyphs
  7387. contained in the rendered text
  7388. @item n
  7389. the number of input frame, starting from 0
  7390. @item rand(min, max)
  7391. return a random number included between @var{min} and @var{max}
  7392. @item sar
  7393. The input sample aspect ratio.
  7394. @item t
  7395. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7396. @item text_h, th
  7397. the height of the rendered text
  7398. @item text_w, tw
  7399. the width of the rendered text
  7400. @item x
  7401. @item y
  7402. the x and y offset coordinates where the text is drawn.
  7403. These parameters allow the @var{x} and @var{y} expressions to refer
  7404. to each other, so you can for example specify @code{y=x/dar}.
  7405. @item pict_type
  7406. A one character description of the current frame's picture type.
  7407. @item pkt_pos
  7408. The current packet's position in the input file or stream
  7409. (in bytes, from the start of the input). A value of -1 indicates
  7410. this info is not available.
  7411. @item pkt_duration
  7412. The current packet's duration, in seconds.
  7413. @item pkt_size
  7414. The current packet's size (in bytes).
  7415. @end table
  7416. @anchor{drawtext_expansion}
  7417. @subsection Text expansion
  7418. If @option{expansion} is set to @code{strftime},
  7419. the filter recognizes strftime() sequences in the provided text and
  7420. expands them accordingly. Check the documentation of strftime(). This
  7421. feature is deprecated.
  7422. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7423. If @option{expansion} is set to @code{normal} (which is the default),
  7424. the following expansion mechanism is used.
  7425. The backslash character @samp{\}, followed by any character, always expands to
  7426. the second character.
  7427. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7428. braces is a function name, possibly followed by arguments separated by ':'.
  7429. If the arguments contain special characters or delimiters (':' or '@}'),
  7430. they should be escaped.
  7431. Note that they probably must also be escaped as the value for the
  7432. @option{text} option in the filter argument string and as the filter
  7433. argument in the filtergraph description, and possibly also for the shell,
  7434. that makes up to four levels of escaping; using a text file avoids these
  7435. problems.
  7436. The following functions are available:
  7437. @table @command
  7438. @item expr, e
  7439. The expression evaluation result.
  7440. It must take one argument specifying the expression to be evaluated,
  7441. which accepts the same constants and functions as the @var{x} and
  7442. @var{y} values. Note that not all constants should be used, for
  7443. example the text size is not known when evaluating the expression, so
  7444. the constants @var{text_w} and @var{text_h} will have an undefined
  7445. value.
  7446. @item expr_int_format, eif
  7447. Evaluate the expression's value and output as formatted integer.
  7448. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7449. The second argument specifies the output format. Allowed values are @samp{x},
  7450. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7451. @code{printf} function.
  7452. The third parameter is optional and sets the number of positions taken by the output.
  7453. It can be used to add padding with zeros from the left.
  7454. @item gmtime
  7455. The time at which the filter is running, expressed in UTC.
  7456. It can accept an argument: a strftime() format string.
  7457. @item localtime
  7458. The time at which the filter is running, expressed in the local time zone.
  7459. It can accept an argument: a strftime() format string.
  7460. @item metadata
  7461. Frame metadata. Takes one or two arguments.
  7462. The first argument is mandatory and specifies the metadata key.
  7463. The second argument is optional and specifies a default value, used when the
  7464. metadata key is not found or empty.
  7465. Available metadata can be identified by inspecting entries
  7466. starting with TAG included within each frame section
  7467. printed by running @code{ffprobe -show_frames}.
  7468. String metadata generated in filters leading to
  7469. the drawtext filter are also available.
  7470. @item n, frame_num
  7471. The frame number, starting from 0.
  7472. @item pict_type
  7473. A one character description of the current picture type.
  7474. @item pts
  7475. The timestamp of the current frame.
  7476. It can take up to three arguments.
  7477. The first argument is the format of the timestamp; it defaults to @code{flt}
  7478. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7479. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7480. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7481. @code{localtime} stands for the timestamp of the frame formatted as
  7482. local time zone time.
  7483. The second argument is an offset added to the timestamp.
  7484. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7485. supplied to present the hour part of the formatted timestamp in 24h format
  7486. (00-23).
  7487. If the format is set to @code{localtime} or @code{gmtime},
  7488. a third argument may be supplied: a strftime() format string.
  7489. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7490. @end table
  7491. @subsection Commands
  7492. This filter supports altering parameters via commands:
  7493. @table @option
  7494. @item reinit
  7495. Alter existing filter parameters.
  7496. Syntax for the argument is the same as for filter invocation, e.g.
  7497. @example
  7498. fontsize=56:fontcolor=green:text='Hello World'
  7499. @end example
  7500. Full filter invocation with sendcmd would look like this:
  7501. @example
  7502. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7503. @end example
  7504. @end table
  7505. If the entire argument can't be parsed or applied as valid values then the filter will
  7506. continue with its existing parameters.
  7507. @subsection Examples
  7508. @itemize
  7509. @item
  7510. Draw "Test Text" with font FreeSerif, using the default values for the
  7511. optional parameters.
  7512. @example
  7513. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7514. @end example
  7515. @item
  7516. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7517. and y=50 (counting from the top-left corner of the screen), text is
  7518. yellow with a red box around it. Both the text and the box have an
  7519. opacity of 20%.
  7520. @example
  7521. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7522. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7523. @end example
  7524. Note that the double quotes are not necessary if spaces are not used
  7525. within the parameter list.
  7526. @item
  7527. Show the text at the center of the video frame:
  7528. @example
  7529. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7530. @end example
  7531. @item
  7532. Show the text at a random position, switching to a new position every 30 seconds:
  7533. @example
  7534. 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)"
  7535. @end example
  7536. @item
  7537. Show a text line sliding from right to left in the last row of the video
  7538. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7539. with no newlines.
  7540. @example
  7541. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7542. @end example
  7543. @item
  7544. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7545. @example
  7546. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7547. @end example
  7548. @item
  7549. Draw a single green letter "g", at the center of the input video.
  7550. The glyph baseline is placed at half screen height.
  7551. @example
  7552. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7553. @end example
  7554. @item
  7555. Show text for 1 second every 3 seconds:
  7556. @example
  7557. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7558. @end example
  7559. @item
  7560. Use fontconfig to set the font. Note that the colons need to be escaped.
  7561. @example
  7562. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7563. @end example
  7564. @item
  7565. Print the date of a real-time encoding (see strftime(3)):
  7566. @example
  7567. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7568. @end example
  7569. @item
  7570. Show text fading in and out (appearing/disappearing):
  7571. @example
  7572. #!/bin/sh
  7573. DS=1.0 # display start
  7574. DE=10.0 # display end
  7575. FID=1.5 # fade in duration
  7576. FOD=5 # fade out duration
  7577. 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 @}"
  7578. @end example
  7579. @item
  7580. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7581. and the @option{fontsize} value are included in the @option{y} offset.
  7582. @example
  7583. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7584. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7585. @end example
  7586. @end itemize
  7587. For more information about libfreetype, check:
  7588. @url{http://www.freetype.org/}.
  7589. For more information about fontconfig, check:
  7590. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7591. For more information about libfribidi, check:
  7592. @url{http://fribidi.org/}.
  7593. @section edgedetect
  7594. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7595. The filter accepts the following options:
  7596. @table @option
  7597. @item low
  7598. @item high
  7599. Set low and high threshold values used by the Canny thresholding
  7600. algorithm.
  7601. The high threshold selects the "strong" edge pixels, which are then
  7602. connected through 8-connectivity with the "weak" edge pixels selected
  7603. by the low threshold.
  7604. @var{low} and @var{high} threshold values must be chosen in the range
  7605. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7606. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7607. is @code{50/255}.
  7608. @item mode
  7609. Define the drawing mode.
  7610. @table @samp
  7611. @item wires
  7612. Draw white/gray wires on black background.
  7613. @item colormix
  7614. Mix the colors to create a paint/cartoon effect.
  7615. @item canny
  7616. Apply Canny edge detector on all selected planes.
  7617. @end table
  7618. Default value is @var{wires}.
  7619. @item planes
  7620. Select planes for filtering. By default all available planes are filtered.
  7621. @end table
  7622. @subsection Examples
  7623. @itemize
  7624. @item
  7625. Standard edge detection with custom values for the hysteresis thresholding:
  7626. @example
  7627. edgedetect=low=0.1:high=0.4
  7628. @end example
  7629. @item
  7630. Painting effect without thresholding:
  7631. @example
  7632. edgedetect=mode=colormix:high=0
  7633. @end example
  7634. @end itemize
  7635. @section elbg
  7636. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7637. For each input image, the filter will compute the optimal mapping from
  7638. the input to the output given the codebook length, that is the number
  7639. of distinct output colors.
  7640. This filter accepts the following options.
  7641. @table @option
  7642. @item codebook_length, l
  7643. Set codebook length. The value must be a positive integer, and
  7644. represents the number of distinct output colors. Default value is 256.
  7645. @item nb_steps, n
  7646. Set the maximum number of iterations to apply for computing the optimal
  7647. mapping. The higher the value the better the result and the higher the
  7648. computation time. Default value is 1.
  7649. @item seed, s
  7650. Set a random seed, must be an integer included between 0 and
  7651. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7652. will try to use a good random seed on a best effort basis.
  7653. @item pal8
  7654. Set pal8 output pixel format. This option does not work with codebook
  7655. length greater than 256.
  7656. @end table
  7657. @section entropy
  7658. Measure graylevel entropy in histogram of color channels of video frames.
  7659. It accepts the following parameters:
  7660. @table @option
  7661. @item mode
  7662. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7663. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7664. between neighbour histogram values.
  7665. @end table
  7666. @section eq
  7667. Set brightness, contrast, saturation and approximate gamma adjustment.
  7668. The filter accepts the following options:
  7669. @table @option
  7670. @item contrast
  7671. Set the contrast expression. The value must be a float value in range
  7672. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7673. @item brightness
  7674. Set the brightness expression. The value must be a float value in
  7675. range @code{-1.0} to @code{1.0}. The default value is "0".
  7676. @item saturation
  7677. Set the saturation expression. The value must be a float in
  7678. range @code{0.0} to @code{3.0}. The default value is "1".
  7679. @item gamma
  7680. Set the gamma expression. The value must be a float in range
  7681. @code{0.1} to @code{10.0}. The default value is "1".
  7682. @item gamma_r
  7683. Set the gamma expression for red. The value must be a float in
  7684. range @code{0.1} to @code{10.0}. The default value is "1".
  7685. @item gamma_g
  7686. Set the gamma expression for green. The value must be a float in range
  7687. @code{0.1} to @code{10.0}. The default value is "1".
  7688. @item gamma_b
  7689. Set the gamma expression for blue. The value must be a float in range
  7690. @code{0.1} to @code{10.0}. The default value is "1".
  7691. @item gamma_weight
  7692. Set the gamma weight expression. It can be used to reduce the effect
  7693. of a high gamma value on bright image areas, e.g. keep them from
  7694. getting overamplified and just plain white. The value must be a float
  7695. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7696. gamma correction all the way down while @code{1.0} leaves it at its
  7697. full strength. Default is "1".
  7698. @item eval
  7699. Set when the expressions for brightness, contrast, saturation and
  7700. gamma expressions are evaluated.
  7701. It accepts the following values:
  7702. @table @samp
  7703. @item init
  7704. only evaluate expressions once during the filter initialization or
  7705. when a command is processed
  7706. @item frame
  7707. evaluate expressions for each incoming frame
  7708. @end table
  7709. Default value is @samp{init}.
  7710. @end table
  7711. The expressions accept the following parameters:
  7712. @table @option
  7713. @item n
  7714. frame count of the input frame starting from 0
  7715. @item pos
  7716. byte position of the corresponding packet in the input file, NAN if
  7717. unspecified
  7718. @item r
  7719. frame rate of the input video, NAN if the input frame rate is unknown
  7720. @item t
  7721. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7722. @end table
  7723. @subsection Commands
  7724. The filter supports the following commands:
  7725. @table @option
  7726. @item contrast
  7727. Set the contrast expression.
  7728. @item brightness
  7729. Set the brightness expression.
  7730. @item saturation
  7731. Set the saturation expression.
  7732. @item gamma
  7733. Set the gamma expression.
  7734. @item gamma_r
  7735. Set the gamma_r expression.
  7736. @item gamma_g
  7737. Set gamma_g expression.
  7738. @item gamma_b
  7739. Set gamma_b expression.
  7740. @item gamma_weight
  7741. Set gamma_weight expression.
  7742. The command accepts the same syntax of the corresponding option.
  7743. If the specified expression is not valid, it is kept at its current
  7744. value.
  7745. @end table
  7746. @section erosion
  7747. Apply erosion effect to the video.
  7748. This filter replaces the pixel by the local(3x3) minimum.
  7749. It accepts the following options:
  7750. @table @option
  7751. @item threshold0
  7752. @item threshold1
  7753. @item threshold2
  7754. @item threshold3
  7755. Limit the maximum change for each plane, default is 65535.
  7756. If 0, plane will remain unchanged.
  7757. @item coordinates
  7758. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7759. pixels are used.
  7760. Flags to local 3x3 coordinates maps like this:
  7761. 1 2 3
  7762. 4 5
  7763. 6 7 8
  7764. @end table
  7765. @subsection Commands
  7766. This filter supports the all above options as @ref{commands}.
  7767. @section extractplanes
  7768. Extract color channel components from input video stream into
  7769. separate grayscale video streams.
  7770. The filter accepts the following option:
  7771. @table @option
  7772. @item planes
  7773. Set plane(s) to extract.
  7774. Available values for planes are:
  7775. @table @samp
  7776. @item y
  7777. @item u
  7778. @item v
  7779. @item a
  7780. @item r
  7781. @item g
  7782. @item b
  7783. @end table
  7784. Choosing planes not available in the input will result in an error.
  7785. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7786. with @code{y}, @code{u}, @code{v} planes at same time.
  7787. @end table
  7788. @subsection Examples
  7789. @itemize
  7790. @item
  7791. Extract luma, u and v color channel component from input video frame
  7792. into 3 grayscale outputs:
  7793. @example
  7794. 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
  7795. @end example
  7796. @end itemize
  7797. @section fade
  7798. Apply a fade-in/out effect to the input video.
  7799. It accepts the following parameters:
  7800. @table @option
  7801. @item type, t
  7802. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7803. effect.
  7804. Default is @code{in}.
  7805. @item start_frame, s
  7806. Specify the number of the frame to start applying the fade
  7807. effect at. Default is 0.
  7808. @item nb_frames, n
  7809. The number of frames that the fade effect lasts. At the end of the
  7810. fade-in effect, the output video will have the same intensity as the input video.
  7811. At the end of the fade-out transition, the output video will be filled with the
  7812. selected @option{color}.
  7813. Default is 25.
  7814. @item alpha
  7815. If set to 1, fade only alpha channel, if one exists on the input.
  7816. Default value is 0.
  7817. @item start_time, st
  7818. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7819. effect. If both start_frame and start_time are specified, the fade will start at
  7820. whichever comes last. Default is 0.
  7821. @item duration, d
  7822. The number of seconds for which the fade effect has to last. At the end of the
  7823. fade-in effect the output video will have the same intensity as the input video,
  7824. at the end of the fade-out transition the output video will be filled with the
  7825. selected @option{color}.
  7826. If both duration and nb_frames are specified, duration is used. Default is 0
  7827. (nb_frames is used by default).
  7828. @item color, c
  7829. Specify the color of the fade. Default is "black".
  7830. @end table
  7831. @subsection Examples
  7832. @itemize
  7833. @item
  7834. Fade in the first 30 frames of video:
  7835. @example
  7836. fade=in:0:30
  7837. @end example
  7838. The command above is equivalent to:
  7839. @example
  7840. fade=t=in:s=0:n=30
  7841. @end example
  7842. @item
  7843. Fade out the last 45 frames of a 200-frame video:
  7844. @example
  7845. fade=out:155:45
  7846. fade=type=out:start_frame=155:nb_frames=45
  7847. @end example
  7848. @item
  7849. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7850. @example
  7851. fade=in:0:25, fade=out:975:25
  7852. @end example
  7853. @item
  7854. Make the first 5 frames yellow, then fade in from frame 5-24:
  7855. @example
  7856. fade=in:5:20:color=yellow
  7857. @end example
  7858. @item
  7859. Fade in alpha over first 25 frames of video:
  7860. @example
  7861. fade=in:0:25:alpha=1
  7862. @end example
  7863. @item
  7864. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7865. @example
  7866. fade=t=in:st=5.5:d=0.5
  7867. @end example
  7868. @end itemize
  7869. @section fftdnoiz
  7870. Denoise frames using 3D FFT (frequency domain filtering).
  7871. The filter accepts the following options:
  7872. @table @option
  7873. @item sigma
  7874. Set the noise sigma constant. This sets denoising strength.
  7875. Default value is 1. Allowed range is from 0 to 30.
  7876. Using very high sigma with low overlap may give blocking artifacts.
  7877. @item amount
  7878. Set amount of denoising. By default all detected noise is reduced.
  7879. Default value is 1. Allowed range is from 0 to 1.
  7880. @item block
  7881. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7882. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7883. block size in pixels is 2^4 which is 16.
  7884. @item overlap
  7885. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7886. @item prev
  7887. Set number of previous frames to use for denoising. By default is set to 0.
  7888. @item next
  7889. Set number of next frames to to use for denoising. By default is set to 0.
  7890. @item planes
  7891. Set planes which will be filtered, by default are all available filtered
  7892. except alpha.
  7893. @end table
  7894. @section fftfilt
  7895. Apply arbitrary expressions to samples in frequency domain
  7896. @table @option
  7897. @item dc_Y
  7898. Adjust the dc value (gain) of the luma plane of the image. The filter
  7899. accepts an integer value in range @code{0} to @code{1000}. The default
  7900. value is set to @code{0}.
  7901. @item dc_U
  7902. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7903. filter accepts an integer value in range @code{0} to @code{1000}. The
  7904. default value is set to @code{0}.
  7905. @item dc_V
  7906. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7907. filter accepts an integer value in range @code{0} to @code{1000}. The
  7908. default value is set to @code{0}.
  7909. @item weight_Y
  7910. Set the frequency domain weight expression for the luma plane.
  7911. @item weight_U
  7912. Set the frequency domain weight expression for the 1st chroma plane.
  7913. @item weight_V
  7914. Set the frequency domain weight expression for the 2nd chroma plane.
  7915. @item eval
  7916. Set when the expressions are evaluated.
  7917. It accepts the following values:
  7918. @table @samp
  7919. @item init
  7920. Only evaluate expressions once during the filter initialization.
  7921. @item frame
  7922. Evaluate expressions for each incoming frame.
  7923. @end table
  7924. Default value is @samp{init}.
  7925. The filter accepts the following variables:
  7926. @item X
  7927. @item Y
  7928. The coordinates of the current sample.
  7929. @item W
  7930. @item H
  7931. The width and height of the image.
  7932. @item N
  7933. The number of input frame, starting from 0.
  7934. @end table
  7935. @subsection Examples
  7936. @itemize
  7937. @item
  7938. High-pass:
  7939. @example
  7940. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7941. @end example
  7942. @item
  7943. Low-pass:
  7944. @example
  7945. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7946. @end example
  7947. @item
  7948. Sharpen:
  7949. @example
  7950. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7951. @end example
  7952. @item
  7953. Blur:
  7954. @example
  7955. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7956. @end example
  7957. @end itemize
  7958. @section field
  7959. Extract a single field from an interlaced image using stride
  7960. arithmetic to avoid wasting CPU time. The output frames are marked as
  7961. non-interlaced.
  7962. The filter accepts the following options:
  7963. @table @option
  7964. @item type
  7965. Specify whether to extract the top (if the value is @code{0} or
  7966. @code{top}) or the bottom field (if the value is @code{1} or
  7967. @code{bottom}).
  7968. @end table
  7969. @section fieldhint
  7970. Create new frames by copying the top and bottom fields from surrounding frames
  7971. supplied as numbers by the hint file.
  7972. @table @option
  7973. @item hint
  7974. Set file containing hints: absolute/relative frame numbers.
  7975. There must be one line for each frame in a clip. Each line must contain two
  7976. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7977. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7978. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7979. for @code{relative} mode. First number tells from which frame to pick up top
  7980. field and second number tells from which frame to pick up bottom field.
  7981. If optionally followed by @code{+} output frame will be marked as interlaced,
  7982. else if followed by @code{-} output frame will be marked as progressive, else
  7983. it will be marked same as input frame.
  7984. If optionally followed by @code{t} output frame will use only top field, or in
  7985. case of @code{b} it will use only bottom field.
  7986. If line starts with @code{#} or @code{;} that line is skipped.
  7987. @item mode
  7988. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7989. @end table
  7990. Example of first several lines of @code{hint} file for @code{relative} mode:
  7991. @example
  7992. 0,0 - # first frame
  7993. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7994. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7995. 1,0 -
  7996. 0,0 -
  7997. 0,0 -
  7998. 1,0 -
  7999. 1,0 -
  8000. 1,0 -
  8001. 0,0 -
  8002. 0,0 -
  8003. 1,0 -
  8004. 1,0 -
  8005. 1,0 -
  8006. 0,0 -
  8007. @end example
  8008. @section fieldmatch
  8009. Field matching filter for inverse telecine. It is meant to reconstruct the
  8010. progressive frames from a telecined stream. The filter does not drop duplicated
  8011. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8012. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8013. The separation of the field matching and the decimation is notably motivated by
  8014. the possibility of inserting a de-interlacing filter fallback between the two.
  8015. If the source has mixed telecined and real interlaced content,
  8016. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8017. But these remaining combed frames will be marked as interlaced, and thus can be
  8018. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8019. In addition to the various configuration options, @code{fieldmatch} can take an
  8020. optional second stream, activated through the @option{ppsrc} option. If
  8021. enabled, the frames reconstruction will be based on the fields and frames from
  8022. this second stream. This allows the first input to be pre-processed in order to
  8023. help the various algorithms of the filter, while keeping the output lossless
  8024. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8025. or brightness/contrast adjustments can help.
  8026. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8027. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8028. which @code{fieldmatch} is based on. While the semantic and usage are very
  8029. close, some behaviour and options names can differ.
  8030. The @ref{decimate} filter currently only works for constant frame rate input.
  8031. If your input has mixed telecined (30fps) and progressive content with a lower
  8032. framerate like 24fps use the following filterchain to produce the necessary cfr
  8033. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8034. The filter accepts the following options:
  8035. @table @option
  8036. @item order
  8037. Specify the assumed field order of the input stream. Available values are:
  8038. @table @samp
  8039. @item auto
  8040. Auto detect parity (use FFmpeg's internal parity value).
  8041. @item bff
  8042. Assume bottom field first.
  8043. @item tff
  8044. Assume top field first.
  8045. @end table
  8046. Note that it is sometimes recommended not to trust the parity announced by the
  8047. stream.
  8048. Default value is @var{auto}.
  8049. @item mode
  8050. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8051. sense that it won't risk creating jerkiness due to duplicate frames when
  8052. possible, but if there are bad edits or blended fields it will end up
  8053. outputting combed frames when a good match might actually exist. On the other
  8054. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8055. but will almost always find a good frame if there is one. The other values are
  8056. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8057. jerkiness and creating duplicate frames versus finding good matches in sections
  8058. with bad edits, orphaned fields, blended fields, etc.
  8059. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8060. Available values are:
  8061. @table @samp
  8062. @item pc
  8063. 2-way matching (p/c)
  8064. @item pc_n
  8065. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8066. @item pc_u
  8067. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8068. @item pc_n_ub
  8069. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8070. still combed (p/c + n + u/b)
  8071. @item pcn
  8072. 3-way matching (p/c/n)
  8073. @item pcn_ub
  8074. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8075. detected as combed (p/c/n + u/b)
  8076. @end table
  8077. The parenthesis at the end indicate the matches that would be used for that
  8078. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8079. @var{top}).
  8080. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8081. the slowest.
  8082. Default value is @var{pc_n}.
  8083. @item ppsrc
  8084. Mark the main input stream as a pre-processed input, and enable the secondary
  8085. input stream as the clean source to pick the fields from. See the filter
  8086. introduction for more details. It is similar to the @option{clip2} feature from
  8087. VFM/TFM.
  8088. Default value is @code{0} (disabled).
  8089. @item field
  8090. Set the field to match from. It is recommended to set this to the same value as
  8091. @option{order} unless you experience matching failures with that setting. In
  8092. certain circumstances changing the field that is used to match from can have a
  8093. large impact on matching performance. Available values are:
  8094. @table @samp
  8095. @item auto
  8096. Automatic (same value as @option{order}).
  8097. @item bottom
  8098. Match from the bottom field.
  8099. @item top
  8100. Match from the top field.
  8101. @end table
  8102. Default value is @var{auto}.
  8103. @item mchroma
  8104. Set whether or not chroma is included during the match comparisons. In most
  8105. cases it is recommended to leave this enabled. You should set this to @code{0}
  8106. only if your clip has bad chroma problems such as heavy rainbowing or other
  8107. artifacts. Setting this to @code{0} could also be used to speed things up at
  8108. the cost of some accuracy.
  8109. Default value is @code{1}.
  8110. @item y0
  8111. @item y1
  8112. These define an exclusion band which excludes the lines between @option{y0} and
  8113. @option{y1} from being included in the field matching decision. An exclusion
  8114. band can be used to ignore subtitles, a logo, or other things that may
  8115. interfere with the matching. @option{y0} sets the starting scan line and
  8116. @option{y1} sets the ending line; all lines in between @option{y0} and
  8117. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8118. @option{y0} and @option{y1} to the same value will disable the feature.
  8119. @option{y0} and @option{y1} defaults to @code{0}.
  8120. @item scthresh
  8121. Set the scene change detection threshold as a percentage of maximum change on
  8122. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8123. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8124. @option{scthresh} is @code{[0.0, 100.0]}.
  8125. Default value is @code{12.0}.
  8126. @item combmatch
  8127. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8128. account the combed scores of matches when deciding what match to use as the
  8129. final match. Available values are:
  8130. @table @samp
  8131. @item none
  8132. No final matching based on combed scores.
  8133. @item sc
  8134. Combed scores are only used when a scene change is detected.
  8135. @item full
  8136. Use combed scores all the time.
  8137. @end table
  8138. Default is @var{sc}.
  8139. @item combdbg
  8140. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8141. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8142. Available values are:
  8143. @table @samp
  8144. @item none
  8145. No forced calculation.
  8146. @item pcn
  8147. Force p/c/n calculations.
  8148. @item pcnub
  8149. Force p/c/n/u/b calculations.
  8150. @end table
  8151. Default value is @var{none}.
  8152. @item cthresh
  8153. This is the area combing threshold used for combed frame detection. This
  8154. essentially controls how "strong" or "visible" combing must be to be detected.
  8155. Larger values mean combing must be more visible and smaller values mean combing
  8156. can be less visible or strong and still be detected. Valid settings are from
  8157. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8158. be detected as combed). This is basically a pixel difference value. A good
  8159. range is @code{[8, 12]}.
  8160. Default value is @code{9}.
  8161. @item chroma
  8162. Sets whether or not chroma is considered in the combed frame decision. Only
  8163. disable this if your source has chroma problems (rainbowing, etc.) that are
  8164. causing problems for the combed frame detection with chroma enabled. Actually,
  8165. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8166. where there is chroma only combing in the source.
  8167. Default value is @code{0}.
  8168. @item blockx
  8169. @item blocky
  8170. Respectively set the x-axis and y-axis size of the window used during combed
  8171. frame detection. This has to do with the size of the area in which
  8172. @option{combpel} pixels are required to be detected as combed for a frame to be
  8173. declared combed. See the @option{combpel} parameter description for more info.
  8174. Possible values are any number that is a power of 2 starting at 4 and going up
  8175. to 512.
  8176. Default value is @code{16}.
  8177. @item combpel
  8178. The number of combed pixels inside any of the @option{blocky} by
  8179. @option{blockx} size blocks on the frame for the frame to be detected as
  8180. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8181. setting controls "how much" combing there must be in any localized area (a
  8182. window defined by the @option{blockx} and @option{blocky} settings) on the
  8183. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8184. which point no frames will ever be detected as combed). This setting is known
  8185. as @option{MI} in TFM/VFM vocabulary.
  8186. Default value is @code{80}.
  8187. @end table
  8188. @anchor{p/c/n/u/b meaning}
  8189. @subsection p/c/n/u/b meaning
  8190. @subsubsection p/c/n
  8191. We assume the following telecined stream:
  8192. @example
  8193. Top fields: 1 2 2 3 4
  8194. Bottom fields: 1 2 3 4 4
  8195. @end example
  8196. The numbers correspond to the progressive frame the fields relate to. Here, the
  8197. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8198. When @code{fieldmatch} is configured to run a matching from bottom
  8199. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8200. @example
  8201. Input stream:
  8202. T 1 2 2 3 4
  8203. B 1 2 3 4 4 <-- matching reference
  8204. Matches: c c n n c
  8205. Output stream:
  8206. T 1 2 3 4 4
  8207. B 1 2 3 4 4
  8208. @end example
  8209. As a result of the field matching, we can see that some frames get duplicated.
  8210. To perform a complete inverse telecine, you need to rely on a decimation filter
  8211. after this operation. See for instance the @ref{decimate} filter.
  8212. The same operation now matching from top fields (@option{field}=@var{top})
  8213. looks like this:
  8214. @example
  8215. Input stream:
  8216. T 1 2 2 3 4 <-- matching reference
  8217. B 1 2 3 4 4
  8218. Matches: c c p p c
  8219. Output stream:
  8220. T 1 2 2 3 4
  8221. B 1 2 2 3 4
  8222. @end example
  8223. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8224. basically, they refer to the frame and field of the opposite parity:
  8225. @itemize
  8226. @item @var{p} matches the field of the opposite parity in the previous frame
  8227. @item @var{c} matches the field of the opposite parity in the current frame
  8228. @item @var{n} matches the field of the opposite parity in the next frame
  8229. @end itemize
  8230. @subsubsection u/b
  8231. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8232. from the opposite parity flag. In the following examples, we assume that we are
  8233. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8234. 'x' is placed above and below each matched fields.
  8235. With bottom matching (@option{field}=@var{bottom}):
  8236. @example
  8237. Match: c p n b u
  8238. x x x x x
  8239. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8240. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8241. x x x x x
  8242. Output frames:
  8243. 2 1 2 2 2
  8244. 2 2 2 1 3
  8245. @end example
  8246. With top matching (@option{field}=@var{top}):
  8247. @example
  8248. Match: c p n b u
  8249. x x x x x
  8250. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8251. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8252. x x x x x
  8253. Output frames:
  8254. 2 2 2 1 2
  8255. 2 1 3 2 2
  8256. @end example
  8257. @subsection Examples
  8258. Simple IVTC of a top field first telecined stream:
  8259. @example
  8260. fieldmatch=order=tff:combmatch=none, decimate
  8261. @end example
  8262. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8263. @example
  8264. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8265. @end example
  8266. @section fieldorder
  8267. Transform the field order of the input video.
  8268. It accepts the following parameters:
  8269. @table @option
  8270. @item order
  8271. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8272. for bottom field first.
  8273. @end table
  8274. The default value is @samp{tff}.
  8275. The transformation is done by shifting the picture content up or down
  8276. by one line, and filling the remaining line with appropriate picture content.
  8277. This method is consistent with most broadcast field order converters.
  8278. If the input video is not flagged as being interlaced, or it is already
  8279. flagged as being of the required output field order, then this filter does
  8280. not alter the incoming video.
  8281. It is very useful when converting to or from PAL DV material,
  8282. which is bottom field first.
  8283. For example:
  8284. @example
  8285. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8286. @end example
  8287. @section fifo, afifo
  8288. Buffer input images and send them when they are requested.
  8289. It is mainly useful when auto-inserted by the libavfilter
  8290. framework.
  8291. It does not take parameters.
  8292. @section fillborders
  8293. Fill borders of the input video, without changing video stream dimensions.
  8294. Sometimes video can have garbage at the four edges and you may not want to
  8295. crop video input to keep size multiple of some number.
  8296. This filter accepts the following options:
  8297. @table @option
  8298. @item left
  8299. Number of pixels to fill from left border.
  8300. @item right
  8301. Number of pixels to fill from right border.
  8302. @item top
  8303. Number of pixels to fill from top border.
  8304. @item bottom
  8305. Number of pixels to fill from bottom border.
  8306. @item mode
  8307. Set fill mode.
  8308. It accepts the following values:
  8309. @table @samp
  8310. @item smear
  8311. fill pixels using outermost pixels
  8312. @item mirror
  8313. fill pixels using mirroring
  8314. @item fixed
  8315. fill pixels with constant value
  8316. @end table
  8317. Default is @var{smear}.
  8318. @item color
  8319. Set color for pixels in fixed mode. Default is @var{black}.
  8320. @end table
  8321. @subsection Commands
  8322. This filter supports same @ref{commands} as options.
  8323. The command accepts the same syntax of the corresponding option.
  8324. If the specified expression is not valid, it is kept at its current
  8325. value.
  8326. @section find_rect
  8327. Find a rectangular object
  8328. It accepts the following options:
  8329. @table @option
  8330. @item object
  8331. Filepath of the object image, needs to be in gray8.
  8332. @item threshold
  8333. Detection threshold, default is 0.5.
  8334. @item mipmaps
  8335. Number of mipmaps, default is 3.
  8336. @item xmin, ymin, xmax, ymax
  8337. Specifies the rectangle in which to search.
  8338. @end table
  8339. @subsection Examples
  8340. @itemize
  8341. @item
  8342. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8343. @example
  8344. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8345. @end example
  8346. @end itemize
  8347. @section floodfill
  8348. Flood area with values of same pixel components with another values.
  8349. It accepts the following options:
  8350. @table @option
  8351. @item x
  8352. Set pixel x coordinate.
  8353. @item y
  8354. Set pixel y coordinate.
  8355. @item s0
  8356. Set source #0 component value.
  8357. @item s1
  8358. Set source #1 component value.
  8359. @item s2
  8360. Set source #2 component value.
  8361. @item s3
  8362. Set source #3 component value.
  8363. @item d0
  8364. Set destination #0 component value.
  8365. @item d1
  8366. Set destination #1 component value.
  8367. @item d2
  8368. Set destination #2 component value.
  8369. @item d3
  8370. Set destination #3 component value.
  8371. @end table
  8372. @anchor{format}
  8373. @section format
  8374. Convert the input video to one of the specified pixel formats.
  8375. Libavfilter will try to pick one that is suitable as input to
  8376. the next filter.
  8377. It accepts the following parameters:
  8378. @table @option
  8379. @item pix_fmts
  8380. A '|'-separated list of pixel format names, such as
  8381. "pix_fmts=yuv420p|monow|rgb24".
  8382. @end table
  8383. @subsection Examples
  8384. @itemize
  8385. @item
  8386. Convert the input video to the @var{yuv420p} format
  8387. @example
  8388. format=pix_fmts=yuv420p
  8389. @end example
  8390. Convert the input video to any of the formats in the list
  8391. @example
  8392. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8393. @end example
  8394. @end itemize
  8395. @anchor{fps}
  8396. @section fps
  8397. Convert the video to specified constant frame rate by duplicating or dropping
  8398. frames as necessary.
  8399. It accepts the following parameters:
  8400. @table @option
  8401. @item fps
  8402. The desired output frame rate. The default is @code{25}.
  8403. @item start_time
  8404. Assume the first PTS should be the given value, in seconds. This allows for
  8405. padding/trimming at the start of stream. By default, no assumption is made
  8406. about the first frame's expected PTS, so no padding or trimming is done.
  8407. For example, this could be set to 0 to pad the beginning with duplicates of
  8408. the first frame if a video stream starts after the audio stream or to trim any
  8409. frames with a negative PTS.
  8410. @item round
  8411. Timestamp (PTS) rounding method.
  8412. Possible values are:
  8413. @table @option
  8414. @item zero
  8415. round towards 0
  8416. @item inf
  8417. round away from 0
  8418. @item down
  8419. round towards -infinity
  8420. @item up
  8421. round towards +infinity
  8422. @item near
  8423. round to nearest
  8424. @end table
  8425. The default is @code{near}.
  8426. @item eof_action
  8427. Action performed when reading the last frame.
  8428. Possible values are:
  8429. @table @option
  8430. @item round
  8431. Use same timestamp rounding method as used for other frames.
  8432. @item pass
  8433. Pass through last frame if input duration has not been reached yet.
  8434. @end table
  8435. The default is @code{round}.
  8436. @end table
  8437. Alternatively, the options can be specified as a flat string:
  8438. @var{fps}[:@var{start_time}[:@var{round}]].
  8439. See also the @ref{setpts} filter.
  8440. @subsection Examples
  8441. @itemize
  8442. @item
  8443. A typical usage in order to set the fps to 25:
  8444. @example
  8445. fps=fps=25
  8446. @end example
  8447. @item
  8448. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8449. @example
  8450. fps=fps=film:round=near
  8451. @end example
  8452. @end itemize
  8453. @section framepack
  8454. Pack two different video streams into a stereoscopic video, setting proper
  8455. metadata on supported codecs. The two views should have the same size and
  8456. framerate and processing will stop when the shorter video ends. Please note
  8457. that you may conveniently adjust view properties with the @ref{scale} and
  8458. @ref{fps} filters.
  8459. It accepts the following parameters:
  8460. @table @option
  8461. @item format
  8462. The desired packing format. Supported values are:
  8463. @table @option
  8464. @item sbs
  8465. The views are next to each other (default).
  8466. @item tab
  8467. The views are on top of each other.
  8468. @item lines
  8469. The views are packed by line.
  8470. @item columns
  8471. The views are packed by column.
  8472. @item frameseq
  8473. The views are temporally interleaved.
  8474. @end table
  8475. @end table
  8476. Some examples:
  8477. @example
  8478. # Convert left and right views into a frame-sequential video
  8479. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8480. # Convert views into a side-by-side video with the same output resolution as the input
  8481. 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
  8482. @end example
  8483. @section framerate
  8484. Change the frame rate by interpolating new video output frames from the source
  8485. frames.
  8486. This filter is not designed to function correctly with interlaced media. If
  8487. you wish to change the frame rate of interlaced media then you are required
  8488. to deinterlace before this filter and re-interlace after this filter.
  8489. A description of the accepted options follows.
  8490. @table @option
  8491. @item fps
  8492. Specify the output frames per second. This option can also be specified
  8493. as a value alone. The default is @code{50}.
  8494. @item interp_start
  8495. Specify the start of a range where the output frame will be created as a
  8496. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8497. the default is @code{15}.
  8498. @item interp_end
  8499. Specify the end of a range where the output frame will be created as a
  8500. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8501. the default is @code{240}.
  8502. @item scene
  8503. Specify the level at which a scene change is detected as a value between
  8504. 0 and 100 to indicate a new scene; a low value reflects a low
  8505. probability for the current frame to introduce a new scene, while a higher
  8506. value means the current frame is more likely to be one.
  8507. The default is @code{8.2}.
  8508. @item flags
  8509. Specify flags influencing the filter process.
  8510. Available value for @var{flags} is:
  8511. @table @option
  8512. @item scene_change_detect, scd
  8513. Enable scene change detection using the value of the option @var{scene}.
  8514. This flag is enabled by default.
  8515. @end table
  8516. @end table
  8517. @section framestep
  8518. Select one frame every N-th frame.
  8519. This filter accepts the following option:
  8520. @table @option
  8521. @item step
  8522. Select frame after every @code{step} frames.
  8523. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8524. @end table
  8525. @section freezedetect
  8526. Detect frozen video.
  8527. This filter logs a message and sets frame metadata when it detects that the
  8528. input video has no significant change in content during a specified duration.
  8529. Video freeze detection calculates the mean average absolute difference of all
  8530. the components of video frames and compares it to a noise floor.
  8531. The printed times and duration are expressed in seconds. The
  8532. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8533. whose timestamp equals or exceeds the detection duration and it contains the
  8534. timestamp of the first frame of the freeze. The
  8535. @code{lavfi.freezedetect.freeze_duration} and
  8536. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8537. after the freeze.
  8538. The filter accepts the following options:
  8539. @table @option
  8540. @item noise, n
  8541. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8542. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8543. 0.001.
  8544. @item duration, d
  8545. Set freeze duration until notification (default is 2 seconds).
  8546. @end table
  8547. @anchor{frei0r}
  8548. @section frei0r
  8549. Apply a frei0r effect to the input video.
  8550. To enable the compilation of this filter, you need to install the frei0r
  8551. header and configure FFmpeg with @code{--enable-frei0r}.
  8552. It accepts the following parameters:
  8553. @table @option
  8554. @item filter_name
  8555. The name of the frei0r effect to load. If the environment variable
  8556. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8557. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8558. Otherwise, the standard frei0r paths are searched, in this order:
  8559. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8560. @file{/usr/lib/frei0r-1/}.
  8561. @item filter_params
  8562. A '|'-separated list of parameters to pass to the frei0r effect.
  8563. @end table
  8564. A frei0r effect parameter can be a boolean (its value is either
  8565. "y" or "n"), a double, a color (specified as
  8566. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8567. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8568. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8569. a position (specified as @var{X}/@var{Y}, where
  8570. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8571. The number and types of parameters depend on the loaded effect. If an
  8572. effect parameter is not specified, the default value is set.
  8573. @subsection Examples
  8574. @itemize
  8575. @item
  8576. Apply the distort0r effect, setting the first two double parameters:
  8577. @example
  8578. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8579. @end example
  8580. @item
  8581. Apply the colordistance effect, taking a color as the first parameter:
  8582. @example
  8583. frei0r=colordistance:0.2/0.3/0.4
  8584. frei0r=colordistance:violet
  8585. frei0r=colordistance:0x112233
  8586. @end example
  8587. @item
  8588. Apply the perspective effect, specifying the top left and top right image
  8589. positions:
  8590. @example
  8591. frei0r=perspective:0.2/0.2|0.8/0.2
  8592. @end example
  8593. @end itemize
  8594. For more information, see
  8595. @url{http://frei0r.dyne.org}
  8596. @section fspp
  8597. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8598. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8599. processing filter, one of them is performed once per block, not per pixel.
  8600. This allows for much higher speed.
  8601. The filter accepts the following options:
  8602. @table @option
  8603. @item quality
  8604. Set quality. This option defines the number of levels for averaging. It accepts
  8605. an integer in the range 4-5. Default value is @code{4}.
  8606. @item qp
  8607. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8608. If not set, the filter will use the QP from the video stream (if available).
  8609. @item strength
  8610. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8611. more details but also more artifacts, while higher values make the image smoother
  8612. but also blurrier. Default value is @code{0} − PSNR optimal.
  8613. @item use_bframe_qp
  8614. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8615. option may cause flicker since the B-Frames have often larger QP. Default is
  8616. @code{0} (not enabled).
  8617. @end table
  8618. @section gblur
  8619. Apply Gaussian blur filter.
  8620. The filter accepts the following options:
  8621. @table @option
  8622. @item sigma
  8623. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8624. @item steps
  8625. Set number of steps for Gaussian approximation. Default is @code{1}.
  8626. @item planes
  8627. Set which planes to filter. By default all planes are filtered.
  8628. @item sigmaV
  8629. Set vertical sigma, if negative it will be same as @code{sigma}.
  8630. Default is @code{-1}.
  8631. @end table
  8632. @subsection Commands
  8633. This filter supports same commands as options.
  8634. The command accepts the same syntax of the corresponding option.
  8635. If the specified expression is not valid, it is kept at its current
  8636. value.
  8637. @section geq
  8638. Apply generic equation to each pixel.
  8639. The filter accepts the following options:
  8640. @table @option
  8641. @item lum_expr, lum
  8642. Set the luminance expression.
  8643. @item cb_expr, cb
  8644. Set the chrominance blue expression.
  8645. @item cr_expr, cr
  8646. Set the chrominance red expression.
  8647. @item alpha_expr, a
  8648. Set the alpha expression.
  8649. @item red_expr, r
  8650. Set the red expression.
  8651. @item green_expr, g
  8652. Set the green expression.
  8653. @item blue_expr, b
  8654. Set the blue expression.
  8655. @end table
  8656. The colorspace is selected according to the specified options. If one
  8657. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8658. options is specified, the filter will automatically select a YCbCr
  8659. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8660. @option{blue_expr} options is specified, it will select an RGB
  8661. colorspace.
  8662. If one of the chrominance expression is not defined, it falls back on the other
  8663. one. If no alpha expression is specified it will evaluate to opaque value.
  8664. If none of chrominance expressions are specified, they will evaluate
  8665. to the luminance expression.
  8666. The expressions can use the following variables and functions:
  8667. @table @option
  8668. @item N
  8669. The sequential number of the filtered frame, starting from @code{0}.
  8670. @item X
  8671. @item Y
  8672. The coordinates of the current sample.
  8673. @item W
  8674. @item H
  8675. The width and height of the image.
  8676. @item SW
  8677. @item SH
  8678. Width and height scale depending on the currently filtered plane. It is the
  8679. ratio between the corresponding luma plane number of pixels and the current
  8680. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8681. @code{0.5,0.5} for chroma planes.
  8682. @item T
  8683. Time of the current frame, expressed in seconds.
  8684. @item p(x, y)
  8685. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8686. plane.
  8687. @item lum(x, y)
  8688. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8689. plane.
  8690. @item cb(x, y)
  8691. Return the value of the pixel at location (@var{x},@var{y}) of the
  8692. blue-difference chroma plane. Return 0 if there is no such plane.
  8693. @item cr(x, y)
  8694. Return the value of the pixel at location (@var{x},@var{y}) of the
  8695. red-difference chroma plane. Return 0 if there is no such plane.
  8696. @item r(x, y)
  8697. @item g(x, y)
  8698. @item b(x, y)
  8699. Return the value of the pixel at location (@var{x},@var{y}) of the
  8700. red/green/blue component. Return 0 if there is no such component.
  8701. @item alpha(x, y)
  8702. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8703. plane. Return 0 if there is no such plane.
  8704. @item interpolation
  8705. Set one of interpolation methods:
  8706. @table @option
  8707. @item nearest, n
  8708. @item bilinear, b
  8709. @end table
  8710. Default is bilinear.
  8711. @end table
  8712. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8713. automatically clipped to the closer edge.
  8714. @subsection Examples
  8715. @itemize
  8716. @item
  8717. Flip the image horizontally:
  8718. @example
  8719. geq=p(W-X\,Y)
  8720. @end example
  8721. @item
  8722. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8723. wavelength of 100 pixels:
  8724. @example
  8725. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8726. @end example
  8727. @item
  8728. Generate a fancy enigmatic moving light:
  8729. @example
  8730. 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
  8731. @end example
  8732. @item
  8733. Generate a quick emboss effect:
  8734. @example
  8735. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8736. @end example
  8737. @item
  8738. Modify RGB components depending on pixel position:
  8739. @example
  8740. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8741. @end example
  8742. @item
  8743. Create a radial gradient that is the same size as the input (also see
  8744. the @ref{vignette} filter):
  8745. @example
  8746. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8747. @end example
  8748. @end itemize
  8749. @section gradfun
  8750. Fix the banding artifacts that are sometimes introduced into nearly flat
  8751. regions by truncation to 8-bit color depth.
  8752. Interpolate the gradients that should go where the bands are, and
  8753. dither them.
  8754. It is designed for playback only. Do not use it prior to
  8755. lossy compression, because compression tends to lose the dither and
  8756. bring back the bands.
  8757. It accepts the following parameters:
  8758. @table @option
  8759. @item strength
  8760. The maximum amount by which the filter will change any one pixel. This is also
  8761. the threshold for detecting nearly flat regions. Acceptable values range from
  8762. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8763. valid range.
  8764. @item radius
  8765. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8766. gradients, but also prevents the filter from modifying the pixels near detailed
  8767. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8768. values will be clipped to the valid range.
  8769. @end table
  8770. Alternatively, the options can be specified as a flat string:
  8771. @var{strength}[:@var{radius}]
  8772. @subsection Examples
  8773. @itemize
  8774. @item
  8775. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8776. @example
  8777. gradfun=3.5:8
  8778. @end example
  8779. @item
  8780. Specify radius, omitting the strength (which will fall-back to the default
  8781. value):
  8782. @example
  8783. gradfun=radius=8
  8784. @end example
  8785. @end itemize
  8786. @anchor{graphmonitor}
  8787. @section graphmonitor
  8788. Show various filtergraph stats.
  8789. With this filter one can debug complete filtergraph.
  8790. Especially issues with links filling with queued frames.
  8791. The filter accepts the following options:
  8792. @table @option
  8793. @item size, s
  8794. Set video output size. Default is @var{hd720}.
  8795. @item opacity, o
  8796. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8797. @item mode, m
  8798. Set output mode, can be @var{fulll} or @var{compact}.
  8799. In @var{compact} mode only filters with some queued frames have displayed stats.
  8800. @item flags, f
  8801. Set flags which enable which stats are shown in video.
  8802. Available values for flags are:
  8803. @table @samp
  8804. @item queue
  8805. Display number of queued frames in each link.
  8806. @item frame_count_in
  8807. Display number of frames taken from filter.
  8808. @item frame_count_out
  8809. Display number of frames given out from filter.
  8810. @item pts
  8811. Display current filtered frame pts.
  8812. @item time
  8813. Display current filtered frame time.
  8814. @item timebase
  8815. Display time base for filter link.
  8816. @item format
  8817. Display used format for filter link.
  8818. @item size
  8819. Display video size or number of audio channels in case of audio used by filter link.
  8820. @item rate
  8821. Display video frame rate or sample rate in case of audio used by filter link.
  8822. @end table
  8823. @item rate, r
  8824. Set upper limit for video rate of output stream, Default value is @var{25}.
  8825. This guarantee that output video frame rate will not be higher than this value.
  8826. @end table
  8827. @section greyedge
  8828. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8829. and corrects the scene colors accordingly.
  8830. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8831. The filter accepts the following options:
  8832. @table @option
  8833. @item difford
  8834. The order of differentiation to be applied on the scene. Must be chosen in the range
  8835. [0,2] and default value is 1.
  8836. @item minknorm
  8837. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8838. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8839. max value instead of calculating Minkowski distance.
  8840. @item sigma
  8841. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8842. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8843. can't be equal to 0 if @var{difford} is greater than 0.
  8844. @end table
  8845. @subsection Examples
  8846. @itemize
  8847. @item
  8848. Grey Edge:
  8849. @example
  8850. greyedge=difford=1:minknorm=5:sigma=2
  8851. @end example
  8852. @item
  8853. Max Edge:
  8854. @example
  8855. greyedge=difford=1:minknorm=0:sigma=2
  8856. @end example
  8857. @end itemize
  8858. @anchor{haldclut}
  8859. @section haldclut
  8860. Apply a Hald CLUT to a video stream.
  8861. First input is the video stream to process, and second one is the Hald CLUT.
  8862. The Hald CLUT input can be a simple picture or a complete video stream.
  8863. The filter accepts the following options:
  8864. @table @option
  8865. @item shortest
  8866. Force termination when the shortest input terminates. Default is @code{0}.
  8867. @item repeatlast
  8868. Continue applying the last CLUT after the end of the stream. A value of
  8869. @code{0} disable the filter after the last frame of the CLUT is reached.
  8870. Default is @code{1}.
  8871. @end table
  8872. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8873. filters share the same internals).
  8874. This filter also supports the @ref{framesync} options.
  8875. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8876. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8877. @subsection Workflow examples
  8878. @subsubsection Hald CLUT video stream
  8879. Generate an identity Hald CLUT stream altered with various effects:
  8880. @example
  8881. 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
  8882. @end example
  8883. Note: make sure you use a lossless codec.
  8884. Then use it with @code{haldclut} to apply it on some random stream:
  8885. @example
  8886. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8887. @end example
  8888. The Hald CLUT will be applied to the 10 first seconds (duration of
  8889. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8890. to the remaining frames of the @code{mandelbrot} stream.
  8891. @subsubsection Hald CLUT with preview
  8892. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8893. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8894. biggest possible square starting at the top left of the picture. The remaining
  8895. padding pixels (bottom or right) will be ignored. This area can be used to add
  8896. a preview of the Hald CLUT.
  8897. Typically, the following generated Hald CLUT will be supported by the
  8898. @code{haldclut} filter:
  8899. @example
  8900. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8901. pad=iw+320 [padded_clut];
  8902. smptebars=s=320x256, split [a][b];
  8903. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8904. [main][b] overlay=W-320" -frames:v 1 clut.png
  8905. @end example
  8906. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8907. bars are displayed on the right-top, and below the same color bars processed by
  8908. the color changes.
  8909. Then, the effect of this Hald CLUT can be visualized with:
  8910. @example
  8911. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8912. @end example
  8913. @section hflip
  8914. Flip the input video horizontally.
  8915. For example, to horizontally flip the input video with @command{ffmpeg}:
  8916. @example
  8917. ffmpeg -i in.avi -vf "hflip" out.avi
  8918. @end example
  8919. @section histeq
  8920. This filter applies a global color histogram equalization on a
  8921. per-frame basis.
  8922. It can be used to correct video that has a compressed range of pixel
  8923. intensities. The filter redistributes the pixel intensities to
  8924. equalize their distribution across the intensity range. It may be
  8925. viewed as an "automatically adjusting contrast filter". This filter is
  8926. useful only for correcting degraded or poorly captured source
  8927. video.
  8928. The filter accepts the following options:
  8929. @table @option
  8930. @item strength
  8931. Determine the amount of equalization to be applied. As the strength
  8932. is reduced, the distribution of pixel intensities more-and-more
  8933. approaches that of the input frame. The value must be a float number
  8934. in the range [0,1] and defaults to 0.200.
  8935. @item intensity
  8936. Set the maximum intensity that can generated and scale the output
  8937. values appropriately. The strength should be set as desired and then
  8938. the intensity can be limited if needed to avoid washing-out. The value
  8939. must be a float number in the range [0,1] and defaults to 0.210.
  8940. @item antibanding
  8941. Set the antibanding level. If enabled the filter will randomly vary
  8942. the luminance of output pixels by a small amount to avoid banding of
  8943. the histogram. Possible values are @code{none}, @code{weak} or
  8944. @code{strong}. It defaults to @code{none}.
  8945. @end table
  8946. @anchor{histogram}
  8947. @section histogram
  8948. Compute and draw a color distribution histogram for the input video.
  8949. The computed histogram is a representation of the color component
  8950. distribution in an image.
  8951. Standard histogram displays the color components distribution in an image.
  8952. Displays color graph for each color component. Shows distribution of
  8953. the Y, U, V, A or R, G, B components, depending on input format, in the
  8954. current frame. Below each graph a color component scale meter is shown.
  8955. The filter accepts the following options:
  8956. @table @option
  8957. @item level_height
  8958. Set height of level. Default value is @code{200}.
  8959. Allowed range is [50, 2048].
  8960. @item scale_height
  8961. Set height of color scale. Default value is @code{12}.
  8962. Allowed range is [0, 40].
  8963. @item display_mode
  8964. Set display mode.
  8965. It accepts the following values:
  8966. @table @samp
  8967. @item stack
  8968. Per color component graphs are placed below each other.
  8969. @item parade
  8970. Per color component graphs are placed side by side.
  8971. @item overlay
  8972. Presents information identical to that in the @code{parade}, except
  8973. that the graphs representing color components are superimposed directly
  8974. over one another.
  8975. @end table
  8976. Default is @code{stack}.
  8977. @item levels_mode
  8978. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8979. Default is @code{linear}.
  8980. @item components
  8981. Set what color components to display.
  8982. Default is @code{7}.
  8983. @item fgopacity
  8984. Set foreground opacity. Default is @code{0.7}.
  8985. @item bgopacity
  8986. Set background opacity. Default is @code{0.5}.
  8987. @end table
  8988. @subsection Examples
  8989. @itemize
  8990. @item
  8991. Calculate and draw histogram:
  8992. @example
  8993. ffplay -i input -vf histogram
  8994. @end example
  8995. @end itemize
  8996. @anchor{hqdn3d}
  8997. @section hqdn3d
  8998. This is a high precision/quality 3d denoise filter. It aims to reduce
  8999. image noise, producing smooth images and making still images really
  9000. still. It should enhance compressibility.
  9001. It accepts the following optional parameters:
  9002. @table @option
  9003. @item luma_spatial
  9004. A non-negative floating point number which specifies spatial luma strength.
  9005. It defaults to 4.0.
  9006. @item chroma_spatial
  9007. A non-negative floating point number which specifies spatial chroma strength.
  9008. It defaults to 3.0*@var{luma_spatial}/4.0.
  9009. @item luma_tmp
  9010. A floating point number which specifies luma temporal strength. It defaults to
  9011. 6.0*@var{luma_spatial}/4.0.
  9012. @item chroma_tmp
  9013. A floating point number which specifies chroma temporal strength. It defaults to
  9014. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9015. @end table
  9016. @subsection Commands
  9017. This filter supports same @ref{commands} as options.
  9018. The command accepts the same syntax of the corresponding option.
  9019. If the specified expression is not valid, it is kept at its current
  9020. value.
  9021. @anchor{hwdownload}
  9022. @section hwdownload
  9023. Download hardware frames to system memory.
  9024. The input must be in hardware frames, and the output a non-hardware format.
  9025. Not all formats will be supported on the output - it may be necessary to insert
  9026. an additional @option{format} filter immediately following in the graph to get
  9027. the output in a supported format.
  9028. @section hwmap
  9029. Map hardware frames to system memory or to another device.
  9030. This filter has several different modes of operation; which one is used depends
  9031. on the input and output formats:
  9032. @itemize
  9033. @item
  9034. Hardware frame input, normal frame output
  9035. Map the input frames to system memory and pass them to the output. If the
  9036. original hardware frame is later required (for example, after overlaying
  9037. something else on part of it), the @option{hwmap} filter can be used again
  9038. in the next mode to retrieve it.
  9039. @item
  9040. Normal frame input, hardware frame output
  9041. If the input is actually a software-mapped hardware frame, then unmap it -
  9042. that is, return the original hardware frame.
  9043. Otherwise, a device must be provided. Create new hardware surfaces on that
  9044. device for the output, then map them back to the software format at the input
  9045. and give those frames to the preceding filter. This will then act like the
  9046. @option{hwupload} filter, but may be able to avoid an additional copy when
  9047. the input is already in a compatible format.
  9048. @item
  9049. Hardware frame input and output
  9050. A device must be supplied for the output, either directly or with the
  9051. @option{derive_device} option. The input and output devices must be of
  9052. different types and compatible - the exact meaning of this is
  9053. system-dependent, but typically it means that they must refer to the same
  9054. underlying hardware context (for example, refer to the same graphics card).
  9055. If the input frames were originally created on the output device, then unmap
  9056. to retrieve the original frames.
  9057. Otherwise, map the frames to the output device - create new hardware frames
  9058. on the output corresponding to the frames on the input.
  9059. @end itemize
  9060. The following additional parameters are accepted:
  9061. @table @option
  9062. @item mode
  9063. Set the frame mapping mode. Some combination of:
  9064. @table @var
  9065. @item read
  9066. The mapped frame should be readable.
  9067. @item write
  9068. The mapped frame should be writeable.
  9069. @item overwrite
  9070. The mapping will always overwrite the entire frame.
  9071. This may improve performance in some cases, as the original contents of the
  9072. frame need not be loaded.
  9073. @item direct
  9074. The mapping must not involve any copying.
  9075. Indirect mappings to copies of frames are created in some cases where either
  9076. direct mapping is not possible or it would have unexpected properties.
  9077. Setting this flag ensures that the mapping is direct and will fail if that is
  9078. not possible.
  9079. @end table
  9080. Defaults to @var{read+write} if not specified.
  9081. @item derive_device @var{type}
  9082. Rather than using the device supplied at initialisation, instead derive a new
  9083. device of type @var{type} from the device the input frames exist on.
  9084. @item reverse
  9085. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9086. and map them back to the source. This may be necessary in some cases where
  9087. a mapping in one direction is required but only the opposite direction is
  9088. supported by the devices being used.
  9089. This option is dangerous - it may break the preceding filter in undefined
  9090. ways if there are any additional constraints on that filter's output.
  9091. Do not use it without fully understanding the implications of its use.
  9092. @end table
  9093. @anchor{hwupload}
  9094. @section hwupload
  9095. Upload system memory frames to hardware surfaces.
  9096. The device to upload to must be supplied when the filter is initialised. If
  9097. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9098. option.
  9099. @anchor{hwupload_cuda}
  9100. @section hwupload_cuda
  9101. Upload system memory frames to a CUDA device.
  9102. It accepts the following optional parameters:
  9103. @table @option
  9104. @item device
  9105. The number of the CUDA device to use
  9106. @end table
  9107. @section hqx
  9108. Apply a high-quality magnification filter designed for pixel art. This filter
  9109. was originally created by Maxim Stepin.
  9110. It accepts the following option:
  9111. @table @option
  9112. @item n
  9113. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9114. @code{hq3x} and @code{4} for @code{hq4x}.
  9115. Default is @code{3}.
  9116. @end table
  9117. @section hstack
  9118. Stack input videos horizontally.
  9119. All streams must be of same pixel format and of same height.
  9120. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9121. to create same output.
  9122. The filter accepts the following option:
  9123. @table @option
  9124. @item inputs
  9125. Set number of input streams. Default is 2.
  9126. @item shortest
  9127. If set to 1, force the output to terminate when the shortest input
  9128. terminates. Default value is 0.
  9129. @end table
  9130. @section hue
  9131. Modify the hue and/or the saturation of the input.
  9132. It accepts the following parameters:
  9133. @table @option
  9134. @item h
  9135. Specify the hue angle as a number of degrees. It accepts an expression,
  9136. and defaults to "0".
  9137. @item s
  9138. Specify the saturation in the [-10,10] range. It accepts an expression and
  9139. defaults to "1".
  9140. @item H
  9141. Specify the hue angle as a number of radians. It accepts an
  9142. expression, and defaults to "0".
  9143. @item b
  9144. Specify the brightness in the [-10,10] range. It accepts an expression and
  9145. defaults to "0".
  9146. @end table
  9147. @option{h} and @option{H} are mutually exclusive, and can't be
  9148. specified at the same time.
  9149. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9150. expressions containing the following constants:
  9151. @table @option
  9152. @item n
  9153. frame count of the input frame starting from 0
  9154. @item pts
  9155. presentation timestamp of the input frame expressed in time base units
  9156. @item r
  9157. frame rate of the input video, NAN if the input frame rate is unknown
  9158. @item t
  9159. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9160. @item tb
  9161. time base of the input video
  9162. @end table
  9163. @subsection Examples
  9164. @itemize
  9165. @item
  9166. Set the hue to 90 degrees and the saturation to 1.0:
  9167. @example
  9168. hue=h=90:s=1
  9169. @end example
  9170. @item
  9171. Same command but expressing the hue in radians:
  9172. @example
  9173. hue=H=PI/2:s=1
  9174. @end example
  9175. @item
  9176. Rotate hue and make the saturation swing between 0
  9177. and 2 over a period of 1 second:
  9178. @example
  9179. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9180. @end example
  9181. @item
  9182. Apply a 3 seconds saturation fade-in effect starting at 0:
  9183. @example
  9184. hue="s=min(t/3\,1)"
  9185. @end example
  9186. The general fade-in expression can be written as:
  9187. @example
  9188. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9189. @end example
  9190. @item
  9191. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9192. @example
  9193. hue="s=max(0\, min(1\, (8-t)/3))"
  9194. @end example
  9195. The general fade-out expression can be written as:
  9196. @example
  9197. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9198. @end example
  9199. @end itemize
  9200. @subsection Commands
  9201. This filter supports the following commands:
  9202. @table @option
  9203. @item b
  9204. @item s
  9205. @item h
  9206. @item H
  9207. Modify the hue and/or the saturation and/or brightness of the input video.
  9208. The command accepts the same syntax of the corresponding option.
  9209. If the specified expression is not valid, it is kept at its current
  9210. value.
  9211. @end table
  9212. @section hysteresis
  9213. Grow first stream into second stream by connecting components.
  9214. This makes it possible to build more robust edge masks.
  9215. This filter accepts the following options:
  9216. @table @option
  9217. @item planes
  9218. Set which planes will be processed as bitmap, unprocessed planes will be
  9219. copied from first stream.
  9220. By default value 0xf, all planes will be processed.
  9221. @item threshold
  9222. Set threshold which is used in filtering. If pixel component value is higher than
  9223. this value filter algorithm for connecting components is activated.
  9224. By default value is 0.
  9225. @end table
  9226. @section idet
  9227. Detect video interlacing type.
  9228. This filter tries to detect if the input frames are interlaced, progressive,
  9229. top or bottom field first. It will also try to detect fields that are
  9230. repeated between adjacent frames (a sign of telecine).
  9231. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9232. Multiple frame detection incorporates the classification history of previous frames.
  9233. The filter will log these metadata values:
  9234. @table @option
  9235. @item single.current_frame
  9236. Detected type of current frame using single-frame detection. One of:
  9237. ``tff'' (top field first), ``bff'' (bottom field first),
  9238. ``progressive'', or ``undetermined''
  9239. @item single.tff
  9240. Cumulative number of frames detected as top field first using single-frame detection.
  9241. @item multiple.tff
  9242. Cumulative number of frames detected as top field first using multiple-frame detection.
  9243. @item single.bff
  9244. Cumulative number of frames detected as bottom field first using single-frame detection.
  9245. @item multiple.current_frame
  9246. Detected type of current frame using multiple-frame detection. One of:
  9247. ``tff'' (top field first), ``bff'' (bottom field first),
  9248. ``progressive'', or ``undetermined''
  9249. @item multiple.bff
  9250. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9251. @item single.progressive
  9252. Cumulative number of frames detected as progressive using single-frame detection.
  9253. @item multiple.progressive
  9254. Cumulative number of frames detected as progressive using multiple-frame detection.
  9255. @item single.undetermined
  9256. Cumulative number of frames that could not be classified using single-frame detection.
  9257. @item multiple.undetermined
  9258. Cumulative number of frames that could not be classified using multiple-frame detection.
  9259. @item repeated.current_frame
  9260. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9261. @item repeated.neither
  9262. Cumulative number of frames with no repeated field.
  9263. @item repeated.top
  9264. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9265. @item repeated.bottom
  9266. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9267. @end table
  9268. The filter accepts the following options:
  9269. @table @option
  9270. @item intl_thres
  9271. Set interlacing threshold.
  9272. @item prog_thres
  9273. Set progressive threshold.
  9274. @item rep_thres
  9275. Threshold for repeated field detection.
  9276. @item half_life
  9277. Number of frames after which a given frame's contribution to the
  9278. statistics is halved (i.e., it contributes only 0.5 to its
  9279. classification). The default of 0 means that all frames seen are given
  9280. full weight of 1.0 forever.
  9281. @item analyze_interlaced_flag
  9282. When this is not 0 then idet will use the specified number of frames to determine
  9283. if the interlaced flag is accurate, it will not count undetermined frames.
  9284. If the flag is found to be accurate it will be used without any further
  9285. computations, if it is found to be inaccurate it will be cleared without any
  9286. further computations. This allows inserting the idet filter as a low computational
  9287. method to clean up the interlaced flag
  9288. @end table
  9289. @section il
  9290. Deinterleave or interleave fields.
  9291. This filter allows one to process interlaced images fields without
  9292. deinterlacing them. Deinterleaving splits the input frame into 2
  9293. fields (so called half pictures). Odd lines are moved to the top
  9294. half of the output image, even lines to the bottom half.
  9295. You can process (filter) them independently and then re-interleave them.
  9296. The filter accepts the following options:
  9297. @table @option
  9298. @item luma_mode, l
  9299. @item chroma_mode, c
  9300. @item alpha_mode, a
  9301. Available values for @var{luma_mode}, @var{chroma_mode} and
  9302. @var{alpha_mode} are:
  9303. @table @samp
  9304. @item none
  9305. Do nothing.
  9306. @item deinterleave, d
  9307. Deinterleave fields, placing one above the other.
  9308. @item interleave, i
  9309. Interleave fields. Reverse the effect of deinterleaving.
  9310. @end table
  9311. Default value is @code{none}.
  9312. @item luma_swap, ls
  9313. @item chroma_swap, cs
  9314. @item alpha_swap, as
  9315. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9316. @end table
  9317. @subsection Commands
  9318. This filter supports the all above options as @ref{commands}.
  9319. @section inflate
  9320. Apply inflate effect to the video.
  9321. This filter replaces the pixel by the local(3x3) average by taking into account
  9322. only values higher than the pixel.
  9323. It accepts the following options:
  9324. @table @option
  9325. @item threshold0
  9326. @item threshold1
  9327. @item threshold2
  9328. @item threshold3
  9329. Limit the maximum change for each plane, default is 65535.
  9330. If 0, plane will remain unchanged.
  9331. @end table
  9332. @subsection Commands
  9333. This filter supports the all above options as @ref{commands}.
  9334. @section interlace
  9335. Simple interlacing filter from progressive contents. This interleaves upper (or
  9336. lower) lines from odd frames with lower (or upper) lines from even frames,
  9337. halving the frame rate and preserving image height.
  9338. @example
  9339. Original Original New Frame
  9340. Frame 'j' Frame 'j+1' (tff)
  9341. ========== =========== ==================
  9342. Line 0 --------------------> Frame 'j' Line 0
  9343. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9344. Line 2 ---------------------> Frame 'j' Line 2
  9345. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9346. ... ... ...
  9347. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9348. @end example
  9349. It accepts the following optional parameters:
  9350. @table @option
  9351. @item scan
  9352. This determines whether the interlaced frame is taken from the even
  9353. (tff - default) or odd (bff) lines of the progressive frame.
  9354. @item lowpass
  9355. Vertical lowpass filter to avoid twitter interlacing and
  9356. reduce moire patterns.
  9357. @table @samp
  9358. @item 0, off
  9359. Disable vertical lowpass filter
  9360. @item 1, linear
  9361. Enable linear filter (default)
  9362. @item 2, complex
  9363. Enable complex filter. This will slightly less reduce twitter and moire
  9364. but better retain detail and subjective sharpness impression.
  9365. @end table
  9366. @end table
  9367. @section kerndeint
  9368. Deinterlace input video by applying Donald Graft's adaptive kernel
  9369. deinterling. Work on interlaced parts of a video to produce
  9370. progressive frames.
  9371. The description of the accepted parameters follows.
  9372. @table @option
  9373. @item thresh
  9374. Set the threshold which affects the filter's tolerance when
  9375. determining if a pixel line must be processed. It must be an integer
  9376. in the range [0,255] and defaults to 10. A value of 0 will result in
  9377. applying the process on every pixels.
  9378. @item map
  9379. Paint pixels exceeding the threshold value to white if set to 1.
  9380. Default is 0.
  9381. @item order
  9382. Set the fields order. Swap fields if set to 1, leave fields alone if
  9383. 0. Default is 0.
  9384. @item sharp
  9385. Enable additional sharpening if set to 1. Default is 0.
  9386. @item twoway
  9387. Enable twoway sharpening if set to 1. Default is 0.
  9388. @end table
  9389. @subsection Examples
  9390. @itemize
  9391. @item
  9392. Apply default values:
  9393. @example
  9394. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9395. @end example
  9396. @item
  9397. Enable additional sharpening:
  9398. @example
  9399. kerndeint=sharp=1
  9400. @end example
  9401. @item
  9402. Paint processed pixels in white:
  9403. @example
  9404. kerndeint=map=1
  9405. @end example
  9406. @end itemize
  9407. @section lagfun
  9408. Slowly update darker pixels.
  9409. This filter makes short flashes of light appear longer.
  9410. This filter accepts the following options:
  9411. @table @option
  9412. @item decay
  9413. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9414. @item planes
  9415. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9416. @end table
  9417. @section lenscorrection
  9418. Correct radial lens distortion
  9419. This filter can be used to correct for radial distortion as can result from the use
  9420. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9421. one can use tools available for example as part of opencv or simply trial-and-error.
  9422. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9423. and extract the k1 and k2 coefficients from the resulting matrix.
  9424. Note that effectively the same filter is available in the open-source tools Krita and
  9425. Digikam from the KDE project.
  9426. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9427. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9428. brightness distribution, so you may want to use both filters together in certain
  9429. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9430. be applied before or after lens correction.
  9431. @subsection Options
  9432. The filter accepts the following options:
  9433. @table @option
  9434. @item cx
  9435. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9436. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9437. width. Default is 0.5.
  9438. @item cy
  9439. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9440. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9441. height. Default is 0.5.
  9442. @item k1
  9443. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9444. no correction. Default is 0.
  9445. @item k2
  9446. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9447. 0 means no correction. Default is 0.
  9448. @end table
  9449. The formula that generates the correction is:
  9450. @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)
  9451. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9452. distances from the focal point in the source and target images, respectively.
  9453. @section lensfun
  9454. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9455. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9456. to apply the lens correction. The filter will load the lensfun database and
  9457. query it to find the corresponding camera and lens entries in the database. As
  9458. long as these entries can be found with the given options, the filter can
  9459. perform corrections on frames. Note that incomplete strings will result in the
  9460. filter choosing the best match with the given options, and the filter will
  9461. output the chosen camera and lens models (logged with level "info"). You must
  9462. provide the make, camera model, and lens model as they are required.
  9463. The filter accepts the following options:
  9464. @table @option
  9465. @item make
  9466. The make of the camera (for example, "Canon"). This option is required.
  9467. @item model
  9468. The model of the camera (for example, "Canon EOS 100D"). This option is
  9469. required.
  9470. @item lens_model
  9471. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9472. option is required.
  9473. @item mode
  9474. The type of correction to apply. The following values are valid options:
  9475. @table @samp
  9476. @item vignetting
  9477. Enables fixing lens vignetting.
  9478. @item geometry
  9479. Enables fixing lens geometry. This is the default.
  9480. @item subpixel
  9481. Enables fixing chromatic aberrations.
  9482. @item vig_geo
  9483. Enables fixing lens vignetting and lens geometry.
  9484. @item vig_subpixel
  9485. Enables fixing lens vignetting and chromatic aberrations.
  9486. @item distortion
  9487. Enables fixing both lens geometry and chromatic aberrations.
  9488. @item all
  9489. Enables all possible corrections.
  9490. @end table
  9491. @item focal_length
  9492. The focal length of the image/video (zoom; expected constant for video). For
  9493. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9494. range should be chosen when using that lens. Default 18.
  9495. @item aperture
  9496. The aperture of the image/video (expected constant for video). Note that
  9497. aperture is only used for vignetting correction. Default 3.5.
  9498. @item focus_distance
  9499. The focus distance of the image/video (expected constant for video). Note that
  9500. focus distance is only used for vignetting and only slightly affects the
  9501. vignetting correction process. If unknown, leave it at the default value (which
  9502. is 1000).
  9503. @item scale
  9504. The scale factor which is applied after transformation. After correction the
  9505. video is no longer necessarily rectangular. This parameter controls how much of
  9506. the resulting image is visible. The value 0 means that a value will be chosen
  9507. automatically such that there is little or no unmapped area in the output
  9508. image. 1.0 means that no additional scaling is done. Lower values may result
  9509. in more of the corrected image being visible, while higher values may avoid
  9510. unmapped areas in the output.
  9511. @item target_geometry
  9512. The target geometry of the output image/video. The following values are valid
  9513. options:
  9514. @table @samp
  9515. @item rectilinear (default)
  9516. @item fisheye
  9517. @item panoramic
  9518. @item equirectangular
  9519. @item fisheye_orthographic
  9520. @item fisheye_stereographic
  9521. @item fisheye_equisolid
  9522. @item fisheye_thoby
  9523. @end table
  9524. @item reverse
  9525. Apply the reverse of image correction (instead of correcting distortion, apply
  9526. it).
  9527. @item interpolation
  9528. The type of interpolation used when correcting distortion. The following values
  9529. are valid options:
  9530. @table @samp
  9531. @item nearest
  9532. @item linear (default)
  9533. @item lanczos
  9534. @end table
  9535. @end table
  9536. @subsection Examples
  9537. @itemize
  9538. @item
  9539. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9540. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9541. aperture of "8.0".
  9542. @example
  9543. 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
  9544. @end example
  9545. @item
  9546. Apply the same as before, but only for the first 5 seconds of video.
  9547. @example
  9548. 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
  9549. @end example
  9550. @end itemize
  9551. @section libvmaf
  9552. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9553. score between two input videos.
  9554. The obtained VMAF score is printed through the logging system.
  9555. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9556. After installing the library it can be enabled using:
  9557. @code{./configure --enable-libvmaf --enable-version3}.
  9558. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9559. The filter has following options:
  9560. @table @option
  9561. @item model_path
  9562. Set the model path which is to be used for SVM.
  9563. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9564. @item log_path
  9565. Set the file path to be used to store logs.
  9566. @item log_fmt
  9567. Set the format of the log file (xml or json).
  9568. @item enable_transform
  9569. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9570. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9571. Default value: @code{false}
  9572. @item phone_model
  9573. Invokes the phone model which will generate VMAF scores higher than in the
  9574. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9575. Default value: @code{false}
  9576. @item psnr
  9577. Enables computing psnr along with vmaf.
  9578. Default value: @code{false}
  9579. @item ssim
  9580. Enables computing ssim along with vmaf.
  9581. Default value: @code{false}
  9582. @item ms_ssim
  9583. Enables computing ms_ssim along with vmaf.
  9584. Default value: @code{false}
  9585. @item pool
  9586. Set the pool method to be used for computing vmaf.
  9587. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9588. @item n_threads
  9589. Set number of threads to be used when computing vmaf.
  9590. Default value: @code{0}, which makes use of all available logical processors.
  9591. @item n_subsample
  9592. Set interval for frame subsampling used when computing vmaf.
  9593. Default value: @code{1}
  9594. @item enable_conf_interval
  9595. Enables confidence interval.
  9596. Default value: @code{false}
  9597. @end table
  9598. This filter also supports the @ref{framesync} options.
  9599. @subsection Examples
  9600. @itemize
  9601. @item
  9602. On the below examples the input file @file{main.mpg} being processed is
  9603. compared with the reference file @file{ref.mpg}.
  9604. @example
  9605. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9606. @end example
  9607. @item
  9608. Example with options:
  9609. @example
  9610. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9611. @end example
  9612. @item
  9613. Example with options and different containers:
  9614. @example
  9615. 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 -
  9616. @end example
  9617. @end itemize
  9618. @section limiter
  9619. Limits the pixel components values to the specified range [min, max].
  9620. The filter accepts the following options:
  9621. @table @option
  9622. @item min
  9623. Lower bound. Defaults to the lowest allowed value for the input.
  9624. @item max
  9625. Upper bound. Defaults to the highest allowed value for the input.
  9626. @item planes
  9627. Specify which planes will be processed. Defaults to all available.
  9628. @end table
  9629. @section loop
  9630. Loop video frames.
  9631. The filter accepts the following options:
  9632. @table @option
  9633. @item loop
  9634. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9635. Default is 0.
  9636. @item size
  9637. Set maximal size in number of frames. Default is 0.
  9638. @item start
  9639. Set first frame of loop. Default is 0.
  9640. @end table
  9641. @subsection Examples
  9642. @itemize
  9643. @item
  9644. Loop single first frame infinitely:
  9645. @example
  9646. loop=loop=-1:size=1:start=0
  9647. @end example
  9648. @item
  9649. Loop single first frame 10 times:
  9650. @example
  9651. loop=loop=10:size=1:start=0
  9652. @end example
  9653. @item
  9654. Loop 10 first frames 5 times:
  9655. @example
  9656. loop=loop=5:size=10:start=0
  9657. @end example
  9658. @end itemize
  9659. @section lut1d
  9660. Apply a 1D LUT to an input video.
  9661. The filter accepts the following options:
  9662. @table @option
  9663. @item file
  9664. Set the 1D LUT file name.
  9665. Currently supported formats:
  9666. @table @samp
  9667. @item cube
  9668. Iridas
  9669. @item csp
  9670. cineSpace
  9671. @end table
  9672. @item interp
  9673. Select interpolation mode.
  9674. Available values are:
  9675. @table @samp
  9676. @item nearest
  9677. Use values from the nearest defined point.
  9678. @item linear
  9679. Interpolate values using the linear interpolation.
  9680. @item cosine
  9681. Interpolate values using the cosine interpolation.
  9682. @item cubic
  9683. Interpolate values using the cubic interpolation.
  9684. @item spline
  9685. Interpolate values using the spline interpolation.
  9686. @end table
  9687. @end table
  9688. @anchor{lut3d}
  9689. @section lut3d
  9690. Apply a 3D LUT to an input video.
  9691. The filter accepts the following options:
  9692. @table @option
  9693. @item file
  9694. Set the 3D LUT file name.
  9695. Currently supported formats:
  9696. @table @samp
  9697. @item 3dl
  9698. AfterEffects
  9699. @item cube
  9700. Iridas
  9701. @item dat
  9702. DaVinci
  9703. @item m3d
  9704. Pandora
  9705. @item csp
  9706. cineSpace
  9707. @end table
  9708. @item interp
  9709. Select interpolation mode.
  9710. Available values are:
  9711. @table @samp
  9712. @item nearest
  9713. Use values from the nearest defined point.
  9714. @item trilinear
  9715. Interpolate values using the 8 points defining a cube.
  9716. @item tetrahedral
  9717. Interpolate values using a tetrahedron.
  9718. @end table
  9719. @end table
  9720. @section lumakey
  9721. Turn certain luma values into transparency.
  9722. The filter accepts the following options:
  9723. @table @option
  9724. @item threshold
  9725. Set the luma which will be used as base for transparency.
  9726. Default value is @code{0}.
  9727. @item tolerance
  9728. Set the range of luma values to be keyed out.
  9729. Default value is @code{0.01}.
  9730. @item softness
  9731. Set the range of softness. Default value is @code{0}.
  9732. Use this to control gradual transition from zero to full transparency.
  9733. @end table
  9734. @subsection Commands
  9735. This filter supports same @ref{commands} as options.
  9736. The command accepts the same syntax of the corresponding option.
  9737. If the specified expression is not valid, it is kept at its current
  9738. value.
  9739. @section lut, lutrgb, lutyuv
  9740. Compute a look-up table for binding each pixel component input value
  9741. to an output value, and apply it to the input video.
  9742. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9743. to an RGB input video.
  9744. These filters accept the following parameters:
  9745. @table @option
  9746. @item c0
  9747. set first pixel component expression
  9748. @item c1
  9749. set second pixel component expression
  9750. @item c2
  9751. set third pixel component expression
  9752. @item c3
  9753. set fourth pixel component expression, corresponds to the alpha component
  9754. @item r
  9755. set red component expression
  9756. @item g
  9757. set green component expression
  9758. @item b
  9759. set blue component expression
  9760. @item a
  9761. alpha component expression
  9762. @item y
  9763. set Y/luminance component expression
  9764. @item u
  9765. set U/Cb component expression
  9766. @item v
  9767. set V/Cr component expression
  9768. @end table
  9769. Each of them specifies the expression to use for computing the lookup table for
  9770. the corresponding pixel component values.
  9771. The exact component associated to each of the @var{c*} options depends on the
  9772. format in input.
  9773. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9774. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9775. The expressions can contain the following constants and functions:
  9776. @table @option
  9777. @item w
  9778. @item h
  9779. The input width and height.
  9780. @item val
  9781. The input value for the pixel component.
  9782. @item clipval
  9783. The input value, clipped to the @var{minval}-@var{maxval} range.
  9784. @item maxval
  9785. The maximum value for the pixel component.
  9786. @item minval
  9787. The minimum value for the pixel component.
  9788. @item negval
  9789. The negated value for the pixel component value, clipped to the
  9790. @var{minval}-@var{maxval} range; it corresponds to the expression
  9791. "maxval-clipval+minval".
  9792. @item clip(val)
  9793. The computed value in @var{val}, clipped to the
  9794. @var{minval}-@var{maxval} range.
  9795. @item gammaval(gamma)
  9796. The computed gamma correction value of the pixel component value,
  9797. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9798. expression
  9799. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9800. @end table
  9801. All expressions default to "val".
  9802. @subsection Examples
  9803. @itemize
  9804. @item
  9805. Negate input video:
  9806. @example
  9807. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9808. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9809. @end example
  9810. The above is the same as:
  9811. @example
  9812. lutrgb="r=negval:g=negval:b=negval"
  9813. lutyuv="y=negval:u=negval:v=negval"
  9814. @end example
  9815. @item
  9816. Negate luminance:
  9817. @example
  9818. lutyuv=y=negval
  9819. @end example
  9820. @item
  9821. Remove chroma components, turning the video into a graytone image:
  9822. @example
  9823. lutyuv="u=128:v=128"
  9824. @end example
  9825. @item
  9826. Apply a luma burning effect:
  9827. @example
  9828. lutyuv="y=2*val"
  9829. @end example
  9830. @item
  9831. Remove green and blue components:
  9832. @example
  9833. lutrgb="g=0:b=0"
  9834. @end example
  9835. @item
  9836. Set a constant alpha channel value on input:
  9837. @example
  9838. format=rgba,lutrgb=a="maxval-minval/2"
  9839. @end example
  9840. @item
  9841. Correct luminance gamma by a factor of 0.5:
  9842. @example
  9843. lutyuv=y=gammaval(0.5)
  9844. @end example
  9845. @item
  9846. Discard least significant bits of luma:
  9847. @example
  9848. lutyuv=y='bitand(val, 128+64+32)'
  9849. @end example
  9850. @item
  9851. Technicolor like effect:
  9852. @example
  9853. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9854. @end example
  9855. @end itemize
  9856. @section lut2, tlut2
  9857. The @code{lut2} filter takes two input streams and outputs one
  9858. stream.
  9859. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9860. from one single stream.
  9861. This filter accepts the following parameters:
  9862. @table @option
  9863. @item c0
  9864. set first pixel component expression
  9865. @item c1
  9866. set second pixel component expression
  9867. @item c2
  9868. set third pixel component expression
  9869. @item c3
  9870. set fourth pixel component expression, corresponds to the alpha component
  9871. @item d
  9872. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9873. which means bit depth is automatically picked from first input format.
  9874. @end table
  9875. Each of them specifies the expression to use for computing the lookup table for
  9876. the corresponding pixel component values.
  9877. The exact component associated to each of the @var{c*} options depends on the
  9878. format in inputs.
  9879. The expressions can contain the following constants:
  9880. @table @option
  9881. @item w
  9882. @item h
  9883. The input width and height.
  9884. @item x
  9885. The first input value for the pixel component.
  9886. @item y
  9887. The second input value for the pixel component.
  9888. @item bdx
  9889. The first input video bit depth.
  9890. @item bdy
  9891. The second input video bit depth.
  9892. @end table
  9893. All expressions default to "x".
  9894. @subsection Examples
  9895. @itemize
  9896. @item
  9897. Highlight differences between two RGB video streams:
  9898. @example
  9899. 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)'
  9900. @end example
  9901. @item
  9902. Highlight differences between two YUV video streams:
  9903. @example
  9904. 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)'
  9905. @end example
  9906. @item
  9907. Show max difference between two video streams:
  9908. @example
  9909. 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)))'
  9910. @end example
  9911. @end itemize
  9912. @section maskedclamp
  9913. Clamp the first input stream with the second input and third input stream.
  9914. Returns the value of first stream to be between second input
  9915. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9916. This filter accepts the following options:
  9917. @table @option
  9918. @item undershoot
  9919. Default value is @code{0}.
  9920. @item overshoot
  9921. Default value is @code{0}.
  9922. @item planes
  9923. Set which planes will be processed as bitmap, unprocessed planes will be
  9924. copied from first stream.
  9925. By default value 0xf, all planes will be processed.
  9926. @end table
  9927. @section maskedmax
  9928. Merge the second and third input stream into output stream using absolute differences
  9929. between second input stream and first input stream and absolute difference between
  9930. third input stream and first input stream. The picked value will be from second input
  9931. stream if second absolute difference is greater than first one or from third input stream
  9932. otherwise.
  9933. This filter accepts the following options:
  9934. @table @option
  9935. @item planes
  9936. Set which planes will be processed as bitmap, unprocessed planes will be
  9937. copied from first stream.
  9938. By default value 0xf, all planes will be processed.
  9939. @end table
  9940. @section maskedmerge
  9941. Merge the first input stream with the second input stream using per pixel
  9942. weights in the third input stream.
  9943. A value of 0 in the third stream pixel component means that pixel component
  9944. from first stream is returned unchanged, while maximum value (eg. 255 for
  9945. 8-bit videos) means that pixel component from second stream is returned
  9946. unchanged. Intermediate values define the amount of merging between both
  9947. input stream's pixel components.
  9948. This filter accepts the following options:
  9949. @table @option
  9950. @item planes
  9951. Set which planes will be processed as bitmap, unprocessed planes will be
  9952. copied from first stream.
  9953. By default value 0xf, all planes will be processed.
  9954. @end table
  9955. @section maskedmin
  9956. Merge the second and third input stream into output stream using absolute differences
  9957. between second input stream and first input stream and absolute difference between
  9958. third input stream and first input stream. The picked value will be from second input
  9959. stream if second absolute difference is less than first one or from third input stream
  9960. otherwise.
  9961. This filter accepts the following options:
  9962. @table @option
  9963. @item planes
  9964. Set which planes will be processed as bitmap, unprocessed planes will be
  9965. copied from first stream.
  9966. By default value 0xf, all planes will be processed.
  9967. @end table
  9968. @section maskfun
  9969. Create mask from input video.
  9970. For example it is useful to create motion masks after @code{tblend} filter.
  9971. This filter accepts the following options:
  9972. @table @option
  9973. @item low
  9974. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9975. @item high
  9976. Set high threshold. Any pixel component higher than this value will be set to max value
  9977. allowed for current pixel format.
  9978. @item planes
  9979. Set planes to filter, by default all available planes are filtered.
  9980. @item fill
  9981. Fill all frame pixels with this value.
  9982. @item sum
  9983. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9984. average, output frame will be completely filled with value set by @var{fill} option.
  9985. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9986. @end table
  9987. @section mcdeint
  9988. Apply motion-compensation deinterlacing.
  9989. It needs one field per frame as input and must thus be used together
  9990. with yadif=1/3 or equivalent.
  9991. This filter accepts the following options:
  9992. @table @option
  9993. @item mode
  9994. Set the deinterlacing mode.
  9995. It accepts one of the following values:
  9996. @table @samp
  9997. @item fast
  9998. @item medium
  9999. @item slow
  10000. use iterative motion estimation
  10001. @item extra_slow
  10002. like @samp{slow}, but use multiple reference frames.
  10003. @end table
  10004. Default value is @samp{fast}.
  10005. @item parity
  10006. Set the picture field parity assumed for the input video. It must be
  10007. one of the following values:
  10008. @table @samp
  10009. @item 0, tff
  10010. assume top field first
  10011. @item 1, bff
  10012. assume bottom field first
  10013. @end table
  10014. Default value is @samp{bff}.
  10015. @item qp
  10016. Set per-block quantization parameter (QP) used by the internal
  10017. encoder.
  10018. Higher values should result in a smoother motion vector field but less
  10019. optimal individual vectors. Default value is 1.
  10020. @end table
  10021. @section median
  10022. Pick median pixel from certain rectangle defined by radius.
  10023. This filter accepts the following options:
  10024. @table @option
  10025. @item radius
  10026. Set horizontal radius size. Default value is @code{1}.
  10027. Allowed range is integer from 1 to 127.
  10028. @item planes
  10029. Set which planes to process. Default is @code{15}, which is all available planes.
  10030. @item radiusV
  10031. Set vertical radius size. Default value is @code{0}.
  10032. Allowed range is integer from 0 to 127.
  10033. If it is 0, value will be picked from horizontal @code{radius} option.
  10034. @end table
  10035. @subsection Commands
  10036. This filter supports same @ref{commands} as options.
  10037. The command accepts the same syntax of the corresponding option.
  10038. If the specified expression is not valid, it is kept at its current
  10039. value.
  10040. @section mergeplanes
  10041. Merge color channel components from several video streams.
  10042. The filter accepts up to 4 input streams, and merge selected input
  10043. planes to the output video.
  10044. This filter accepts the following options:
  10045. @table @option
  10046. @item mapping
  10047. Set input to output plane mapping. Default is @code{0}.
  10048. The mappings is specified as a bitmap. It should be specified as a
  10049. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10050. mapping for the first plane of the output stream. 'A' sets the number of
  10051. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10052. corresponding input to use (from 0 to 3). The rest of the mappings is
  10053. similar, 'Bb' describes the mapping for the output stream second
  10054. plane, 'Cc' describes the mapping for the output stream third plane and
  10055. 'Dd' describes the mapping for the output stream fourth plane.
  10056. @item format
  10057. Set output pixel format. Default is @code{yuva444p}.
  10058. @end table
  10059. @subsection Examples
  10060. @itemize
  10061. @item
  10062. Merge three gray video streams of same width and height into single video stream:
  10063. @example
  10064. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10065. @end example
  10066. @item
  10067. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10068. @example
  10069. [a0][a1]mergeplanes=0x00010210:yuva444p
  10070. @end example
  10071. @item
  10072. Swap Y and A plane in yuva444p stream:
  10073. @example
  10074. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10075. @end example
  10076. @item
  10077. Swap U and V plane in yuv420p stream:
  10078. @example
  10079. format=yuv420p,mergeplanes=0x000201:yuv420p
  10080. @end example
  10081. @item
  10082. Cast a rgb24 clip to yuv444p:
  10083. @example
  10084. format=rgb24,mergeplanes=0x000102:yuv444p
  10085. @end example
  10086. @end itemize
  10087. @section mestimate
  10088. Estimate and export motion vectors using block matching algorithms.
  10089. Motion vectors are stored in frame side data to be used by other filters.
  10090. This filter accepts the following options:
  10091. @table @option
  10092. @item method
  10093. Specify the motion estimation method. Accepts one of the following values:
  10094. @table @samp
  10095. @item esa
  10096. Exhaustive search algorithm.
  10097. @item tss
  10098. Three step search algorithm.
  10099. @item tdls
  10100. Two dimensional logarithmic search algorithm.
  10101. @item ntss
  10102. New three step search algorithm.
  10103. @item fss
  10104. Four step search algorithm.
  10105. @item ds
  10106. Diamond search algorithm.
  10107. @item hexbs
  10108. Hexagon-based search algorithm.
  10109. @item epzs
  10110. Enhanced predictive zonal search algorithm.
  10111. @item umh
  10112. Uneven multi-hexagon search algorithm.
  10113. @end table
  10114. Default value is @samp{esa}.
  10115. @item mb_size
  10116. Macroblock size. Default @code{16}.
  10117. @item search_param
  10118. Search parameter. Default @code{7}.
  10119. @end table
  10120. @section midequalizer
  10121. Apply Midway Image Equalization effect using two video streams.
  10122. Midway Image Equalization adjusts a pair of images to have the same
  10123. histogram, while maintaining their dynamics as much as possible. It's
  10124. useful for e.g. matching exposures from a pair of stereo cameras.
  10125. This filter has two inputs and one output, which must be of same pixel format, but
  10126. may be of different sizes. The output of filter is first input adjusted with
  10127. midway histogram of both inputs.
  10128. This filter accepts the following option:
  10129. @table @option
  10130. @item planes
  10131. Set which planes to process. Default is @code{15}, which is all available planes.
  10132. @end table
  10133. @section minterpolate
  10134. Convert the video to specified frame rate using motion interpolation.
  10135. This filter accepts the following options:
  10136. @table @option
  10137. @item fps
  10138. 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}.
  10139. @item mi_mode
  10140. Motion interpolation mode. Following values are accepted:
  10141. @table @samp
  10142. @item dup
  10143. Duplicate previous or next frame for interpolating new ones.
  10144. @item blend
  10145. Blend source frames. Interpolated frame is mean of previous and next frames.
  10146. @item mci
  10147. Motion compensated interpolation. Following options are effective when this mode is selected:
  10148. @table @samp
  10149. @item mc_mode
  10150. Motion compensation mode. Following values are accepted:
  10151. @table @samp
  10152. @item obmc
  10153. Overlapped block motion compensation.
  10154. @item aobmc
  10155. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10156. @end table
  10157. Default mode is @samp{obmc}.
  10158. @item me_mode
  10159. Motion estimation mode. Following values are accepted:
  10160. @table @samp
  10161. @item bidir
  10162. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10163. @item bilat
  10164. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10165. @end table
  10166. Default mode is @samp{bilat}.
  10167. @item me
  10168. The algorithm to be used for motion estimation. Following values are accepted:
  10169. @table @samp
  10170. @item esa
  10171. Exhaustive search algorithm.
  10172. @item tss
  10173. Three step search algorithm.
  10174. @item tdls
  10175. Two dimensional logarithmic search algorithm.
  10176. @item ntss
  10177. New three step search algorithm.
  10178. @item fss
  10179. Four step search algorithm.
  10180. @item ds
  10181. Diamond search algorithm.
  10182. @item hexbs
  10183. Hexagon-based search algorithm.
  10184. @item epzs
  10185. Enhanced predictive zonal search algorithm.
  10186. @item umh
  10187. Uneven multi-hexagon search algorithm.
  10188. @end table
  10189. Default algorithm is @samp{epzs}.
  10190. @item mb_size
  10191. Macroblock size. Default @code{16}.
  10192. @item search_param
  10193. Motion estimation search parameter. Default @code{32}.
  10194. @item vsbmc
  10195. 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).
  10196. @end table
  10197. @end table
  10198. @item scd
  10199. 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:
  10200. @table @samp
  10201. @item none
  10202. Disable scene change detection.
  10203. @item fdiff
  10204. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10205. @end table
  10206. Default method is @samp{fdiff}.
  10207. @item scd_threshold
  10208. Scene change detection threshold. Default is @code{5.0}.
  10209. @end table
  10210. @section mix
  10211. Mix several video input streams into one video stream.
  10212. A description of the accepted options follows.
  10213. @table @option
  10214. @item nb_inputs
  10215. The number of inputs. If unspecified, it defaults to 2.
  10216. @item weights
  10217. Specify weight of each input video stream as sequence.
  10218. Each weight is separated by space. If number of weights
  10219. is smaller than number of @var{frames} last specified
  10220. weight will be used for all remaining unset weights.
  10221. @item scale
  10222. Specify scale, if it is set it will be multiplied with sum
  10223. of each weight multiplied with pixel values to give final destination
  10224. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10225. @item duration
  10226. Specify how end of stream is determined.
  10227. @table @samp
  10228. @item longest
  10229. The duration of the longest input. (default)
  10230. @item shortest
  10231. The duration of the shortest input.
  10232. @item first
  10233. The duration of the first input.
  10234. @end table
  10235. @end table
  10236. @section mpdecimate
  10237. Drop frames that do not differ greatly from the previous frame in
  10238. order to reduce frame rate.
  10239. The main use of this filter is for very-low-bitrate encoding
  10240. (e.g. streaming over dialup modem), but it could in theory be used for
  10241. fixing movies that were inverse-telecined incorrectly.
  10242. A description of the accepted options follows.
  10243. @table @option
  10244. @item max
  10245. Set the maximum number of consecutive frames which can be dropped (if
  10246. positive), or the minimum interval between dropped frames (if
  10247. negative). If the value is 0, the frame is dropped disregarding the
  10248. number of previous sequentially dropped frames.
  10249. Default value is 0.
  10250. @item hi
  10251. @item lo
  10252. @item frac
  10253. Set the dropping threshold values.
  10254. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10255. represent actual pixel value differences, so a threshold of 64
  10256. corresponds to 1 unit of difference for each pixel, or the same spread
  10257. out differently over the block.
  10258. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10259. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10260. meaning the whole image) differ by more than a threshold of @option{lo}.
  10261. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10262. 64*5, and default value for @option{frac} is 0.33.
  10263. @end table
  10264. @section negate
  10265. Negate (invert) the input video.
  10266. It accepts the following option:
  10267. @table @option
  10268. @item negate_alpha
  10269. With value 1, it negates the alpha component, if present. Default value is 0.
  10270. @end table
  10271. @anchor{nlmeans}
  10272. @section nlmeans
  10273. Denoise frames using Non-Local Means algorithm.
  10274. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10275. context similarity is defined by comparing their surrounding patches of size
  10276. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10277. around the pixel.
  10278. Note that the research area defines centers for patches, which means some
  10279. patches will be made of pixels outside that research area.
  10280. The filter accepts the following options.
  10281. @table @option
  10282. @item s
  10283. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10284. @item p
  10285. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10286. @item pc
  10287. Same as @option{p} but for chroma planes.
  10288. The default value is @var{0} and means automatic.
  10289. @item r
  10290. Set research size. Default is 15. Must be odd number in range [0, 99].
  10291. @item rc
  10292. Same as @option{r} but for chroma planes.
  10293. The default value is @var{0} and means automatic.
  10294. @end table
  10295. @section nnedi
  10296. Deinterlace video using neural network edge directed interpolation.
  10297. This filter accepts the following options:
  10298. @table @option
  10299. @item weights
  10300. Mandatory option, without binary file filter can not work.
  10301. Currently file can be found here:
  10302. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10303. @item deint
  10304. Set which frames to deinterlace, by default it is @code{all}.
  10305. Can be @code{all} or @code{interlaced}.
  10306. @item field
  10307. Set mode of operation.
  10308. Can be one of the following:
  10309. @table @samp
  10310. @item af
  10311. Use frame flags, both fields.
  10312. @item a
  10313. Use frame flags, single field.
  10314. @item t
  10315. Use top field only.
  10316. @item b
  10317. Use bottom field only.
  10318. @item tf
  10319. Use both fields, top first.
  10320. @item bf
  10321. Use both fields, bottom first.
  10322. @end table
  10323. @item planes
  10324. Set which planes to process, by default filter process all frames.
  10325. @item nsize
  10326. Set size of local neighborhood around each pixel, used by the predictor neural
  10327. network.
  10328. Can be one of the following:
  10329. @table @samp
  10330. @item s8x6
  10331. @item s16x6
  10332. @item s32x6
  10333. @item s48x6
  10334. @item s8x4
  10335. @item s16x4
  10336. @item s32x4
  10337. @end table
  10338. @item nns
  10339. Set the number of neurons in predictor neural network.
  10340. Can be one of the following:
  10341. @table @samp
  10342. @item n16
  10343. @item n32
  10344. @item n64
  10345. @item n128
  10346. @item n256
  10347. @end table
  10348. @item qual
  10349. Controls the number of different neural network predictions that are blended
  10350. together to compute the final output value. Can be @code{fast}, default or
  10351. @code{slow}.
  10352. @item etype
  10353. Set which set of weights to use in the predictor.
  10354. Can be one of the following:
  10355. @table @samp
  10356. @item a
  10357. weights trained to minimize absolute error
  10358. @item s
  10359. weights trained to minimize squared error
  10360. @end table
  10361. @item pscrn
  10362. Controls whether or not the prescreener neural network is used to decide
  10363. which pixels should be processed by the predictor neural network and which
  10364. can be handled by simple cubic interpolation.
  10365. The prescreener is trained to know whether cubic interpolation will be
  10366. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10367. The computational complexity of the prescreener nn is much less than that of
  10368. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10369. using the prescreener generally results in much faster processing.
  10370. The prescreener is pretty accurate, so the difference between using it and not
  10371. using it is almost always unnoticeable.
  10372. Can be one of the following:
  10373. @table @samp
  10374. @item none
  10375. @item original
  10376. @item new
  10377. @end table
  10378. Default is @code{new}.
  10379. @item fapprox
  10380. Set various debugging flags.
  10381. @end table
  10382. @section noformat
  10383. Force libavfilter not to use any of the specified pixel formats for the
  10384. input to the next filter.
  10385. It accepts the following parameters:
  10386. @table @option
  10387. @item pix_fmts
  10388. A '|'-separated list of pixel format names, such as
  10389. pix_fmts=yuv420p|monow|rgb24".
  10390. @end table
  10391. @subsection Examples
  10392. @itemize
  10393. @item
  10394. Force libavfilter to use a format different from @var{yuv420p} for the
  10395. input to the vflip filter:
  10396. @example
  10397. noformat=pix_fmts=yuv420p,vflip
  10398. @end example
  10399. @item
  10400. Convert the input video to any of the formats not contained in the list:
  10401. @example
  10402. noformat=yuv420p|yuv444p|yuv410p
  10403. @end example
  10404. @end itemize
  10405. @section noise
  10406. Add noise on video input frame.
  10407. The filter accepts the following options:
  10408. @table @option
  10409. @item all_seed
  10410. @item c0_seed
  10411. @item c1_seed
  10412. @item c2_seed
  10413. @item c3_seed
  10414. Set noise seed for specific pixel component or all pixel components in case
  10415. of @var{all_seed}. Default value is @code{123457}.
  10416. @item all_strength, alls
  10417. @item c0_strength, c0s
  10418. @item c1_strength, c1s
  10419. @item c2_strength, c2s
  10420. @item c3_strength, c3s
  10421. Set noise strength for specific pixel component or all pixel components in case
  10422. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10423. @item all_flags, allf
  10424. @item c0_flags, c0f
  10425. @item c1_flags, c1f
  10426. @item c2_flags, c2f
  10427. @item c3_flags, c3f
  10428. Set pixel component flags or set flags for all components if @var{all_flags}.
  10429. Available values for component flags are:
  10430. @table @samp
  10431. @item a
  10432. averaged temporal noise (smoother)
  10433. @item p
  10434. mix random noise with a (semi)regular pattern
  10435. @item t
  10436. temporal noise (noise pattern changes between frames)
  10437. @item u
  10438. uniform noise (gaussian otherwise)
  10439. @end table
  10440. @end table
  10441. @subsection Examples
  10442. Add temporal and uniform noise to input video:
  10443. @example
  10444. noise=alls=20:allf=t+u
  10445. @end example
  10446. @section normalize
  10447. Normalize RGB video (aka histogram stretching, contrast stretching).
  10448. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10449. For each channel of each frame, the filter computes the input range and maps
  10450. it linearly to the user-specified output range. The output range defaults
  10451. to the full dynamic range from pure black to pure white.
  10452. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10453. changes in brightness) caused when small dark or bright objects enter or leave
  10454. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10455. video camera, and, like a video camera, it may cause a period of over- or
  10456. under-exposure of the video.
  10457. The R,G,B channels can be normalized independently, which may cause some
  10458. color shifting, or linked together as a single channel, which prevents
  10459. color shifting. Linked normalization preserves hue. Independent normalization
  10460. does not, so it can be used to remove some color casts. Independent and linked
  10461. normalization can be combined in any ratio.
  10462. The normalize filter accepts the following options:
  10463. @table @option
  10464. @item blackpt
  10465. @item whitept
  10466. Colors which define the output range. The minimum input value is mapped to
  10467. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10468. The defaults are black and white respectively. Specifying white for
  10469. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10470. normalized video. Shades of grey can be used to reduce the dynamic range
  10471. (contrast). Specifying saturated colors here can create some interesting
  10472. effects.
  10473. @item smoothing
  10474. The number of previous frames to use for temporal smoothing. The input range
  10475. of each channel is smoothed using a rolling average over the current frame
  10476. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10477. smoothing).
  10478. @item independence
  10479. Controls the ratio of independent (color shifting) channel normalization to
  10480. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10481. independent. Defaults to 1.0 (fully independent).
  10482. @item strength
  10483. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10484. expensive no-op. Defaults to 1.0 (full strength).
  10485. @end table
  10486. @subsection Commands
  10487. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10488. The command accepts the same syntax of the corresponding option.
  10489. If the specified expression is not valid, it is kept at its current
  10490. value.
  10491. @subsection Examples
  10492. Stretch video contrast to use the full dynamic range, with no temporal
  10493. smoothing; may flicker depending on the source content:
  10494. @example
  10495. normalize=blackpt=black:whitept=white:smoothing=0
  10496. @end example
  10497. As above, but with 50 frames of temporal smoothing; flicker should be
  10498. reduced, depending on the source content:
  10499. @example
  10500. normalize=blackpt=black:whitept=white:smoothing=50
  10501. @end example
  10502. As above, but with hue-preserving linked channel normalization:
  10503. @example
  10504. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10505. @end example
  10506. As above, but with half strength:
  10507. @example
  10508. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10509. @end example
  10510. Map the darkest input color to red, the brightest input color to cyan:
  10511. @example
  10512. normalize=blackpt=red:whitept=cyan
  10513. @end example
  10514. @section null
  10515. Pass the video source unchanged to the output.
  10516. @section ocr
  10517. Optical Character Recognition
  10518. This filter uses Tesseract for optical character recognition. To enable
  10519. compilation of this filter, you need to configure FFmpeg with
  10520. @code{--enable-libtesseract}.
  10521. It accepts the following options:
  10522. @table @option
  10523. @item datapath
  10524. Set datapath to tesseract data. Default is to use whatever was
  10525. set at installation.
  10526. @item language
  10527. Set language, default is "eng".
  10528. @item whitelist
  10529. Set character whitelist.
  10530. @item blacklist
  10531. Set character blacklist.
  10532. @end table
  10533. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10534. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10535. @section ocv
  10536. Apply a video transform using libopencv.
  10537. To enable this filter, install the libopencv library and headers and
  10538. configure FFmpeg with @code{--enable-libopencv}.
  10539. It accepts the following parameters:
  10540. @table @option
  10541. @item filter_name
  10542. The name of the libopencv filter to apply.
  10543. @item filter_params
  10544. The parameters to pass to the libopencv filter. If not specified, the default
  10545. values are assumed.
  10546. @end table
  10547. Refer to the official libopencv documentation for more precise
  10548. information:
  10549. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10550. Several libopencv filters are supported; see the following subsections.
  10551. @anchor{dilate}
  10552. @subsection dilate
  10553. Dilate an image by using a specific structuring element.
  10554. It corresponds to the libopencv function @code{cvDilate}.
  10555. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10556. @var{struct_el} represents a structuring element, and has the syntax:
  10557. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10558. @var{cols} and @var{rows} represent the number of columns and rows of
  10559. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10560. point, and @var{shape} the shape for the structuring element. @var{shape}
  10561. must be "rect", "cross", "ellipse", or "custom".
  10562. If the value for @var{shape} is "custom", it must be followed by a
  10563. string of the form "=@var{filename}". The file with name
  10564. @var{filename} is assumed to represent a binary image, with each
  10565. printable character corresponding to a bright pixel. When a custom
  10566. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10567. or columns and rows of the read file are assumed instead.
  10568. The default value for @var{struct_el} is "3x3+0x0/rect".
  10569. @var{nb_iterations} specifies the number of times the transform is
  10570. applied to the image, and defaults to 1.
  10571. Some examples:
  10572. @example
  10573. # Use the default values
  10574. ocv=dilate
  10575. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10576. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10577. # Read the shape from the file diamond.shape, iterating two times.
  10578. # The file diamond.shape may contain a pattern of characters like this
  10579. # *
  10580. # ***
  10581. # *****
  10582. # ***
  10583. # *
  10584. # The specified columns and rows are ignored
  10585. # but the anchor point coordinates are not
  10586. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10587. @end example
  10588. @subsection erode
  10589. Erode an image by using a specific structuring element.
  10590. It corresponds to the libopencv function @code{cvErode}.
  10591. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10592. with the same syntax and semantics as the @ref{dilate} filter.
  10593. @subsection smooth
  10594. Smooth the input video.
  10595. The filter takes the following parameters:
  10596. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10597. @var{type} is the type of smooth filter to apply, and must be one of
  10598. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10599. or "bilateral". The default value is "gaussian".
  10600. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10601. depends on the smooth type. @var{param1} and
  10602. @var{param2} accept integer positive values or 0. @var{param3} and
  10603. @var{param4} accept floating point values.
  10604. The default value for @var{param1} is 3. The default value for the
  10605. other parameters is 0.
  10606. These parameters correspond to the parameters assigned to the
  10607. libopencv function @code{cvSmooth}.
  10608. @section oscilloscope
  10609. 2D Video Oscilloscope.
  10610. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10611. It accepts the following parameters:
  10612. @table @option
  10613. @item x
  10614. Set scope center x position.
  10615. @item y
  10616. Set scope center y position.
  10617. @item s
  10618. Set scope size, relative to frame diagonal.
  10619. @item t
  10620. Set scope tilt/rotation.
  10621. @item o
  10622. Set trace opacity.
  10623. @item tx
  10624. Set trace center x position.
  10625. @item ty
  10626. Set trace center y position.
  10627. @item tw
  10628. Set trace width, relative to width of frame.
  10629. @item th
  10630. Set trace height, relative to height of frame.
  10631. @item c
  10632. Set which components to trace. By default it traces first three components.
  10633. @item g
  10634. Draw trace grid. By default is enabled.
  10635. @item st
  10636. Draw some statistics. By default is enabled.
  10637. @item sc
  10638. Draw scope. By default is enabled.
  10639. @end table
  10640. @subsection Commands
  10641. This filter supports same @ref{commands} as options.
  10642. The command accepts the same syntax of the corresponding option.
  10643. If the specified expression is not valid, it is kept at its current
  10644. value.
  10645. @subsection Examples
  10646. @itemize
  10647. @item
  10648. Inspect full first row of video frame.
  10649. @example
  10650. oscilloscope=x=0.5:y=0:s=1
  10651. @end example
  10652. @item
  10653. Inspect full last row of video frame.
  10654. @example
  10655. oscilloscope=x=0.5:y=1:s=1
  10656. @end example
  10657. @item
  10658. Inspect full 5th line of video frame of height 1080.
  10659. @example
  10660. oscilloscope=x=0.5:y=5/1080:s=1
  10661. @end example
  10662. @item
  10663. Inspect full last column of video frame.
  10664. @example
  10665. oscilloscope=x=1:y=0.5:s=1:t=1
  10666. @end example
  10667. @end itemize
  10668. @anchor{overlay}
  10669. @section overlay
  10670. Overlay one video on top of another.
  10671. It takes two inputs and has one output. The first input is the "main"
  10672. video on which the second input is overlaid.
  10673. It accepts the following parameters:
  10674. A description of the accepted options follows.
  10675. @table @option
  10676. @item x
  10677. @item y
  10678. Set the expression for the x and y coordinates of the overlaid video
  10679. on the main video. Default value is "0" for both expressions. In case
  10680. the expression is invalid, it is set to a huge value (meaning that the
  10681. overlay will not be displayed within the output visible area).
  10682. @item eof_action
  10683. See @ref{framesync}.
  10684. @item eval
  10685. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10686. It accepts the following values:
  10687. @table @samp
  10688. @item init
  10689. only evaluate expressions once during the filter initialization or
  10690. when a command is processed
  10691. @item frame
  10692. evaluate expressions for each incoming frame
  10693. @end table
  10694. Default value is @samp{frame}.
  10695. @item shortest
  10696. See @ref{framesync}.
  10697. @item format
  10698. Set the format for the output video.
  10699. It accepts the following values:
  10700. @table @samp
  10701. @item yuv420
  10702. force YUV420 output
  10703. @item yuv422
  10704. force YUV422 output
  10705. @item yuv444
  10706. force YUV444 output
  10707. @item rgb
  10708. force packed RGB output
  10709. @item gbrp
  10710. force planar RGB output
  10711. @item auto
  10712. automatically pick format
  10713. @end table
  10714. Default value is @samp{yuv420}.
  10715. @item repeatlast
  10716. See @ref{framesync}.
  10717. @item alpha
  10718. Set format of alpha of the overlaid video, it can be @var{straight} or
  10719. @var{premultiplied}. Default is @var{straight}.
  10720. @end table
  10721. The @option{x}, and @option{y} expressions can contain the following
  10722. parameters.
  10723. @table @option
  10724. @item main_w, W
  10725. @item main_h, H
  10726. The main input width and height.
  10727. @item overlay_w, w
  10728. @item overlay_h, h
  10729. The overlay input width and height.
  10730. @item x
  10731. @item y
  10732. The computed values for @var{x} and @var{y}. They are evaluated for
  10733. each new frame.
  10734. @item hsub
  10735. @item vsub
  10736. horizontal and vertical chroma subsample values of the output
  10737. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10738. @var{vsub} is 1.
  10739. @item n
  10740. the number of input frame, starting from 0
  10741. @item pos
  10742. the position in the file of the input frame, NAN if unknown
  10743. @item t
  10744. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10745. @end table
  10746. This filter also supports the @ref{framesync} options.
  10747. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10748. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10749. when @option{eval} is set to @samp{init}.
  10750. Be aware that frames are taken from each input video in timestamp
  10751. order, hence, if their initial timestamps differ, it is a good idea
  10752. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10753. have them begin in the same zero timestamp, as the example for
  10754. the @var{movie} filter does.
  10755. You can chain together more overlays but you should test the
  10756. efficiency of such approach.
  10757. @subsection Commands
  10758. This filter supports the following commands:
  10759. @table @option
  10760. @item x
  10761. @item y
  10762. Modify the x and y of the overlay input.
  10763. The command accepts the same syntax of the corresponding option.
  10764. If the specified expression is not valid, it is kept at its current
  10765. value.
  10766. @end table
  10767. @subsection Examples
  10768. @itemize
  10769. @item
  10770. Draw the overlay at 10 pixels from the bottom right corner of the main
  10771. video:
  10772. @example
  10773. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10774. @end example
  10775. Using named options the example above becomes:
  10776. @example
  10777. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10778. @end example
  10779. @item
  10780. Insert a transparent PNG logo in the bottom left corner of the input,
  10781. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10782. @example
  10783. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10784. @end example
  10785. @item
  10786. Insert 2 different transparent PNG logos (second logo on bottom
  10787. right corner) using the @command{ffmpeg} tool:
  10788. @example
  10789. 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
  10790. @end example
  10791. @item
  10792. Add a transparent color layer on top of the main video; @code{WxH}
  10793. must specify the size of the main input to the overlay filter:
  10794. @example
  10795. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10796. @end example
  10797. @item
  10798. Play an original video and a filtered version (here with the deshake
  10799. filter) side by side using the @command{ffplay} tool:
  10800. @example
  10801. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10802. @end example
  10803. The above command is the same as:
  10804. @example
  10805. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10806. @end example
  10807. @item
  10808. Make a sliding overlay appearing from the left to the right top part of the
  10809. screen starting since time 2:
  10810. @example
  10811. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10812. @end example
  10813. @item
  10814. Compose output by putting two input videos side to side:
  10815. @example
  10816. ffmpeg -i left.avi -i right.avi -filter_complex "
  10817. nullsrc=size=200x100 [background];
  10818. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10819. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10820. [background][left] overlay=shortest=1 [background+left];
  10821. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10822. "
  10823. @end example
  10824. @item
  10825. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10826. @example
  10827. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10828. -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]'
  10829. masked.avi
  10830. @end example
  10831. @item
  10832. Chain several overlays in cascade:
  10833. @example
  10834. nullsrc=s=200x200 [bg];
  10835. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10836. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10837. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10838. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10839. [in3] null, [mid2] overlay=100:100 [out0]
  10840. @end example
  10841. @end itemize
  10842. @section owdenoise
  10843. Apply Overcomplete Wavelet denoiser.
  10844. The filter accepts the following options:
  10845. @table @option
  10846. @item depth
  10847. Set depth.
  10848. Larger depth values will denoise lower frequency components more, but
  10849. slow down filtering.
  10850. Must be an int in the range 8-16, default is @code{8}.
  10851. @item luma_strength, ls
  10852. Set luma strength.
  10853. Must be a double value in the range 0-1000, default is @code{1.0}.
  10854. @item chroma_strength, cs
  10855. Set chroma strength.
  10856. Must be a double value in the range 0-1000, default is @code{1.0}.
  10857. @end table
  10858. @anchor{pad}
  10859. @section pad
  10860. Add paddings to the input image, and place the original input at the
  10861. provided @var{x}, @var{y} coordinates.
  10862. It accepts the following parameters:
  10863. @table @option
  10864. @item width, w
  10865. @item height, h
  10866. Specify an expression for the size of the output image with the
  10867. paddings added. If the value for @var{width} or @var{height} is 0, the
  10868. corresponding input size is used for the output.
  10869. The @var{width} expression can reference the value set by the
  10870. @var{height} expression, and vice versa.
  10871. The default value of @var{width} and @var{height} is 0.
  10872. @item x
  10873. @item y
  10874. Specify the offsets to place the input image at within the padded area,
  10875. with respect to the top/left border of the output image.
  10876. The @var{x} expression can reference the value set by the @var{y}
  10877. expression, and vice versa.
  10878. The default value of @var{x} and @var{y} is 0.
  10879. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10880. so the input image is centered on the padded area.
  10881. @item color
  10882. Specify the color of the padded area. For the syntax of this option,
  10883. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10884. manual,ffmpeg-utils}.
  10885. The default value of @var{color} is "black".
  10886. @item eval
  10887. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10888. It accepts the following values:
  10889. @table @samp
  10890. @item init
  10891. Only evaluate expressions once during the filter initialization or when
  10892. a command is processed.
  10893. @item frame
  10894. Evaluate expressions for each incoming frame.
  10895. @end table
  10896. Default value is @samp{init}.
  10897. @item aspect
  10898. Pad to aspect instead to a resolution.
  10899. @end table
  10900. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10901. options are expressions containing the following constants:
  10902. @table @option
  10903. @item in_w
  10904. @item in_h
  10905. The input video width and height.
  10906. @item iw
  10907. @item ih
  10908. These are the same as @var{in_w} and @var{in_h}.
  10909. @item out_w
  10910. @item out_h
  10911. The output width and height (the size of the padded area), as
  10912. specified by the @var{width} and @var{height} expressions.
  10913. @item ow
  10914. @item oh
  10915. These are the same as @var{out_w} and @var{out_h}.
  10916. @item x
  10917. @item y
  10918. The x and y offsets as specified by the @var{x} and @var{y}
  10919. expressions, or NAN if not yet specified.
  10920. @item a
  10921. same as @var{iw} / @var{ih}
  10922. @item sar
  10923. input sample aspect ratio
  10924. @item dar
  10925. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10926. @item hsub
  10927. @item vsub
  10928. The horizontal and vertical chroma subsample values. For example for the
  10929. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10930. @end table
  10931. @subsection Examples
  10932. @itemize
  10933. @item
  10934. Add paddings with the color "violet" to the input video. The output video
  10935. size is 640x480, and the top-left corner of the input video is placed at
  10936. column 0, row 40
  10937. @example
  10938. pad=640:480:0:40:violet
  10939. @end example
  10940. The example above is equivalent to the following command:
  10941. @example
  10942. pad=width=640:height=480:x=0:y=40:color=violet
  10943. @end example
  10944. @item
  10945. Pad the input to get an output with dimensions increased by 3/2,
  10946. and put the input video at the center of the padded area:
  10947. @example
  10948. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10949. @end example
  10950. @item
  10951. Pad the input to get a squared output with size equal to the maximum
  10952. value between the input width and height, and put the input video at
  10953. the center of the padded area:
  10954. @example
  10955. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10956. @end example
  10957. @item
  10958. Pad the input to get a final w/h ratio of 16:9:
  10959. @example
  10960. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10961. @end example
  10962. @item
  10963. In case of anamorphic video, in order to set the output display aspect
  10964. correctly, it is necessary to use @var{sar} in the expression,
  10965. according to the relation:
  10966. @example
  10967. (ih * X / ih) * sar = output_dar
  10968. X = output_dar / sar
  10969. @end example
  10970. Thus the previous example needs to be modified to:
  10971. @example
  10972. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10973. @end example
  10974. @item
  10975. Double the output size and put the input video in the bottom-right
  10976. corner of the output padded area:
  10977. @example
  10978. pad="2*iw:2*ih:ow-iw:oh-ih"
  10979. @end example
  10980. @end itemize
  10981. @anchor{palettegen}
  10982. @section palettegen
  10983. Generate one palette for a whole video stream.
  10984. It accepts the following options:
  10985. @table @option
  10986. @item max_colors
  10987. Set the maximum number of colors to quantize in the palette.
  10988. Note: the palette will still contain 256 colors; the unused palette entries
  10989. will be black.
  10990. @item reserve_transparent
  10991. Create a palette of 255 colors maximum and reserve the last one for
  10992. transparency. Reserving the transparency color is useful for GIF optimization.
  10993. If not set, the maximum of colors in the palette will be 256. You probably want
  10994. to disable this option for a standalone image.
  10995. Set by default.
  10996. @item transparency_color
  10997. Set the color that will be used as background for transparency.
  10998. @item stats_mode
  10999. Set statistics mode.
  11000. It accepts the following values:
  11001. @table @samp
  11002. @item full
  11003. Compute full frame histograms.
  11004. @item diff
  11005. Compute histograms only for the part that differs from previous frame. This
  11006. might be relevant to give more importance to the moving part of your input if
  11007. the background is static.
  11008. @item single
  11009. Compute new histogram for each frame.
  11010. @end table
  11011. Default value is @var{full}.
  11012. @end table
  11013. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11014. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11015. color quantization of the palette. This information is also visible at
  11016. @var{info} logging level.
  11017. @subsection Examples
  11018. @itemize
  11019. @item
  11020. Generate a representative palette of a given video using @command{ffmpeg}:
  11021. @example
  11022. ffmpeg -i input.mkv -vf palettegen palette.png
  11023. @end example
  11024. @end itemize
  11025. @section paletteuse
  11026. Use a palette to downsample an input video stream.
  11027. The filter takes two inputs: one video stream and a palette. The palette must
  11028. be a 256 pixels image.
  11029. It accepts the following options:
  11030. @table @option
  11031. @item dither
  11032. Select dithering mode. Available algorithms are:
  11033. @table @samp
  11034. @item bayer
  11035. Ordered 8x8 bayer dithering (deterministic)
  11036. @item heckbert
  11037. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11038. Note: this dithering is sometimes considered "wrong" and is included as a
  11039. reference.
  11040. @item floyd_steinberg
  11041. Floyd and Steingberg dithering (error diffusion)
  11042. @item sierra2
  11043. Frankie Sierra dithering v2 (error diffusion)
  11044. @item sierra2_4a
  11045. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11046. @end table
  11047. Default is @var{sierra2_4a}.
  11048. @item bayer_scale
  11049. When @var{bayer} dithering is selected, this option defines the scale of the
  11050. pattern (how much the crosshatch pattern is visible). A low value means more
  11051. visible pattern for less banding, and higher value means less visible pattern
  11052. at the cost of more banding.
  11053. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11054. @item diff_mode
  11055. If set, define the zone to process
  11056. @table @samp
  11057. @item rectangle
  11058. Only the changing rectangle will be reprocessed. This is similar to GIF
  11059. cropping/offsetting compression mechanism. This option can be useful for speed
  11060. if only a part of the image is changing, and has use cases such as limiting the
  11061. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11062. moving scene (it leads to more deterministic output if the scene doesn't change
  11063. much, and as a result less moving noise and better GIF compression).
  11064. @end table
  11065. Default is @var{none}.
  11066. @item new
  11067. Take new palette for each output frame.
  11068. @item alpha_threshold
  11069. Sets the alpha threshold for transparency. Alpha values above this threshold
  11070. will be treated as completely opaque, and values below this threshold will be
  11071. treated as completely transparent.
  11072. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11073. @end table
  11074. @subsection Examples
  11075. @itemize
  11076. @item
  11077. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11078. using @command{ffmpeg}:
  11079. @example
  11080. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11081. @end example
  11082. @end itemize
  11083. @section perspective
  11084. Correct perspective of video not recorded perpendicular to the screen.
  11085. A description of the accepted parameters follows.
  11086. @table @option
  11087. @item x0
  11088. @item y0
  11089. @item x1
  11090. @item y1
  11091. @item x2
  11092. @item y2
  11093. @item x3
  11094. @item y3
  11095. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11096. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11097. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11098. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11099. then the corners of the source will be sent to the specified coordinates.
  11100. The expressions can use the following variables:
  11101. @table @option
  11102. @item W
  11103. @item H
  11104. the width and height of video frame.
  11105. @item in
  11106. Input frame count.
  11107. @item on
  11108. Output frame count.
  11109. @end table
  11110. @item interpolation
  11111. Set interpolation for perspective correction.
  11112. It accepts the following values:
  11113. @table @samp
  11114. @item linear
  11115. @item cubic
  11116. @end table
  11117. Default value is @samp{linear}.
  11118. @item sense
  11119. Set interpretation of coordinate options.
  11120. It accepts the following values:
  11121. @table @samp
  11122. @item 0, source
  11123. Send point in the source specified by the given coordinates to
  11124. the corners of the destination.
  11125. @item 1, destination
  11126. Send the corners of the source to the point in the destination specified
  11127. by the given coordinates.
  11128. Default value is @samp{source}.
  11129. @end table
  11130. @item eval
  11131. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11132. It accepts the following values:
  11133. @table @samp
  11134. @item init
  11135. only evaluate expressions once during the filter initialization or
  11136. when a command is processed
  11137. @item frame
  11138. evaluate expressions for each incoming frame
  11139. @end table
  11140. Default value is @samp{init}.
  11141. @end table
  11142. @section phase
  11143. Delay interlaced video by one field time so that the field order changes.
  11144. The intended use is to fix PAL movies that have been captured with the
  11145. opposite field order to the film-to-video transfer.
  11146. A description of the accepted parameters follows.
  11147. @table @option
  11148. @item mode
  11149. Set phase mode.
  11150. It accepts the following values:
  11151. @table @samp
  11152. @item t
  11153. Capture field order top-first, transfer bottom-first.
  11154. Filter will delay the bottom field.
  11155. @item b
  11156. Capture field order bottom-first, transfer top-first.
  11157. Filter will delay the top field.
  11158. @item p
  11159. Capture and transfer with the same field order. This mode only exists
  11160. for the documentation of the other options to refer to, but if you
  11161. actually select it, the filter will faithfully do nothing.
  11162. @item a
  11163. Capture field order determined automatically by field flags, transfer
  11164. opposite.
  11165. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11166. basis using field flags. If no field information is available,
  11167. then this works just like @samp{u}.
  11168. @item u
  11169. Capture unknown or varying, transfer opposite.
  11170. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11171. analyzing the images and selecting the alternative that produces best
  11172. match between the fields.
  11173. @item T
  11174. Capture top-first, transfer unknown or varying.
  11175. Filter selects among @samp{t} and @samp{p} using image analysis.
  11176. @item B
  11177. Capture bottom-first, transfer unknown or varying.
  11178. Filter selects among @samp{b} and @samp{p} using image analysis.
  11179. @item A
  11180. Capture determined by field flags, transfer unknown or varying.
  11181. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11182. image analysis. If no field information is available, then this works just
  11183. like @samp{U}. This is the default mode.
  11184. @item U
  11185. Both capture and transfer unknown or varying.
  11186. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11187. @end table
  11188. @end table
  11189. @section photosensitivity
  11190. Reduce various flashes in video, so to help users with epilepsy.
  11191. It accepts the following options:
  11192. @table @option
  11193. @item frames, f
  11194. Set how many frames to use when filtering. Default is 30.
  11195. @item threshold, t
  11196. Set detection threshold factor. Default is 1.
  11197. Lower is stricter.
  11198. @item skip
  11199. Set how many pixels to skip when sampling frames. Default is 1.
  11200. Allowed range is from 1 to 1024.
  11201. @item bypass
  11202. Leave frames unchanged. Default is disabled.
  11203. @end table
  11204. @section pixdesctest
  11205. Pixel format descriptor test filter, mainly useful for internal
  11206. testing. The output video should be equal to the input video.
  11207. For example:
  11208. @example
  11209. format=monow, pixdesctest
  11210. @end example
  11211. can be used to test the monowhite pixel format descriptor definition.
  11212. @section pixscope
  11213. Display sample values of color channels. Mainly useful for checking color
  11214. and levels. Minimum supported resolution is 640x480.
  11215. The filters accept the following options:
  11216. @table @option
  11217. @item x
  11218. Set scope X position, relative offset on X axis.
  11219. @item y
  11220. Set scope Y position, relative offset on Y axis.
  11221. @item w
  11222. Set scope width.
  11223. @item h
  11224. Set scope height.
  11225. @item o
  11226. Set window opacity. This window also holds statistics about pixel area.
  11227. @item wx
  11228. Set window X position, relative offset on X axis.
  11229. @item wy
  11230. Set window Y position, relative offset on Y axis.
  11231. @end table
  11232. @section pp
  11233. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11234. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11235. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11236. Each subfilter and some options have a short and a long name that can be used
  11237. interchangeably, i.e. dr/dering are the same.
  11238. The filters accept the following options:
  11239. @table @option
  11240. @item subfilters
  11241. Set postprocessing subfilters string.
  11242. @end table
  11243. All subfilters share common options to determine their scope:
  11244. @table @option
  11245. @item a/autoq
  11246. Honor the quality commands for this subfilter.
  11247. @item c/chrom
  11248. Do chrominance filtering, too (default).
  11249. @item y/nochrom
  11250. Do luminance filtering only (no chrominance).
  11251. @item n/noluma
  11252. Do chrominance filtering only (no luminance).
  11253. @end table
  11254. These options can be appended after the subfilter name, separated by a '|'.
  11255. Available subfilters are:
  11256. @table @option
  11257. @item hb/hdeblock[|difference[|flatness]]
  11258. Horizontal deblocking filter
  11259. @table @option
  11260. @item difference
  11261. Difference factor where higher values mean more deblocking (default: @code{32}).
  11262. @item flatness
  11263. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11264. @end table
  11265. @item vb/vdeblock[|difference[|flatness]]
  11266. Vertical deblocking filter
  11267. @table @option
  11268. @item difference
  11269. Difference factor where higher values mean more deblocking (default: @code{32}).
  11270. @item flatness
  11271. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11272. @end table
  11273. @item ha/hadeblock[|difference[|flatness]]
  11274. Accurate horizontal deblocking filter
  11275. @table @option
  11276. @item difference
  11277. Difference factor where higher values mean more deblocking (default: @code{32}).
  11278. @item flatness
  11279. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11280. @end table
  11281. @item va/vadeblock[|difference[|flatness]]
  11282. Accurate vertical deblocking filter
  11283. @table @option
  11284. @item difference
  11285. Difference factor where higher values mean more deblocking (default: @code{32}).
  11286. @item flatness
  11287. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11288. @end table
  11289. @end table
  11290. The horizontal and vertical deblocking filters share the difference and
  11291. flatness values so you cannot set different horizontal and vertical
  11292. thresholds.
  11293. @table @option
  11294. @item h1/x1hdeblock
  11295. Experimental horizontal deblocking filter
  11296. @item v1/x1vdeblock
  11297. Experimental vertical deblocking filter
  11298. @item dr/dering
  11299. Deringing filter
  11300. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11301. @table @option
  11302. @item threshold1
  11303. larger -> stronger filtering
  11304. @item threshold2
  11305. larger -> stronger filtering
  11306. @item threshold3
  11307. larger -> stronger filtering
  11308. @end table
  11309. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11310. @table @option
  11311. @item f/fullyrange
  11312. Stretch luminance to @code{0-255}.
  11313. @end table
  11314. @item lb/linblenddeint
  11315. Linear blend deinterlacing filter that deinterlaces the given block by
  11316. filtering all lines with a @code{(1 2 1)} filter.
  11317. @item li/linipoldeint
  11318. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11319. linearly interpolating every second line.
  11320. @item ci/cubicipoldeint
  11321. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11322. cubically interpolating every second line.
  11323. @item md/mediandeint
  11324. Median deinterlacing filter that deinterlaces the given block by applying a
  11325. median filter to every second line.
  11326. @item fd/ffmpegdeint
  11327. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11328. second line with a @code{(-1 4 2 4 -1)} filter.
  11329. @item l5/lowpass5
  11330. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11331. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11332. @item fq/forceQuant[|quantizer]
  11333. Overrides the quantizer table from the input with the constant quantizer you
  11334. specify.
  11335. @table @option
  11336. @item quantizer
  11337. Quantizer to use
  11338. @end table
  11339. @item de/default
  11340. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11341. @item fa/fast
  11342. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11343. @item ac
  11344. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11345. @end table
  11346. @subsection Examples
  11347. @itemize
  11348. @item
  11349. Apply horizontal and vertical deblocking, deringing and automatic
  11350. brightness/contrast:
  11351. @example
  11352. pp=hb/vb/dr/al
  11353. @end example
  11354. @item
  11355. Apply default filters without brightness/contrast correction:
  11356. @example
  11357. pp=de/-al
  11358. @end example
  11359. @item
  11360. Apply default filters and temporal denoiser:
  11361. @example
  11362. pp=default/tmpnoise|1|2|3
  11363. @end example
  11364. @item
  11365. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11366. automatically depending on available CPU time:
  11367. @example
  11368. pp=hb|y/vb|a
  11369. @end example
  11370. @end itemize
  11371. @section pp7
  11372. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11373. similar to spp = 6 with 7 point DCT, where only the center sample is
  11374. used after IDCT.
  11375. The filter accepts the following options:
  11376. @table @option
  11377. @item qp
  11378. Force a constant quantization parameter. It accepts an integer in range
  11379. 0 to 63. If not set, the filter will use the QP from the video stream
  11380. (if available).
  11381. @item mode
  11382. Set thresholding mode. Available modes are:
  11383. @table @samp
  11384. @item hard
  11385. Set hard thresholding.
  11386. @item soft
  11387. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11388. @item medium
  11389. Set medium thresholding (good results, default).
  11390. @end table
  11391. @end table
  11392. @section premultiply
  11393. Apply alpha premultiply effect to input video stream using first plane
  11394. of second stream as alpha.
  11395. Both streams must have same dimensions and same pixel format.
  11396. The filter accepts the following option:
  11397. @table @option
  11398. @item planes
  11399. Set which planes will be processed, unprocessed planes will be copied.
  11400. By default value 0xf, all planes will be processed.
  11401. @item inplace
  11402. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11403. @end table
  11404. @section prewitt
  11405. Apply prewitt operator to input video stream.
  11406. The filter accepts the following option:
  11407. @table @option
  11408. @item planes
  11409. Set which planes will be processed, unprocessed planes will be copied.
  11410. By default value 0xf, all planes will be processed.
  11411. @item scale
  11412. Set value which will be multiplied with filtered result.
  11413. @item delta
  11414. Set value which will be added to filtered result.
  11415. @end table
  11416. @anchor{program_opencl}
  11417. @section program_opencl
  11418. Filter video using an OpenCL program.
  11419. @table @option
  11420. @item source
  11421. OpenCL program source file.
  11422. @item kernel
  11423. Kernel name in program.
  11424. @item inputs
  11425. Number of inputs to the filter. Defaults to 1.
  11426. @item size, s
  11427. Size of output frames. Defaults to the same as the first input.
  11428. @end table
  11429. The program source file must contain a kernel function with the given name,
  11430. which will be run once for each plane of the output. Each run on a plane
  11431. gets enqueued as a separate 2D global NDRange with one work-item for each
  11432. pixel to be generated. The global ID offset for each work-item is therefore
  11433. the coordinates of a pixel in the destination image.
  11434. The kernel function needs to take the following arguments:
  11435. @itemize
  11436. @item
  11437. Destination image, @var{__write_only image2d_t}.
  11438. This image will become the output; the kernel should write all of it.
  11439. @item
  11440. Frame index, @var{unsigned int}.
  11441. This is a counter starting from zero and increasing by one for each frame.
  11442. @item
  11443. Source images, @var{__read_only image2d_t}.
  11444. These are the most recent images on each input. The kernel may read from
  11445. them to generate the output, but they can't be written to.
  11446. @end itemize
  11447. Example programs:
  11448. @itemize
  11449. @item
  11450. Copy the input to the output (output must be the same size as the input).
  11451. @verbatim
  11452. __kernel void copy(__write_only image2d_t destination,
  11453. unsigned int index,
  11454. __read_only image2d_t source)
  11455. {
  11456. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  11457. int2 location = (int2)(get_global_id(0), get_global_id(1));
  11458. float4 value = read_imagef(source, sampler, location);
  11459. write_imagef(destination, location, value);
  11460. }
  11461. @end verbatim
  11462. @item
  11463. Apply a simple transformation, rotating the input by an amount increasing
  11464. with the index counter. Pixel values are linearly interpolated by the
  11465. sampler, and the output need not have the same dimensions as the input.
  11466. @verbatim
  11467. __kernel void rotate_image(__write_only image2d_t dst,
  11468. unsigned int index,
  11469. __read_only image2d_t src)
  11470. {
  11471. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11472. CLK_FILTER_LINEAR);
  11473. float angle = (float)index / 100.0f;
  11474. float2 dst_dim = convert_float2(get_image_dim(dst));
  11475. float2 src_dim = convert_float2(get_image_dim(src));
  11476. float2 dst_cen = dst_dim / 2.0f;
  11477. float2 src_cen = src_dim / 2.0f;
  11478. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11479. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11480. float2 src_pos = {
  11481. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11482. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11483. };
  11484. src_pos = src_pos * src_dim / dst_dim;
  11485. float2 src_loc = src_pos + src_cen;
  11486. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11487. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11488. write_imagef(dst, dst_loc, 0.5f);
  11489. else
  11490. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11491. }
  11492. @end verbatim
  11493. @item
  11494. Blend two inputs together, with the amount of each input used varying
  11495. with the index counter.
  11496. @verbatim
  11497. __kernel void blend_images(__write_only image2d_t dst,
  11498. unsigned int index,
  11499. __read_only image2d_t src1,
  11500. __read_only image2d_t src2)
  11501. {
  11502. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11503. CLK_FILTER_LINEAR);
  11504. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11505. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11506. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11507. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11508. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11509. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11510. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11511. }
  11512. @end verbatim
  11513. @end itemize
  11514. @section pseudocolor
  11515. Alter frame colors in video with pseudocolors.
  11516. This filter accepts the following options:
  11517. @table @option
  11518. @item c0
  11519. set pixel first component expression
  11520. @item c1
  11521. set pixel second component expression
  11522. @item c2
  11523. set pixel third component expression
  11524. @item c3
  11525. set pixel fourth component expression, corresponds to the alpha component
  11526. @item i
  11527. set component to use as base for altering colors
  11528. @end table
  11529. Each of them specifies the expression to use for computing the lookup table for
  11530. the corresponding pixel component values.
  11531. The expressions can contain the following constants and functions:
  11532. @table @option
  11533. @item w
  11534. @item h
  11535. The input width and height.
  11536. @item val
  11537. The input value for the pixel component.
  11538. @item ymin, umin, vmin, amin
  11539. The minimum allowed component value.
  11540. @item ymax, umax, vmax, amax
  11541. The maximum allowed component value.
  11542. @end table
  11543. All expressions default to "val".
  11544. @subsection Examples
  11545. @itemize
  11546. @item
  11547. Change too high luma values to gradient:
  11548. @example
  11549. 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'"
  11550. @end example
  11551. @end itemize
  11552. @section psnr
  11553. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11554. Ratio) between two input videos.
  11555. This filter takes in input two input videos, the first input is
  11556. considered the "main" source and is passed unchanged to the
  11557. output. The second input is used as a "reference" video for computing
  11558. the PSNR.
  11559. Both video inputs must have the same resolution and pixel format for
  11560. this filter to work correctly. Also it assumes that both inputs
  11561. have the same number of frames, which are compared one by one.
  11562. The obtained average PSNR is printed through the logging system.
  11563. The filter stores the accumulated MSE (mean squared error) of each
  11564. frame, and at the end of the processing it is averaged across all frames
  11565. equally, and the following formula is applied to obtain the PSNR:
  11566. @example
  11567. PSNR = 10*log10(MAX^2/MSE)
  11568. @end example
  11569. Where MAX is the average of the maximum values of each component of the
  11570. image.
  11571. The description of the accepted parameters follows.
  11572. @table @option
  11573. @item stats_file, f
  11574. If specified the filter will use the named file to save the PSNR of
  11575. each individual frame. When filename equals "-" the data is sent to
  11576. standard output.
  11577. @item stats_version
  11578. Specifies which version of the stats file format to use. Details of
  11579. each format are written below.
  11580. Default value is 1.
  11581. @item stats_add_max
  11582. Determines whether the max value is output to the stats log.
  11583. Default value is 0.
  11584. Requires stats_version >= 2. If this is set and stats_version < 2,
  11585. the filter will return an error.
  11586. @end table
  11587. This filter also supports the @ref{framesync} options.
  11588. The file printed if @var{stats_file} is selected, contains a sequence of
  11589. key/value pairs of the form @var{key}:@var{value} for each compared
  11590. couple of frames.
  11591. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11592. the list of per-frame-pair stats, with key value pairs following the frame
  11593. format with the following parameters:
  11594. @table @option
  11595. @item psnr_log_version
  11596. The version of the log file format. Will match @var{stats_version}.
  11597. @item fields
  11598. A comma separated list of the per-frame-pair parameters included in
  11599. the log.
  11600. @end table
  11601. A description of each shown per-frame-pair parameter follows:
  11602. @table @option
  11603. @item n
  11604. sequential number of the input frame, starting from 1
  11605. @item mse_avg
  11606. Mean Square Error pixel-by-pixel average difference of the compared
  11607. frames, averaged over all the image components.
  11608. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11609. Mean Square Error pixel-by-pixel average difference of the compared
  11610. frames for the component specified by the suffix.
  11611. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11612. Peak Signal to Noise ratio of the compared frames for the component
  11613. specified by the suffix.
  11614. @item max_avg, max_y, max_u, max_v
  11615. Maximum allowed value for each channel, and average over all
  11616. channels.
  11617. @end table
  11618. @subsection Examples
  11619. @itemize
  11620. @item
  11621. For example:
  11622. @example
  11623. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11624. [main][ref] psnr="stats_file=stats.log" [out]
  11625. @end example
  11626. On this example the input file being processed is compared with the
  11627. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11628. is stored in @file{stats.log}.
  11629. @item
  11630. Another example with different containers:
  11631. @example
  11632. 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 -
  11633. @end example
  11634. @end itemize
  11635. @anchor{pullup}
  11636. @section pullup
  11637. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11638. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11639. content.
  11640. The pullup filter is designed to take advantage of future context in making
  11641. its decisions. This filter is stateless in the sense that it does not lock
  11642. onto a pattern to follow, but it instead looks forward to the following
  11643. fields in order to identify matches and rebuild progressive frames.
  11644. To produce content with an even framerate, insert the fps filter after
  11645. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11646. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11647. The filter accepts the following options:
  11648. @table @option
  11649. @item jl
  11650. @item jr
  11651. @item jt
  11652. @item jb
  11653. These options set the amount of "junk" to ignore at the left, right, top, and
  11654. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11655. while top and bottom are in units of 2 lines.
  11656. The default is 8 pixels on each side.
  11657. @item sb
  11658. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11659. filter generating an occasional mismatched frame, but it may also cause an
  11660. excessive number of frames to be dropped during high motion sequences.
  11661. Conversely, setting it to -1 will make filter match fields more easily.
  11662. This may help processing of video where there is slight blurring between
  11663. the fields, but may also cause there to be interlaced frames in the output.
  11664. Default value is @code{0}.
  11665. @item mp
  11666. Set the metric plane to use. It accepts the following values:
  11667. @table @samp
  11668. @item l
  11669. Use luma plane.
  11670. @item u
  11671. Use chroma blue plane.
  11672. @item v
  11673. Use chroma red plane.
  11674. @end table
  11675. This option may be set to use chroma plane instead of the default luma plane
  11676. for doing filter's computations. This may improve accuracy on very clean
  11677. source material, but more likely will decrease accuracy, especially if there
  11678. is chroma noise (rainbow effect) or any grayscale video.
  11679. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11680. load and make pullup usable in realtime on slow machines.
  11681. @end table
  11682. For best results (without duplicated frames in the output file) it is
  11683. necessary to change the output frame rate. For example, to inverse
  11684. telecine NTSC input:
  11685. @example
  11686. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11687. @end example
  11688. @section qp
  11689. Change video quantization parameters (QP).
  11690. The filter accepts the following option:
  11691. @table @option
  11692. @item qp
  11693. Set expression for quantization parameter.
  11694. @end table
  11695. The expression is evaluated through the eval API and can contain, among others,
  11696. the following constants:
  11697. @table @var
  11698. @item known
  11699. 1 if index is not 129, 0 otherwise.
  11700. @item qp
  11701. Sequential index starting from -129 to 128.
  11702. @end table
  11703. @subsection Examples
  11704. @itemize
  11705. @item
  11706. Some equation like:
  11707. @example
  11708. qp=2+2*sin(PI*qp)
  11709. @end example
  11710. @end itemize
  11711. @section random
  11712. Flush video frames from internal cache of frames into a random order.
  11713. No frame is discarded.
  11714. Inspired by @ref{frei0r} nervous filter.
  11715. @table @option
  11716. @item frames
  11717. Set size in number of frames of internal cache, in range from @code{2} to
  11718. @code{512}. Default is @code{30}.
  11719. @item seed
  11720. Set seed for random number generator, must be an integer included between
  11721. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11722. less than @code{0}, the filter will try to use a good random seed on a
  11723. best effort basis.
  11724. @end table
  11725. @section readeia608
  11726. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11727. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11728. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11729. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11730. @table @option
  11731. @item lavfi.readeia608.X.cc
  11732. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11733. @item lavfi.readeia608.X.line
  11734. The number of the line on which the EIA-608 data was identified and read.
  11735. @end table
  11736. This filter accepts the following options:
  11737. @table @option
  11738. @item scan_min
  11739. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11740. @item scan_max
  11741. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11742. @item spw
  11743. Set the ratio of width reserved for sync code detection.
  11744. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  11745. @item chp
  11746. Enable checking the parity bit. In the event of a parity error, the filter will output
  11747. @code{0x00} for that character. Default is false.
  11748. @item lp
  11749. Lowpass lines prior to further processing. Default is enabled.
  11750. @end table
  11751. @subsection Examples
  11752. @itemize
  11753. @item
  11754. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11755. @example
  11756. 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
  11757. @end example
  11758. @end itemize
  11759. @section readvitc
  11760. Read vertical interval timecode (VITC) information from the top lines of a
  11761. video frame.
  11762. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11763. timecode value, if a valid timecode has been detected. Further metadata key
  11764. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11765. timecode data has been found or not.
  11766. This filter accepts the following options:
  11767. @table @option
  11768. @item scan_max
  11769. Set the maximum number of lines to scan for VITC data. If the value is set to
  11770. @code{-1} the full video frame is scanned. Default is @code{45}.
  11771. @item thr_b
  11772. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11773. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11774. @item thr_w
  11775. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11776. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11777. @end table
  11778. @subsection Examples
  11779. @itemize
  11780. @item
  11781. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11782. draw @code{--:--:--:--} as a placeholder:
  11783. @example
  11784. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11785. @end example
  11786. @end itemize
  11787. @section remap
  11788. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11789. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11790. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11791. value for pixel will be used for destination pixel.
  11792. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11793. will have Xmap/Ymap video stream dimensions.
  11794. Xmap and Ymap input video streams are 16bit depth, single channel.
  11795. @table @option
  11796. @item format
  11797. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11798. Default is @code{color}.
  11799. @end table
  11800. @section removegrain
  11801. The removegrain filter is a spatial denoiser for progressive video.
  11802. @table @option
  11803. @item m0
  11804. Set mode for the first plane.
  11805. @item m1
  11806. Set mode for the second plane.
  11807. @item m2
  11808. Set mode for the third plane.
  11809. @item m3
  11810. Set mode for the fourth plane.
  11811. @end table
  11812. Range of mode is from 0 to 24. Description of each mode follows:
  11813. @table @var
  11814. @item 0
  11815. Leave input plane unchanged. Default.
  11816. @item 1
  11817. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11818. @item 2
  11819. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11820. @item 3
  11821. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11822. @item 4
  11823. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11824. This is equivalent to a median filter.
  11825. @item 5
  11826. Line-sensitive clipping giving the minimal change.
  11827. @item 6
  11828. Line-sensitive clipping, intermediate.
  11829. @item 7
  11830. Line-sensitive clipping, intermediate.
  11831. @item 8
  11832. Line-sensitive clipping, intermediate.
  11833. @item 9
  11834. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11835. @item 10
  11836. Replaces the target pixel with the closest neighbour.
  11837. @item 11
  11838. [1 2 1] horizontal and vertical kernel blur.
  11839. @item 12
  11840. Same as mode 11.
  11841. @item 13
  11842. Bob mode, interpolates top field from the line where the neighbours
  11843. pixels are the closest.
  11844. @item 14
  11845. Bob mode, interpolates bottom field from the line where the neighbours
  11846. pixels are the closest.
  11847. @item 15
  11848. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11849. interpolation formula.
  11850. @item 16
  11851. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11852. interpolation formula.
  11853. @item 17
  11854. Clips the pixel with the minimum and maximum of respectively the maximum and
  11855. minimum of each pair of opposite neighbour pixels.
  11856. @item 18
  11857. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11858. the current pixel is minimal.
  11859. @item 19
  11860. Replaces the pixel with the average of its 8 neighbours.
  11861. @item 20
  11862. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11863. @item 21
  11864. Clips pixels using the averages of opposite neighbour.
  11865. @item 22
  11866. Same as mode 21 but simpler and faster.
  11867. @item 23
  11868. Small edge and halo removal, but reputed useless.
  11869. @item 24
  11870. Similar as 23.
  11871. @end table
  11872. @section removelogo
  11873. Suppress a TV station logo, using an image file to determine which
  11874. pixels comprise the logo. It works by filling in the pixels that
  11875. comprise the logo with neighboring pixels.
  11876. The filter accepts the following options:
  11877. @table @option
  11878. @item filename, f
  11879. Set the filter bitmap file, which can be any image format supported by
  11880. libavformat. The width and height of the image file must match those of the
  11881. video stream being processed.
  11882. @end table
  11883. Pixels in the provided bitmap image with a value of zero are not
  11884. considered part of the logo, non-zero pixels are considered part of
  11885. the logo. If you use white (255) for the logo and black (0) for the
  11886. rest, you will be safe. For making the filter bitmap, it is
  11887. recommended to take a screen capture of a black frame with the logo
  11888. visible, and then using a threshold filter followed by the erode
  11889. filter once or twice.
  11890. If needed, little splotches can be fixed manually. Remember that if
  11891. logo pixels are not covered, the filter quality will be much
  11892. reduced. Marking too many pixels as part of the logo does not hurt as
  11893. much, but it will increase the amount of blurring needed to cover over
  11894. the image and will destroy more information than necessary, and extra
  11895. pixels will slow things down on a large logo.
  11896. @section repeatfields
  11897. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11898. fields based on its value.
  11899. @section reverse
  11900. Reverse a video clip.
  11901. Warning: This filter requires memory to buffer the entire clip, so trimming
  11902. is suggested.
  11903. @subsection Examples
  11904. @itemize
  11905. @item
  11906. Take the first 5 seconds of a clip, and reverse it.
  11907. @example
  11908. trim=end=5,reverse
  11909. @end example
  11910. @end itemize
  11911. @section rgbashift
  11912. Shift R/G/B/A pixels horizontally and/or vertically.
  11913. The filter accepts the following options:
  11914. @table @option
  11915. @item rh
  11916. Set amount to shift red horizontally.
  11917. @item rv
  11918. Set amount to shift red vertically.
  11919. @item gh
  11920. Set amount to shift green horizontally.
  11921. @item gv
  11922. Set amount to shift green vertically.
  11923. @item bh
  11924. Set amount to shift blue horizontally.
  11925. @item bv
  11926. Set amount to shift blue vertically.
  11927. @item ah
  11928. Set amount to shift alpha horizontally.
  11929. @item av
  11930. Set amount to shift alpha vertically.
  11931. @item edge
  11932. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11933. @end table
  11934. @subsection Commands
  11935. This filter supports the all above options as @ref{commands}.
  11936. @section roberts
  11937. Apply roberts cross operator to input video stream.
  11938. The filter accepts the following option:
  11939. @table @option
  11940. @item planes
  11941. Set which planes will be processed, unprocessed planes will be copied.
  11942. By default value 0xf, all planes will be processed.
  11943. @item scale
  11944. Set value which will be multiplied with filtered result.
  11945. @item delta
  11946. Set value which will be added to filtered result.
  11947. @end table
  11948. @section rotate
  11949. Rotate video by an arbitrary angle expressed in radians.
  11950. The filter accepts the following options:
  11951. A description of the optional parameters follows.
  11952. @table @option
  11953. @item angle, a
  11954. Set an expression for the angle by which to rotate the input video
  11955. clockwise, expressed as a number of radians. A negative value will
  11956. result in a counter-clockwise rotation. By default it is set to "0".
  11957. This expression is evaluated for each frame.
  11958. @item out_w, ow
  11959. Set the output width expression, default value is "iw".
  11960. This expression is evaluated just once during configuration.
  11961. @item out_h, oh
  11962. Set the output height expression, default value is "ih".
  11963. This expression is evaluated just once during configuration.
  11964. @item bilinear
  11965. Enable bilinear interpolation if set to 1, a value of 0 disables
  11966. it. Default value is 1.
  11967. @item fillcolor, c
  11968. Set the color used to fill the output area not covered by the rotated
  11969. image. For the general syntax of this option, check the
  11970. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11971. If the special value "none" is selected then no
  11972. background is printed (useful for example if the background is never shown).
  11973. Default value is "black".
  11974. @end table
  11975. The expressions for the angle and the output size can contain the
  11976. following constants and functions:
  11977. @table @option
  11978. @item n
  11979. sequential number of the input frame, starting from 0. It is always NAN
  11980. before the first frame is filtered.
  11981. @item t
  11982. time in seconds of the input frame, it is set to 0 when the filter is
  11983. configured. It is always NAN before the first frame is filtered.
  11984. @item hsub
  11985. @item vsub
  11986. horizontal and vertical chroma subsample values. For example for the
  11987. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11988. @item in_w, iw
  11989. @item in_h, ih
  11990. the input video width and height
  11991. @item out_w, ow
  11992. @item out_h, oh
  11993. the output width and height, that is the size of the padded area as
  11994. specified by the @var{width} and @var{height} expressions
  11995. @item rotw(a)
  11996. @item roth(a)
  11997. the minimal width/height required for completely containing the input
  11998. video rotated by @var{a} radians.
  11999. These are only available when computing the @option{out_w} and
  12000. @option{out_h} expressions.
  12001. @end table
  12002. @subsection Examples
  12003. @itemize
  12004. @item
  12005. Rotate the input by PI/6 radians clockwise:
  12006. @example
  12007. rotate=PI/6
  12008. @end example
  12009. @item
  12010. Rotate the input by PI/6 radians counter-clockwise:
  12011. @example
  12012. rotate=-PI/6
  12013. @end example
  12014. @item
  12015. Rotate the input by 45 degrees clockwise:
  12016. @example
  12017. rotate=45*PI/180
  12018. @end example
  12019. @item
  12020. Apply a constant rotation with period T, starting from an angle of PI/3:
  12021. @example
  12022. rotate=PI/3+2*PI*t/T
  12023. @end example
  12024. @item
  12025. Make the input video rotation oscillating with a period of T
  12026. seconds and an amplitude of A radians:
  12027. @example
  12028. rotate=A*sin(2*PI/T*t)
  12029. @end example
  12030. @item
  12031. Rotate the video, output size is chosen so that the whole rotating
  12032. input video is always completely contained in the output:
  12033. @example
  12034. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12035. @end example
  12036. @item
  12037. Rotate the video, reduce the output size so that no background is ever
  12038. shown:
  12039. @example
  12040. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12041. @end example
  12042. @end itemize
  12043. @subsection Commands
  12044. The filter supports the following commands:
  12045. @table @option
  12046. @item a, angle
  12047. Set the angle expression.
  12048. The command accepts the same syntax of the corresponding option.
  12049. If the specified expression is not valid, it is kept at its current
  12050. value.
  12051. @end table
  12052. @section sab
  12053. Apply Shape Adaptive Blur.
  12054. The filter accepts the following options:
  12055. @table @option
  12056. @item luma_radius, lr
  12057. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12058. value is 1.0. A greater value will result in a more blurred image, and
  12059. in slower processing.
  12060. @item luma_pre_filter_radius, lpfr
  12061. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12062. value is 1.0.
  12063. @item luma_strength, ls
  12064. Set luma maximum difference between pixels to still be considered, must
  12065. be a value in the 0.1-100.0 range, default value is 1.0.
  12066. @item chroma_radius, cr
  12067. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12068. greater value will result in a more blurred image, and in slower
  12069. processing.
  12070. @item chroma_pre_filter_radius, cpfr
  12071. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12072. @item chroma_strength, cs
  12073. Set chroma maximum difference between pixels to still be considered,
  12074. must be a value in the -0.9-100.0 range.
  12075. @end table
  12076. Each chroma option value, if not explicitly specified, is set to the
  12077. corresponding luma option value.
  12078. @anchor{scale}
  12079. @section scale
  12080. Scale (resize) the input video, using the libswscale library.
  12081. The scale filter forces the output display aspect ratio to be the same
  12082. of the input, by changing the output sample aspect ratio.
  12083. If the input image format is different from the format requested by
  12084. the next filter, the scale filter will convert the input to the
  12085. requested format.
  12086. @subsection Options
  12087. The filter accepts the following options, or any of the options
  12088. supported by the libswscale scaler.
  12089. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12090. the complete list of scaler options.
  12091. @table @option
  12092. @item width, w
  12093. @item height, h
  12094. Set the output video dimension expression. Default value is the input
  12095. dimension.
  12096. If the @var{width} or @var{w} value is 0, the input width is used for
  12097. the output. If the @var{height} or @var{h} value is 0, the input height
  12098. is used for the output.
  12099. If one and only one of the values is -n with n >= 1, the scale filter
  12100. will use a value that maintains the aspect ratio of the input image,
  12101. calculated from the other specified dimension. After that it will,
  12102. however, make sure that the calculated dimension is divisible by n and
  12103. adjust the value if necessary.
  12104. If both values are -n with n >= 1, the behavior will be identical to
  12105. both values being set to 0 as previously detailed.
  12106. See below for the list of accepted constants for use in the dimension
  12107. expression.
  12108. @item eval
  12109. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12110. @table @samp
  12111. @item init
  12112. Only evaluate expressions once during the filter initialization or when a command is processed.
  12113. @item frame
  12114. Evaluate expressions for each incoming frame.
  12115. @end table
  12116. Default value is @samp{init}.
  12117. @item interl
  12118. Set the interlacing mode. It accepts the following values:
  12119. @table @samp
  12120. @item 1
  12121. Force interlaced aware scaling.
  12122. @item 0
  12123. Do not apply interlaced scaling.
  12124. @item -1
  12125. Select interlaced aware scaling depending on whether the source frames
  12126. are flagged as interlaced or not.
  12127. @end table
  12128. Default value is @samp{0}.
  12129. @item flags
  12130. Set libswscale scaling flags. See
  12131. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12132. complete list of values. If not explicitly specified the filter applies
  12133. the default flags.
  12134. @item param0, param1
  12135. Set libswscale input parameters for scaling algorithms that need them. See
  12136. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12137. complete documentation. If not explicitly specified the filter applies
  12138. empty parameters.
  12139. @item size, s
  12140. Set the video size. For the syntax of this option, check the
  12141. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12142. @item in_color_matrix
  12143. @item out_color_matrix
  12144. Set in/output YCbCr color space type.
  12145. This allows the autodetected value to be overridden as well as allows forcing
  12146. a specific value used for the output and encoder.
  12147. If not specified, the color space type depends on the pixel format.
  12148. Possible values:
  12149. @table @samp
  12150. @item auto
  12151. Choose automatically.
  12152. @item bt709
  12153. Format conforming to International Telecommunication Union (ITU)
  12154. Recommendation BT.709.
  12155. @item fcc
  12156. Set color space conforming to the United States Federal Communications
  12157. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12158. @item bt601
  12159. @item bt470
  12160. @item smpte170m
  12161. Set color space conforming to:
  12162. @itemize
  12163. @item
  12164. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12165. @item
  12166. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12167. @item
  12168. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12169. @end itemize
  12170. @item smpte240m
  12171. Set color space conforming to SMPTE ST 240:1999.
  12172. @item bt2020
  12173. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12174. @end table
  12175. @item in_range
  12176. @item out_range
  12177. Set in/output YCbCr sample range.
  12178. This allows the autodetected value to be overridden as well as allows forcing
  12179. a specific value used for the output and encoder. If not specified, the
  12180. range depends on the pixel format. Possible values:
  12181. @table @samp
  12182. @item auto/unknown
  12183. Choose automatically.
  12184. @item jpeg/full/pc
  12185. Set full range (0-255 in case of 8-bit luma).
  12186. @item mpeg/limited/tv
  12187. Set "MPEG" range (16-235 in case of 8-bit luma).
  12188. @end table
  12189. @item force_original_aspect_ratio
  12190. Enable decreasing or increasing output video width or height if necessary to
  12191. keep the original aspect ratio. Possible values:
  12192. @table @samp
  12193. @item disable
  12194. Scale the video as specified and disable this feature.
  12195. @item decrease
  12196. The output video dimensions will automatically be decreased if needed.
  12197. @item increase
  12198. The output video dimensions will automatically be increased if needed.
  12199. @end table
  12200. One useful instance of this option is that when you know a specific device's
  12201. maximum allowed resolution, you can use this to limit the output video to
  12202. that, while retaining the aspect ratio. For example, device A allows
  12203. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12204. decrease) and specifying 1280x720 to the command line makes the output
  12205. 1280x533.
  12206. Please note that this is a different thing than specifying -1 for @option{w}
  12207. or @option{h}, you still need to specify the output resolution for this option
  12208. to work.
  12209. @item force_divisible_by
  12210. Ensures that both the output dimensions, width and height, are divisible by the
  12211. given integer when used together with @option{force_original_aspect_ratio}. This
  12212. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12213. This option respects the value set for @option{force_original_aspect_ratio},
  12214. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12215. may be slightly modified.
  12216. This option can be handy if you need to have a video fit within or exceed
  12217. a defined resolution using @option{force_original_aspect_ratio} but also have
  12218. encoder restrictions on width or height divisibility.
  12219. @end table
  12220. The values of the @option{w} and @option{h} options are expressions
  12221. containing the following constants:
  12222. @table @var
  12223. @item in_w
  12224. @item in_h
  12225. The input width and height
  12226. @item iw
  12227. @item ih
  12228. These are the same as @var{in_w} and @var{in_h}.
  12229. @item out_w
  12230. @item out_h
  12231. The output (scaled) width and height
  12232. @item ow
  12233. @item oh
  12234. These are the same as @var{out_w} and @var{out_h}
  12235. @item a
  12236. The same as @var{iw} / @var{ih}
  12237. @item sar
  12238. input sample aspect ratio
  12239. @item dar
  12240. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12241. @item hsub
  12242. @item vsub
  12243. horizontal and vertical input chroma subsample values. For example for the
  12244. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12245. @item ohsub
  12246. @item ovsub
  12247. horizontal and vertical output chroma subsample values. For example for the
  12248. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12249. @end table
  12250. @subsection Examples
  12251. @itemize
  12252. @item
  12253. Scale the input video to a size of 200x100
  12254. @example
  12255. scale=w=200:h=100
  12256. @end example
  12257. This is equivalent to:
  12258. @example
  12259. scale=200:100
  12260. @end example
  12261. or:
  12262. @example
  12263. scale=200x100
  12264. @end example
  12265. @item
  12266. Specify a size abbreviation for the output size:
  12267. @example
  12268. scale=qcif
  12269. @end example
  12270. which can also be written as:
  12271. @example
  12272. scale=size=qcif
  12273. @end example
  12274. @item
  12275. Scale the input to 2x:
  12276. @example
  12277. scale=w=2*iw:h=2*ih
  12278. @end example
  12279. @item
  12280. The above is the same as:
  12281. @example
  12282. scale=2*in_w:2*in_h
  12283. @end example
  12284. @item
  12285. Scale the input to 2x with forced interlaced scaling:
  12286. @example
  12287. scale=2*iw:2*ih:interl=1
  12288. @end example
  12289. @item
  12290. Scale the input to half size:
  12291. @example
  12292. scale=w=iw/2:h=ih/2
  12293. @end example
  12294. @item
  12295. Increase the width, and set the height to the same size:
  12296. @example
  12297. scale=3/2*iw:ow
  12298. @end example
  12299. @item
  12300. Seek Greek harmony:
  12301. @example
  12302. scale=iw:1/PHI*iw
  12303. scale=ih*PHI:ih
  12304. @end example
  12305. @item
  12306. Increase the height, and set the width to 3/2 of the height:
  12307. @example
  12308. scale=w=3/2*oh:h=3/5*ih
  12309. @end example
  12310. @item
  12311. Increase the size, making the size a multiple of the chroma
  12312. subsample values:
  12313. @example
  12314. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12315. @end example
  12316. @item
  12317. Increase the width to a maximum of 500 pixels,
  12318. keeping the same aspect ratio as the input:
  12319. @example
  12320. scale=w='min(500\, iw*3/2):h=-1'
  12321. @end example
  12322. @item
  12323. Make pixels square by combining scale and setsar:
  12324. @example
  12325. scale='trunc(ih*dar):ih',setsar=1/1
  12326. @end example
  12327. @item
  12328. Make pixels square by combining scale and setsar,
  12329. making sure the resulting resolution is even (required by some codecs):
  12330. @example
  12331. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12332. @end example
  12333. @end itemize
  12334. @subsection Commands
  12335. This filter supports the following commands:
  12336. @table @option
  12337. @item width, w
  12338. @item height, h
  12339. Set the output video dimension expression.
  12340. The command accepts the same syntax of the corresponding option.
  12341. If the specified expression is not valid, it is kept at its current
  12342. value.
  12343. @end table
  12344. @section scale_npp
  12345. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12346. format conversion on CUDA video frames. Setting the output width and height
  12347. works in the same way as for the @var{scale} filter.
  12348. The following additional options are accepted:
  12349. @table @option
  12350. @item format
  12351. The pixel format of the output CUDA frames. If set to the string "same" (the
  12352. default), the input format will be kept. Note that automatic format negotiation
  12353. and conversion is not yet supported for hardware frames
  12354. @item interp_algo
  12355. The interpolation algorithm used for resizing. One of the following:
  12356. @table @option
  12357. @item nn
  12358. Nearest neighbour.
  12359. @item linear
  12360. @item cubic
  12361. @item cubic2p_bspline
  12362. 2-parameter cubic (B=1, C=0)
  12363. @item cubic2p_catmullrom
  12364. 2-parameter cubic (B=0, C=1/2)
  12365. @item cubic2p_b05c03
  12366. 2-parameter cubic (B=1/2, C=3/10)
  12367. @item super
  12368. Supersampling
  12369. @item lanczos
  12370. @end table
  12371. @item force_original_aspect_ratio
  12372. Enable decreasing or increasing output video width or height if necessary to
  12373. keep the original aspect ratio. Possible values:
  12374. @table @samp
  12375. @item disable
  12376. Scale the video as specified and disable this feature.
  12377. @item decrease
  12378. The output video dimensions will automatically be decreased if needed.
  12379. @item increase
  12380. The output video dimensions will automatically be increased if needed.
  12381. @end table
  12382. One useful instance of this option is that when you know a specific device's
  12383. maximum allowed resolution, you can use this to limit the output video to
  12384. that, while retaining the aspect ratio. For example, device A allows
  12385. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12386. decrease) and specifying 1280x720 to the command line makes the output
  12387. 1280x533.
  12388. Please note that this is a different thing than specifying -1 for @option{w}
  12389. or @option{h}, you still need to specify the output resolution for this option
  12390. to work.
  12391. @item force_divisible_by
  12392. Ensures that both the output dimensions, width and height, are divisible by the
  12393. given integer when used together with @option{force_original_aspect_ratio}. This
  12394. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12395. This option respects the value set for @option{force_original_aspect_ratio},
  12396. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12397. may be slightly modified.
  12398. This option can be handy if you need to have a video fit within or exceed
  12399. a defined resolution using @option{force_original_aspect_ratio} but also have
  12400. encoder restrictions on width or height divisibility.
  12401. @end table
  12402. @section scale2ref
  12403. Scale (resize) the input video, based on a reference video.
  12404. See the scale filter for available options, scale2ref supports the same but
  12405. uses the reference video instead of the main input as basis. scale2ref also
  12406. supports the following additional constants for the @option{w} and
  12407. @option{h} options:
  12408. @table @var
  12409. @item main_w
  12410. @item main_h
  12411. The main input video's width and height
  12412. @item main_a
  12413. The same as @var{main_w} / @var{main_h}
  12414. @item main_sar
  12415. The main input video's sample aspect ratio
  12416. @item main_dar, mdar
  12417. The main input video's display aspect ratio. Calculated from
  12418. @code{(main_w / main_h) * main_sar}.
  12419. @item main_hsub
  12420. @item main_vsub
  12421. The main input video's horizontal and vertical chroma subsample values.
  12422. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12423. is 1.
  12424. @end table
  12425. @subsection Examples
  12426. @itemize
  12427. @item
  12428. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12429. @example
  12430. 'scale2ref[b][a];[a][b]overlay'
  12431. @end example
  12432. @item
  12433. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12434. @example
  12435. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12436. @end example
  12437. @end itemize
  12438. @section scroll
  12439. Scroll input video horizontally and/or vertically by constant speed.
  12440. The filter accepts the following options:
  12441. @table @option
  12442. @item horizontal, h
  12443. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12444. Negative values changes scrolling direction.
  12445. @item vertical, v
  12446. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12447. Negative values changes scrolling direction.
  12448. @item hpos
  12449. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12450. @item vpos
  12451. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12452. @end table
  12453. @subsection Commands
  12454. This filter supports the following @ref{commands}:
  12455. @table @option
  12456. @item horizontal, h
  12457. Set the horizontal scrolling speed.
  12458. @item vertical, v
  12459. Set the vertical scrolling speed.
  12460. @end table
  12461. @anchor{selectivecolor}
  12462. @section selectivecolor
  12463. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12464. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12465. by the "purity" of the color (that is, how saturated it already is).
  12466. This filter is similar to the Adobe Photoshop Selective Color tool.
  12467. The filter accepts the following options:
  12468. @table @option
  12469. @item correction_method
  12470. Select color correction method.
  12471. Available values are:
  12472. @table @samp
  12473. @item absolute
  12474. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12475. component value).
  12476. @item relative
  12477. Specified adjustments are relative to the original component value.
  12478. @end table
  12479. Default is @code{absolute}.
  12480. @item reds
  12481. Adjustments for red pixels (pixels where the red component is the maximum)
  12482. @item yellows
  12483. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12484. @item greens
  12485. Adjustments for green pixels (pixels where the green component is the maximum)
  12486. @item cyans
  12487. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12488. @item blues
  12489. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12490. @item magentas
  12491. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12492. @item whites
  12493. Adjustments for white pixels (pixels where all components are greater than 128)
  12494. @item neutrals
  12495. Adjustments for all pixels except pure black and pure white
  12496. @item blacks
  12497. Adjustments for black pixels (pixels where all components are lesser than 128)
  12498. @item psfile
  12499. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12500. @end table
  12501. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12502. 4 space separated floating point adjustment values in the [-1,1] range,
  12503. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12504. pixels of its range.
  12505. @subsection Examples
  12506. @itemize
  12507. @item
  12508. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12509. increase magenta by 27% in blue areas:
  12510. @example
  12511. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12512. @end example
  12513. @item
  12514. Use a Photoshop selective color preset:
  12515. @example
  12516. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12517. @end example
  12518. @end itemize
  12519. @anchor{separatefields}
  12520. @section separatefields
  12521. The @code{separatefields} takes a frame-based video input and splits
  12522. each frame into its components fields, producing a new half height clip
  12523. with twice the frame rate and twice the frame count.
  12524. This filter use field-dominance information in frame to decide which
  12525. of each pair of fields to place first in the output.
  12526. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12527. @section setdar, setsar
  12528. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12529. output video.
  12530. This is done by changing the specified Sample (aka Pixel) Aspect
  12531. Ratio, according to the following equation:
  12532. @example
  12533. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12534. @end example
  12535. Keep in mind that the @code{setdar} filter does not modify the pixel
  12536. dimensions of the video frame. Also, the display aspect ratio set by
  12537. this filter may be changed by later filters in the filterchain,
  12538. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12539. applied.
  12540. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12541. the filter output video.
  12542. Note that as a consequence of the application of this filter, the
  12543. output display aspect ratio will change according to the equation
  12544. above.
  12545. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12546. filter may be changed by later filters in the filterchain, e.g. if
  12547. another "setsar" or a "setdar" filter is applied.
  12548. It accepts the following parameters:
  12549. @table @option
  12550. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12551. Set the aspect ratio used by the filter.
  12552. The parameter can be a floating point number string, an expression, or
  12553. a string of the form @var{num}:@var{den}, where @var{num} and
  12554. @var{den} are the numerator and denominator of the aspect ratio. If
  12555. the parameter is not specified, it is assumed the value "0".
  12556. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12557. should be escaped.
  12558. @item max
  12559. Set the maximum integer value to use for expressing numerator and
  12560. denominator when reducing the expressed aspect ratio to a rational.
  12561. Default value is @code{100}.
  12562. @end table
  12563. The parameter @var{sar} is an expression containing
  12564. the following constants:
  12565. @table @option
  12566. @item E, PI, PHI
  12567. These are approximated values for the mathematical constants e
  12568. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12569. @item w, h
  12570. The input width and height.
  12571. @item a
  12572. These are the same as @var{w} / @var{h}.
  12573. @item sar
  12574. The input sample aspect ratio.
  12575. @item dar
  12576. The input display aspect ratio. It is the same as
  12577. (@var{w} / @var{h}) * @var{sar}.
  12578. @item hsub, vsub
  12579. Horizontal and vertical chroma subsample values. For example, for the
  12580. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12581. @end table
  12582. @subsection Examples
  12583. @itemize
  12584. @item
  12585. To change the display aspect ratio to 16:9, specify one of the following:
  12586. @example
  12587. setdar=dar=1.77777
  12588. setdar=dar=16/9
  12589. @end example
  12590. @item
  12591. To change the sample aspect ratio to 10:11, specify:
  12592. @example
  12593. setsar=sar=10/11
  12594. @end example
  12595. @item
  12596. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12597. 1000 in the aspect ratio reduction, use the command:
  12598. @example
  12599. setdar=ratio=16/9:max=1000
  12600. @end example
  12601. @end itemize
  12602. @anchor{setfield}
  12603. @section setfield
  12604. Force field for the output video frame.
  12605. The @code{setfield} filter marks the interlace type field for the
  12606. output frames. It does not change the input frame, but only sets the
  12607. corresponding property, which affects how the frame is treated by
  12608. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12609. The filter accepts the following options:
  12610. @table @option
  12611. @item mode
  12612. Available values are:
  12613. @table @samp
  12614. @item auto
  12615. Keep the same field property.
  12616. @item bff
  12617. Mark the frame as bottom-field-first.
  12618. @item tff
  12619. Mark the frame as top-field-first.
  12620. @item prog
  12621. Mark the frame as progressive.
  12622. @end table
  12623. @end table
  12624. @anchor{setparams}
  12625. @section setparams
  12626. Force frame parameter for the output video frame.
  12627. The @code{setparams} filter marks interlace and color range for the
  12628. output frames. It does not change the input frame, but only sets the
  12629. corresponding property, which affects how the frame is treated by
  12630. filters/encoders.
  12631. @table @option
  12632. @item field_mode
  12633. Available values are:
  12634. @table @samp
  12635. @item auto
  12636. Keep the same field property (default).
  12637. @item bff
  12638. Mark the frame as bottom-field-first.
  12639. @item tff
  12640. Mark the frame as top-field-first.
  12641. @item prog
  12642. Mark the frame as progressive.
  12643. @end table
  12644. @item range
  12645. Available values are:
  12646. @table @samp
  12647. @item auto
  12648. Keep the same color range property (default).
  12649. @item unspecified, unknown
  12650. Mark the frame as unspecified color range.
  12651. @item limited, tv, mpeg
  12652. Mark the frame as limited range.
  12653. @item full, pc, jpeg
  12654. Mark the frame as full range.
  12655. @end table
  12656. @item color_primaries
  12657. Set the color primaries.
  12658. Available values are:
  12659. @table @samp
  12660. @item auto
  12661. Keep the same color primaries property (default).
  12662. @item bt709
  12663. @item unknown
  12664. @item bt470m
  12665. @item bt470bg
  12666. @item smpte170m
  12667. @item smpte240m
  12668. @item film
  12669. @item bt2020
  12670. @item smpte428
  12671. @item smpte431
  12672. @item smpte432
  12673. @item jedec-p22
  12674. @end table
  12675. @item color_trc
  12676. Set the color transfer.
  12677. Available values are:
  12678. @table @samp
  12679. @item auto
  12680. Keep the same color trc property (default).
  12681. @item bt709
  12682. @item unknown
  12683. @item bt470m
  12684. @item bt470bg
  12685. @item smpte170m
  12686. @item smpte240m
  12687. @item linear
  12688. @item log100
  12689. @item log316
  12690. @item iec61966-2-4
  12691. @item bt1361e
  12692. @item iec61966-2-1
  12693. @item bt2020-10
  12694. @item bt2020-12
  12695. @item smpte2084
  12696. @item smpte428
  12697. @item arib-std-b67
  12698. @end table
  12699. @item colorspace
  12700. Set the colorspace.
  12701. Available values are:
  12702. @table @samp
  12703. @item auto
  12704. Keep the same colorspace property (default).
  12705. @item gbr
  12706. @item bt709
  12707. @item unknown
  12708. @item fcc
  12709. @item bt470bg
  12710. @item smpte170m
  12711. @item smpte240m
  12712. @item ycgco
  12713. @item bt2020nc
  12714. @item bt2020c
  12715. @item smpte2085
  12716. @item chroma-derived-nc
  12717. @item chroma-derived-c
  12718. @item ictcp
  12719. @end table
  12720. @end table
  12721. @section showinfo
  12722. Show a line containing various information for each input video frame.
  12723. The input video is not modified.
  12724. This filter supports the following options:
  12725. @table @option
  12726. @item checksum
  12727. Calculate checksums of each plane. By default enabled.
  12728. @end table
  12729. The shown line contains a sequence of key/value pairs of the form
  12730. @var{key}:@var{value}.
  12731. The following values are shown in the output:
  12732. @table @option
  12733. @item n
  12734. The (sequential) number of the input frame, starting from 0.
  12735. @item pts
  12736. The Presentation TimeStamp of the input frame, expressed as a number of
  12737. time base units. The time base unit depends on the filter input pad.
  12738. @item pts_time
  12739. The Presentation TimeStamp of the input frame, expressed as a number of
  12740. seconds.
  12741. @item pos
  12742. The position of the frame in the input stream, or -1 if this information is
  12743. unavailable and/or meaningless (for example in case of synthetic video).
  12744. @item fmt
  12745. The pixel format name.
  12746. @item sar
  12747. The sample aspect ratio of the input frame, expressed in the form
  12748. @var{num}/@var{den}.
  12749. @item s
  12750. The size of the input frame. For the syntax of this option, check the
  12751. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12752. @item i
  12753. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12754. for bottom field first).
  12755. @item iskey
  12756. This is 1 if the frame is a key frame, 0 otherwise.
  12757. @item type
  12758. The picture type of the input frame ("I" for an I-frame, "P" for a
  12759. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12760. Also refer to the documentation of the @code{AVPictureType} enum and of
  12761. the @code{av_get_picture_type_char} function defined in
  12762. @file{libavutil/avutil.h}.
  12763. @item checksum
  12764. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12765. @item plane_checksum
  12766. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12767. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12768. @item mean
  12769. The mean value of pixels in each plane of the input frame, expressed in the form
  12770. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  12771. @item stdev
  12772. The standard deviation of pixel values in each plane of the input frame, expressed
  12773. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  12774. @end table
  12775. @section showpalette
  12776. Displays the 256 colors palette of each frame. This filter is only relevant for
  12777. @var{pal8} pixel format frames.
  12778. It accepts the following option:
  12779. @table @option
  12780. @item s
  12781. Set the size of the box used to represent one palette color entry. Default is
  12782. @code{30} (for a @code{30x30} pixel box).
  12783. @end table
  12784. @section shuffleframes
  12785. Reorder and/or duplicate and/or drop video frames.
  12786. It accepts the following parameters:
  12787. @table @option
  12788. @item mapping
  12789. Set the destination indexes of input frames.
  12790. This is space or '|' separated list of indexes that maps input frames to output
  12791. frames. Number of indexes also sets maximal value that each index may have.
  12792. '-1' index have special meaning and that is to drop frame.
  12793. @end table
  12794. The first frame has the index 0. The default is to keep the input unchanged.
  12795. @subsection Examples
  12796. @itemize
  12797. @item
  12798. Swap second and third frame of every three frames of the input:
  12799. @example
  12800. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12801. @end example
  12802. @item
  12803. Swap 10th and 1st frame of every ten frames of the input:
  12804. @example
  12805. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12806. @end example
  12807. @end itemize
  12808. @section shuffleplanes
  12809. Reorder and/or duplicate video planes.
  12810. It accepts the following parameters:
  12811. @table @option
  12812. @item map0
  12813. The index of the input plane to be used as the first output plane.
  12814. @item map1
  12815. The index of the input plane to be used as the second output plane.
  12816. @item map2
  12817. The index of the input plane to be used as the third output plane.
  12818. @item map3
  12819. The index of the input plane to be used as the fourth output plane.
  12820. @end table
  12821. The first plane has the index 0. The default is to keep the input unchanged.
  12822. @subsection Examples
  12823. @itemize
  12824. @item
  12825. Swap the second and third planes of the input:
  12826. @example
  12827. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12828. @end example
  12829. @end itemize
  12830. @anchor{signalstats}
  12831. @section signalstats
  12832. Evaluate various visual metrics that assist in determining issues associated
  12833. with the digitization of analog video media.
  12834. By default the filter will log these metadata values:
  12835. @table @option
  12836. @item YMIN
  12837. Display the minimal Y value contained within the input frame. Expressed in
  12838. range of [0-255].
  12839. @item YLOW
  12840. Display the Y value at the 10% percentile within the input frame. Expressed in
  12841. range of [0-255].
  12842. @item YAVG
  12843. Display the average Y value within the input frame. Expressed in range of
  12844. [0-255].
  12845. @item YHIGH
  12846. Display the Y value at the 90% percentile within the input frame. Expressed in
  12847. range of [0-255].
  12848. @item YMAX
  12849. Display the maximum Y value contained within the input frame. Expressed in
  12850. range of [0-255].
  12851. @item UMIN
  12852. Display the minimal U value contained within the input frame. Expressed in
  12853. range of [0-255].
  12854. @item ULOW
  12855. Display the U value at the 10% percentile within the input frame. Expressed in
  12856. range of [0-255].
  12857. @item UAVG
  12858. Display the average U value within the input frame. Expressed in range of
  12859. [0-255].
  12860. @item UHIGH
  12861. Display the U value at the 90% percentile within the input frame. Expressed in
  12862. range of [0-255].
  12863. @item UMAX
  12864. Display the maximum U value contained within the input frame. Expressed in
  12865. range of [0-255].
  12866. @item VMIN
  12867. Display the minimal V value contained within the input frame. Expressed in
  12868. range of [0-255].
  12869. @item VLOW
  12870. Display the V value at the 10% percentile within the input frame. Expressed in
  12871. range of [0-255].
  12872. @item VAVG
  12873. Display the average V value within the input frame. Expressed in range of
  12874. [0-255].
  12875. @item VHIGH
  12876. Display the V value at the 90% percentile within the input frame. Expressed in
  12877. range of [0-255].
  12878. @item VMAX
  12879. Display the maximum V value contained within the input frame. Expressed in
  12880. range of [0-255].
  12881. @item SATMIN
  12882. Display the minimal saturation value contained within the input frame.
  12883. Expressed in range of [0-~181.02].
  12884. @item SATLOW
  12885. Display the saturation value at the 10% percentile within the input frame.
  12886. Expressed in range of [0-~181.02].
  12887. @item SATAVG
  12888. Display the average saturation value within the input frame. Expressed in range
  12889. of [0-~181.02].
  12890. @item SATHIGH
  12891. Display the saturation value at the 90% percentile within the input frame.
  12892. Expressed in range of [0-~181.02].
  12893. @item SATMAX
  12894. Display the maximum saturation value contained within the input frame.
  12895. Expressed in range of [0-~181.02].
  12896. @item HUEMED
  12897. Display the median value for hue within the input frame. Expressed in range of
  12898. [0-360].
  12899. @item HUEAVG
  12900. Display the average value for hue within the input frame. Expressed in range of
  12901. [0-360].
  12902. @item YDIF
  12903. Display the average of sample value difference between all values of the Y
  12904. plane in the current frame and corresponding values of the previous input frame.
  12905. Expressed in range of [0-255].
  12906. @item UDIF
  12907. Display the average of sample value difference between all values of the U
  12908. plane in the current frame and corresponding values of the previous input frame.
  12909. Expressed in range of [0-255].
  12910. @item VDIF
  12911. Display the average of sample value difference between all values of the V
  12912. plane in the current frame and corresponding values of the previous input frame.
  12913. Expressed in range of [0-255].
  12914. @item YBITDEPTH
  12915. Display bit depth of Y plane in current frame.
  12916. Expressed in range of [0-16].
  12917. @item UBITDEPTH
  12918. Display bit depth of U plane in current frame.
  12919. Expressed in range of [0-16].
  12920. @item VBITDEPTH
  12921. Display bit depth of V plane in current frame.
  12922. Expressed in range of [0-16].
  12923. @end table
  12924. The filter accepts the following options:
  12925. @table @option
  12926. @item stat
  12927. @item out
  12928. @option{stat} specify an additional form of image analysis.
  12929. @option{out} output video with the specified type of pixel highlighted.
  12930. Both options accept the following values:
  12931. @table @samp
  12932. @item tout
  12933. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12934. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12935. include the results of video dropouts, head clogs, or tape tracking issues.
  12936. @item vrep
  12937. Identify @var{vertical line repetition}. Vertical line repetition includes
  12938. similar rows of pixels within a frame. In born-digital video vertical line
  12939. repetition is common, but this pattern is uncommon in video digitized from an
  12940. analog source. When it occurs in video that results from the digitization of an
  12941. analog source it can indicate concealment from a dropout compensator.
  12942. @item brng
  12943. Identify pixels that fall outside of legal broadcast range.
  12944. @end table
  12945. @item color, c
  12946. Set the highlight color for the @option{out} option. The default color is
  12947. yellow.
  12948. @end table
  12949. @subsection Examples
  12950. @itemize
  12951. @item
  12952. Output data of various video metrics:
  12953. @example
  12954. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12955. @end example
  12956. @item
  12957. Output specific data about the minimum and maximum values of the Y plane per frame:
  12958. @example
  12959. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12960. @end example
  12961. @item
  12962. Playback video while highlighting pixels that are outside of broadcast range in red.
  12963. @example
  12964. ffplay example.mov -vf signalstats="out=brng:color=red"
  12965. @end example
  12966. @item
  12967. Playback video with signalstats metadata drawn over the frame.
  12968. @example
  12969. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12970. @end example
  12971. The contents of signalstat_drawtext.txt used in the command are:
  12972. @example
  12973. time %@{pts:hms@}
  12974. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12975. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12976. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12977. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12978. @end example
  12979. @end itemize
  12980. @anchor{signature}
  12981. @section signature
  12982. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12983. input. In this case the matching between the inputs can be calculated additionally.
  12984. The filter always passes through the first input. The signature of each stream can
  12985. be written into a file.
  12986. It accepts the following options:
  12987. @table @option
  12988. @item detectmode
  12989. Enable or disable the matching process.
  12990. Available values are:
  12991. @table @samp
  12992. @item off
  12993. Disable the calculation of a matching (default).
  12994. @item full
  12995. Calculate the matching for the whole video and output whether the whole video
  12996. matches or only parts.
  12997. @item fast
  12998. Calculate only until a matching is found or the video ends. Should be faster in
  12999. some cases.
  13000. @end table
  13001. @item nb_inputs
  13002. Set the number of inputs. The option value must be a non negative integer.
  13003. Default value is 1.
  13004. @item filename
  13005. Set the path to which the output is written. If there is more than one input,
  13006. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13007. integer), that will be replaced with the input number. If no filename is
  13008. specified, no output will be written. This is the default.
  13009. @item format
  13010. Choose the output format.
  13011. Available values are:
  13012. @table @samp
  13013. @item binary
  13014. Use the specified binary representation (default).
  13015. @item xml
  13016. Use the specified xml representation.
  13017. @end table
  13018. @item th_d
  13019. Set threshold to detect one word as similar. The option value must be an integer
  13020. greater than zero. The default value is 9000.
  13021. @item th_dc
  13022. Set threshold to detect all words as similar. The option value must be an integer
  13023. greater than zero. The default value is 60000.
  13024. @item th_xh
  13025. Set threshold to detect frames as similar. The option value must be an integer
  13026. greater than zero. The default value is 116.
  13027. @item th_di
  13028. Set the minimum length of a sequence in frames to recognize it as matching
  13029. sequence. The option value must be a non negative integer value.
  13030. The default value is 0.
  13031. @item th_it
  13032. Set the minimum relation, that matching frames to all frames must have.
  13033. The option value must be a double value between 0 and 1. The default value is 0.5.
  13034. @end table
  13035. @subsection Examples
  13036. @itemize
  13037. @item
  13038. To calculate the signature of an input video and store it in signature.bin:
  13039. @example
  13040. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13041. @end example
  13042. @item
  13043. To detect whether two videos match and store the signatures in XML format in
  13044. signature0.xml and signature1.xml:
  13045. @example
  13046. 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 -
  13047. @end example
  13048. @end itemize
  13049. @anchor{smartblur}
  13050. @section smartblur
  13051. Blur the input video without impacting the outlines.
  13052. It accepts the following options:
  13053. @table @option
  13054. @item luma_radius, lr
  13055. Set the luma radius. The option value must be a float number in
  13056. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13057. used to blur the image (slower if larger). Default value is 1.0.
  13058. @item luma_strength, ls
  13059. Set the luma strength. The option value must be a float number
  13060. in the range [-1.0,1.0] that configures the blurring. A value included
  13061. in [0.0,1.0] will blur the image whereas a value included in
  13062. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13063. @item luma_threshold, lt
  13064. Set the luma threshold used as a coefficient to determine
  13065. whether a pixel should be blurred or not. The option value must be an
  13066. integer in the range [-30,30]. A value of 0 will filter all the image,
  13067. a value included in [0,30] will filter flat areas and a value included
  13068. in [-30,0] will filter edges. Default value is 0.
  13069. @item chroma_radius, cr
  13070. Set the chroma radius. The option value must be a float number in
  13071. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13072. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13073. @item chroma_strength, cs
  13074. Set the chroma strength. The option value must be a float number
  13075. in the range [-1.0,1.0] that configures the blurring. A value included
  13076. in [0.0,1.0] will blur the image whereas a value included in
  13077. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13078. @item chroma_threshold, ct
  13079. Set the chroma threshold used as a coefficient to determine
  13080. whether a pixel should be blurred or not. The option value must be an
  13081. integer in the range [-30,30]. A value of 0 will filter all the image,
  13082. a value included in [0,30] will filter flat areas and a value included
  13083. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13084. @end table
  13085. If a chroma option is not explicitly set, the corresponding luma value
  13086. is set.
  13087. @section sobel
  13088. Apply sobel operator to input video stream.
  13089. The filter accepts the following option:
  13090. @table @option
  13091. @item planes
  13092. Set which planes will be processed, unprocessed planes will be copied.
  13093. By default value 0xf, all planes will be processed.
  13094. @item scale
  13095. Set value which will be multiplied with filtered result.
  13096. @item delta
  13097. Set value which will be added to filtered result.
  13098. @end table
  13099. @anchor{spp}
  13100. @section spp
  13101. Apply a simple postprocessing filter that compresses and decompresses the image
  13102. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13103. and average the results.
  13104. The filter accepts the following options:
  13105. @table @option
  13106. @item quality
  13107. Set quality. This option defines the number of levels for averaging. It accepts
  13108. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13109. effect. A value of @code{6} means the higher quality. For each increment of
  13110. that value the speed drops by a factor of approximately 2. Default value is
  13111. @code{3}.
  13112. @item qp
  13113. Force a constant quantization parameter. If not set, the filter will use the QP
  13114. from the video stream (if available).
  13115. @item mode
  13116. Set thresholding mode. Available modes are:
  13117. @table @samp
  13118. @item hard
  13119. Set hard thresholding (default).
  13120. @item soft
  13121. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13122. @end table
  13123. @item use_bframe_qp
  13124. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13125. option may cause flicker since the B-Frames have often larger QP. Default is
  13126. @code{0} (not enabled).
  13127. @end table
  13128. @section sr
  13129. Scale the input by applying one of the super-resolution methods based on
  13130. convolutional neural networks. Supported models:
  13131. @itemize
  13132. @item
  13133. Super-Resolution Convolutional Neural Network model (SRCNN).
  13134. See @url{https://arxiv.org/abs/1501.00092}.
  13135. @item
  13136. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13137. See @url{https://arxiv.org/abs/1609.05158}.
  13138. @end itemize
  13139. Training scripts as well as scripts for model file (.pb) saving can be found at
  13140. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13141. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13142. Native model files (.model) can be generated from TensorFlow model
  13143. files (.pb) by using tools/python/convert.py
  13144. The filter accepts the following options:
  13145. @table @option
  13146. @item dnn_backend
  13147. Specify which DNN backend to use for model loading and execution. This option accepts
  13148. the following values:
  13149. @table @samp
  13150. @item native
  13151. Native implementation of DNN loading and execution.
  13152. @item tensorflow
  13153. TensorFlow backend. To enable this backend you
  13154. need to install the TensorFlow for C library (see
  13155. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13156. @code{--enable-libtensorflow}
  13157. @end table
  13158. Default value is @samp{native}.
  13159. @item model
  13160. Set path to model file specifying network architecture and its parameters.
  13161. Note that different backends use different file formats. TensorFlow backend
  13162. can load files for both formats, while native backend can load files for only
  13163. its format.
  13164. @item scale_factor
  13165. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13166. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13167. input upscaled using bicubic upscaling with proper scale factor.
  13168. @end table
  13169. @section ssim
  13170. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13171. This filter takes in input two input videos, the first input is
  13172. considered the "main" source and is passed unchanged to the
  13173. output. The second input is used as a "reference" video for computing
  13174. the SSIM.
  13175. Both video inputs must have the same resolution and pixel format for
  13176. this filter to work correctly. Also it assumes that both inputs
  13177. have the same number of frames, which are compared one by one.
  13178. The filter stores the calculated SSIM of each frame.
  13179. The description of the accepted parameters follows.
  13180. @table @option
  13181. @item stats_file, f
  13182. If specified the filter will use the named file to save the SSIM of
  13183. each individual frame. When filename equals "-" the data is sent to
  13184. standard output.
  13185. @end table
  13186. The file printed if @var{stats_file} is selected, contains a sequence of
  13187. key/value pairs of the form @var{key}:@var{value} for each compared
  13188. couple of frames.
  13189. A description of each shown parameter follows:
  13190. @table @option
  13191. @item n
  13192. sequential number of the input frame, starting from 1
  13193. @item Y, U, V, R, G, B
  13194. SSIM of the compared frames for the component specified by the suffix.
  13195. @item All
  13196. SSIM of the compared frames for the whole frame.
  13197. @item dB
  13198. Same as above but in dB representation.
  13199. @end table
  13200. This filter also supports the @ref{framesync} options.
  13201. @subsection Examples
  13202. @itemize
  13203. @item
  13204. For example:
  13205. @example
  13206. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13207. [main][ref] ssim="stats_file=stats.log" [out]
  13208. @end example
  13209. On this example the input file being processed is compared with the
  13210. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13211. is stored in @file{stats.log}.
  13212. @item
  13213. Another example with both psnr and ssim at same time:
  13214. @example
  13215. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13216. @end example
  13217. @item
  13218. Another example with different containers:
  13219. @example
  13220. 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 -
  13221. @end example
  13222. @end itemize
  13223. @section stereo3d
  13224. Convert between different stereoscopic image formats.
  13225. The filters accept the following options:
  13226. @table @option
  13227. @item in
  13228. Set stereoscopic image format of input.
  13229. Available values for input image formats are:
  13230. @table @samp
  13231. @item sbsl
  13232. side by side parallel (left eye left, right eye right)
  13233. @item sbsr
  13234. side by side crosseye (right eye left, left eye right)
  13235. @item sbs2l
  13236. side by side parallel with half width resolution
  13237. (left eye left, right eye right)
  13238. @item sbs2r
  13239. side by side crosseye with half width resolution
  13240. (right eye left, left eye right)
  13241. @item abl
  13242. @item tbl
  13243. above-below (left eye above, right eye below)
  13244. @item abr
  13245. @item tbr
  13246. above-below (right eye above, left eye below)
  13247. @item ab2l
  13248. @item tb2l
  13249. above-below with half height resolution
  13250. (left eye above, right eye below)
  13251. @item ab2r
  13252. @item tb2r
  13253. above-below with half height resolution
  13254. (right eye above, left eye below)
  13255. @item al
  13256. alternating frames (left eye first, right eye second)
  13257. @item ar
  13258. alternating frames (right eye first, left eye second)
  13259. @item irl
  13260. interleaved rows (left eye has top row, right eye starts on next row)
  13261. @item irr
  13262. interleaved rows (right eye has top row, left eye starts on next row)
  13263. @item icl
  13264. interleaved columns, left eye first
  13265. @item icr
  13266. interleaved columns, right eye first
  13267. Default value is @samp{sbsl}.
  13268. @end table
  13269. @item out
  13270. Set stereoscopic image format of output.
  13271. @table @samp
  13272. @item sbsl
  13273. side by side parallel (left eye left, right eye right)
  13274. @item sbsr
  13275. side by side crosseye (right eye left, left eye right)
  13276. @item sbs2l
  13277. side by side parallel with half width resolution
  13278. (left eye left, right eye right)
  13279. @item sbs2r
  13280. side by side crosseye with half width resolution
  13281. (right eye left, left eye right)
  13282. @item abl
  13283. @item tbl
  13284. above-below (left eye above, right eye below)
  13285. @item abr
  13286. @item tbr
  13287. above-below (right eye above, left eye below)
  13288. @item ab2l
  13289. @item tb2l
  13290. above-below with half height resolution
  13291. (left eye above, right eye below)
  13292. @item ab2r
  13293. @item tb2r
  13294. above-below with half height resolution
  13295. (right eye above, left eye below)
  13296. @item al
  13297. alternating frames (left eye first, right eye second)
  13298. @item ar
  13299. alternating frames (right eye first, left eye second)
  13300. @item irl
  13301. interleaved rows (left eye has top row, right eye starts on next row)
  13302. @item irr
  13303. interleaved rows (right eye has top row, left eye starts on next row)
  13304. @item arbg
  13305. anaglyph red/blue gray
  13306. (red filter on left eye, blue filter on right eye)
  13307. @item argg
  13308. anaglyph red/green gray
  13309. (red filter on left eye, green filter on right eye)
  13310. @item arcg
  13311. anaglyph red/cyan gray
  13312. (red filter on left eye, cyan filter on right eye)
  13313. @item arch
  13314. anaglyph red/cyan half colored
  13315. (red filter on left eye, cyan filter on right eye)
  13316. @item arcc
  13317. anaglyph red/cyan color
  13318. (red filter on left eye, cyan filter on right eye)
  13319. @item arcd
  13320. anaglyph red/cyan color optimized with the least squares projection of dubois
  13321. (red filter on left eye, cyan filter on right eye)
  13322. @item agmg
  13323. anaglyph green/magenta gray
  13324. (green filter on left eye, magenta filter on right eye)
  13325. @item agmh
  13326. anaglyph green/magenta half colored
  13327. (green filter on left eye, magenta filter on right eye)
  13328. @item agmc
  13329. anaglyph green/magenta colored
  13330. (green filter on left eye, magenta filter on right eye)
  13331. @item agmd
  13332. anaglyph green/magenta color optimized with the least squares projection of dubois
  13333. (green filter on left eye, magenta filter on right eye)
  13334. @item aybg
  13335. anaglyph yellow/blue gray
  13336. (yellow filter on left eye, blue filter on right eye)
  13337. @item aybh
  13338. anaglyph yellow/blue half colored
  13339. (yellow filter on left eye, blue filter on right eye)
  13340. @item aybc
  13341. anaglyph yellow/blue colored
  13342. (yellow filter on left eye, blue filter on right eye)
  13343. @item aybd
  13344. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13345. (yellow filter on left eye, blue filter on right eye)
  13346. @item ml
  13347. mono output (left eye only)
  13348. @item mr
  13349. mono output (right eye only)
  13350. @item chl
  13351. checkerboard, left eye first
  13352. @item chr
  13353. checkerboard, right eye first
  13354. @item icl
  13355. interleaved columns, left eye first
  13356. @item icr
  13357. interleaved columns, right eye first
  13358. @item hdmi
  13359. HDMI frame pack
  13360. @end table
  13361. Default value is @samp{arcd}.
  13362. @end table
  13363. @subsection Examples
  13364. @itemize
  13365. @item
  13366. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13367. @example
  13368. stereo3d=sbsl:aybd
  13369. @end example
  13370. @item
  13371. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13372. @example
  13373. stereo3d=abl:sbsr
  13374. @end example
  13375. @end itemize
  13376. @section streamselect, astreamselect
  13377. Select video or audio streams.
  13378. The filter accepts the following options:
  13379. @table @option
  13380. @item inputs
  13381. Set number of inputs. Default is 2.
  13382. @item map
  13383. Set input indexes to remap to outputs.
  13384. @end table
  13385. @subsection Commands
  13386. The @code{streamselect} and @code{astreamselect} filter supports the following
  13387. commands:
  13388. @table @option
  13389. @item map
  13390. Set input indexes to remap to outputs.
  13391. @end table
  13392. @subsection Examples
  13393. @itemize
  13394. @item
  13395. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13396. @example
  13397. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13398. @end example
  13399. @item
  13400. Same as above, but for audio:
  13401. @example
  13402. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13403. @end example
  13404. @end itemize
  13405. @anchor{subtitles}
  13406. @section subtitles
  13407. Draw subtitles on top of input video using the libass library.
  13408. To enable compilation of this filter you need to configure FFmpeg with
  13409. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13410. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13411. Alpha) subtitles format.
  13412. The filter accepts the following options:
  13413. @table @option
  13414. @item filename, f
  13415. Set the filename of the subtitle file to read. It must be specified.
  13416. @item original_size
  13417. Specify the size of the original video, the video for which the ASS file
  13418. was composed. For the syntax of this option, check the
  13419. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13420. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13421. correctly scale the fonts if the aspect ratio has been changed.
  13422. @item fontsdir
  13423. Set a directory path containing fonts that can be used by the filter.
  13424. These fonts will be used in addition to whatever the font provider uses.
  13425. @item alpha
  13426. Process alpha channel, by default alpha channel is untouched.
  13427. @item charenc
  13428. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13429. useful if not UTF-8.
  13430. @item stream_index, si
  13431. Set subtitles stream index. @code{subtitles} filter only.
  13432. @item force_style
  13433. Override default style or script info parameters of the subtitles. It accepts a
  13434. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13435. @end table
  13436. If the first key is not specified, it is assumed that the first value
  13437. specifies the @option{filename}.
  13438. For example, to render the file @file{sub.srt} on top of the input
  13439. video, use the command:
  13440. @example
  13441. subtitles=sub.srt
  13442. @end example
  13443. which is equivalent to:
  13444. @example
  13445. subtitles=filename=sub.srt
  13446. @end example
  13447. To render the default subtitles stream from file @file{video.mkv}, use:
  13448. @example
  13449. subtitles=video.mkv
  13450. @end example
  13451. To render the second subtitles stream from that file, use:
  13452. @example
  13453. subtitles=video.mkv:si=1
  13454. @end example
  13455. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13456. @code{DejaVu Serif}, use:
  13457. @example
  13458. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13459. @end example
  13460. @section super2xsai
  13461. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13462. Interpolate) pixel art scaling algorithm.
  13463. Useful for enlarging pixel art images without reducing sharpness.
  13464. @section swaprect
  13465. Swap two rectangular objects in video.
  13466. This filter accepts the following options:
  13467. @table @option
  13468. @item w
  13469. Set object width.
  13470. @item h
  13471. Set object height.
  13472. @item x1
  13473. Set 1st rect x coordinate.
  13474. @item y1
  13475. Set 1st rect y coordinate.
  13476. @item x2
  13477. Set 2nd rect x coordinate.
  13478. @item y2
  13479. Set 2nd rect y coordinate.
  13480. All expressions are evaluated once for each frame.
  13481. @end table
  13482. The all options are expressions containing the following constants:
  13483. @table @option
  13484. @item w
  13485. @item h
  13486. The input width and height.
  13487. @item a
  13488. same as @var{w} / @var{h}
  13489. @item sar
  13490. input sample aspect ratio
  13491. @item dar
  13492. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13493. @item n
  13494. The number of the input frame, starting from 0.
  13495. @item t
  13496. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13497. @item pos
  13498. the position in the file of the input frame, NAN if unknown
  13499. @end table
  13500. @section swapuv
  13501. Swap U & V plane.
  13502. @section telecine
  13503. Apply telecine process to the video.
  13504. This filter accepts the following options:
  13505. @table @option
  13506. @item first_field
  13507. @table @samp
  13508. @item top, t
  13509. top field first
  13510. @item bottom, b
  13511. bottom field first
  13512. The default value is @code{top}.
  13513. @end table
  13514. @item pattern
  13515. A string of numbers representing the pulldown pattern you wish to apply.
  13516. The default value is @code{23}.
  13517. @end table
  13518. @example
  13519. Some typical patterns:
  13520. NTSC output (30i):
  13521. 27.5p: 32222
  13522. 24p: 23 (classic)
  13523. 24p: 2332 (preferred)
  13524. 20p: 33
  13525. 18p: 334
  13526. 16p: 3444
  13527. PAL output (25i):
  13528. 27.5p: 12222
  13529. 24p: 222222222223 ("Euro pulldown")
  13530. 16.67p: 33
  13531. 16p: 33333334
  13532. @end example
  13533. @section thistogram
  13534. Compute and draw a color distribution histogram for the input video across time.
  13535. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13536. at certain time, this filter shows also past histograms of number of frames defined
  13537. by @code{width} option.
  13538. The computed histogram is a representation of the color component
  13539. distribution in an image.
  13540. The filter accepts the following options:
  13541. @table @option
  13542. @item width, w
  13543. Set width of single color component output. Default value is @code{0}.
  13544. Value of @code{0} means width will be picked from input video.
  13545. This also set number of passed histograms to keep.
  13546. Allowed range is [0, 8192].
  13547. @item display_mode, d
  13548. Set display mode.
  13549. It accepts the following values:
  13550. @table @samp
  13551. @item stack
  13552. Per color component graphs are placed below each other.
  13553. @item parade
  13554. Per color component graphs are placed side by side.
  13555. @item overlay
  13556. Presents information identical to that in the @code{parade}, except
  13557. that the graphs representing color components are superimposed directly
  13558. over one another.
  13559. @end table
  13560. Default is @code{stack}.
  13561. @item levels_mode, m
  13562. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  13563. Default is @code{linear}.
  13564. @item components, c
  13565. Set what color components to display.
  13566. Default is @code{7}.
  13567. @item bgopacity, b
  13568. Set background opacity. Default is @code{0.9}.
  13569. @item envelope, e
  13570. Show envelope. Default is disabled.
  13571. @item ecolor, ec
  13572. Set envelope color. Default is @code{gold}.
  13573. @end table
  13574. @section threshold
  13575. Apply threshold effect to video stream.
  13576. This filter needs four video streams to perform thresholding.
  13577. First stream is stream we are filtering.
  13578. Second stream is holding threshold values, third stream is holding min values,
  13579. and last, fourth stream is holding max values.
  13580. The filter accepts the following option:
  13581. @table @option
  13582. @item planes
  13583. Set which planes will be processed, unprocessed planes will be copied.
  13584. By default value 0xf, all planes will be processed.
  13585. @end table
  13586. For example if first stream pixel's component value is less then threshold value
  13587. of pixel component from 2nd threshold stream, third stream value will picked,
  13588. otherwise fourth stream pixel component value will be picked.
  13589. Using color source filter one can perform various types of thresholding:
  13590. @subsection Examples
  13591. @itemize
  13592. @item
  13593. Binary threshold, using gray color as threshold:
  13594. @example
  13595. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13596. @end example
  13597. @item
  13598. Inverted binary threshold, using gray color as threshold:
  13599. @example
  13600. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13601. @end example
  13602. @item
  13603. Truncate binary threshold, using gray color as threshold:
  13604. @example
  13605. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13606. @end example
  13607. @item
  13608. Threshold to zero, using gray color as threshold:
  13609. @example
  13610. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13611. @end example
  13612. @item
  13613. Inverted threshold to zero, using gray color as threshold:
  13614. @example
  13615. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13616. @end example
  13617. @end itemize
  13618. @section thumbnail
  13619. Select the most representative frame in a given sequence of consecutive frames.
  13620. The filter accepts the following options:
  13621. @table @option
  13622. @item n
  13623. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13624. will pick one of them, and then handle the next batch of @var{n} frames until
  13625. the end. Default is @code{100}.
  13626. @end table
  13627. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13628. value will result in a higher memory usage, so a high value is not recommended.
  13629. @subsection Examples
  13630. @itemize
  13631. @item
  13632. Extract one picture each 50 frames:
  13633. @example
  13634. thumbnail=50
  13635. @end example
  13636. @item
  13637. Complete example of a thumbnail creation with @command{ffmpeg}:
  13638. @example
  13639. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13640. @end example
  13641. @end itemize
  13642. @section tile
  13643. Tile several successive frames together.
  13644. The filter accepts the following options:
  13645. @table @option
  13646. @item layout
  13647. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13648. this option, check the
  13649. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13650. @item nb_frames
  13651. Set the maximum number of frames to render in the given area. It must be less
  13652. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13653. the area will be used.
  13654. @item margin
  13655. Set the outer border margin in pixels.
  13656. @item padding
  13657. Set the inner border thickness (i.e. the number of pixels between frames). For
  13658. more advanced padding options (such as having different values for the edges),
  13659. refer to the pad video filter.
  13660. @item color
  13661. Specify the color of the unused area. For the syntax of this option, check the
  13662. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13663. The default value of @var{color} is "black".
  13664. @item overlap
  13665. Set the number of frames to overlap when tiling several successive frames together.
  13666. The value must be between @code{0} and @var{nb_frames - 1}.
  13667. @item init_padding
  13668. Set the number of frames to initially be empty before displaying first output frame.
  13669. This controls how soon will one get first output frame.
  13670. The value must be between @code{0} and @var{nb_frames - 1}.
  13671. @end table
  13672. @subsection Examples
  13673. @itemize
  13674. @item
  13675. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13676. @example
  13677. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13678. @end example
  13679. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13680. duplicating each output frame to accommodate the originally detected frame
  13681. rate.
  13682. @item
  13683. Display @code{5} pictures in an area of @code{3x2} frames,
  13684. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13685. mixed flat and named options:
  13686. @example
  13687. tile=3x2:nb_frames=5:padding=7:margin=2
  13688. @end example
  13689. @end itemize
  13690. @section tinterlace
  13691. Perform various types of temporal field interlacing.
  13692. Frames are counted starting from 1, so the first input frame is
  13693. considered odd.
  13694. The filter accepts the following options:
  13695. @table @option
  13696. @item mode
  13697. Specify the mode of the interlacing. This option can also be specified
  13698. as a value alone. See below for a list of values for this option.
  13699. Available values are:
  13700. @table @samp
  13701. @item merge, 0
  13702. Move odd frames into the upper field, even into the lower field,
  13703. generating a double height frame at half frame rate.
  13704. @example
  13705. ------> time
  13706. Input:
  13707. Frame 1 Frame 2 Frame 3 Frame 4
  13708. 11111 22222 33333 44444
  13709. 11111 22222 33333 44444
  13710. 11111 22222 33333 44444
  13711. 11111 22222 33333 44444
  13712. Output:
  13713. 11111 33333
  13714. 22222 44444
  13715. 11111 33333
  13716. 22222 44444
  13717. 11111 33333
  13718. 22222 44444
  13719. 11111 33333
  13720. 22222 44444
  13721. @end example
  13722. @item drop_even, 1
  13723. Only output odd frames, even frames are dropped, generating a frame with
  13724. unchanged height at half frame rate.
  13725. @example
  13726. ------> time
  13727. Input:
  13728. Frame 1 Frame 2 Frame 3 Frame 4
  13729. 11111 22222 33333 44444
  13730. 11111 22222 33333 44444
  13731. 11111 22222 33333 44444
  13732. 11111 22222 33333 44444
  13733. Output:
  13734. 11111 33333
  13735. 11111 33333
  13736. 11111 33333
  13737. 11111 33333
  13738. @end example
  13739. @item drop_odd, 2
  13740. Only output even frames, odd frames are dropped, generating a frame with
  13741. unchanged height at half frame rate.
  13742. @example
  13743. ------> time
  13744. Input:
  13745. Frame 1 Frame 2 Frame 3 Frame 4
  13746. 11111 22222 33333 44444
  13747. 11111 22222 33333 44444
  13748. 11111 22222 33333 44444
  13749. 11111 22222 33333 44444
  13750. Output:
  13751. 22222 44444
  13752. 22222 44444
  13753. 22222 44444
  13754. 22222 44444
  13755. @end example
  13756. @item pad, 3
  13757. Expand each frame to full height, but pad alternate lines with black,
  13758. generating a frame with double height at the same input frame rate.
  13759. @example
  13760. ------> time
  13761. Input:
  13762. Frame 1 Frame 2 Frame 3 Frame 4
  13763. 11111 22222 33333 44444
  13764. 11111 22222 33333 44444
  13765. 11111 22222 33333 44444
  13766. 11111 22222 33333 44444
  13767. Output:
  13768. 11111 ..... 33333 .....
  13769. ..... 22222 ..... 44444
  13770. 11111 ..... 33333 .....
  13771. ..... 22222 ..... 44444
  13772. 11111 ..... 33333 .....
  13773. ..... 22222 ..... 44444
  13774. 11111 ..... 33333 .....
  13775. ..... 22222 ..... 44444
  13776. @end example
  13777. @item interleave_top, 4
  13778. Interleave the upper field from odd frames with the lower field from
  13779. even frames, generating a frame with unchanged height at half frame rate.
  13780. @example
  13781. ------> time
  13782. Input:
  13783. Frame 1 Frame 2 Frame 3 Frame 4
  13784. 11111<- 22222 33333<- 44444
  13785. 11111 22222<- 33333 44444<-
  13786. 11111<- 22222 33333<- 44444
  13787. 11111 22222<- 33333 44444<-
  13788. Output:
  13789. 11111 33333
  13790. 22222 44444
  13791. 11111 33333
  13792. 22222 44444
  13793. @end example
  13794. @item interleave_bottom, 5
  13795. Interleave the lower field from odd frames with the upper field from
  13796. even frames, generating a frame with unchanged height at half frame rate.
  13797. @example
  13798. ------> time
  13799. Input:
  13800. Frame 1 Frame 2 Frame 3 Frame 4
  13801. 11111 22222<- 33333 44444<-
  13802. 11111<- 22222 33333<- 44444
  13803. 11111 22222<- 33333 44444<-
  13804. 11111<- 22222 33333<- 44444
  13805. Output:
  13806. 22222 44444
  13807. 11111 33333
  13808. 22222 44444
  13809. 11111 33333
  13810. @end example
  13811. @item interlacex2, 6
  13812. Double frame rate with unchanged height. Frames are inserted each
  13813. containing the second temporal field from the previous input frame and
  13814. the first temporal field from the next input frame. This mode relies on
  13815. the top_field_first flag. Useful for interlaced video displays with no
  13816. field synchronisation.
  13817. @example
  13818. ------> time
  13819. Input:
  13820. Frame 1 Frame 2 Frame 3 Frame 4
  13821. 11111 22222 33333 44444
  13822. 11111 22222 33333 44444
  13823. 11111 22222 33333 44444
  13824. 11111 22222 33333 44444
  13825. Output:
  13826. 11111 22222 22222 33333 33333 44444 44444
  13827. 11111 11111 22222 22222 33333 33333 44444
  13828. 11111 22222 22222 33333 33333 44444 44444
  13829. 11111 11111 22222 22222 33333 33333 44444
  13830. @end example
  13831. @item mergex2, 7
  13832. Move odd frames into the upper field, even into the lower field,
  13833. generating a double height frame at same frame rate.
  13834. @example
  13835. ------> time
  13836. Input:
  13837. Frame 1 Frame 2 Frame 3 Frame 4
  13838. 11111 22222 33333 44444
  13839. 11111 22222 33333 44444
  13840. 11111 22222 33333 44444
  13841. 11111 22222 33333 44444
  13842. Output:
  13843. 11111 33333 33333 55555
  13844. 22222 22222 44444 44444
  13845. 11111 33333 33333 55555
  13846. 22222 22222 44444 44444
  13847. 11111 33333 33333 55555
  13848. 22222 22222 44444 44444
  13849. 11111 33333 33333 55555
  13850. 22222 22222 44444 44444
  13851. @end example
  13852. @end table
  13853. Numeric values are deprecated but are accepted for backward
  13854. compatibility reasons.
  13855. Default mode is @code{merge}.
  13856. @item flags
  13857. Specify flags influencing the filter process.
  13858. Available value for @var{flags} is:
  13859. @table @option
  13860. @item low_pass_filter, vlpf
  13861. Enable linear vertical low-pass filtering in the filter.
  13862. Vertical low-pass filtering is required when creating an interlaced
  13863. destination from a progressive source which contains high-frequency
  13864. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13865. patterning.
  13866. @item complex_filter, cvlpf
  13867. Enable complex vertical low-pass filtering.
  13868. This will slightly less reduce interlace 'twitter' and Moire
  13869. patterning but better retain detail and subjective sharpness impression.
  13870. @item bypass_il
  13871. Bypass already interlaced frames, only adjust the frame rate.
  13872. @end table
  13873. Vertical low-pass filtering and bypassing already interlaced frames can only be
  13874. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  13875. @end table
  13876. @section tmix
  13877. Mix successive video frames.
  13878. A description of the accepted options follows.
  13879. @table @option
  13880. @item frames
  13881. The number of successive frames to mix. If unspecified, it defaults to 3.
  13882. @item weights
  13883. Specify weight of each input video frame.
  13884. Each weight is separated by space. If number of weights is smaller than
  13885. number of @var{frames} last specified weight will be used for all remaining
  13886. unset weights.
  13887. @item scale
  13888. Specify scale, if it is set it will be multiplied with sum
  13889. of each weight multiplied with pixel values to give final destination
  13890. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13891. @end table
  13892. @subsection Examples
  13893. @itemize
  13894. @item
  13895. Average 7 successive frames:
  13896. @example
  13897. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13898. @end example
  13899. @item
  13900. Apply simple temporal convolution:
  13901. @example
  13902. tmix=frames=3:weights="-1 3 -1"
  13903. @end example
  13904. @item
  13905. Similar as above but only showing temporal differences:
  13906. @example
  13907. tmix=frames=3:weights="-1 2 -1":scale=1
  13908. @end example
  13909. @end itemize
  13910. @anchor{tonemap}
  13911. @section tonemap
  13912. Tone map colors from different dynamic ranges.
  13913. This filter expects data in single precision floating point, as it needs to
  13914. operate on (and can output) out-of-range values. Another filter, such as
  13915. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13916. The tonemapping algorithms implemented only work on linear light, so input
  13917. data should be linearized beforehand (and possibly correctly tagged).
  13918. @example
  13919. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13920. @end example
  13921. @subsection Options
  13922. The filter accepts the following options.
  13923. @table @option
  13924. @item tonemap
  13925. Set the tone map algorithm to use.
  13926. Possible values are:
  13927. @table @var
  13928. @item none
  13929. Do not apply any tone map, only desaturate overbright pixels.
  13930. @item clip
  13931. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13932. in-range values, while distorting out-of-range values.
  13933. @item linear
  13934. Stretch the entire reference gamut to a linear multiple of the display.
  13935. @item gamma
  13936. Fit a logarithmic transfer between the tone curves.
  13937. @item reinhard
  13938. Preserve overall image brightness with a simple curve, using nonlinear
  13939. contrast, which results in flattening details and degrading color accuracy.
  13940. @item hable
  13941. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13942. of slightly darkening everything. Use it when detail preservation is more
  13943. important than color and brightness accuracy.
  13944. @item mobius
  13945. Smoothly map out-of-range values, while retaining contrast and colors for
  13946. in-range material as much as possible. Use it when color accuracy is more
  13947. important than detail preservation.
  13948. @end table
  13949. Default is none.
  13950. @item param
  13951. Tune the tone mapping algorithm.
  13952. This affects the following algorithms:
  13953. @table @var
  13954. @item none
  13955. Ignored.
  13956. @item linear
  13957. Specifies the scale factor to use while stretching.
  13958. Default to 1.0.
  13959. @item gamma
  13960. Specifies the exponent of the function.
  13961. Default to 1.8.
  13962. @item clip
  13963. Specify an extra linear coefficient to multiply into the signal before clipping.
  13964. Default to 1.0.
  13965. @item reinhard
  13966. Specify the local contrast coefficient at the display peak.
  13967. Default to 0.5, which means that in-gamut values will be about half as bright
  13968. as when clipping.
  13969. @item hable
  13970. Ignored.
  13971. @item mobius
  13972. Specify the transition point from linear to mobius transform. Every value
  13973. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13974. more accurate the result will be, at the cost of losing bright details.
  13975. Default to 0.3, which due to the steep initial slope still preserves in-range
  13976. colors fairly accurately.
  13977. @end table
  13978. @item desat
  13979. Apply desaturation for highlights that exceed this level of brightness. The
  13980. higher the parameter, the more color information will be preserved. This
  13981. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13982. (smoothly) turning into white instead. This makes images feel more natural,
  13983. at the cost of reducing information about out-of-range colors.
  13984. The default of 2.0 is somewhat conservative and will mostly just apply to
  13985. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13986. This option works only if the input frame has a supported color tag.
  13987. @item peak
  13988. Override signal/nominal/reference peak with this value. Useful when the
  13989. embedded peak information in display metadata is not reliable or when tone
  13990. mapping from a lower range to a higher range.
  13991. @end table
  13992. @section tpad
  13993. Temporarily pad video frames.
  13994. The filter accepts the following options:
  13995. @table @option
  13996. @item start
  13997. Specify number of delay frames before input video stream.
  13998. @item stop
  13999. Specify number of padding frames after input video stream.
  14000. Set to -1 to pad indefinitely.
  14001. @item start_mode
  14002. Set kind of frames added to beginning of stream.
  14003. Can be either @var{add} or @var{clone}.
  14004. With @var{add} frames of solid-color are added.
  14005. With @var{clone} frames are clones of first frame.
  14006. @item stop_mode
  14007. Set kind of frames added to end of stream.
  14008. Can be either @var{add} or @var{clone}.
  14009. With @var{add} frames of solid-color are added.
  14010. With @var{clone} frames are clones of last frame.
  14011. @item start_duration, stop_duration
  14012. Specify the duration of the start/stop delay. See
  14013. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14014. for the accepted syntax.
  14015. These options override @var{start} and @var{stop}.
  14016. @item color
  14017. Specify the color of the padded area. For the syntax of this option,
  14018. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14019. manual,ffmpeg-utils}.
  14020. The default value of @var{color} is "black".
  14021. @end table
  14022. @anchor{transpose}
  14023. @section transpose
  14024. Transpose rows with columns in the input video and optionally flip it.
  14025. It accepts the following parameters:
  14026. @table @option
  14027. @item dir
  14028. Specify the transposition direction.
  14029. Can assume the following values:
  14030. @table @samp
  14031. @item 0, 4, cclock_flip
  14032. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14033. @example
  14034. L.R L.l
  14035. . . -> . .
  14036. l.r R.r
  14037. @end example
  14038. @item 1, 5, clock
  14039. Rotate by 90 degrees clockwise, that is:
  14040. @example
  14041. L.R l.L
  14042. . . -> . .
  14043. l.r r.R
  14044. @end example
  14045. @item 2, 6, cclock
  14046. Rotate by 90 degrees counterclockwise, that is:
  14047. @example
  14048. L.R R.r
  14049. . . -> . .
  14050. l.r L.l
  14051. @end example
  14052. @item 3, 7, clock_flip
  14053. Rotate by 90 degrees clockwise and vertically flip, that is:
  14054. @example
  14055. L.R r.R
  14056. . . -> . .
  14057. l.r l.L
  14058. @end example
  14059. @end table
  14060. For values between 4-7, the transposition is only done if the input
  14061. video geometry is portrait and not landscape. These values are
  14062. deprecated, the @code{passthrough} option should be used instead.
  14063. Numerical values are deprecated, and should be dropped in favor of
  14064. symbolic constants.
  14065. @item passthrough
  14066. Do not apply the transposition if the input geometry matches the one
  14067. specified by the specified value. It accepts the following values:
  14068. @table @samp
  14069. @item none
  14070. Always apply transposition.
  14071. @item portrait
  14072. Preserve portrait geometry (when @var{height} >= @var{width}).
  14073. @item landscape
  14074. Preserve landscape geometry (when @var{width} >= @var{height}).
  14075. @end table
  14076. Default value is @code{none}.
  14077. @end table
  14078. For example to rotate by 90 degrees clockwise and preserve portrait
  14079. layout:
  14080. @example
  14081. transpose=dir=1:passthrough=portrait
  14082. @end example
  14083. The command above can also be specified as:
  14084. @example
  14085. transpose=1:portrait
  14086. @end example
  14087. @section transpose_npp
  14088. Transpose rows with columns in the input video and optionally flip it.
  14089. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14090. It accepts the following parameters:
  14091. @table @option
  14092. @item dir
  14093. Specify the transposition direction.
  14094. Can assume the following values:
  14095. @table @samp
  14096. @item cclock_flip
  14097. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14098. @item clock
  14099. Rotate by 90 degrees clockwise.
  14100. @item cclock
  14101. Rotate by 90 degrees counterclockwise.
  14102. @item clock_flip
  14103. Rotate by 90 degrees clockwise and vertically flip.
  14104. @end table
  14105. @item passthrough
  14106. Do not apply the transposition if the input geometry matches the one
  14107. specified by the specified value. It accepts the following values:
  14108. @table @samp
  14109. @item none
  14110. Always apply transposition. (default)
  14111. @item portrait
  14112. Preserve portrait geometry (when @var{height} >= @var{width}).
  14113. @item landscape
  14114. Preserve landscape geometry (when @var{width} >= @var{height}).
  14115. @end table
  14116. @end table
  14117. @section trim
  14118. Trim the input so that the output contains one continuous subpart of the input.
  14119. It accepts the following parameters:
  14120. @table @option
  14121. @item start
  14122. Specify the time of the start of the kept section, i.e. the frame with the
  14123. timestamp @var{start} will be the first frame in the output.
  14124. @item end
  14125. Specify the time of the first frame that will be dropped, i.e. the frame
  14126. immediately preceding the one with the timestamp @var{end} will be the last
  14127. frame in the output.
  14128. @item start_pts
  14129. This is the same as @var{start}, except this option sets the start timestamp
  14130. in timebase units instead of seconds.
  14131. @item end_pts
  14132. This is the same as @var{end}, except this option sets the end timestamp
  14133. in timebase units instead of seconds.
  14134. @item duration
  14135. The maximum duration of the output in seconds.
  14136. @item start_frame
  14137. The number of the first frame that should be passed to the output.
  14138. @item end_frame
  14139. The number of the first frame that should be dropped.
  14140. @end table
  14141. @option{start}, @option{end}, and @option{duration} are expressed as time
  14142. duration specifications; see
  14143. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14144. for the accepted syntax.
  14145. Note that the first two sets of the start/end options and the @option{duration}
  14146. option look at the frame timestamp, while the _frame variants simply count the
  14147. frames that pass through the filter. Also note that this filter does not modify
  14148. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14149. setpts filter after the trim filter.
  14150. If multiple start or end options are set, this filter tries to be greedy and
  14151. keep all the frames that match at least one of the specified constraints. To keep
  14152. only the part that matches all the constraints at once, chain multiple trim
  14153. filters.
  14154. The defaults are such that all the input is kept. So it is possible to set e.g.
  14155. just the end values to keep everything before the specified time.
  14156. Examples:
  14157. @itemize
  14158. @item
  14159. Drop everything except the second minute of input:
  14160. @example
  14161. ffmpeg -i INPUT -vf trim=60:120
  14162. @end example
  14163. @item
  14164. Keep only the first second:
  14165. @example
  14166. ffmpeg -i INPUT -vf trim=duration=1
  14167. @end example
  14168. @end itemize
  14169. @section unpremultiply
  14170. Apply alpha unpremultiply effect to input video stream using first plane
  14171. of second stream as alpha.
  14172. Both streams must have same dimensions and same pixel format.
  14173. The filter accepts the following option:
  14174. @table @option
  14175. @item planes
  14176. Set which planes will be processed, unprocessed planes will be copied.
  14177. By default value 0xf, all planes will be processed.
  14178. If the format has 1 or 2 components, then luma is bit 0.
  14179. If the format has 3 or 4 components:
  14180. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14181. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14182. If present, the alpha channel is always the last bit.
  14183. @item inplace
  14184. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14185. @end table
  14186. @anchor{unsharp}
  14187. @section unsharp
  14188. Sharpen or blur the input video.
  14189. It accepts the following parameters:
  14190. @table @option
  14191. @item luma_msize_x, lx
  14192. Set the luma matrix horizontal size. It must be an odd integer between
  14193. 3 and 23. The default value is 5.
  14194. @item luma_msize_y, ly
  14195. Set the luma matrix vertical size. It must be an odd integer between 3
  14196. and 23. The default value is 5.
  14197. @item luma_amount, la
  14198. Set the luma effect strength. It must be a floating point number, reasonable
  14199. values lay between -1.5 and 1.5.
  14200. Negative values will blur the input video, while positive values will
  14201. sharpen it, a value of zero will disable the effect.
  14202. Default value is 1.0.
  14203. @item chroma_msize_x, cx
  14204. Set the chroma matrix horizontal size. It must be an odd integer
  14205. between 3 and 23. The default value is 5.
  14206. @item chroma_msize_y, cy
  14207. Set the chroma matrix vertical size. It must be an odd integer
  14208. between 3 and 23. The default value is 5.
  14209. @item chroma_amount, ca
  14210. Set the chroma effect strength. It must be a floating point number, reasonable
  14211. values lay between -1.5 and 1.5.
  14212. Negative values will blur the input video, while positive values will
  14213. sharpen it, a value of zero will disable the effect.
  14214. Default value is 0.0.
  14215. @end table
  14216. All parameters are optional and default to the equivalent of the
  14217. string '5:5:1.0:5:5:0.0'.
  14218. @subsection Examples
  14219. @itemize
  14220. @item
  14221. Apply strong luma sharpen effect:
  14222. @example
  14223. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14224. @end example
  14225. @item
  14226. Apply a strong blur of both luma and chroma parameters:
  14227. @example
  14228. unsharp=7:7:-2:7:7:-2
  14229. @end example
  14230. @end itemize
  14231. @section uspp
  14232. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14233. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14234. shifts and average the results.
  14235. The way this differs from the behavior of spp is that uspp actually encodes &
  14236. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14237. DCT similar to MJPEG.
  14238. The filter accepts the following options:
  14239. @table @option
  14240. @item quality
  14241. Set quality. This option defines the number of levels for averaging. It accepts
  14242. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14243. effect. A value of @code{8} means the higher quality. For each increment of
  14244. that value the speed drops by a factor of approximately 2. Default value is
  14245. @code{3}.
  14246. @item qp
  14247. Force a constant quantization parameter. If not set, the filter will use the QP
  14248. from the video stream (if available).
  14249. @end table
  14250. @section v360
  14251. Convert 360 videos between various formats.
  14252. The filter accepts the following options:
  14253. @table @option
  14254. @item input
  14255. @item output
  14256. Set format of the input/output video.
  14257. Available formats:
  14258. @table @samp
  14259. @item e
  14260. @item equirect
  14261. Equirectangular projection.
  14262. @item c3x2
  14263. @item c6x1
  14264. @item c1x6
  14265. Cubemap with 3x2/6x1/1x6 layout.
  14266. Format specific options:
  14267. @table @option
  14268. @item in_pad
  14269. @item out_pad
  14270. Set padding proportion for the input/output cubemap. Values in decimals.
  14271. Example values:
  14272. @table @samp
  14273. @item 0
  14274. No padding.
  14275. @item 0.01
  14276. 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)
  14277. @end table
  14278. Default value is @b{@samp{0}}.
  14279. @item fin_pad
  14280. @item fout_pad
  14281. Set fixed padding for the input/output cubemap. Values in pixels.
  14282. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14283. @item in_forder
  14284. @item out_forder
  14285. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14286. Designation of directions:
  14287. @table @samp
  14288. @item r
  14289. right
  14290. @item l
  14291. left
  14292. @item u
  14293. up
  14294. @item d
  14295. down
  14296. @item f
  14297. forward
  14298. @item b
  14299. back
  14300. @end table
  14301. Default value is @b{@samp{rludfb}}.
  14302. @item in_frot
  14303. @item out_frot
  14304. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14305. Designation of angles:
  14306. @table @samp
  14307. @item 0
  14308. 0 degrees clockwise
  14309. @item 1
  14310. 90 degrees clockwise
  14311. @item 2
  14312. 180 degrees clockwise
  14313. @item 3
  14314. 270 degrees clockwise
  14315. @end table
  14316. Default value is @b{@samp{000000}}.
  14317. @end table
  14318. @item eac
  14319. Equi-Angular Cubemap.
  14320. @item flat
  14321. @item gnomonic
  14322. @item rectilinear
  14323. Regular video. @i{(output only)}
  14324. Format specific options:
  14325. @table @option
  14326. @item h_fov
  14327. @item v_fov
  14328. @item d_fov
  14329. Set horizontal/vertical/diagonal field of view. Values in degrees.
  14330. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14331. @end table
  14332. @item dfisheye
  14333. Dual fisheye.
  14334. Format specific options:
  14335. @table @option
  14336. @item in_pad
  14337. @item out_pad
  14338. Set padding proportion. Values in decimals.
  14339. Example values:
  14340. @table @samp
  14341. @item 0
  14342. No padding.
  14343. @item 0.01
  14344. 1% padding.
  14345. @end table
  14346. Default value is @b{@samp{0}}.
  14347. @end table
  14348. @item barrel
  14349. @item fb
  14350. Facebook's 360 format.
  14351. @item sg
  14352. Stereographic format.
  14353. Format specific options:
  14354. @table @option
  14355. @item h_fov
  14356. @item v_fov
  14357. @item d_fov
  14358. Set horizontal/vertical/diagonal field of view. Values in degrees.
  14359. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14360. @end table
  14361. @item mercator
  14362. Mercator format.
  14363. @item ball
  14364. Ball format, gives significant distortion toward the back.
  14365. @item hammer
  14366. Hammer-Aitoff map projection format.
  14367. @item sinusoidal
  14368. Sinusoidal map projection format.
  14369. @end table
  14370. @item interp
  14371. Set interpolation method.@*
  14372. @i{Note: more complex interpolation methods require much more memory to run.}
  14373. Available methods:
  14374. @table @samp
  14375. @item near
  14376. @item nearest
  14377. Nearest neighbour.
  14378. @item line
  14379. @item linear
  14380. Bilinear interpolation.
  14381. @item cube
  14382. @item cubic
  14383. Bicubic interpolation.
  14384. @item lanc
  14385. @item lanczos
  14386. Lanczos interpolation.
  14387. @end table
  14388. Default value is @b{@samp{line}}.
  14389. @item w
  14390. @item h
  14391. Set the output video resolution.
  14392. Default resolution depends on formats.
  14393. @item in_stereo
  14394. @item out_stereo
  14395. Set the input/output stereo format.
  14396. @table @samp
  14397. @item 2d
  14398. 2D mono
  14399. @item sbs
  14400. Side by side
  14401. @item tb
  14402. Top bottom
  14403. @end table
  14404. Default value is @b{@samp{2d}} for input and output format.
  14405. @item yaw
  14406. @item pitch
  14407. @item roll
  14408. Set rotation for the output video. Values in degrees.
  14409. @item rorder
  14410. Set rotation order for the output video. Choose one item for each position.
  14411. @table @samp
  14412. @item y, Y
  14413. yaw
  14414. @item p, P
  14415. pitch
  14416. @item r, R
  14417. roll
  14418. @end table
  14419. Default value is @b{@samp{ypr}}.
  14420. @item h_flip
  14421. @item v_flip
  14422. @item d_flip
  14423. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14424. @item ih_flip
  14425. @item iv_flip
  14426. Set if input video is flipped horizontally/vertically. Boolean values.
  14427. @item in_trans
  14428. Set if input video is transposed. Boolean value, by default disabled.
  14429. @item out_trans
  14430. Set if output video needs to be transposed. Boolean value, by default disabled.
  14431. @end table
  14432. @subsection Examples
  14433. @itemize
  14434. @item
  14435. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14436. @example
  14437. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14438. @end example
  14439. @item
  14440. Extract back view of Equi-Angular Cubemap:
  14441. @example
  14442. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14443. @end example
  14444. @item
  14445. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14446. @example
  14447. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14448. @end example
  14449. @end itemize
  14450. @section vaguedenoiser
  14451. Apply a wavelet based denoiser.
  14452. It transforms each frame from the video input into the wavelet domain,
  14453. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14454. the obtained coefficients. It does an inverse wavelet transform after.
  14455. Due to wavelet properties, it should give a nice smoothed result, and
  14456. reduced noise, without blurring picture features.
  14457. This filter accepts the following options:
  14458. @table @option
  14459. @item threshold
  14460. The filtering strength. The higher, the more filtered the video will be.
  14461. Hard thresholding can use a higher threshold than soft thresholding
  14462. before the video looks overfiltered. Default value is 2.
  14463. @item method
  14464. The filtering method the filter will use.
  14465. It accepts the following values:
  14466. @table @samp
  14467. @item hard
  14468. All values under the threshold will be zeroed.
  14469. @item soft
  14470. All values under the threshold will be zeroed. All values above will be
  14471. reduced by the threshold.
  14472. @item garrote
  14473. Scales or nullifies coefficients - intermediary between (more) soft and
  14474. (less) hard thresholding.
  14475. @end table
  14476. Default is garrote.
  14477. @item nsteps
  14478. Number of times, the wavelet will decompose the picture. Picture can't
  14479. be decomposed beyond a particular point (typically, 8 for a 640x480
  14480. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14481. @item percent
  14482. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14483. @item planes
  14484. A list of the planes to process. By default all planes are processed.
  14485. @end table
  14486. @section vectorscope
  14487. Display 2 color component values in the two dimensional graph (which is called
  14488. a vectorscope).
  14489. This filter accepts the following options:
  14490. @table @option
  14491. @item mode, m
  14492. Set vectorscope mode.
  14493. It accepts the following values:
  14494. @table @samp
  14495. @item gray
  14496. @item tint
  14497. Gray values are displayed on graph, higher brightness means more pixels have
  14498. same component color value on location in graph. This is the default mode.
  14499. @item color
  14500. Gray values are displayed on graph. Surrounding pixels values which are not
  14501. present in video frame are drawn in gradient of 2 color components which are
  14502. set by option @code{x} and @code{y}. The 3rd color component is static.
  14503. @item color2
  14504. Actual color components values present in video frame are displayed on graph.
  14505. @item color3
  14506. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14507. on graph increases value of another color component, which is luminance by
  14508. default values of @code{x} and @code{y}.
  14509. @item color4
  14510. Actual colors present in video frame are displayed on graph. If two different
  14511. colors map to same position on graph then color with higher value of component
  14512. not present in graph is picked.
  14513. @item color5
  14514. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14515. component picked from radial gradient.
  14516. @end table
  14517. @item x
  14518. Set which color component will be represented on X-axis. Default is @code{1}.
  14519. @item y
  14520. Set which color component will be represented on Y-axis. Default is @code{2}.
  14521. @item intensity, i
  14522. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14523. of color component which represents frequency of (X, Y) location in graph.
  14524. @item envelope, e
  14525. @table @samp
  14526. @item none
  14527. No envelope, this is default.
  14528. @item instant
  14529. Instant envelope, even darkest single pixel will be clearly highlighted.
  14530. @item peak
  14531. Hold maximum and minimum values presented in graph over time. This way you
  14532. can still spot out of range values without constantly looking at vectorscope.
  14533. @item peak+instant
  14534. Peak and instant envelope combined together.
  14535. @end table
  14536. @item graticule, g
  14537. Set what kind of graticule to draw.
  14538. @table @samp
  14539. @item none
  14540. @item green
  14541. @item color
  14542. @item invert
  14543. @end table
  14544. @item opacity, o
  14545. Set graticule opacity.
  14546. @item flags, f
  14547. Set graticule flags.
  14548. @table @samp
  14549. @item white
  14550. Draw graticule for white point.
  14551. @item black
  14552. Draw graticule for black point.
  14553. @item name
  14554. Draw color points short names.
  14555. @end table
  14556. @item bgopacity, b
  14557. Set background opacity.
  14558. @item lthreshold, l
  14559. Set low threshold for color component not represented on X or Y axis.
  14560. Values lower than this value will be ignored. Default is 0.
  14561. Note this value is multiplied with actual max possible value one pixel component
  14562. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14563. is 0.1 * 255 = 25.
  14564. @item hthreshold, h
  14565. Set high threshold for color component not represented on X or Y axis.
  14566. Values higher than this value will be ignored. Default is 1.
  14567. Note this value is multiplied with actual max possible value one pixel component
  14568. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14569. is 0.9 * 255 = 230.
  14570. @item colorspace, c
  14571. Set what kind of colorspace to use when drawing graticule.
  14572. @table @samp
  14573. @item auto
  14574. @item 601
  14575. @item 709
  14576. @end table
  14577. Default is auto.
  14578. @item tint0, t0
  14579. @item tint1, t1
  14580. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  14581. This means no tint, and output will remain gray.
  14582. @end table
  14583. @anchor{vidstabdetect}
  14584. @section vidstabdetect
  14585. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14586. @ref{vidstabtransform} for pass 2.
  14587. This filter generates a file with relative translation and rotation
  14588. transform information about subsequent frames, which is then used by
  14589. the @ref{vidstabtransform} filter.
  14590. To enable compilation of this filter you need to configure FFmpeg with
  14591. @code{--enable-libvidstab}.
  14592. This filter accepts the following options:
  14593. @table @option
  14594. @item result
  14595. Set the path to the file used to write the transforms information.
  14596. Default value is @file{transforms.trf}.
  14597. @item shakiness
  14598. Set how shaky the video is and how quick the camera is. It accepts an
  14599. integer in the range 1-10, a value of 1 means little shakiness, a
  14600. value of 10 means strong shakiness. Default value is 5.
  14601. @item accuracy
  14602. Set the accuracy of the detection process. It must be a value in the
  14603. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14604. accuracy. Default value is 15.
  14605. @item stepsize
  14606. Set stepsize of the search process. The region around minimum is
  14607. scanned with 1 pixel resolution. Default value is 6.
  14608. @item mincontrast
  14609. Set minimum contrast. Below this value a local measurement field is
  14610. discarded. Must be a floating point value in the range 0-1. Default
  14611. value is 0.3.
  14612. @item tripod
  14613. Set reference frame number for tripod mode.
  14614. If enabled, the motion of the frames is compared to a reference frame
  14615. in the filtered stream, identified by the specified number. The idea
  14616. is to compensate all movements in a more-or-less static scene and keep
  14617. the camera view absolutely still.
  14618. If set to 0, it is disabled. The frames are counted starting from 1.
  14619. @item show
  14620. Show fields and transforms in the resulting frames. It accepts an
  14621. integer in the range 0-2. Default value is 0, which disables any
  14622. visualization.
  14623. @end table
  14624. @subsection Examples
  14625. @itemize
  14626. @item
  14627. Use default values:
  14628. @example
  14629. vidstabdetect
  14630. @end example
  14631. @item
  14632. Analyze strongly shaky movie and put the results in file
  14633. @file{mytransforms.trf}:
  14634. @example
  14635. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14636. @end example
  14637. @item
  14638. Visualize the result of internal transformations in the resulting
  14639. video:
  14640. @example
  14641. vidstabdetect=show=1
  14642. @end example
  14643. @item
  14644. Analyze a video with medium shakiness using @command{ffmpeg}:
  14645. @example
  14646. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14647. @end example
  14648. @end itemize
  14649. @anchor{vidstabtransform}
  14650. @section vidstabtransform
  14651. Video stabilization/deshaking: pass 2 of 2,
  14652. see @ref{vidstabdetect} for pass 1.
  14653. Read a file with transform information for each frame and
  14654. apply/compensate them. Together with the @ref{vidstabdetect}
  14655. filter this can be used to deshake videos. See also
  14656. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14657. the @ref{unsharp} filter, see below.
  14658. To enable compilation of this filter you need to configure FFmpeg with
  14659. @code{--enable-libvidstab}.
  14660. @subsection Options
  14661. @table @option
  14662. @item input
  14663. Set path to the file used to read the transforms. Default value is
  14664. @file{transforms.trf}.
  14665. @item smoothing
  14666. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14667. camera movements. Default value is 10.
  14668. For example a number of 10 means that 21 frames are used (10 in the
  14669. past and 10 in the future) to smoothen the motion in the video. A
  14670. larger value leads to a smoother video, but limits the acceleration of
  14671. the camera (pan/tilt movements). 0 is a special case where a static
  14672. camera is simulated.
  14673. @item optalgo
  14674. Set the camera path optimization algorithm.
  14675. Accepted values are:
  14676. @table @samp
  14677. @item gauss
  14678. gaussian kernel low-pass filter on camera motion (default)
  14679. @item avg
  14680. averaging on transformations
  14681. @end table
  14682. @item maxshift
  14683. Set maximal number of pixels to translate frames. Default value is -1,
  14684. meaning no limit.
  14685. @item maxangle
  14686. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14687. value is -1, meaning no limit.
  14688. @item crop
  14689. Specify how to deal with borders that may be visible due to movement
  14690. compensation.
  14691. Available values are:
  14692. @table @samp
  14693. @item keep
  14694. keep image information from previous frame (default)
  14695. @item black
  14696. fill the border black
  14697. @end table
  14698. @item invert
  14699. Invert transforms if set to 1. Default value is 0.
  14700. @item relative
  14701. Consider transforms as relative to previous frame if set to 1,
  14702. absolute if set to 0. Default value is 0.
  14703. @item zoom
  14704. Set percentage to zoom. A positive value will result in a zoom-in
  14705. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14706. zoom).
  14707. @item optzoom
  14708. Set optimal zooming to avoid borders.
  14709. Accepted values are:
  14710. @table @samp
  14711. @item 0
  14712. disabled
  14713. @item 1
  14714. optimal static zoom value is determined (only very strong movements
  14715. will lead to visible borders) (default)
  14716. @item 2
  14717. optimal adaptive zoom value is determined (no borders will be
  14718. visible), see @option{zoomspeed}
  14719. @end table
  14720. Note that the value given at zoom is added to the one calculated here.
  14721. @item zoomspeed
  14722. Set percent to zoom maximally each frame (enabled when
  14723. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14724. 0.25.
  14725. @item interpol
  14726. Specify type of interpolation.
  14727. Available values are:
  14728. @table @samp
  14729. @item no
  14730. no interpolation
  14731. @item linear
  14732. linear only horizontal
  14733. @item bilinear
  14734. linear in both directions (default)
  14735. @item bicubic
  14736. cubic in both directions (slow)
  14737. @end table
  14738. @item tripod
  14739. Enable virtual tripod mode if set to 1, which is equivalent to
  14740. @code{relative=0:smoothing=0}. Default value is 0.
  14741. Use also @code{tripod} option of @ref{vidstabdetect}.
  14742. @item debug
  14743. Increase log verbosity if set to 1. Also the detected global motions
  14744. are written to the temporary file @file{global_motions.trf}. Default
  14745. value is 0.
  14746. @end table
  14747. @subsection Examples
  14748. @itemize
  14749. @item
  14750. Use @command{ffmpeg} for a typical stabilization with default values:
  14751. @example
  14752. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14753. @end example
  14754. Note the use of the @ref{unsharp} filter which is always recommended.
  14755. @item
  14756. Zoom in a bit more and load transform data from a given file:
  14757. @example
  14758. vidstabtransform=zoom=5:input="mytransforms.trf"
  14759. @end example
  14760. @item
  14761. Smoothen the video even more:
  14762. @example
  14763. vidstabtransform=smoothing=30
  14764. @end example
  14765. @end itemize
  14766. @section vflip
  14767. Flip the input video vertically.
  14768. For example, to vertically flip a video with @command{ffmpeg}:
  14769. @example
  14770. ffmpeg -i in.avi -vf "vflip" out.avi
  14771. @end example
  14772. @section vfrdet
  14773. Detect variable frame rate video.
  14774. This filter tries to detect if the input is variable or constant frame rate.
  14775. At end it will output number of frames detected as having variable delta pts,
  14776. and ones with constant delta pts.
  14777. If there was frames with variable delta, than it will also show min, max and
  14778. average delta encountered.
  14779. @section vibrance
  14780. Boost or alter saturation.
  14781. The filter accepts the following options:
  14782. @table @option
  14783. @item intensity
  14784. Set strength of boost if positive value or strength of alter if negative value.
  14785. Default is 0. Allowed range is from -2 to 2.
  14786. @item rbal
  14787. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14788. @item gbal
  14789. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14790. @item bbal
  14791. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14792. @item rlum
  14793. Set the red luma coefficient.
  14794. @item glum
  14795. Set the green luma coefficient.
  14796. @item blum
  14797. Set the blue luma coefficient.
  14798. @item alternate
  14799. If @code{intensity} is negative and this is set to 1, colors will change,
  14800. otherwise colors will be less saturated, more towards gray.
  14801. @end table
  14802. @subsection Commands
  14803. This filter supports the all above options as @ref{commands}.
  14804. @anchor{vignette}
  14805. @section vignette
  14806. Make or reverse a natural vignetting effect.
  14807. The filter accepts the following options:
  14808. @table @option
  14809. @item angle, a
  14810. Set lens angle expression as a number of radians.
  14811. The value is clipped in the @code{[0,PI/2]} range.
  14812. Default value: @code{"PI/5"}
  14813. @item x0
  14814. @item y0
  14815. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14816. by default.
  14817. @item mode
  14818. Set forward/backward mode.
  14819. Available modes are:
  14820. @table @samp
  14821. @item forward
  14822. The larger the distance from the central point, the darker the image becomes.
  14823. @item backward
  14824. The larger the distance from the central point, the brighter the image becomes.
  14825. This can be used to reverse a vignette effect, though there is no automatic
  14826. detection to extract the lens @option{angle} and other settings (yet). It can
  14827. also be used to create a burning effect.
  14828. @end table
  14829. Default value is @samp{forward}.
  14830. @item eval
  14831. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14832. It accepts the following values:
  14833. @table @samp
  14834. @item init
  14835. Evaluate expressions only once during the filter initialization.
  14836. @item frame
  14837. Evaluate expressions for each incoming frame. This is way slower than the
  14838. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14839. allows advanced dynamic expressions.
  14840. @end table
  14841. Default value is @samp{init}.
  14842. @item dither
  14843. Set dithering to reduce the circular banding effects. Default is @code{1}
  14844. (enabled).
  14845. @item aspect
  14846. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14847. Setting this value to the SAR of the input will make a rectangular vignetting
  14848. following the dimensions of the video.
  14849. Default is @code{1/1}.
  14850. @end table
  14851. @subsection Expressions
  14852. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14853. following parameters.
  14854. @table @option
  14855. @item w
  14856. @item h
  14857. input width and height
  14858. @item n
  14859. the number of input frame, starting from 0
  14860. @item pts
  14861. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14862. @var{TB} units, NAN if undefined
  14863. @item r
  14864. frame rate of the input video, NAN if the input frame rate is unknown
  14865. @item t
  14866. the PTS (Presentation TimeStamp) of the filtered video frame,
  14867. expressed in seconds, NAN if undefined
  14868. @item tb
  14869. time base of the input video
  14870. @end table
  14871. @subsection Examples
  14872. @itemize
  14873. @item
  14874. Apply simple strong vignetting effect:
  14875. @example
  14876. vignette=PI/4
  14877. @end example
  14878. @item
  14879. Make a flickering vignetting:
  14880. @example
  14881. vignette='PI/4+random(1)*PI/50':eval=frame
  14882. @end example
  14883. @end itemize
  14884. @section vmafmotion
  14885. Obtain the average VMAF motion score of a video.
  14886. It is one of the component metrics of VMAF.
  14887. The obtained average motion score is printed through the logging system.
  14888. The filter accepts the following options:
  14889. @table @option
  14890. @item stats_file
  14891. If specified, the filter will use the named file to save the motion score of
  14892. each frame with respect to the previous frame.
  14893. When filename equals "-" the data is sent to standard output.
  14894. @end table
  14895. Example:
  14896. @example
  14897. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  14898. @end example
  14899. @section vstack
  14900. Stack input videos vertically.
  14901. All streams must be of same pixel format and of same width.
  14902. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14903. to create same output.
  14904. The filter accepts the following options:
  14905. @table @option
  14906. @item inputs
  14907. Set number of input streams. Default is 2.
  14908. @item shortest
  14909. If set to 1, force the output to terminate when the shortest input
  14910. terminates. Default value is 0.
  14911. @end table
  14912. @section w3fdif
  14913. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14914. Deinterlacing Filter").
  14915. Based on the process described by Martin Weston for BBC R&D, and
  14916. implemented based on the de-interlace algorithm written by Jim
  14917. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14918. uses filter coefficients calculated by BBC R&D.
  14919. This filter uses field-dominance information in frame to decide which
  14920. of each pair of fields to place first in the output.
  14921. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14922. There are two sets of filter coefficients, so called "simple"
  14923. and "complex". Which set of filter coefficients is used can
  14924. be set by passing an optional parameter:
  14925. @table @option
  14926. @item filter
  14927. Set the interlacing filter coefficients. Accepts one of the following values:
  14928. @table @samp
  14929. @item simple
  14930. Simple filter coefficient set.
  14931. @item complex
  14932. More-complex filter coefficient set.
  14933. @end table
  14934. Default value is @samp{complex}.
  14935. @item deint
  14936. Specify which frames to deinterlace. Accepts one of the following values:
  14937. @table @samp
  14938. @item all
  14939. Deinterlace all frames,
  14940. @item interlaced
  14941. Only deinterlace frames marked as interlaced.
  14942. @end table
  14943. Default value is @samp{all}.
  14944. @end table
  14945. @section waveform
  14946. Video waveform monitor.
  14947. The waveform monitor plots color component intensity. By default luminance
  14948. only. Each column of the waveform corresponds to a column of pixels in the
  14949. source video.
  14950. It accepts the following options:
  14951. @table @option
  14952. @item mode, m
  14953. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14954. In row mode, the graph on the left side represents color component value 0 and
  14955. the right side represents value = 255. In column mode, the top side represents
  14956. color component value = 0 and bottom side represents value = 255.
  14957. @item intensity, i
  14958. Set intensity. Smaller values are useful to find out how many values of the same
  14959. luminance are distributed across input rows/columns.
  14960. Default value is @code{0.04}. Allowed range is [0, 1].
  14961. @item mirror, r
  14962. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14963. In mirrored mode, higher values will be represented on the left
  14964. side for @code{row} mode and at the top for @code{column} mode. Default is
  14965. @code{1} (mirrored).
  14966. @item display, d
  14967. Set display mode.
  14968. It accepts the following values:
  14969. @table @samp
  14970. @item overlay
  14971. Presents information identical to that in the @code{parade}, except
  14972. that the graphs representing color components are superimposed directly
  14973. over one another.
  14974. This display mode makes it easier to spot relative differences or similarities
  14975. in overlapping areas of the color components that are supposed to be identical,
  14976. such as neutral whites, grays, or blacks.
  14977. @item stack
  14978. Display separate graph for the color components side by side in
  14979. @code{row} mode or one below the other in @code{column} mode.
  14980. @item parade
  14981. Display separate graph for the color components side by side in
  14982. @code{column} mode or one below the other in @code{row} mode.
  14983. Using this display mode makes it easy to spot color casts in the highlights
  14984. and shadows of an image, by comparing the contours of the top and the bottom
  14985. graphs of each waveform. Since whites, grays, and blacks are characterized
  14986. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14987. should display three waveforms of roughly equal width/height. If not, the
  14988. correction is easy to perform by making level adjustments the three waveforms.
  14989. @end table
  14990. Default is @code{stack}.
  14991. @item components, c
  14992. Set which color components to display. Default is 1, which means only luminance
  14993. or red color component if input is in RGB colorspace. If is set for example to
  14994. 7 it will display all 3 (if) available color components.
  14995. @item envelope, e
  14996. @table @samp
  14997. @item none
  14998. No envelope, this is default.
  14999. @item instant
  15000. Instant envelope, minimum and maximum values presented in graph will be easily
  15001. visible even with small @code{step} value.
  15002. @item peak
  15003. Hold minimum and maximum values presented in graph across time. This way you
  15004. can still spot out of range values without constantly looking at waveforms.
  15005. @item peak+instant
  15006. Peak and instant envelope combined together.
  15007. @end table
  15008. @item filter, f
  15009. @table @samp
  15010. @item lowpass
  15011. No filtering, this is default.
  15012. @item flat
  15013. Luma and chroma combined together.
  15014. @item aflat
  15015. Similar as above, but shows difference between blue and red chroma.
  15016. @item xflat
  15017. Similar as above, but use different colors.
  15018. @item yflat
  15019. Similar as above, but again with different colors.
  15020. @item chroma
  15021. Displays only chroma.
  15022. @item color
  15023. Displays actual color value on waveform.
  15024. @item acolor
  15025. Similar as above, but with luma showing frequency of chroma values.
  15026. @end table
  15027. @item graticule, g
  15028. Set which graticule to display.
  15029. @table @samp
  15030. @item none
  15031. Do not display graticule.
  15032. @item green
  15033. Display green graticule showing legal broadcast ranges.
  15034. @item orange
  15035. Display orange graticule showing legal broadcast ranges.
  15036. @item invert
  15037. Display invert graticule showing legal broadcast ranges.
  15038. @end table
  15039. @item opacity, o
  15040. Set graticule opacity.
  15041. @item flags, fl
  15042. Set graticule flags.
  15043. @table @samp
  15044. @item numbers
  15045. Draw numbers above lines. By default enabled.
  15046. @item dots
  15047. Draw dots instead of lines.
  15048. @end table
  15049. @item scale, s
  15050. Set scale used for displaying graticule.
  15051. @table @samp
  15052. @item digital
  15053. @item millivolts
  15054. @item ire
  15055. @end table
  15056. Default is digital.
  15057. @item bgopacity, b
  15058. Set background opacity.
  15059. @item tint0, t0
  15060. @item tint1, t1
  15061. Set tint for output.
  15062. Only used with lowpass filter and when display is not overlay and input
  15063. pixel formats are not RGB.
  15064. @end table
  15065. @section weave, doubleweave
  15066. The @code{weave} takes a field-based video input and join
  15067. each two sequential fields into single frame, producing a new double
  15068. height clip with half the frame rate and half the frame count.
  15069. The @code{doubleweave} works same as @code{weave} but without
  15070. halving frame rate and frame count.
  15071. It accepts the following option:
  15072. @table @option
  15073. @item first_field
  15074. Set first field. Available values are:
  15075. @table @samp
  15076. @item top, t
  15077. Set the frame as top-field-first.
  15078. @item bottom, b
  15079. Set the frame as bottom-field-first.
  15080. @end table
  15081. @end table
  15082. @subsection Examples
  15083. @itemize
  15084. @item
  15085. Interlace video using @ref{select} and @ref{separatefields} filter:
  15086. @example
  15087. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15088. @end example
  15089. @end itemize
  15090. @section xbr
  15091. Apply the xBR high-quality magnification filter which is designed for pixel
  15092. art. It follows a set of edge-detection rules, see
  15093. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15094. It accepts the following option:
  15095. @table @option
  15096. @item n
  15097. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15098. @code{3xBR} and @code{4} for @code{4xBR}.
  15099. Default is @code{3}.
  15100. @end table
  15101. @section xmedian
  15102. Pick median pixels from several input videos.
  15103. The filter accepts the following options:
  15104. @table @option
  15105. @item inputs
  15106. Set number of inputs.
  15107. Default is 3. Allowed range is from 3 to 255.
  15108. If number of inputs is even number, than result will be mean value between two median values.
  15109. @item planes
  15110. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15111. @end table
  15112. @section xstack
  15113. Stack video inputs into custom layout.
  15114. All streams must be of same pixel format.
  15115. The filter accepts the following options:
  15116. @table @option
  15117. @item inputs
  15118. Set number of input streams. Default is 2.
  15119. @item layout
  15120. Specify layout of inputs.
  15121. This option requires the desired layout configuration to be explicitly set by the user.
  15122. This sets position of each video input in output. Each input
  15123. is separated by '|'.
  15124. The first number represents the column, and the second number represents the row.
  15125. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15126. where X is video input from which to take width or height.
  15127. Multiple values can be used when separated by '+'. In such
  15128. case values are summed together.
  15129. Note that if inputs are of different sizes gaps may appear, as not all of
  15130. the output video frame will be filled. Similarly, videos can overlap each
  15131. other if their position doesn't leave enough space for the full frame of
  15132. adjoining videos.
  15133. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15134. a layout must be set by the user.
  15135. @item shortest
  15136. If set to 1, force the output to terminate when the shortest input
  15137. terminates. Default value is 0.
  15138. @end table
  15139. @subsection Examples
  15140. @itemize
  15141. @item
  15142. Display 4 inputs into 2x2 grid.
  15143. Layout:
  15144. @example
  15145. input1(0, 0) | input3(w0, 0)
  15146. input2(0, h0) | input4(w0, h0)
  15147. @end example
  15148. @example
  15149. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15150. @end example
  15151. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15152. @item
  15153. Display 4 inputs into 1x4 grid.
  15154. Layout:
  15155. @example
  15156. input1(0, 0)
  15157. input2(0, h0)
  15158. input3(0, h0+h1)
  15159. input4(0, h0+h1+h2)
  15160. @end example
  15161. @example
  15162. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15163. @end example
  15164. Note that if inputs are of different widths, unused space will appear.
  15165. @item
  15166. Display 9 inputs into 3x3 grid.
  15167. Layout:
  15168. @example
  15169. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15170. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15171. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15172. @end example
  15173. @example
  15174. 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
  15175. @end example
  15176. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15177. @item
  15178. Display 16 inputs into 4x4 grid.
  15179. Layout:
  15180. @example
  15181. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15182. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15183. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15184. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15185. @end example
  15186. @example
  15187. 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|
  15188. 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
  15189. @end example
  15190. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15191. @end itemize
  15192. @anchor{yadif}
  15193. @section yadif
  15194. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15195. filter").
  15196. It accepts the following parameters:
  15197. @table @option
  15198. @item mode
  15199. The interlacing mode to adopt. It accepts one of the following values:
  15200. @table @option
  15201. @item 0, send_frame
  15202. Output one frame for each frame.
  15203. @item 1, send_field
  15204. Output one frame for each field.
  15205. @item 2, send_frame_nospatial
  15206. Like @code{send_frame}, but it skips the spatial interlacing check.
  15207. @item 3, send_field_nospatial
  15208. Like @code{send_field}, but it skips the spatial interlacing check.
  15209. @end table
  15210. The default value is @code{send_frame}.
  15211. @item parity
  15212. The picture field parity assumed for the input interlaced video. It accepts one
  15213. of the following values:
  15214. @table @option
  15215. @item 0, tff
  15216. Assume the top field is first.
  15217. @item 1, bff
  15218. Assume the bottom field is first.
  15219. @item -1, auto
  15220. Enable automatic detection of field parity.
  15221. @end table
  15222. The default value is @code{auto}.
  15223. If the interlacing is unknown or the decoder does not export this information,
  15224. top field first will be assumed.
  15225. @item deint
  15226. Specify which frames to deinterlace. Accepts one of the following
  15227. values:
  15228. @table @option
  15229. @item 0, all
  15230. Deinterlace all frames.
  15231. @item 1, interlaced
  15232. Only deinterlace frames marked as interlaced.
  15233. @end table
  15234. The default value is @code{all}.
  15235. @end table
  15236. @section yadif_cuda
  15237. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15238. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15239. and/or nvenc.
  15240. It accepts the following parameters:
  15241. @table @option
  15242. @item mode
  15243. The interlacing mode to adopt. It accepts one of the following values:
  15244. @table @option
  15245. @item 0, send_frame
  15246. Output one frame for each frame.
  15247. @item 1, send_field
  15248. Output one frame for each field.
  15249. @item 2, send_frame_nospatial
  15250. Like @code{send_frame}, but it skips the spatial interlacing check.
  15251. @item 3, send_field_nospatial
  15252. Like @code{send_field}, but it skips the spatial interlacing check.
  15253. @end table
  15254. The default value is @code{send_frame}.
  15255. @item parity
  15256. The picture field parity assumed for the input interlaced video. It accepts one
  15257. of the following values:
  15258. @table @option
  15259. @item 0, tff
  15260. Assume the top field is first.
  15261. @item 1, bff
  15262. Assume the bottom field is first.
  15263. @item -1, auto
  15264. Enable automatic detection of field parity.
  15265. @end table
  15266. The default value is @code{auto}.
  15267. If the interlacing is unknown or the decoder does not export this information,
  15268. top field first will be assumed.
  15269. @item deint
  15270. Specify which frames to deinterlace. Accepts one of the following
  15271. values:
  15272. @table @option
  15273. @item 0, all
  15274. Deinterlace all frames.
  15275. @item 1, interlaced
  15276. Only deinterlace frames marked as interlaced.
  15277. @end table
  15278. The default value is @code{all}.
  15279. @end table
  15280. @section yaepblur
  15281. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15282. The algorithm is described in
  15283. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15284. It accepts the following parameters:
  15285. @table @option
  15286. @item radius, r
  15287. Set the window radius. Default value is 3.
  15288. @item planes, p
  15289. Set which planes to filter. Default is only the first plane.
  15290. @item sigma, s
  15291. Set blur strength. Default value is 128.
  15292. @end table
  15293. @subsection Commands
  15294. This filter supports same @ref{commands} as options.
  15295. @section zoompan
  15296. Apply Zoom & Pan effect.
  15297. This filter accepts the following options:
  15298. @table @option
  15299. @item zoom, z
  15300. Set the zoom expression. Range is 1-10. Default is 1.
  15301. @item x
  15302. @item y
  15303. Set the x and y expression. Default is 0.
  15304. @item d
  15305. Set the duration expression in number of frames.
  15306. This sets for how many number of frames effect will last for
  15307. single input image.
  15308. @item s
  15309. Set the output image size, default is 'hd720'.
  15310. @item fps
  15311. Set the output frame rate, default is '25'.
  15312. @end table
  15313. Each expression can contain the following constants:
  15314. @table @option
  15315. @item in_w, iw
  15316. Input width.
  15317. @item in_h, ih
  15318. Input height.
  15319. @item out_w, ow
  15320. Output width.
  15321. @item out_h, oh
  15322. Output height.
  15323. @item in
  15324. Input frame count.
  15325. @item on
  15326. Output frame count.
  15327. @item x
  15328. @item y
  15329. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15330. for current input frame.
  15331. @item px
  15332. @item py
  15333. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15334. not yet such frame (first input frame).
  15335. @item zoom
  15336. Last calculated zoom from 'z' expression for current input frame.
  15337. @item pzoom
  15338. Last calculated zoom of last output frame of previous input frame.
  15339. @item duration
  15340. Number of output frames for current input frame. Calculated from 'd' expression
  15341. for each input frame.
  15342. @item pduration
  15343. number of output frames created for previous input frame
  15344. @item a
  15345. Rational number: input width / input height
  15346. @item sar
  15347. sample aspect ratio
  15348. @item dar
  15349. display aspect ratio
  15350. @end table
  15351. @subsection Examples
  15352. @itemize
  15353. @item
  15354. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  15355. @example
  15356. 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
  15357. @end example
  15358. @item
  15359. Zoom-in up to 1.5 and pan always at center of picture:
  15360. @example
  15361. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15362. @end example
  15363. @item
  15364. Same as above but without pausing:
  15365. @example
  15366. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15367. @end example
  15368. @end itemize
  15369. @anchor{zscale}
  15370. @section zscale
  15371. Scale (resize) the input video, using the z.lib library:
  15372. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  15373. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  15374. The zscale filter forces the output display aspect ratio to be the same
  15375. as the input, by changing the output sample aspect ratio.
  15376. If the input image format is different from the format requested by
  15377. the next filter, the zscale filter will convert the input to the
  15378. requested format.
  15379. @subsection Options
  15380. The filter accepts the following options.
  15381. @table @option
  15382. @item width, w
  15383. @item height, h
  15384. Set the output video dimension expression. Default value is the input
  15385. dimension.
  15386. If the @var{width} or @var{w} value is 0, the input width is used for
  15387. the output. If the @var{height} or @var{h} value is 0, the input height
  15388. is used for the output.
  15389. If one and only one of the values is -n with n >= 1, the zscale filter
  15390. will use a value that maintains the aspect ratio of the input image,
  15391. calculated from the other specified dimension. After that it will,
  15392. however, make sure that the calculated dimension is divisible by n and
  15393. adjust the value if necessary.
  15394. If both values are -n with n >= 1, the behavior will be identical to
  15395. both values being set to 0 as previously detailed.
  15396. See below for the list of accepted constants for use in the dimension
  15397. expression.
  15398. @item size, s
  15399. Set the video size. For the syntax of this option, check the
  15400. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15401. @item dither, d
  15402. Set the dither type.
  15403. Possible values are:
  15404. @table @var
  15405. @item none
  15406. @item ordered
  15407. @item random
  15408. @item error_diffusion
  15409. @end table
  15410. Default is none.
  15411. @item filter, f
  15412. Set the resize filter type.
  15413. Possible values are:
  15414. @table @var
  15415. @item point
  15416. @item bilinear
  15417. @item bicubic
  15418. @item spline16
  15419. @item spline36
  15420. @item lanczos
  15421. @end table
  15422. Default is bilinear.
  15423. @item range, r
  15424. Set the color range.
  15425. Possible values are:
  15426. @table @var
  15427. @item input
  15428. @item limited
  15429. @item full
  15430. @end table
  15431. Default is same as input.
  15432. @item primaries, p
  15433. Set the color primaries.
  15434. Possible values are:
  15435. @table @var
  15436. @item input
  15437. @item 709
  15438. @item unspecified
  15439. @item 170m
  15440. @item 240m
  15441. @item 2020
  15442. @end table
  15443. Default is same as input.
  15444. @item transfer, t
  15445. Set the transfer characteristics.
  15446. Possible values are:
  15447. @table @var
  15448. @item input
  15449. @item 709
  15450. @item unspecified
  15451. @item 601
  15452. @item linear
  15453. @item 2020_10
  15454. @item 2020_12
  15455. @item smpte2084
  15456. @item iec61966-2-1
  15457. @item arib-std-b67
  15458. @end table
  15459. Default is same as input.
  15460. @item matrix, m
  15461. Set the colorspace matrix.
  15462. Possible value are:
  15463. @table @var
  15464. @item input
  15465. @item 709
  15466. @item unspecified
  15467. @item 470bg
  15468. @item 170m
  15469. @item 2020_ncl
  15470. @item 2020_cl
  15471. @end table
  15472. Default is same as input.
  15473. @item rangein, rin
  15474. Set the input color range.
  15475. Possible values are:
  15476. @table @var
  15477. @item input
  15478. @item limited
  15479. @item full
  15480. @end table
  15481. Default is same as input.
  15482. @item primariesin, pin
  15483. Set the input color primaries.
  15484. Possible values are:
  15485. @table @var
  15486. @item input
  15487. @item 709
  15488. @item unspecified
  15489. @item 170m
  15490. @item 240m
  15491. @item 2020
  15492. @end table
  15493. Default is same as input.
  15494. @item transferin, tin
  15495. Set the input transfer characteristics.
  15496. Possible values are:
  15497. @table @var
  15498. @item input
  15499. @item 709
  15500. @item unspecified
  15501. @item 601
  15502. @item linear
  15503. @item 2020_10
  15504. @item 2020_12
  15505. @end table
  15506. Default is same as input.
  15507. @item matrixin, min
  15508. Set the input colorspace matrix.
  15509. Possible value are:
  15510. @table @var
  15511. @item input
  15512. @item 709
  15513. @item unspecified
  15514. @item 470bg
  15515. @item 170m
  15516. @item 2020_ncl
  15517. @item 2020_cl
  15518. @end table
  15519. @item chromal, c
  15520. Set the output chroma location.
  15521. Possible values are:
  15522. @table @var
  15523. @item input
  15524. @item left
  15525. @item center
  15526. @item topleft
  15527. @item top
  15528. @item bottomleft
  15529. @item bottom
  15530. @end table
  15531. @item chromalin, cin
  15532. Set the input chroma location.
  15533. Possible values are:
  15534. @table @var
  15535. @item input
  15536. @item left
  15537. @item center
  15538. @item topleft
  15539. @item top
  15540. @item bottomleft
  15541. @item bottom
  15542. @end table
  15543. @item npl
  15544. Set the nominal peak luminance.
  15545. @end table
  15546. The values of the @option{w} and @option{h} options are expressions
  15547. containing the following constants:
  15548. @table @var
  15549. @item in_w
  15550. @item in_h
  15551. The input width and height
  15552. @item iw
  15553. @item ih
  15554. These are the same as @var{in_w} and @var{in_h}.
  15555. @item out_w
  15556. @item out_h
  15557. The output (scaled) width and height
  15558. @item ow
  15559. @item oh
  15560. These are the same as @var{out_w} and @var{out_h}
  15561. @item a
  15562. The same as @var{iw} / @var{ih}
  15563. @item sar
  15564. input sample aspect ratio
  15565. @item dar
  15566. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15567. @item hsub
  15568. @item vsub
  15569. horizontal and vertical input chroma subsample values. For example for the
  15570. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15571. @item ohsub
  15572. @item ovsub
  15573. horizontal and vertical output chroma subsample values. For example for the
  15574. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15575. @end table
  15576. @subsection Commands
  15577. This filter supports the following commands:
  15578. @table @option
  15579. @item width, w
  15580. @item height, h
  15581. Set the output video dimension expression.
  15582. The command accepts the same syntax of the corresponding option.
  15583. If the specified expression is not valid, it is kept at its current
  15584. value.
  15585. @end table
  15586. @c man end VIDEO FILTERS
  15587. @chapter OpenCL Video Filters
  15588. @c man begin OPENCL VIDEO FILTERS
  15589. Below is a description of the currently available OpenCL video filters.
  15590. To enable compilation of these filters you need to configure FFmpeg with
  15591. @code{--enable-opencl}.
  15592. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15593. @table @option
  15594. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15595. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15596. given device parameters.
  15597. @item -filter_hw_device @var{name}
  15598. Pass the hardware device called @var{name} to all filters in any filter graph.
  15599. @end table
  15600. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15601. @itemize
  15602. @item
  15603. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15604. @example
  15605. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15606. @end example
  15607. @end itemize
  15608. 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.
  15609. @section avgblur_opencl
  15610. Apply average blur filter.
  15611. The filter accepts the following options:
  15612. @table @option
  15613. @item sizeX
  15614. Set horizontal radius size.
  15615. Range is @code{[1, 1024]} and default value is @code{1}.
  15616. @item planes
  15617. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15618. @item sizeY
  15619. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15620. @end table
  15621. @subsection Example
  15622. @itemize
  15623. @item
  15624. 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.
  15625. @example
  15626. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15627. @end example
  15628. @end itemize
  15629. @section boxblur_opencl
  15630. Apply a boxblur algorithm to the input video.
  15631. It accepts the following parameters:
  15632. @table @option
  15633. @item luma_radius, lr
  15634. @item luma_power, lp
  15635. @item chroma_radius, cr
  15636. @item chroma_power, cp
  15637. @item alpha_radius, ar
  15638. @item alpha_power, ap
  15639. @end table
  15640. A description of the accepted options follows.
  15641. @table @option
  15642. @item luma_radius, lr
  15643. @item chroma_radius, cr
  15644. @item alpha_radius, ar
  15645. Set an expression for the box radius in pixels used for blurring the
  15646. corresponding input plane.
  15647. The radius value must be a non-negative number, and must not be
  15648. greater than the value of the expression @code{min(w,h)/2} for the
  15649. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15650. planes.
  15651. Default value for @option{luma_radius} is "2". If not specified,
  15652. @option{chroma_radius} and @option{alpha_radius} default to the
  15653. corresponding value set for @option{luma_radius}.
  15654. The expressions can contain the following constants:
  15655. @table @option
  15656. @item w
  15657. @item h
  15658. The input width and height in pixels.
  15659. @item cw
  15660. @item ch
  15661. The input chroma image width and height in pixels.
  15662. @item hsub
  15663. @item vsub
  15664. The horizontal and vertical chroma subsample values. For example, for the
  15665. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15666. @end table
  15667. @item luma_power, lp
  15668. @item chroma_power, cp
  15669. @item alpha_power, ap
  15670. Specify how many times the boxblur filter is applied to the
  15671. corresponding plane.
  15672. Default value for @option{luma_power} is 2. If not specified,
  15673. @option{chroma_power} and @option{alpha_power} default to the
  15674. corresponding value set for @option{luma_power}.
  15675. A value of 0 will disable the effect.
  15676. @end table
  15677. @subsection Examples
  15678. 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.
  15679. @itemize
  15680. @item
  15681. Apply a boxblur filter with the luma, chroma, and alpha radius
  15682. 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.
  15683. @example
  15684. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15685. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15686. @end example
  15687. @item
  15688. 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.
  15689. For the luma plane, a 2x2 box radius will be run once.
  15690. For the chroma plane, a 4x4 box radius will be run 5 times.
  15691. For the alpha plane, a 3x3 box radius will be run 7 times.
  15692. @example
  15693. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15694. @end example
  15695. @end itemize
  15696. @section convolution_opencl
  15697. Apply convolution of 3x3, 5x5, 7x7 matrix.
  15698. The filter accepts the following options:
  15699. @table @option
  15700. @item 0m
  15701. @item 1m
  15702. @item 2m
  15703. @item 3m
  15704. Set matrix for each plane.
  15705. Matrix is sequence of 9, 25 or 49 signed numbers.
  15706. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  15707. @item 0rdiv
  15708. @item 1rdiv
  15709. @item 2rdiv
  15710. @item 3rdiv
  15711. Set multiplier for calculated value for each plane.
  15712. If unset or 0, it will be sum of all matrix elements.
  15713. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  15714. @item 0bias
  15715. @item 1bias
  15716. @item 2bias
  15717. @item 3bias
  15718. Set bias for each plane. This value is added to the result of the multiplication.
  15719. Useful for making the overall image brighter or darker.
  15720. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15721. @end table
  15722. @subsection Examples
  15723. @itemize
  15724. @item
  15725. Apply sharpen:
  15726. @example
  15727. -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
  15728. @end example
  15729. @item
  15730. Apply blur:
  15731. @example
  15732. -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
  15733. @end example
  15734. @item
  15735. Apply edge enhance:
  15736. @example
  15737. -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
  15738. @end example
  15739. @item
  15740. Apply edge detect:
  15741. @example
  15742. -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
  15743. @end example
  15744. @item
  15745. Apply laplacian edge detector which includes diagonals:
  15746. @example
  15747. -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
  15748. @end example
  15749. @item
  15750. Apply emboss:
  15751. @example
  15752. -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
  15753. @end example
  15754. @end itemize
  15755. @section dilation_opencl
  15756. Apply dilation effect to the video.
  15757. This filter replaces the pixel by the local(3x3) maximum.
  15758. It accepts the following options:
  15759. @table @option
  15760. @item threshold0
  15761. @item threshold1
  15762. @item threshold2
  15763. @item threshold3
  15764. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15765. If @code{0}, plane will remain unchanged.
  15766. @item coordinates
  15767. Flag which specifies the pixel to refer to.
  15768. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15769. Flags to local 3x3 coordinates region centered on @code{x}:
  15770. 1 2 3
  15771. 4 x 5
  15772. 6 7 8
  15773. @end table
  15774. @subsection Example
  15775. @itemize
  15776. @item
  15777. 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.
  15778. @example
  15779. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15780. @end example
  15781. @end itemize
  15782. @section erosion_opencl
  15783. Apply erosion effect to the video.
  15784. This filter replaces the pixel by the local(3x3) minimum.
  15785. It accepts the following options:
  15786. @table @option
  15787. @item threshold0
  15788. @item threshold1
  15789. @item threshold2
  15790. @item threshold3
  15791. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15792. If @code{0}, plane will remain unchanged.
  15793. @item coordinates
  15794. Flag which specifies the pixel to refer to.
  15795. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15796. Flags to local 3x3 coordinates region centered on @code{x}:
  15797. 1 2 3
  15798. 4 x 5
  15799. 6 7 8
  15800. @end table
  15801. @subsection Example
  15802. @itemize
  15803. @item
  15804. 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.
  15805. @example
  15806. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15807. @end example
  15808. @end itemize
  15809. @section colorkey_opencl
  15810. RGB colorspace color keying.
  15811. The filter accepts the following options:
  15812. @table @option
  15813. @item color
  15814. The color which will be replaced with transparency.
  15815. @item similarity
  15816. Similarity percentage with the key color.
  15817. 0.01 matches only the exact key color, while 1.0 matches everything.
  15818. @item blend
  15819. Blend percentage.
  15820. 0.0 makes pixels either fully transparent, or not transparent at all.
  15821. Higher values result in semi-transparent pixels, with a higher transparency
  15822. the more similar the pixels color is to the key color.
  15823. @end table
  15824. @subsection Examples
  15825. @itemize
  15826. @item
  15827. Make every semi-green pixel in the input transparent with some slight blending:
  15828. @example
  15829. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15830. @end example
  15831. @end itemize
  15832. @section deshake_opencl
  15833. Feature-point based video stabilization filter.
  15834. The filter accepts the following options:
  15835. @table @option
  15836. @item tripod
  15837. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15838. @item debug
  15839. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15840. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15841. Viewing point matches in the output video is only supported for RGB input.
  15842. Defaults to @code{0}.
  15843. @item adaptive_crop
  15844. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15845. Defaults to @code{1}.
  15846. @item refine_features
  15847. Whether or not feature points should be refined at a sub-pixel level.
  15848. This can be turned off for a slight performance gain at the cost of precision.
  15849. Defaults to @code{1}.
  15850. @item smooth_strength
  15851. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15852. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15853. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15854. Defaults to @code{0.0}.
  15855. @item smooth_window_multiplier
  15856. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15857. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15858. Acceptable values range from @code{0.1} to @code{10.0}.
  15859. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15860. potentially improving smoothness, but also increase latency and memory usage.
  15861. Defaults to @code{2.0}.
  15862. @end table
  15863. @subsection Examples
  15864. @itemize
  15865. @item
  15866. Stabilize a video with a fixed, medium smoothing strength:
  15867. @example
  15868. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15869. @end example
  15870. @item
  15871. Stabilize a video with debugging (both in console and in rendered video):
  15872. @example
  15873. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15874. @end example
  15875. @end itemize
  15876. @section nlmeans_opencl
  15877. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15878. @section overlay_opencl
  15879. Overlay one video on top of another.
  15880. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15881. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15882. The filter accepts the following options:
  15883. @table @option
  15884. @item x
  15885. Set the x coordinate of the overlaid video on the main video.
  15886. Default value is @code{0}.
  15887. @item y
  15888. Set the y coordinate of the overlaid video on the main video.
  15889. Default value is @code{0}.
  15890. @end table
  15891. @subsection Examples
  15892. @itemize
  15893. @item
  15894. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15895. @example
  15896. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15897. @end example
  15898. @item
  15899. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15900. @example
  15901. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15902. @end example
  15903. @end itemize
  15904. @section prewitt_opencl
  15905. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15906. The filter accepts the following option:
  15907. @table @option
  15908. @item planes
  15909. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15910. @item scale
  15911. Set value which will be multiplied with filtered result.
  15912. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15913. @item delta
  15914. Set value which will be added to filtered result.
  15915. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15916. @end table
  15917. @subsection Example
  15918. @itemize
  15919. @item
  15920. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15921. @example
  15922. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15923. @end example
  15924. @end itemize
  15925. @section roberts_opencl
  15926. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15927. The filter accepts the following option:
  15928. @table @option
  15929. @item planes
  15930. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15931. @item scale
  15932. Set value which will be multiplied with filtered result.
  15933. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15934. @item delta
  15935. Set value which will be added to filtered result.
  15936. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15937. @end table
  15938. @subsection Example
  15939. @itemize
  15940. @item
  15941. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15942. @example
  15943. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15944. @end example
  15945. @end itemize
  15946. @section sobel_opencl
  15947. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15948. The filter accepts the following option:
  15949. @table @option
  15950. @item planes
  15951. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15952. @item scale
  15953. Set value which will be multiplied with filtered result.
  15954. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15955. @item delta
  15956. Set value which will be added to filtered result.
  15957. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15958. @end table
  15959. @subsection Example
  15960. @itemize
  15961. @item
  15962. Apply sobel operator with scale set to 2 and delta set to 10
  15963. @example
  15964. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15965. @end example
  15966. @end itemize
  15967. @section tonemap_opencl
  15968. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15969. It accepts the following parameters:
  15970. @table @option
  15971. @item tonemap
  15972. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15973. @item param
  15974. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15975. @item desat
  15976. Apply desaturation for highlights that exceed this level of brightness. The
  15977. higher the parameter, the more color information will be preserved. This
  15978. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15979. (smoothly) turning into white instead. This makes images feel more natural,
  15980. at the cost of reducing information about out-of-range colors.
  15981. The default value is 0.5, and the algorithm here is a little different from
  15982. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15983. @item threshold
  15984. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15985. is used to detect whether the scene has changed or not. If the distance between
  15986. the current frame average brightness and the current running average exceeds
  15987. a threshold value, we would re-calculate scene average and peak brightness.
  15988. The default value is 0.2.
  15989. @item format
  15990. Specify the output pixel format.
  15991. Currently supported formats are:
  15992. @table @var
  15993. @item p010
  15994. @item nv12
  15995. @end table
  15996. @item range, r
  15997. Set the output color range.
  15998. Possible values are:
  15999. @table @var
  16000. @item tv/mpeg
  16001. @item pc/jpeg
  16002. @end table
  16003. Default is same as input.
  16004. @item primaries, p
  16005. Set the output color primaries.
  16006. Possible values are:
  16007. @table @var
  16008. @item bt709
  16009. @item bt2020
  16010. @end table
  16011. Default is same as input.
  16012. @item transfer, t
  16013. Set the output transfer characteristics.
  16014. Possible values are:
  16015. @table @var
  16016. @item bt709
  16017. @item bt2020
  16018. @end table
  16019. Default is bt709.
  16020. @item matrix, m
  16021. Set the output colorspace matrix.
  16022. Possible value are:
  16023. @table @var
  16024. @item bt709
  16025. @item bt2020
  16026. @end table
  16027. Default is same as input.
  16028. @end table
  16029. @subsection Example
  16030. @itemize
  16031. @item
  16032. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16033. @example
  16034. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16035. @end example
  16036. @end itemize
  16037. @section unsharp_opencl
  16038. Sharpen or blur the input video.
  16039. It accepts the following parameters:
  16040. @table @option
  16041. @item luma_msize_x, lx
  16042. Set the luma matrix horizontal size.
  16043. Range is @code{[1, 23]} and default value is @code{5}.
  16044. @item luma_msize_y, ly
  16045. Set the luma matrix vertical size.
  16046. Range is @code{[1, 23]} and default value is @code{5}.
  16047. @item luma_amount, la
  16048. Set the luma effect strength.
  16049. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16050. Negative values will blur the input video, while positive values will
  16051. sharpen it, a value of zero will disable the effect.
  16052. @item chroma_msize_x, cx
  16053. Set the chroma matrix horizontal size.
  16054. Range is @code{[1, 23]} and default value is @code{5}.
  16055. @item chroma_msize_y, cy
  16056. Set the chroma matrix vertical size.
  16057. Range is @code{[1, 23]} and default value is @code{5}.
  16058. @item chroma_amount, ca
  16059. Set the chroma effect strength.
  16060. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16061. Negative values will blur the input video, while positive values will
  16062. sharpen it, a value of zero will disable the effect.
  16063. @end table
  16064. All parameters are optional and default to the equivalent of the
  16065. string '5:5:1.0:5:5:0.0'.
  16066. @subsection Examples
  16067. @itemize
  16068. @item
  16069. Apply strong luma sharpen effect:
  16070. @example
  16071. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16072. @end example
  16073. @item
  16074. Apply a strong blur of both luma and chroma parameters:
  16075. @example
  16076. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16077. @end example
  16078. @end itemize
  16079. @c man end OPENCL VIDEO FILTERS
  16080. @chapter VAAPI Video Filters
  16081. @c man begin VAAPI VIDEO FILTERS
  16082. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  16083. To enable compilation of these filters you need to configure FFmpeg with
  16084. @code{--enable-vaapi}.
  16085. 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}
  16086. @section tonemap_vappi
  16087. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  16088. It maps the dynamic range of HDR10 content to the SDR content.
  16089. It currently only accepts HDR10 as input.
  16090. It accepts the following parameters:
  16091. @table @option
  16092. @item format
  16093. Specify the output pixel format.
  16094. Currently supported formats are:
  16095. @table @var
  16096. @item p010
  16097. @item nv12
  16098. @end table
  16099. Default is nv12.
  16100. @item primaries, p
  16101. Set the output color primaries.
  16102. Default is same as input.
  16103. @item transfer, t
  16104. Set the output transfer characteristics.
  16105. Default is bt709.
  16106. @item matrix, m
  16107. Set the output colorspace matrix.
  16108. Default is same as input.
  16109. @end table
  16110. @subsection Example
  16111. @itemize
  16112. @item
  16113. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  16114. @example
  16115. tonemap_vaapi=format=p010:t=bt2020-10
  16116. @end example
  16117. @end itemize
  16118. @c man end VAAPI VIDEO FILTERS
  16119. @chapter Video Sources
  16120. @c man begin VIDEO SOURCES
  16121. Below is a description of the currently available video sources.
  16122. @section buffer
  16123. Buffer video frames, and make them available to the filter chain.
  16124. This source is mainly intended for a programmatic use, in particular
  16125. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  16126. It accepts the following parameters:
  16127. @table @option
  16128. @item video_size
  16129. Specify the size (width and height) of the buffered video frames. For the
  16130. syntax of this option, check the
  16131. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16132. @item width
  16133. The input video width.
  16134. @item height
  16135. The input video height.
  16136. @item pix_fmt
  16137. A string representing the pixel format of the buffered video frames.
  16138. It may be a number corresponding to a pixel format, or a pixel format
  16139. name.
  16140. @item time_base
  16141. Specify the timebase assumed by the timestamps of the buffered frames.
  16142. @item frame_rate
  16143. Specify the frame rate expected for the video stream.
  16144. @item pixel_aspect, sar
  16145. The sample (pixel) aspect ratio of the input video.
  16146. @item sws_param
  16147. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  16148. to the filtergraph description to specify swscale flags for automatically
  16149. inserted scalers. See @ref{Filtergraph syntax}.
  16150. @item hw_frames_ctx
  16151. When using a hardware pixel format, this should be a reference to an
  16152. AVHWFramesContext describing input frames.
  16153. @end table
  16154. For example:
  16155. @example
  16156. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  16157. @end example
  16158. will instruct the source to accept video frames with size 320x240 and
  16159. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  16160. square pixels (1:1 sample aspect ratio).
  16161. Since the pixel format with name "yuv410p" corresponds to the number 6
  16162. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  16163. this example corresponds to:
  16164. @example
  16165. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  16166. @end example
  16167. Alternatively, the options can be specified as a flat string, but this
  16168. syntax is deprecated:
  16169. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  16170. @section cellauto
  16171. Create a pattern generated by an elementary cellular automaton.
  16172. The initial state of the cellular automaton can be defined through the
  16173. @option{filename} and @option{pattern} options. If such options are
  16174. not specified an initial state is created randomly.
  16175. At each new frame a new row in the video is filled with the result of
  16176. the cellular automaton next generation. The behavior when the whole
  16177. frame is filled is defined by the @option{scroll} option.
  16178. This source accepts the following options:
  16179. @table @option
  16180. @item filename, f
  16181. Read the initial cellular automaton state, i.e. the starting row, from
  16182. the specified file.
  16183. In the file, each non-whitespace character is considered an alive
  16184. cell, a newline will terminate the row, and further characters in the
  16185. file will be ignored.
  16186. @item pattern, p
  16187. Read the initial cellular automaton state, i.e. the starting row, from
  16188. the specified string.
  16189. Each non-whitespace character in the string is considered an alive
  16190. cell, a newline will terminate the row, and further characters in the
  16191. string will be ignored.
  16192. @item rate, r
  16193. Set the video rate, that is the number of frames generated per second.
  16194. Default is 25.
  16195. @item random_fill_ratio, ratio
  16196. Set the random fill ratio for the initial cellular automaton row. It
  16197. is a floating point number value ranging from 0 to 1, defaults to
  16198. 1/PHI.
  16199. This option is ignored when a file or a pattern is specified.
  16200. @item random_seed, seed
  16201. Set the seed for filling randomly the initial row, must be an integer
  16202. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16203. set to -1, the filter will try to use a good random seed on a best
  16204. effort basis.
  16205. @item rule
  16206. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  16207. Default value is 110.
  16208. @item size, s
  16209. Set the size of the output video. For the syntax of this option, check the
  16210. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16211. If @option{filename} or @option{pattern} is specified, the size is set
  16212. by default to the width of the specified initial state row, and the
  16213. height is set to @var{width} * PHI.
  16214. If @option{size} is set, it must contain the width of the specified
  16215. pattern string, and the specified pattern will be centered in the
  16216. larger row.
  16217. If a filename or a pattern string is not specified, the size value
  16218. defaults to "320x518" (used for a randomly generated initial state).
  16219. @item scroll
  16220. If set to 1, scroll the output upward when all the rows in the output
  16221. have been already filled. If set to 0, the new generated row will be
  16222. written over the top row just after the bottom row is filled.
  16223. Defaults to 1.
  16224. @item start_full, full
  16225. If set to 1, completely fill the output with generated rows before
  16226. outputting the first frame.
  16227. This is the default behavior, for disabling set the value to 0.
  16228. @item stitch
  16229. If set to 1, stitch the left and right row edges together.
  16230. This is the default behavior, for disabling set the value to 0.
  16231. @end table
  16232. @subsection Examples
  16233. @itemize
  16234. @item
  16235. Read the initial state from @file{pattern}, and specify an output of
  16236. size 200x400.
  16237. @example
  16238. cellauto=f=pattern:s=200x400
  16239. @end example
  16240. @item
  16241. Generate a random initial row with a width of 200 cells, with a fill
  16242. ratio of 2/3:
  16243. @example
  16244. cellauto=ratio=2/3:s=200x200
  16245. @end example
  16246. @item
  16247. Create a pattern generated by rule 18 starting by a single alive cell
  16248. centered on an initial row with width 100:
  16249. @example
  16250. cellauto=p=@@:s=100x400:full=0:rule=18
  16251. @end example
  16252. @item
  16253. Specify a more elaborated initial pattern:
  16254. @example
  16255. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  16256. @end example
  16257. @end itemize
  16258. @anchor{coreimagesrc}
  16259. @section coreimagesrc
  16260. Video source generated on GPU using Apple's CoreImage API on OSX.
  16261. This video source is a specialized version of the @ref{coreimage} video filter.
  16262. Use a core image generator at the beginning of the applied filterchain to
  16263. generate the content.
  16264. The coreimagesrc video source accepts the following options:
  16265. @table @option
  16266. @item list_generators
  16267. List all available generators along with all their respective options as well as
  16268. possible minimum and maximum values along with the default values.
  16269. @example
  16270. list_generators=true
  16271. @end example
  16272. @item size, s
  16273. Specify the size of the sourced video. For the syntax of this option, check the
  16274. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16275. The default value is @code{320x240}.
  16276. @item rate, r
  16277. Specify the frame rate of the sourced video, as the number of frames
  16278. generated per second. It has to be a string in the format
  16279. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16280. number or a valid video frame rate abbreviation. The default value is
  16281. "25".
  16282. @item sar
  16283. Set the sample aspect ratio of the sourced video.
  16284. @item duration, d
  16285. Set the duration of the sourced video. See
  16286. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16287. for the accepted syntax.
  16288. If not specified, or the expressed duration is negative, the video is
  16289. supposed to be generated forever.
  16290. @end table
  16291. Additionally, all options of the @ref{coreimage} video filter are accepted.
  16292. A complete filterchain can be used for further processing of the
  16293. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  16294. and examples for details.
  16295. @subsection Examples
  16296. @itemize
  16297. @item
  16298. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  16299. given as complete and escaped command-line for Apple's standard bash shell:
  16300. @example
  16301. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  16302. @end example
  16303. This example is equivalent to the QRCode example of @ref{coreimage} without the
  16304. need for a nullsrc video source.
  16305. @end itemize
  16306. @section mandelbrot
  16307. Generate a Mandelbrot set fractal, and progressively zoom towards the
  16308. point specified with @var{start_x} and @var{start_y}.
  16309. This source accepts the following options:
  16310. @table @option
  16311. @item end_pts
  16312. Set the terminal pts value. Default value is 400.
  16313. @item end_scale
  16314. Set the terminal scale value.
  16315. Must be a floating point value. Default value is 0.3.
  16316. @item inner
  16317. Set the inner coloring mode, that is the algorithm used to draw the
  16318. Mandelbrot fractal internal region.
  16319. It shall assume one of the following values:
  16320. @table @option
  16321. @item black
  16322. Set black mode.
  16323. @item convergence
  16324. Show time until convergence.
  16325. @item mincol
  16326. Set color based on point closest to the origin of the iterations.
  16327. @item period
  16328. Set period mode.
  16329. @end table
  16330. Default value is @var{mincol}.
  16331. @item bailout
  16332. Set the bailout value. Default value is 10.0.
  16333. @item maxiter
  16334. Set the maximum of iterations performed by the rendering
  16335. algorithm. Default value is 7189.
  16336. @item outer
  16337. Set outer coloring mode.
  16338. It shall assume one of following values:
  16339. @table @option
  16340. @item iteration_count
  16341. Set iteration count mode.
  16342. @item normalized_iteration_count
  16343. set normalized iteration count mode.
  16344. @end table
  16345. Default value is @var{normalized_iteration_count}.
  16346. @item rate, r
  16347. Set frame rate, expressed as number of frames per second. Default
  16348. value is "25".
  16349. @item size, s
  16350. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16351. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16352. @item start_scale
  16353. Set the initial scale value. Default value is 3.0.
  16354. @item start_x
  16355. Set the initial x position. Must be a floating point value between
  16356. -100 and 100. Default value is -0.743643887037158704752191506114774.
  16357. @item start_y
  16358. Set the initial y position. Must be a floating point value between
  16359. -100 and 100. Default value is -0.131825904205311970493132056385139.
  16360. @end table
  16361. @section mptestsrc
  16362. Generate various test patterns, as generated by the MPlayer test filter.
  16363. The size of the generated video is fixed, and is 256x256.
  16364. This source is useful in particular for testing encoding features.
  16365. This source accepts the following options:
  16366. @table @option
  16367. @item rate, r
  16368. Specify the frame rate of the sourced video, as the number of frames
  16369. generated per second. It has to be a string in the format
  16370. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16371. number or a valid video frame rate abbreviation. The default value is
  16372. "25".
  16373. @item duration, d
  16374. Set the duration of the sourced video. See
  16375. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16376. for the accepted syntax.
  16377. If not specified, or the expressed duration is negative, the video is
  16378. supposed to be generated forever.
  16379. @item test, t
  16380. Set the number or the name of the test to perform. Supported tests are:
  16381. @table @option
  16382. @item dc_luma
  16383. @item dc_chroma
  16384. @item freq_luma
  16385. @item freq_chroma
  16386. @item amp_luma
  16387. @item amp_chroma
  16388. @item cbp
  16389. @item mv
  16390. @item ring1
  16391. @item ring2
  16392. @item all
  16393. @item max_frames, m
  16394. Set the maximum number of frames generated for each test, default value is 30.
  16395. @end table
  16396. Default value is "all", which will cycle through the list of all tests.
  16397. @end table
  16398. Some examples:
  16399. @example
  16400. mptestsrc=t=dc_luma
  16401. @end example
  16402. will generate a "dc_luma" test pattern.
  16403. @section frei0r_src
  16404. Provide a frei0r source.
  16405. To enable compilation of this filter you need to install the frei0r
  16406. header and configure FFmpeg with @code{--enable-frei0r}.
  16407. This source accepts the following parameters:
  16408. @table @option
  16409. @item size
  16410. The size of the video to generate. For the syntax of this option, check the
  16411. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16412. @item framerate
  16413. The framerate of the generated video. It may be a string of the form
  16414. @var{num}/@var{den} or a frame rate abbreviation.
  16415. @item filter_name
  16416. The name to the frei0r source to load. For more information regarding frei0r and
  16417. how to set the parameters, read the @ref{frei0r} section in the video filters
  16418. documentation.
  16419. @item filter_params
  16420. A '|'-separated list of parameters to pass to the frei0r source.
  16421. @end table
  16422. For example, to generate a frei0r partik0l source with size 200x200
  16423. and frame rate 10 which is overlaid on the overlay filter main input:
  16424. @example
  16425. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  16426. @end example
  16427. @section life
  16428. Generate a life pattern.
  16429. This source is based on a generalization of John Conway's life game.
  16430. The sourced input represents a life grid, each pixel represents a cell
  16431. which can be in one of two possible states, alive or dead. Every cell
  16432. interacts with its eight neighbours, which are the cells that are
  16433. horizontally, vertically, or diagonally adjacent.
  16434. At each interaction the grid evolves according to the adopted rule,
  16435. which specifies the number of neighbor alive cells which will make a
  16436. cell stay alive or born. The @option{rule} option allows one to specify
  16437. the rule to adopt.
  16438. This source accepts the following options:
  16439. @table @option
  16440. @item filename, f
  16441. Set the file from which to read the initial grid state. In the file,
  16442. each non-whitespace character is considered an alive cell, and newline
  16443. is used to delimit the end of each row.
  16444. If this option is not specified, the initial grid is generated
  16445. randomly.
  16446. @item rate, r
  16447. Set the video rate, that is the number of frames generated per second.
  16448. Default is 25.
  16449. @item random_fill_ratio, ratio
  16450. Set the random fill ratio for the initial random grid. It is a
  16451. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  16452. It is ignored when a file is specified.
  16453. @item random_seed, seed
  16454. Set the seed for filling the initial random grid, must be an integer
  16455. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16456. set to -1, the filter will try to use a good random seed on a best
  16457. effort basis.
  16458. @item rule
  16459. Set the life rule.
  16460. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  16461. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  16462. @var{NS} specifies the number of alive neighbor cells which make a
  16463. live cell stay alive, and @var{NB} the number of alive neighbor cells
  16464. which make a dead cell to become alive (i.e. to "born").
  16465. "s" and "b" can be used in place of "S" and "B", respectively.
  16466. Alternatively a rule can be specified by an 18-bits integer. The 9
  16467. high order bits are used to encode the next cell state if it is alive
  16468. for each number of neighbor alive cells, the low order bits specify
  16469. the rule for "borning" new cells. Higher order bits encode for an
  16470. higher number of neighbor cells.
  16471. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  16472. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  16473. Default value is "S23/B3", which is the original Conway's game of life
  16474. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  16475. cells, and will born a new cell if there are three alive cells around
  16476. a dead cell.
  16477. @item size, s
  16478. Set the size of the output video. For the syntax of this option, check the
  16479. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16480. If @option{filename} is specified, the size is set by default to the
  16481. same size of the input file. If @option{size} is set, it must contain
  16482. the size specified in the input file, and the initial grid defined in
  16483. that file is centered in the larger resulting area.
  16484. If a filename is not specified, the size value defaults to "320x240"
  16485. (used for a randomly generated initial grid).
  16486. @item stitch
  16487. If set to 1, stitch the left and right grid edges together, and the
  16488. top and bottom edges also. Defaults to 1.
  16489. @item mold
  16490. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  16491. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  16492. value from 0 to 255.
  16493. @item life_color
  16494. Set the color of living (or new born) cells.
  16495. @item death_color
  16496. Set the color of dead cells. If @option{mold} is set, this is the first color
  16497. used to represent a dead cell.
  16498. @item mold_color
  16499. Set mold color, for definitely dead and moldy cells.
  16500. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  16501. ffmpeg-utils manual,ffmpeg-utils}.
  16502. @end table
  16503. @subsection Examples
  16504. @itemize
  16505. @item
  16506. Read a grid from @file{pattern}, and center it on a grid of size
  16507. 300x300 pixels:
  16508. @example
  16509. life=f=pattern:s=300x300
  16510. @end example
  16511. @item
  16512. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  16513. @example
  16514. life=ratio=2/3:s=200x200
  16515. @end example
  16516. @item
  16517. Specify a custom rule for evolving a randomly generated grid:
  16518. @example
  16519. life=rule=S14/B34
  16520. @end example
  16521. @item
  16522. Full example with slow death effect (mold) using @command{ffplay}:
  16523. @example
  16524. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  16525. @end example
  16526. @end itemize
  16527. @anchor{allrgb}
  16528. @anchor{allyuv}
  16529. @anchor{color}
  16530. @anchor{haldclutsrc}
  16531. @anchor{nullsrc}
  16532. @anchor{pal75bars}
  16533. @anchor{pal100bars}
  16534. @anchor{rgbtestsrc}
  16535. @anchor{smptebars}
  16536. @anchor{smptehdbars}
  16537. @anchor{testsrc}
  16538. @anchor{testsrc2}
  16539. @anchor{yuvtestsrc}
  16540. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  16541. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  16542. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  16543. The @code{color} source provides an uniformly colored input.
  16544. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  16545. @ref{haldclut} filter.
  16546. The @code{nullsrc} source returns unprocessed video frames. It is
  16547. mainly useful to be employed in analysis / debugging tools, or as the
  16548. source for filters which ignore the input data.
  16549. The @code{pal75bars} source generates a color bars pattern, based on
  16550. EBU PAL recommendations with 75% color levels.
  16551. The @code{pal100bars} source generates a color bars pattern, based on
  16552. EBU PAL recommendations with 100% color levels.
  16553. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  16554. detecting RGB vs BGR issues. You should see a red, green and blue
  16555. stripe from top to bottom.
  16556. The @code{smptebars} source generates a color bars pattern, based on
  16557. the SMPTE Engineering Guideline EG 1-1990.
  16558. The @code{smptehdbars} source generates a color bars pattern, based on
  16559. the SMPTE RP 219-2002.
  16560. The @code{testsrc} source generates a test video pattern, showing a
  16561. color pattern, a scrolling gradient and a timestamp. This is mainly
  16562. intended for testing purposes.
  16563. The @code{testsrc2} source is similar to testsrc, but supports more
  16564. pixel formats instead of just @code{rgb24}. This allows using it as an
  16565. input for other tests without requiring a format conversion.
  16566. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  16567. see a y, cb and cr stripe from top to bottom.
  16568. The sources accept the following parameters:
  16569. @table @option
  16570. @item level
  16571. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  16572. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  16573. pixels to be used as identity matrix for 3D lookup tables. Each component is
  16574. coded on a @code{1/(N*N)} scale.
  16575. @item color, c
  16576. Specify the color of the source, only available in the @code{color}
  16577. source. For the syntax of this option, check the
  16578. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16579. @item size, s
  16580. Specify the size of the sourced video. For the syntax of this option, check the
  16581. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16582. The default value is @code{320x240}.
  16583. This option is not available with the @code{allrgb}, @code{allyuv}, and
  16584. @code{haldclutsrc} filters.
  16585. @item rate, r
  16586. Specify the frame rate of the sourced video, as the number of frames
  16587. generated per second. It has to be a string in the format
  16588. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16589. number or a valid video frame rate abbreviation. The default value is
  16590. "25".
  16591. @item duration, d
  16592. Set the duration of the sourced video. See
  16593. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16594. for the accepted syntax.
  16595. If not specified, or the expressed duration is negative, the video is
  16596. supposed to be generated forever.
  16597. @item sar
  16598. Set the sample aspect ratio of the sourced video.
  16599. @item alpha
  16600. Specify the alpha (opacity) of the background, only available in the
  16601. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  16602. 255 (fully opaque, the default).
  16603. @item decimals, n
  16604. Set the number of decimals to show in the timestamp, only available in the
  16605. @code{testsrc} source.
  16606. The displayed timestamp value will correspond to the original
  16607. timestamp value multiplied by the power of 10 of the specified
  16608. value. Default value is 0.
  16609. @end table
  16610. @subsection Examples
  16611. @itemize
  16612. @item
  16613. Generate a video with a duration of 5.3 seconds, with size
  16614. 176x144 and a frame rate of 10 frames per second:
  16615. @example
  16616. testsrc=duration=5.3:size=qcif:rate=10
  16617. @end example
  16618. @item
  16619. The following graph description will generate a red source
  16620. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  16621. frames per second:
  16622. @example
  16623. color=c=red@@0.2:s=qcif:r=10
  16624. @end example
  16625. @item
  16626. If the input content is to be ignored, @code{nullsrc} can be used. The
  16627. following command generates noise in the luminance plane by employing
  16628. the @code{geq} filter:
  16629. @example
  16630. nullsrc=s=256x256, geq=random(1)*255:128:128
  16631. @end example
  16632. @end itemize
  16633. @subsection Commands
  16634. The @code{color} source supports the following commands:
  16635. @table @option
  16636. @item c, color
  16637. Set the color of the created image. Accepts the same syntax of the
  16638. corresponding @option{color} option.
  16639. @end table
  16640. @section openclsrc
  16641. Generate video using an OpenCL program.
  16642. @table @option
  16643. @item source
  16644. OpenCL program source file.
  16645. @item kernel
  16646. Kernel name in program.
  16647. @item size, s
  16648. Size of frames to generate. This must be set.
  16649. @item format
  16650. Pixel format to use for the generated frames. This must be set.
  16651. @item rate, r
  16652. Number of frames generated every second. Default value is '25'.
  16653. @end table
  16654. For details of how the program loading works, see the @ref{program_opencl}
  16655. filter.
  16656. Example programs:
  16657. @itemize
  16658. @item
  16659. Generate a colour ramp by setting pixel values from the position of the pixel
  16660. in the output image. (Note that this will work with all pixel formats, but
  16661. the generated output will not be the same.)
  16662. @verbatim
  16663. __kernel void ramp(__write_only image2d_t dst,
  16664. unsigned int index)
  16665. {
  16666. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16667. float4 val;
  16668. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  16669. write_imagef(dst, loc, val);
  16670. }
  16671. @end verbatim
  16672. @item
  16673. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  16674. @verbatim
  16675. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  16676. unsigned int index)
  16677. {
  16678. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16679. float4 value = 0.0f;
  16680. int x = loc.x + index;
  16681. int y = loc.y + index;
  16682. while (x > 0 || y > 0) {
  16683. if (x % 3 == 1 && y % 3 == 1) {
  16684. value = 1.0f;
  16685. break;
  16686. }
  16687. x /= 3;
  16688. y /= 3;
  16689. }
  16690. write_imagef(dst, loc, value);
  16691. }
  16692. @end verbatim
  16693. @end itemize
  16694. @section sierpinski
  16695. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  16696. This source accepts the following options:
  16697. @table @option
  16698. @item size, s
  16699. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16700. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16701. @item rate, r
  16702. Set frame rate, expressed as number of frames per second. Default
  16703. value is "25".
  16704. @item seed
  16705. Set seed which is used for random panning.
  16706. @item jump
  16707. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  16708. @item type
  16709. Set fractal type, can be default @code{carpet} or @code{triangle}.
  16710. @end table
  16711. @c man end VIDEO SOURCES
  16712. @chapter Video Sinks
  16713. @c man begin VIDEO SINKS
  16714. Below is a description of the currently available video sinks.
  16715. @section buffersink
  16716. Buffer video frames, and make them available to the end of the filter
  16717. graph.
  16718. This sink is mainly intended for programmatic use, in particular
  16719. through the interface defined in @file{libavfilter/buffersink.h}
  16720. or the options system.
  16721. It accepts a pointer to an AVBufferSinkContext structure, which
  16722. defines the incoming buffers' formats, to be passed as the opaque
  16723. parameter to @code{avfilter_init_filter} for initialization.
  16724. @section nullsink
  16725. Null video sink: do absolutely nothing with the input video. It is
  16726. mainly useful as a template and for use in analysis / debugging
  16727. tools.
  16728. @c man end VIDEO SINKS
  16729. @chapter Multimedia Filters
  16730. @c man begin MULTIMEDIA FILTERS
  16731. Below is a description of the currently available multimedia filters.
  16732. @section abitscope
  16733. Convert input audio to a video output, displaying the audio bit scope.
  16734. The filter accepts the following options:
  16735. @table @option
  16736. @item rate, r
  16737. Set frame rate, expressed as number of frames per second. Default
  16738. value is "25".
  16739. @item size, s
  16740. Specify the video size for the output. For the syntax of this option, check the
  16741. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16742. Default value is @code{1024x256}.
  16743. @item colors
  16744. Specify list of colors separated by space or by '|' which will be used to
  16745. draw channels. Unrecognized or missing colors will be replaced
  16746. by white color.
  16747. @end table
  16748. @section adrawgraph
  16749. Draw a graph using input audio metadata.
  16750. See @ref{drawgraph}
  16751. @section agraphmonitor
  16752. See @ref{graphmonitor}.
  16753. @section ahistogram
  16754. Convert input audio to a video output, displaying the volume histogram.
  16755. The filter accepts the following options:
  16756. @table @option
  16757. @item dmode
  16758. Specify how histogram is calculated.
  16759. It accepts the following values:
  16760. @table @samp
  16761. @item single
  16762. Use single histogram for all channels.
  16763. @item separate
  16764. Use separate histogram for each channel.
  16765. @end table
  16766. Default is @code{single}.
  16767. @item rate, r
  16768. Set frame rate, expressed as number of frames per second. Default
  16769. value is "25".
  16770. @item size, s
  16771. Specify the video size for the output. For the syntax of this option, check the
  16772. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16773. Default value is @code{hd720}.
  16774. @item scale
  16775. Set display scale.
  16776. It accepts the following values:
  16777. @table @samp
  16778. @item log
  16779. logarithmic
  16780. @item sqrt
  16781. square root
  16782. @item cbrt
  16783. cubic root
  16784. @item lin
  16785. linear
  16786. @item rlog
  16787. reverse logarithmic
  16788. @end table
  16789. Default is @code{log}.
  16790. @item ascale
  16791. Set amplitude scale.
  16792. It accepts the following values:
  16793. @table @samp
  16794. @item log
  16795. logarithmic
  16796. @item lin
  16797. linear
  16798. @end table
  16799. Default is @code{log}.
  16800. @item acount
  16801. Set how much frames to accumulate in histogram.
  16802. Default is 1. Setting this to -1 accumulates all frames.
  16803. @item rheight
  16804. Set histogram ratio of window height.
  16805. @item slide
  16806. Set sonogram sliding.
  16807. It accepts the following values:
  16808. @table @samp
  16809. @item replace
  16810. replace old rows with new ones.
  16811. @item scroll
  16812. scroll from top to bottom.
  16813. @end table
  16814. Default is @code{replace}.
  16815. @end table
  16816. @section aphasemeter
  16817. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16818. representing mean phase of current audio frame. A video output can also be produced and is
  16819. enabled by default. The audio is passed through as first output.
  16820. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16821. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16822. and @code{1} means channels are in phase.
  16823. The filter accepts the following options, all related to its video output:
  16824. @table @option
  16825. @item rate, r
  16826. Set the output frame rate. Default value is @code{25}.
  16827. @item size, s
  16828. Set the video size for the output. For the syntax of this option, check the
  16829. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16830. Default value is @code{800x400}.
  16831. @item rc
  16832. @item gc
  16833. @item bc
  16834. Specify the red, green, blue contrast. Default values are @code{2},
  16835. @code{7} and @code{1}.
  16836. Allowed range is @code{[0, 255]}.
  16837. @item mpc
  16838. Set color which will be used for drawing median phase. If color is
  16839. @code{none} which is default, no median phase value will be drawn.
  16840. @item video
  16841. Enable video output. Default is enabled.
  16842. @end table
  16843. @section avectorscope
  16844. Convert input audio to a video output, representing the audio vector
  16845. scope.
  16846. The filter is used to measure the difference between channels of stereo
  16847. audio stream. A monaural signal, consisting of identical left and right
  16848. signal, results in straight vertical line. Any stereo separation is visible
  16849. as a deviation from this line, creating a Lissajous figure.
  16850. If the straight (or deviation from it) but horizontal line appears this
  16851. indicates that the left and right channels are out of phase.
  16852. The filter accepts the following options:
  16853. @table @option
  16854. @item mode, m
  16855. Set the vectorscope mode.
  16856. Available values are:
  16857. @table @samp
  16858. @item lissajous
  16859. Lissajous rotated by 45 degrees.
  16860. @item lissajous_xy
  16861. Same as above but not rotated.
  16862. @item polar
  16863. Shape resembling half of circle.
  16864. @end table
  16865. Default value is @samp{lissajous}.
  16866. @item size, s
  16867. Set the video size for the output. For the syntax of this option, check the
  16868. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16869. Default value is @code{400x400}.
  16870. @item rate, r
  16871. Set the output frame rate. Default value is @code{25}.
  16872. @item rc
  16873. @item gc
  16874. @item bc
  16875. @item ac
  16876. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16877. @code{160}, @code{80} and @code{255}.
  16878. Allowed range is @code{[0, 255]}.
  16879. @item rf
  16880. @item gf
  16881. @item bf
  16882. @item af
  16883. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16884. @code{10}, @code{5} and @code{5}.
  16885. Allowed range is @code{[0, 255]}.
  16886. @item zoom
  16887. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16888. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16889. @item draw
  16890. Set the vectorscope drawing mode.
  16891. Available values are:
  16892. @table @samp
  16893. @item dot
  16894. Draw dot for each sample.
  16895. @item line
  16896. Draw line between previous and current sample.
  16897. @end table
  16898. Default value is @samp{dot}.
  16899. @item scale
  16900. Specify amplitude scale of audio samples.
  16901. Available values are:
  16902. @table @samp
  16903. @item lin
  16904. Linear.
  16905. @item sqrt
  16906. Square root.
  16907. @item cbrt
  16908. Cubic root.
  16909. @item log
  16910. Logarithmic.
  16911. @end table
  16912. @item swap
  16913. Swap left channel axis with right channel axis.
  16914. @item mirror
  16915. Mirror axis.
  16916. @table @samp
  16917. @item none
  16918. No mirror.
  16919. @item x
  16920. Mirror only x axis.
  16921. @item y
  16922. Mirror only y axis.
  16923. @item xy
  16924. Mirror both axis.
  16925. @end table
  16926. @end table
  16927. @subsection Examples
  16928. @itemize
  16929. @item
  16930. Complete example using @command{ffplay}:
  16931. @example
  16932. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16933. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16934. @end example
  16935. @end itemize
  16936. @section bench, abench
  16937. Benchmark part of a filtergraph.
  16938. The filter accepts the following options:
  16939. @table @option
  16940. @item action
  16941. Start or stop a timer.
  16942. Available values are:
  16943. @table @samp
  16944. @item start
  16945. Get the current time, set it as frame metadata (using the key
  16946. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16947. @item stop
  16948. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16949. the input frame metadata to get the time difference. Time difference, average,
  16950. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16951. @code{min}) are then printed. The timestamps are expressed in seconds.
  16952. @end table
  16953. @end table
  16954. @subsection Examples
  16955. @itemize
  16956. @item
  16957. Benchmark @ref{selectivecolor} filter:
  16958. @example
  16959. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16960. @end example
  16961. @end itemize
  16962. @section concat
  16963. Concatenate audio and video streams, joining them together one after the
  16964. other.
  16965. The filter works on segments of synchronized video and audio streams. All
  16966. segments must have the same number of streams of each type, and that will
  16967. also be the number of streams at output.
  16968. The filter accepts the following options:
  16969. @table @option
  16970. @item n
  16971. Set the number of segments. Default is 2.
  16972. @item v
  16973. Set the number of output video streams, that is also the number of video
  16974. streams in each segment. Default is 1.
  16975. @item a
  16976. Set the number of output audio streams, that is also the number of audio
  16977. streams in each segment. Default is 0.
  16978. @item unsafe
  16979. Activate unsafe mode: do not fail if segments have a different format.
  16980. @end table
  16981. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16982. @var{a} audio outputs.
  16983. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16984. segment, in the same order as the outputs, then the inputs for the second
  16985. segment, etc.
  16986. Related streams do not always have exactly the same duration, for various
  16987. reasons including codec frame size or sloppy authoring. For that reason,
  16988. related synchronized streams (e.g. a video and its audio track) should be
  16989. concatenated at once. The concat filter will use the duration of the longest
  16990. stream in each segment (except the last one), and if necessary pad shorter
  16991. audio streams with silence.
  16992. For this filter to work correctly, all segments must start at timestamp 0.
  16993. All corresponding streams must have the same parameters in all segments; the
  16994. filtering system will automatically select a common pixel format for video
  16995. streams, and a common sample format, sample rate and channel layout for
  16996. audio streams, but other settings, such as resolution, must be converted
  16997. explicitly by the user.
  16998. Different frame rates are acceptable but will result in variable frame rate
  16999. at output; be sure to configure the output file to handle it.
  17000. @subsection Examples
  17001. @itemize
  17002. @item
  17003. Concatenate an opening, an episode and an ending, all in bilingual version
  17004. (video in stream 0, audio in streams 1 and 2):
  17005. @example
  17006. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  17007. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  17008. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  17009. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  17010. @end example
  17011. @item
  17012. Concatenate two parts, handling audio and video separately, using the
  17013. (a)movie sources, and adjusting the resolution:
  17014. @example
  17015. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  17016. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  17017. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  17018. @end example
  17019. Note that a desync will happen at the stitch if the audio and video streams
  17020. do not have exactly the same duration in the first file.
  17021. @end itemize
  17022. @subsection Commands
  17023. This filter supports the following commands:
  17024. @table @option
  17025. @item next
  17026. Close the current segment and step to the next one
  17027. @end table
  17028. @anchor{ebur128}
  17029. @section ebur128
  17030. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  17031. level. By default, it logs a message at a frequency of 10Hz with the
  17032. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  17033. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  17034. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  17035. sample format is double-precision floating point. The input stream will be converted to
  17036. this specification, if needed. Users may need to insert aformat and/or aresample filters
  17037. after this filter to obtain the original parameters.
  17038. The filter also has a video output (see the @var{video} option) with a real
  17039. time graph to observe the loudness evolution. The graphic contains the logged
  17040. message mentioned above, so it is not printed anymore when this option is set,
  17041. unless the verbose logging is set. The main graphing area contains the
  17042. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  17043. the momentary loudness (400 milliseconds), but can optionally be configured
  17044. to instead display short-term loudness (see @var{gauge}).
  17045. The green area marks a +/- 1LU target range around the target loudness
  17046. (-23LUFS by default, unless modified through @var{target}).
  17047. More information about the Loudness Recommendation EBU R128 on
  17048. @url{http://tech.ebu.ch/loudness}.
  17049. The filter accepts the following options:
  17050. @table @option
  17051. @item video
  17052. Activate the video output. The audio stream is passed unchanged whether this
  17053. option is set or no. The video stream will be the first output stream if
  17054. activated. Default is @code{0}.
  17055. @item size
  17056. Set the video size. This option is for video only. For the syntax of this
  17057. option, check the
  17058. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17059. Default and minimum resolution is @code{640x480}.
  17060. @item meter
  17061. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  17062. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  17063. other integer value between this range is allowed.
  17064. @item metadata
  17065. Set metadata injection. If set to @code{1}, the audio input will be segmented
  17066. into 100ms output frames, each of them containing various loudness information
  17067. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  17068. Default is @code{0}.
  17069. @item framelog
  17070. Force the frame logging level.
  17071. Available values are:
  17072. @table @samp
  17073. @item info
  17074. information logging level
  17075. @item verbose
  17076. verbose logging level
  17077. @end table
  17078. By default, the logging level is set to @var{info}. If the @option{video} or
  17079. the @option{metadata} options are set, it switches to @var{verbose}.
  17080. @item peak
  17081. Set peak mode(s).
  17082. Available modes can be cumulated (the option is a @code{flag} type). Possible
  17083. values are:
  17084. @table @samp
  17085. @item none
  17086. Disable any peak mode (default).
  17087. @item sample
  17088. Enable sample-peak mode.
  17089. Simple peak mode looking for the higher sample value. It logs a message
  17090. for sample-peak (identified by @code{SPK}).
  17091. @item true
  17092. Enable true-peak mode.
  17093. If enabled, the peak lookup is done on an over-sampled version of the input
  17094. stream for better peak accuracy. It logs a message for true-peak.
  17095. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  17096. This mode requires a build with @code{libswresample}.
  17097. @end table
  17098. @item dualmono
  17099. Treat mono input files as "dual mono". If a mono file is intended for playback
  17100. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  17101. If set to @code{true}, this option will compensate for this effect.
  17102. Multi-channel input files are not affected by this option.
  17103. @item panlaw
  17104. Set a specific pan law to be used for the measurement of dual mono files.
  17105. This parameter is optional, and has a default value of -3.01dB.
  17106. @item target
  17107. Set a specific target level (in LUFS) used as relative zero in the visualization.
  17108. This parameter is optional and has a default value of -23LUFS as specified
  17109. by EBU R128. However, material published online may prefer a level of -16LUFS
  17110. (e.g. for use with podcasts or video platforms).
  17111. @item gauge
  17112. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  17113. @code{shortterm}. By default the momentary value will be used, but in certain
  17114. scenarios it may be more useful to observe the short term value instead (e.g.
  17115. live mixing).
  17116. @item scale
  17117. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  17118. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  17119. video output, not the summary or continuous log output.
  17120. @end table
  17121. @subsection Examples
  17122. @itemize
  17123. @item
  17124. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  17125. @example
  17126. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  17127. @end example
  17128. @item
  17129. Run an analysis with @command{ffmpeg}:
  17130. @example
  17131. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  17132. @end example
  17133. @end itemize
  17134. @section interleave, ainterleave
  17135. Temporally interleave frames from several inputs.
  17136. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  17137. These filters read frames from several inputs and send the oldest
  17138. queued frame to the output.
  17139. Input streams must have well defined, monotonically increasing frame
  17140. timestamp values.
  17141. In order to submit one frame to output, these filters need to enqueue
  17142. at least one frame for each input, so they cannot work in case one
  17143. input is not yet terminated and will not receive incoming frames.
  17144. For example consider the case when one input is a @code{select} filter
  17145. which always drops input frames. The @code{interleave} filter will keep
  17146. reading from that input, but it will never be able to send new frames
  17147. to output until the input sends an end-of-stream signal.
  17148. Also, depending on inputs synchronization, the filters will drop
  17149. frames in case one input receives more frames than the other ones, and
  17150. the queue is already filled.
  17151. These filters accept the following options:
  17152. @table @option
  17153. @item nb_inputs, n
  17154. Set the number of different inputs, it is 2 by default.
  17155. @end table
  17156. @subsection Examples
  17157. @itemize
  17158. @item
  17159. Interleave frames belonging to different streams using @command{ffmpeg}:
  17160. @example
  17161. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  17162. @end example
  17163. @item
  17164. Add flickering blur effect:
  17165. @example
  17166. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  17167. @end example
  17168. @end itemize
  17169. @section metadata, ametadata
  17170. Manipulate frame metadata.
  17171. This filter accepts the following options:
  17172. @table @option
  17173. @item mode
  17174. Set mode of operation of the filter.
  17175. Can be one of the following:
  17176. @table @samp
  17177. @item select
  17178. If both @code{value} and @code{key} is set, select frames
  17179. which have such metadata. If only @code{key} is set, select
  17180. every frame that has such key in metadata.
  17181. @item add
  17182. Add new metadata @code{key} and @code{value}. If key is already available
  17183. do nothing.
  17184. @item modify
  17185. Modify value of already present key.
  17186. @item delete
  17187. If @code{value} is set, delete only keys that have such value.
  17188. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  17189. the frame.
  17190. @item print
  17191. Print key and its value if metadata was found. If @code{key} is not set print all
  17192. metadata values available in frame.
  17193. @end table
  17194. @item key
  17195. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  17196. @item value
  17197. Set metadata value which will be used. This option is mandatory for
  17198. @code{modify} and @code{add} mode.
  17199. @item function
  17200. Which function to use when comparing metadata value and @code{value}.
  17201. Can be one of following:
  17202. @table @samp
  17203. @item same_str
  17204. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  17205. @item starts_with
  17206. Values are interpreted as strings, returns true if metadata value starts with
  17207. the @code{value} option string.
  17208. @item less
  17209. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  17210. @item equal
  17211. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  17212. @item greater
  17213. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  17214. @item expr
  17215. Values are interpreted as floats, returns true if expression from option @code{expr}
  17216. evaluates to true.
  17217. @item ends_with
  17218. Values are interpreted as strings, returns true if metadata value ends with
  17219. the @code{value} option string.
  17220. @end table
  17221. @item expr
  17222. Set expression which is used when @code{function} is set to @code{expr}.
  17223. The expression is evaluated through the eval API and can contain the following
  17224. constants:
  17225. @table @option
  17226. @item VALUE1
  17227. Float representation of @code{value} from metadata key.
  17228. @item VALUE2
  17229. Float representation of @code{value} as supplied by user in @code{value} option.
  17230. @end table
  17231. @item file
  17232. If specified in @code{print} mode, output is written to the named file. Instead of
  17233. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  17234. for standard output. If @code{file} option is not set, output is written to the log
  17235. with AV_LOG_INFO loglevel.
  17236. @end table
  17237. @subsection Examples
  17238. @itemize
  17239. @item
  17240. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  17241. between 0 and 1.
  17242. @example
  17243. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  17244. @end example
  17245. @item
  17246. Print silencedetect output to file @file{metadata.txt}.
  17247. @example
  17248. silencedetect,ametadata=mode=print:file=metadata.txt
  17249. @end example
  17250. @item
  17251. Direct all metadata to a pipe with file descriptor 4.
  17252. @example
  17253. metadata=mode=print:file='pipe\:4'
  17254. @end example
  17255. @end itemize
  17256. @section perms, aperms
  17257. Set read/write permissions for the output frames.
  17258. These filters are mainly aimed at developers to test direct path in the
  17259. following filter in the filtergraph.
  17260. The filters accept the following options:
  17261. @table @option
  17262. @item mode
  17263. Select the permissions mode.
  17264. It accepts the following values:
  17265. @table @samp
  17266. @item none
  17267. Do nothing. This is the default.
  17268. @item ro
  17269. Set all the output frames read-only.
  17270. @item rw
  17271. Set all the output frames directly writable.
  17272. @item toggle
  17273. Make the frame read-only if writable, and writable if read-only.
  17274. @item random
  17275. Set each output frame read-only or writable randomly.
  17276. @end table
  17277. @item seed
  17278. Set the seed for the @var{random} mode, must be an integer included between
  17279. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  17280. @code{-1}, the filter will try to use a good random seed on a best effort
  17281. basis.
  17282. @end table
  17283. Note: in case of auto-inserted filter between the permission filter and the
  17284. following one, the permission might not be received as expected in that
  17285. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  17286. perms/aperms filter can avoid this problem.
  17287. @section realtime, arealtime
  17288. Slow down filtering to match real time approximately.
  17289. These filters will pause the filtering for a variable amount of time to
  17290. match the output rate with the input timestamps.
  17291. They are similar to the @option{re} option to @code{ffmpeg}.
  17292. They accept the following options:
  17293. @table @option
  17294. @item limit
  17295. Time limit for the pauses. Any pause longer than that will be considered
  17296. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  17297. @item speed
  17298. Speed factor for processing. The value must be a float larger than zero.
  17299. Values larger than 1.0 will result in faster than realtime processing,
  17300. smaller will slow processing down. The @var{limit} is automatically adapted
  17301. accordingly. Default is 1.0.
  17302. A processing speed faster than what is possible without these filters cannot
  17303. be achieved.
  17304. @end table
  17305. @anchor{select}
  17306. @section select, aselect
  17307. Select frames to pass in output.
  17308. This filter accepts the following options:
  17309. @table @option
  17310. @item expr, e
  17311. Set expression, which is evaluated for each input frame.
  17312. If the expression is evaluated to zero, the frame is discarded.
  17313. If the evaluation result is negative or NaN, the frame is sent to the
  17314. first output; otherwise it is sent to the output with index
  17315. @code{ceil(val)-1}, assuming that the input index starts from 0.
  17316. For example a value of @code{1.2} corresponds to the output with index
  17317. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  17318. @item outputs, n
  17319. Set the number of outputs. The output to which to send the selected
  17320. frame is based on the result of the evaluation. Default value is 1.
  17321. @end table
  17322. The expression can contain the following constants:
  17323. @table @option
  17324. @item n
  17325. The (sequential) number of the filtered frame, starting from 0.
  17326. @item selected_n
  17327. The (sequential) number of the selected frame, starting from 0.
  17328. @item prev_selected_n
  17329. The sequential number of the last selected frame. It's NAN if undefined.
  17330. @item TB
  17331. The timebase of the input timestamps.
  17332. @item pts
  17333. The PTS (Presentation TimeStamp) of the filtered video frame,
  17334. expressed in @var{TB} units. It's NAN if undefined.
  17335. @item t
  17336. The PTS of the filtered video frame,
  17337. expressed in seconds. It's NAN if undefined.
  17338. @item prev_pts
  17339. The PTS of the previously filtered video frame. It's NAN if undefined.
  17340. @item prev_selected_pts
  17341. The PTS of the last previously filtered video frame. It's NAN if undefined.
  17342. @item prev_selected_t
  17343. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  17344. @item start_pts
  17345. The PTS of the first video frame in the video. It's NAN if undefined.
  17346. @item start_t
  17347. The time of the first video frame in the video. It's NAN if undefined.
  17348. @item pict_type @emph{(video only)}
  17349. The type of the filtered frame. It can assume one of the following
  17350. values:
  17351. @table @option
  17352. @item I
  17353. @item P
  17354. @item B
  17355. @item S
  17356. @item SI
  17357. @item SP
  17358. @item BI
  17359. @end table
  17360. @item interlace_type @emph{(video only)}
  17361. The frame interlace type. It can assume one of the following values:
  17362. @table @option
  17363. @item PROGRESSIVE
  17364. The frame is progressive (not interlaced).
  17365. @item TOPFIRST
  17366. The frame is top-field-first.
  17367. @item BOTTOMFIRST
  17368. The frame is bottom-field-first.
  17369. @end table
  17370. @item consumed_sample_n @emph{(audio only)}
  17371. the number of selected samples before the current frame
  17372. @item samples_n @emph{(audio only)}
  17373. the number of samples in the current frame
  17374. @item sample_rate @emph{(audio only)}
  17375. the input sample rate
  17376. @item key
  17377. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  17378. @item pos
  17379. the position in the file of the filtered frame, -1 if the information
  17380. is not available (e.g. for synthetic video)
  17381. @item scene @emph{(video only)}
  17382. value between 0 and 1 to indicate a new scene; a low value reflects a low
  17383. probability for the current frame to introduce a new scene, while a higher
  17384. value means the current frame is more likely to be one (see the example below)
  17385. @item concatdec_select
  17386. The concat demuxer can select only part of a concat input file by setting an
  17387. inpoint and an outpoint, but the output packets may not be entirely contained
  17388. in the selected interval. By using this variable, it is possible to skip frames
  17389. generated by the concat demuxer which are not exactly contained in the selected
  17390. interval.
  17391. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  17392. and the @var{lavf.concat.duration} packet metadata values which are also
  17393. present in the decoded frames.
  17394. The @var{concatdec_select} variable is -1 if the frame pts is at least
  17395. start_time and either the duration metadata is missing or the frame pts is less
  17396. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  17397. missing.
  17398. That basically means that an input frame is selected if its pts is within the
  17399. interval set by the concat demuxer.
  17400. @end table
  17401. The default value of the select expression is "1".
  17402. @subsection Examples
  17403. @itemize
  17404. @item
  17405. Select all frames in input:
  17406. @example
  17407. select
  17408. @end example
  17409. The example above is the same as:
  17410. @example
  17411. select=1
  17412. @end example
  17413. @item
  17414. Skip all frames:
  17415. @example
  17416. select=0
  17417. @end example
  17418. @item
  17419. Select only I-frames:
  17420. @example
  17421. select='eq(pict_type\,I)'
  17422. @end example
  17423. @item
  17424. Select one frame every 100:
  17425. @example
  17426. select='not(mod(n\,100))'
  17427. @end example
  17428. @item
  17429. Select only frames contained in the 10-20 time interval:
  17430. @example
  17431. select=between(t\,10\,20)
  17432. @end example
  17433. @item
  17434. Select only I-frames contained in the 10-20 time interval:
  17435. @example
  17436. select=between(t\,10\,20)*eq(pict_type\,I)
  17437. @end example
  17438. @item
  17439. Select frames with a minimum distance of 10 seconds:
  17440. @example
  17441. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  17442. @end example
  17443. @item
  17444. Use aselect to select only audio frames with samples number > 100:
  17445. @example
  17446. aselect='gt(samples_n\,100)'
  17447. @end example
  17448. @item
  17449. Create a mosaic of the first scenes:
  17450. @example
  17451. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  17452. @end example
  17453. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  17454. choice.
  17455. @item
  17456. Send even and odd frames to separate outputs, and compose them:
  17457. @example
  17458. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  17459. @end example
  17460. @item
  17461. Select useful frames from an ffconcat file which is using inpoints and
  17462. outpoints but where the source files are not intra frame only.
  17463. @example
  17464. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  17465. @end example
  17466. @end itemize
  17467. @section sendcmd, asendcmd
  17468. Send commands to filters in the filtergraph.
  17469. These filters read commands to be sent to other filters in the
  17470. filtergraph.
  17471. @code{sendcmd} must be inserted between two video filters,
  17472. @code{asendcmd} must be inserted between two audio filters, but apart
  17473. from that they act the same way.
  17474. The specification of commands can be provided in the filter arguments
  17475. with the @var{commands} option, or in a file specified by the
  17476. @var{filename} option.
  17477. These filters accept the following options:
  17478. @table @option
  17479. @item commands, c
  17480. Set the commands to be read and sent to the other filters.
  17481. @item filename, f
  17482. Set the filename of the commands to be read and sent to the other
  17483. filters.
  17484. @end table
  17485. @subsection Commands syntax
  17486. A commands description consists of a sequence of interval
  17487. specifications, comprising a list of commands to be executed when a
  17488. particular event related to that interval occurs. The occurring event
  17489. is typically the current frame time entering or leaving a given time
  17490. interval.
  17491. An interval is specified by the following syntax:
  17492. @example
  17493. @var{START}[-@var{END}] @var{COMMANDS};
  17494. @end example
  17495. The time interval is specified by the @var{START} and @var{END} times.
  17496. @var{END} is optional and defaults to the maximum time.
  17497. The current frame time is considered within the specified interval if
  17498. it is included in the interval [@var{START}, @var{END}), that is when
  17499. the time is greater or equal to @var{START} and is lesser than
  17500. @var{END}.
  17501. @var{COMMANDS} consists of a sequence of one or more command
  17502. specifications, separated by ",", relating to that interval. The
  17503. syntax of a command specification is given by:
  17504. @example
  17505. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  17506. @end example
  17507. @var{FLAGS} is optional and specifies the type of events relating to
  17508. the time interval which enable sending the specified command, and must
  17509. be a non-null sequence of identifier flags separated by "+" or "|" and
  17510. enclosed between "[" and "]".
  17511. The following flags are recognized:
  17512. @table @option
  17513. @item enter
  17514. The command is sent when the current frame timestamp enters the
  17515. specified interval. In other words, the command is sent when the
  17516. previous frame timestamp was not in the given interval, and the
  17517. current is.
  17518. @item leave
  17519. The command is sent when the current frame timestamp leaves the
  17520. specified interval. In other words, the command is sent when the
  17521. previous frame timestamp was in the given interval, and the
  17522. current is not.
  17523. @end table
  17524. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  17525. assumed.
  17526. @var{TARGET} specifies the target of the command, usually the name of
  17527. the filter class or a specific filter instance name.
  17528. @var{COMMAND} specifies the name of the command for the target filter.
  17529. @var{ARG} is optional and specifies the optional list of argument for
  17530. the given @var{COMMAND}.
  17531. Between one interval specification and another, whitespaces, or
  17532. sequences of characters starting with @code{#} until the end of line,
  17533. are ignored and can be used to annotate comments.
  17534. A simplified BNF description of the commands specification syntax
  17535. follows:
  17536. @example
  17537. @var{COMMAND_FLAG} ::= "enter" | "leave"
  17538. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  17539. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  17540. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  17541. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  17542. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  17543. @end example
  17544. @subsection Examples
  17545. @itemize
  17546. @item
  17547. Specify audio tempo change at second 4:
  17548. @example
  17549. asendcmd=c='4.0 atempo tempo 1.5',atempo
  17550. @end example
  17551. @item
  17552. Target a specific filter instance:
  17553. @example
  17554. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  17555. @end example
  17556. @item
  17557. Specify a list of drawtext and hue commands in a file.
  17558. @example
  17559. # show text in the interval 5-10
  17560. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  17561. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  17562. # desaturate the image in the interval 15-20
  17563. 15.0-20.0 [enter] hue s 0,
  17564. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  17565. [leave] hue s 1,
  17566. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  17567. # apply an exponential saturation fade-out effect, starting from time 25
  17568. 25 [enter] hue s exp(25-t)
  17569. @end example
  17570. A filtergraph allowing to read and process the above command list
  17571. stored in a file @file{test.cmd}, can be specified with:
  17572. @example
  17573. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  17574. @end example
  17575. @end itemize
  17576. @anchor{setpts}
  17577. @section setpts, asetpts
  17578. Change the PTS (presentation timestamp) of the input frames.
  17579. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  17580. This filter accepts the following options:
  17581. @table @option
  17582. @item expr
  17583. The expression which is evaluated for each frame to construct its timestamp.
  17584. @end table
  17585. The expression is evaluated through the eval API and can contain the following
  17586. constants:
  17587. @table @option
  17588. @item FRAME_RATE, FR
  17589. frame rate, only defined for constant frame-rate video
  17590. @item PTS
  17591. The presentation timestamp in input
  17592. @item N
  17593. The count of the input frame for video or the number of consumed samples,
  17594. not including the current frame for audio, starting from 0.
  17595. @item NB_CONSUMED_SAMPLES
  17596. The number of consumed samples, not including the current frame (only
  17597. audio)
  17598. @item NB_SAMPLES, S
  17599. The number of samples in the current frame (only audio)
  17600. @item SAMPLE_RATE, SR
  17601. The audio sample rate.
  17602. @item STARTPTS
  17603. The PTS of the first frame.
  17604. @item STARTT
  17605. the time in seconds of the first frame
  17606. @item INTERLACED
  17607. State whether the current frame is interlaced.
  17608. @item T
  17609. the time in seconds of the current frame
  17610. @item POS
  17611. original position in the file of the frame, or undefined if undefined
  17612. for the current frame
  17613. @item PREV_INPTS
  17614. The previous input PTS.
  17615. @item PREV_INT
  17616. previous input time in seconds
  17617. @item PREV_OUTPTS
  17618. The previous output PTS.
  17619. @item PREV_OUTT
  17620. previous output time in seconds
  17621. @item RTCTIME
  17622. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  17623. instead.
  17624. @item RTCSTART
  17625. The wallclock (RTC) time at the start of the movie in microseconds.
  17626. @item TB
  17627. The timebase of the input timestamps.
  17628. @end table
  17629. @subsection Examples
  17630. @itemize
  17631. @item
  17632. Start counting PTS from zero
  17633. @example
  17634. setpts=PTS-STARTPTS
  17635. @end example
  17636. @item
  17637. Apply fast motion effect:
  17638. @example
  17639. setpts=0.5*PTS
  17640. @end example
  17641. @item
  17642. Apply slow motion effect:
  17643. @example
  17644. setpts=2.0*PTS
  17645. @end example
  17646. @item
  17647. Set fixed rate of 25 frames per second:
  17648. @example
  17649. setpts=N/(25*TB)
  17650. @end example
  17651. @item
  17652. Set fixed rate 25 fps with some jitter:
  17653. @example
  17654. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  17655. @end example
  17656. @item
  17657. Apply an offset of 10 seconds to the input PTS:
  17658. @example
  17659. setpts=PTS+10/TB
  17660. @end example
  17661. @item
  17662. Generate timestamps from a "live source" and rebase onto the current timebase:
  17663. @example
  17664. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  17665. @end example
  17666. @item
  17667. Generate timestamps by counting samples:
  17668. @example
  17669. asetpts=N/SR/TB
  17670. @end example
  17671. @end itemize
  17672. @section setrange
  17673. Force color range for the output video frame.
  17674. The @code{setrange} filter marks the color range property for the
  17675. output frames. It does not change the input frame, but only sets the
  17676. corresponding property, which affects how the frame is treated by
  17677. following filters.
  17678. The filter accepts the following options:
  17679. @table @option
  17680. @item range
  17681. Available values are:
  17682. @table @samp
  17683. @item auto
  17684. Keep the same color range property.
  17685. @item unspecified, unknown
  17686. Set the color range as unspecified.
  17687. @item limited, tv, mpeg
  17688. Set the color range as limited.
  17689. @item full, pc, jpeg
  17690. Set the color range as full.
  17691. @end table
  17692. @end table
  17693. @section settb, asettb
  17694. Set the timebase to use for the output frames timestamps.
  17695. It is mainly useful for testing timebase configuration.
  17696. It accepts the following parameters:
  17697. @table @option
  17698. @item expr, tb
  17699. The expression which is evaluated into the output timebase.
  17700. @end table
  17701. The value for @option{tb} is an arithmetic expression representing a
  17702. rational. The expression can contain the constants "AVTB" (the default
  17703. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  17704. audio only). Default value is "intb".
  17705. @subsection Examples
  17706. @itemize
  17707. @item
  17708. Set the timebase to 1/25:
  17709. @example
  17710. settb=expr=1/25
  17711. @end example
  17712. @item
  17713. Set the timebase to 1/10:
  17714. @example
  17715. settb=expr=0.1
  17716. @end example
  17717. @item
  17718. Set the timebase to 1001/1000:
  17719. @example
  17720. settb=1+0.001
  17721. @end example
  17722. @item
  17723. Set the timebase to 2*intb:
  17724. @example
  17725. settb=2*intb
  17726. @end example
  17727. @item
  17728. Set the default timebase value:
  17729. @example
  17730. settb=AVTB
  17731. @end example
  17732. @end itemize
  17733. @section showcqt
  17734. Convert input audio to a video output representing frequency spectrum
  17735. logarithmically using Brown-Puckette constant Q transform algorithm with
  17736. direct frequency domain coefficient calculation (but the transform itself
  17737. is not really constant Q, instead the Q factor is actually variable/clamped),
  17738. with musical tone scale, from E0 to D#10.
  17739. The filter accepts the following options:
  17740. @table @option
  17741. @item size, s
  17742. Specify the video size for the output. It must be even. For the syntax of this option,
  17743. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17744. Default value is @code{1920x1080}.
  17745. @item fps, rate, r
  17746. Set the output frame rate. Default value is @code{25}.
  17747. @item bar_h
  17748. Set the bargraph height. It must be even. Default value is @code{-1} which
  17749. computes the bargraph height automatically.
  17750. @item axis_h
  17751. Set the axis height. It must be even. Default value is @code{-1} which computes
  17752. the axis height automatically.
  17753. @item sono_h
  17754. Set the sonogram height. It must be even. Default value is @code{-1} which
  17755. computes the sonogram height automatically.
  17756. @item fullhd
  17757. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17758. instead. Default value is @code{1}.
  17759. @item sono_v, volume
  17760. Specify the sonogram volume expression. It can contain variables:
  17761. @table @option
  17762. @item bar_v
  17763. the @var{bar_v} evaluated expression
  17764. @item frequency, freq, f
  17765. the frequency where it is evaluated
  17766. @item timeclamp, tc
  17767. the value of @var{timeclamp} option
  17768. @end table
  17769. and functions:
  17770. @table @option
  17771. @item a_weighting(f)
  17772. A-weighting of equal loudness
  17773. @item b_weighting(f)
  17774. B-weighting of equal loudness
  17775. @item c_weighting(f)
  17776. C-weighting of equal loudness.
  17777. @end table
  17778. Default value is @code{16}.
  17779. @item bar_v, volume2
  17780. Specify the bargraph volume expression. It can contain variables:
  17781. @table @option
  17782. @item sono_v
  17783. the @var{sono_v} evaluated expression
  17784. @item frequency, freq, f
  17785. the frequency where it is evaluated
  17786. @item timeclamp, tc
  17787. the value of @var{timeclamp} option
  17788. @end table
  17789. and functions:
  17790. @table @option
  17791. @item a_weighting(f)
  17792. A-weighting of equal loudness
  17793. @item b_weighting(f)
  17794. B-weighting of equal loudness
  17795. @item c_weighting(f)
  17796. C-weighting of equal loudness.
  17797. @end table
  17798. Default value is @code{sono_v}.
  17799. @item sono_g, gamma
  17800. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17801. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17802. Acceptable range is @code{[1, 7]}.
  17803. @item bar_g, gamma2
  17804. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17805. @code{[1, 7]}.
  17806. @item bar_t
  17807. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17808. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17809. @item timeclamp, tc
  17810. Specify the transform timeclamp. At low frequency, there is trade-off between
  17811. accuracy in time domain and frequency domain. If timeclamp is lower,
  17812. event in time domain is represented more accurately (such as fast bass drum),
  17813. otherwise event in frequency domain is represented more accurately
  17814. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17815. @item attack
  17816. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17817. limits future samples by applying asymmetric windowing in time domain, useful
  17818. when low latency is required. Accepted range is @code{[0, 1]}.
  17819. @item basefreq
  17820. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17821. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17822. @item endfreq
  17823. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17824. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17825. @item coeffclamp
  17826. This option is deprecated and ignored.
  17827. @item tlength
  17828. Specify the transform length in time domain. Use this option to control accuracy
  17829. trade-off between time domain and frequency domain at every frequency sample.
  17830. It can contain variables:
  17831. @table @option
  17832. @item frequency, freq, f
  17833. the frequency where it is evaluated
  17834. @item timeclamp, tc
  17835. the value of @var{timeclamp} option.
  17836. @end table
  17837. Default value is @code{384*tc/(384+tc*f)}.
  17838. @item count
  17839. Specify the transform count for every video frame. Default value is @code{6}.
  17840. Acceptable range is @code{[1, 30]}.
  17841. @item fcount
  17842. Specify the transform count for every single pixel. Default value is @code{0},
  17843. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17844. @item fontfile
  17845. Specify font file for use with freetype to draw the axis. If not specified,
  17846. use embedded font. Note that drawing with font file or embedded font is not
  17847. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17848. option instead.
  17849. @item font
  17850. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  17851. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  17852. escaping.
  17853. @item fontcolor
  17854. Specify font color expression. This is arithmetic expression that should return
  17855. integer value 0xRRGGBB. It can contain variables:
  17856. @table @option
  17857. @item frequency, freq, f
  17858. the frequency where it is evaluated
  17859. @item timeclamp, tc
  17860. the value of @var{timeclamp} option
  17861. @end table
  17862. and functions:
  17863. @table @option
  17864. @item midi(f)
  17865. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17866. @item r(x), g(x), b(x)
  17867. red, green, and blue value of intensity x.
  17868. @end table
  17869. Default value is @code{st(0, (midi(f)-59.5)/12);
  17870. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17871. r(1-ld(1)) + b(ld(1))}.
  17872. @item axisfile
  17873. Specify image file to draw the axis. This option override @var{fontfile} and
  17874. @var{fontcolor} option.
  17875. @item axis, text
  17876. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17877. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17878. Default value is @code{1}.
  17879. @item csp
  17880. Set colorspace. The accepted values are:
  17881. @table @samp
  17882. @item unspecified
  17883. Unspecified (default)
  17884. @item bt709
  17885. BT.709
  17886. @item fcc
  17887. FCC
  17888. @item bt470bg
  17889. BT.470BG or BT.601-6 625
  17890. @item smpte170m
  17891. SMPTE-170M or BT.601-6 525
  17892. @item smpte240m
  17893. SMPTE-240M
  17894. @item bt2020ncl
  17895. BT.2020 with non-constant luminance
  17896. @end table
  17897. @item cscheme
  17898. Set spectrogram color scheme. This is list of floating point values with format
  17899. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17900. The default is @code{1|0.5|0|0|0.5|1}.
  17901. @end table
  17902. @subsection Examples
  17903. @itemize
  17904. @item
  17905. Playing audio while showing the spectrum:
  17906. @example
  17907. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17908. @end example
  17909. @item
  17910. Same as above, but with frame rate 30 fps:
  17911. @example
  17912. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17913. @end example
  17914. @item
  17915. Playing at 1280x720:
  17916. @example
  17917. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17918. @end example
  17919. @item
  17920. Disable sonogram display:
  17921. @example
  17922. sono_h=0
  17923. @end example
  17924. @item
  17925. A1 and its harmonics: A1, A2, (near)E3, A3:
  17926. @example
  17927. 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),
  17928. asplit[a][out1]; [a] showcqt [out0]'
  17929. @end example
  17930. @item
  17931. Same as above, but with more accuracy in frequency domain:
  17932. @example
  17933. 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),
  17934. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17935. @end example
  17936. @item
  17937. Custom volume:
  17938. @example
  17939. bar_v=10:sono_v=bar_v*a_weighting(f)
  17940. @end example
  17941. @item
  17942. Custom gamma, now spectrum is linear to the amplitude.
  17943. @example
  17944. bar_g=2:sono_g=2
  17945. @end example
  17946. @item
  17947. Custom tlength equation:
  17948. @example
  17949. 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)))'
  17950. @end example
  17951. @item
  17952. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17953. @example
  17954. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17955. @end example
  17956. @item
  17957. Custom font using fontconfig:
  17958. @example
  17959. font='Courier New,Monospace,mono|bold'
  17960. @end example
  17961. @item
  17962. Custom frequency range with custom axis using image file:
  17963. @example
  17964. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17965. @end example
  17966. @end itemize
  17967. @section showfreqs
  17968. Convert input audio to video output representing the audio power spectrum.
  17969. Audio amplitude is on Y-axis while frequency is on X-axis.
  17970. The filter accepts the following options:
  17971. @table @option
  17972. @item size, s
  17973. Specify size of video. For the syntax of this option, check the
  17974. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17975. Default is @code{1024x512}.
  17976. @item mode
  17977. Set display mode.
  17978. This set how each frequency bin will be represented.
  17979. It accepts the following values:
  17980. @table @samp
  17981. @item line
  17982. @item bar
  17983. @item dot
  17984. @end table
  17985. Default is @code{bar}.
  17986. @item ascale
  17987. Set amplitude scale.
  17988. It accepts the following values:
  17989. @table @samp
  17990. @item lin
  17991. Linear scale.
  17992. @item sqrt
  17993. Square root scale.
  17994. @item cbrt
  17995. Cubic root scale.
  17996. @item log
  17997. Logarithmic scale.
  17998. @end table
  17999. Default is @code{log}.
  18000. @item fscale
  18001. Set frequency scale.
  18002. It accepts the following values:
  18003. @table @samp
  18004. @item lin
  18005. Linear scale.
  18006. @item log
  18007. Logarithmic scale.
  18008. @item rlog
  18009. Reverse logarithmic scale.
  18010. @end table
  18011. Default is @code{lin}.
  18012. @item win_size
  18013. Set window size. Allowed range is from 16 to 65536.
  18014. Default is @code{2048}
  18015. @item win_func
  18016. Set windowing function.
  18017. It accepts the following values:
  18018. @table @samp
  18019. @item rect
  18020. @item bartlett
  18021. @item hanning
  18022. @item hamming
  18023. @item blackman
  18024. @item welch
  18025. @item flattop
  18026. @item bharris
  18027. @item bnuttall
  18028. @item bhann
  18029. @item sine
  18030. @item nuttall
  18031. @item lanczos
  18032. @item gauss
  18033. @item tukey
  18034. @item dolph
  18035. @item cauchy
  18036. @item parzen
  18037. @item poisson
  18038. @item bohman
  18039. @end table
  18040. Default is @code{hanning}.
  18041. @item overlap
  18042. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18043. which means optimal overlap for selected window function will be picked.
  18044. @item averaging
  18045. Set time averaging. Setting this to 0 will display current maximal peaks.
  18046. Default is @code{1}, which means time averaging is disabled.
  18047. @item colors
  18048. Specify list of colors separated by space or by '|' which will be used to
  18049. draw channel frequencies. Unrecognized or missing colors will be replaced
  18050. by white color.
  18051. @item cmode
  18052. Set channel display mode.
  18053. It accepts the following values:
  18054. @table @samp
  18055. @item combined
  18056. @item separate
  18057. @end table
  18058. Default is @code{combined}.
  18059. @item minamp
  18060. Set minimum amplitude used in @code{log} amplitude scaler.
  18061. @end table
  18062. @section showspatial
  18063. Convert stereo input audio to a video output, representing the spatial relationship
  18064. between two channels.
  18065. The filter accepts the following options:
  18066. @table @option
  18067. @item size, s
  18068. Specify the video size for the output. For the syntax of this option, check the
  18069. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18070. Default value is @code{512x512}.
  18071. @item win_size
  18072. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  18073. @item win_func
  18074. Set window function.
  18075. It accepts the following values:
  18076. @table @samp
  18077. @item rect
  18078. @item bartlett
  18079. @item hann
  18080. @item hanning
  18081. @item hamming
  18082. @item blackman
  18083. @item welch
  18084. @item flattop
  18085. @item bharris
  18086. @item bnuttall
  18087. @item bhann
  18088. @item sine
  18089. @item nuttall
  18090. @item lanczos
  18091. @item gauss
  18092. @item tukey
  18093. @item dolph
  18094. @item cauchy
  18095. @item parzen
  18096. @item poisson
  18097. @item bohman
  18098. @end table
  18099. Default value is @code{hann}.
  18100. @item overlap
  18101. Set ratio of overlap window. Default value is @code{0.5}.
  18102. When value is @code{1} overlap is set to recommended size for specific
  18103. window function currently used.
  18104. @end table
  18105. @anchor{showspectrum}
  18106. @section showspectrum
  18107. Convert input audio to a video output, representing the audio frequency
  18108. spectrum.
  18109. The filter accepts the following options:
  18110. @table @option
  18111. @item size, s
  18112. Specify the video size for the output. For the syntax of this option, check the
  18113. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18114. Default value is @code{640x512}.
  18115. @item slide
  18116. Specify how the spectrum should slide along the window.
  18117. It accepts the following values:
  18118. @table @samp
  18119. @item replace
  18120. the samples start again on the left when they reach the right
  18121. @item scroll
  18122. the samples scroll from right to left
  18123. @item fullframe
  18124. frames are only produced when the samples reach the right
  18125. @item rscroll
  18126. the samples scroll from left to right
  18127. @end table
  18128. Default value is @code{replace}.
  18129. @item mode
  18130. Specify display mode.
  18131. It accepts the following values:
  18132. @table @samp
  18133. @item combined
  18134. all channels are displayed in the same row
  18135. @item separate
  18136. all channels are displayed in separate rows
  18137. @end table
  18138. Default value is @samp{combined}.
  18139. @item color
  18140. Specify display color mode.
  18141. It accepts the following values:
  18142. @table @samp
  18143. @item channel
  18144. each channel is displayed in a separate color
  18145. @item intensity
  18146. each channel is displayed using the same color scheme
  18147. @item rainbow
  18148. each channel is displayed using the rainbow color scheme
  18149. @item moreland
  18150. each channel is displayed using the moreland color scheme
  18151. @item nebulae
  18152. each channel is displayed using the nebulae color scheme
  18153. @item fire
  18154. each channel is displayed using the fire color scheme
  18155. @item fiery
  18156. each channel is displayed using the fiery color scheme
  18157. @item fruit
  18158. each channel is displayed using the fruit color scheme
  18159. @item cool
  18160. each channel is displayed using the cool color scheme
  18161. @item magma
  18162. each channel is displayed using the magma color scheme
  18163. @item green
  18164. each channel is displayed using the green color scheme
  18165. @item viridis
  18166. each channel is displayed using the viridis color scheme
  18167. @item plasma
  18168. each channel is displayed using the plasma color scheme
  18169. @item cividis
  18170. each channel is displayed using the cividis color scheme
  18171. @item terrain
  18172. each channel is displayed using the terrain color scheme
  18173. @end table
  18174. Default value is @samp{channel}.
  18175. @item scale
  18176. Specify scale used for calculating intensity color values.
  18177. It accepts the following values:
  18178. @table @samp
  18179. @item lin
  18180. linear
  18181. @item sqrt
  18182. square root, default
  18183. @item cbrt
  18184. cubic root
  18185. @item log
  18186. logarithmic
  18187. @item 4thrt
  18188. 4th root
  18189. @item 5thrt
  18190. 5th root
  18191. @end table
  18192. Default value is @samp{sqrt}.
  18193. @item fscale
  18194. Specify frequency scale.
  18195. It accepts the following values:
  18196. @table @samp
  18197. @item lin
  18198. linear
  18199. @item log
  18200. logarithmic
  18201. @end table
  18202. Default value is @samp{lin}.
  18203. @item saturation
  18204. Set saturation modifier for displayed colors. Negative values provide
  18205. alternative color scheme. @code{0} is no saturation at all.
  18206. Saturation must be in [-10.0, 10.0] range.
  18207. Default value is @code{1}.
  18208. @item win_func
  18209. Set window function.
  18210. It accepts the following values:
  18211. @table @samp
  18212. @item rect
  18213. @item bartlett
  18214. @item hann
  18215. @item hanning
  18216. @item hamming
  18217. @item blackman
  18218. @item welch
  18219. @item flattop
  18220. @item bharris
  18221. @item bnuttall
  18222. @item bhann
  18223. @item sine
  18224. @item nuttall
  18225. @item lanczos
  18226. @item gauss
  18227. @item tukey
  18228. @item dolph
  18229. @item cauchy
  18230. @item parzen
  18231. @item poisson
  18232. @item bohman
  18233. @end table
  18234. Default value is @code{hann}.
  18235. @item orientation
  18236. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18237. @code{horizontal}. Default is @code{vertical}.
  18238. @item overlap
  18239. Set ratio of overlap window. Default value is @code{0}.
  18240. When value is @code{1} overlap is set to recommended size for specific
  18241. window function currently used.
  18242. @item gain
  18243. Set scale gain for calculating intensity color values.
  18244. Default value is @code{1}.
  18245. @item data
  18246. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  18247. @item rotation
  18248. Set color rotation, must be in [-1.0, 1.0] range.
  18249. Default value is @code{0}.
  18250. @item start
  18251. Set start frequency from which to display spectrogram. Default is @code{0}.
  18252. @item stop
  18253. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18254. @item fps
  18255. Set upper frame rate limit. Default is @code{auto}, unlimited.
  18256. @item legend
  18257. Draw time and frequency axes and legends. Default is disabled.
  18258. @end table
  18259. The usage is very similar to the showwaves filter; see the examples in that
  18260. section.
  18261. @subsection Examples
  18262. @itemize
  18263. @item
  18264. Large window with logarithmic color scaling:
  18265. @example
  18266. showspectrum=s=1280x480:scale=log
  18267. @end example
  18268. @item
  18269. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  18270. @example
  18271. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18272. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  18273. @end example
  18274. @end itemize
  18275. @section showspectrumpic
  18276. Convert input audio to a single video frame, representing the audio frequency
  18277. spectrum.
  18278. The filter accepts the following options:
  18279. @table @option
  18280. @item size, s
  18281. Specify the video size for the output. For the syntax of this option, check the
  18282. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18283. Default value is @code{4096x2048}.
  18284. @item mode
  18285. Specify display mode.
  18286. It accepts the following values:
  18287. @table @samp
  18288. @item combined
  18289. all channels are displayed in the same row
  18290. @item separate
  18291. all channels are displayed in separate rows
  18292. @end table
  18293. Default value is @samp{combined}.
  18294. @item color
  18295. Specify display color mode.
  18296. It accepts the following values:
  18297. @table @samp
  18298. @item channel
  18299. each channel is displayed in a separate color
  18300. @item intensity
  18301. each channel is displayed using the same color scheme
  18302. @item rainbow
  18303. each channel is displayed using the rainbow color scheme
  18304. @item moreland
  18305. each channel is displayed using the moreland color scheme
  18306. @item nebulae
  18307. each channel is displayed using the nebulae color scheme
  18308. @item fire
  18309. each channel is displayed using the fire color scheme
  18310. @item fiery
  18311. each channel is displayed using the fiery color scheme
  18312. @item fruit
  18313. each channel is displayed using the fruit color scheme
  18314. @item cool
  18315. each channel is displayed using the cool color scheme
  18316. @item magma
  18317. each channel is displayed using the magma color scheme
  18318. @item green
  18319. each channel is displayed using the green color scheme
  18320. @item viridis
  18321. each channel is displayed using the viridis color scheme
  18322. @item plasma
  18323. each channel is displayed using the plasma color scheme
  18324. @item cividis
  18325. each channel is displayed using the cividis color scheme
  18326. @item terrain
  18327. each channel is displayed using the terrain color scheme
  18328. @end table
  18329. Default value is @samp{intensity}.
  18330. @item scale
  18331. Specify scale used for calculating intensity color values.
  18332. It accepts the following values:
  18333. @table @samp
  18334. @item lin
  18335. linear
  18336. @item sqrt
  18337. square root, default
  18338. @item cbrt
  18339. cubic root
  18340. @item log
  18341. logarithmic
  18342. @item 4thrt
  18343. 4th root
  18344. @item 5thrt
  18345. 5th root
  18346. @end table
  18347. Default value is @samp{log}.
  18348. @item fscale
  18349. Specify frequency scale.
  18350. It accepts the following values:
  18351. @table @samp
  18352. @item lin
  18353. linear
  18354. @item log
  18355. logarithmic
  18356. @end table
  18357. Default value is @samp{lin}.
  18358. @item saturation
  18359. Set saturation modifier for displayed colors. Negative values provide
  18360. alternative color scheme. @code{0} is no saturation at all.
  18361. Saturation must be in [-10.0, 10.0] range.
  18362. Default value is @code{1}.
  18363. @item win_func
  18364. Set window function.
  18365. It accepts the following values:
  18366. @table @samp
  18367. @item rect
  18368. @item bartlett
  18369. @item hann
  18370. @item hanning
  18371. @item hamming
  18372. @item blackman
  18373. @item welch
  18374. @item flattop
  18375. @item bharris
  18376. @item bnuttall
  18377. @item bhann
  18378. @item sine
  18379. @item nuttall
  18380. @item lanczos
  18381. @item gauss
  18382. @item tukey
  18383. @item dolph
  18384. @item cauchy
  18385. @item parzen
  18386. @item poisson
  18387. @item bohman
  18388. @end table
  18389. Default value is @code{hann}.
  18390. @item orientation
  18391. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18392. @code{horizontal}. Default is @code{vertical}.
  18393. @item gain
  18394. Set scale gain for calculating intensity color values.
  18395. Default value is @code{1}.
  18396. @item legend
  18397. Draw time and frequency axes and legends. Default is enabled.
  18398. @item rotation
  18399. Set color rotation, must be in [-1.0, 1.0] range.
  18400. Default value is @code{0}.
  18401. @item start
  18402. Set start frequency from which to display spectrogram. Default is @code{0}.
  18403. @item stop
  18404. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18405. @end table
  18406. @subsection Examples
  18407. @itemize
  18408. @item
  18409. Extract an audio spectrogram of a whole audio track
  18410. in a 1024x1024 picture using @command{ffmpeg}:
  18411. @example
  18412. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  18413. @end example
  18414. @end itemize
  18415. @section showvolume
  18416. Convert input audio volume to a video output.
  18417. The filter accepts the following options:
  18418. @table @option
  18419. @item rate, r
  18420. Set video rate.
  18421. @item b
  18422. Set border width, allowed range is [0, 5]. Default is 1.
  18423. @item w
  18424. Set channel width, allowed range is [80, 8192]. Default is 400.
  18425. @item h
  18426. Set channel height, allowed range is [1, 900]. Default is 20.
  18427. @item f
  18428. Set fade, allowed range is [0, 1]. Default is 0.95.
  18429. @item c
  18430. Set volume color expression.
  18431. The expression can use the following variables:
  18432. @table @option
  18433. @item VOLUME
  18434. Current max volume of channel in dB.
  18435. @item PEAK
  18436. Current peak.
  18437. @item CHANNEL
  18438. Current channel number, starting from 0.
  18439. @end table
  18440. @item t
  18441. If set, displays channel names. Default is enabled.
  18442. @item v
  18443. If set, displays volume values. Default is enabled.
  18444. @item o
  18445. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  18446. default is @code{h}.
  18447. @item s
  18448. Set step size, allowed range is [0, 5]. Default is 0, which means
  18449. step is disabled.
  18450. @item p
  18451. Set background opacity, allowed range is [0, 1]. Default is 0.
  18452. @item m
  18453. Set metering mode, can be peak: @code{p} or rms: @code{r},
  18454. default is @code{p}.
  18455. @item ds
  18456. Set display scale, can be linear: @code{lin} or log: @code{log},
  18457. default is @code{lin}.
  18458. @item dm
  18459. In second.
  18460. If set to > 0., display a line for the max level
  18461. in the previous seconds.
  18462. default is disabled: @code{0.}
  18463. @item dmc
  18464. The color of the max line. Use when @code{dm} option is set to > 0.
  18465. default is: @code{orange}
  18466. @end table
  18467. @section showwaves
  18468. Convert input audio to a video output, representing the samples waves.
  18469. The filter accepts the following options:
  18470. @table @option
  18471. @item size, s
  18472. Specify the video size for the output. For the syntax of this option, check the
  18473. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18474. Default value is @code{600x240}.
  18475. @item mode
  18476. Set display mode.
  18477. Available values are:
  18478. @table @samp
  18479. @item point
  18480. Draw a point for each sample.
  18481. @item line
  18482. Draw a vertical line for each sample.
  18483. @item p2p
  18484. Draw a point for each sample and a line between them.
  18485. @item cline
  18486. Draw a centered vertical line for each sample.
  18487. @end table
  18488. Default value is @code{point}.
  18489. @item n
  18490. Set the number of samples which are printed on the same column. A
  18491. larger value will decrease the frame rate. Must be a positive
  18492. integer. This option can be set only if the value for @var{rate}
  18493. is not explicitly specified.
  18494. @item rate, r
  18495. Set the (approximate) output frame rate. This is done by setting the
  18496. option @var{n}. Default value is "25".
  18497. @item split_channels
  18498. Set if channels should be drawn separately or overlap. Default value is 0.
  18499. @item colors
  18500. Set colors separated by '|' which are going to be used for drawing of each channel.
  18501. @item scale
  18502. Set amplitude scale.
  18503. Available values are:
  18504. @table @samp
  18505. @item lin
  18506. Linear.
  18507. @item log
  18508. Logarithmic.
  18509. @item sqrt
  18510. Square root.
  18511. @item cbrt
  18512. Cubic root.
  18513. @end table
  18514. Default is linear.
  18515. @item draw
  18516. Set the draw mode. This is mostly useful to set for high @var{n}.
  18517. Available values are:
  18518. @table @samp
  18519. @item scale
  18520. Scale pixel values for each drawn sample.
  18521. @item full
  18522. Draw every sample directly.
  18523. @end table
  18524. Default value is @code{scale}.
  18525. @end table
  18526. @subsection Examples
  18527. @itemize
  18528. @item
  18529. Output the input file audio and the corresponding video representation
  18530. at the same time:
  18531. @example
  18532. amovie=a.mp3,asplit[out0],showwaves[out1]
  18533. @end example
  18534. @item
  18535. Create a synthetic signal and show it with showwaves, forcing a
  18536. frame rate of 30 frames per second:
  18537. @example
  18538. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  18539. @end example
  18540. @end itemize
  18541. @section showwavespic
  18542. Convert input audio to a single video frame, representing the samples waves.
  18543. The filter accepts the following options:
  18544. @table @option
  18545. @item size, s
  18546. Specify the video size for the output. For the syntax of this option, check the
  18547. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18548. Default value is @code{600x240}.
  18549. @item split_channels
  18550. Set if channels should be drawn separately or overlap. Default value is 0.
  18551. @item colors
  18552. Set colors separated by '|' which are going to be used for drawing of each channel.
  18553. @item scale
  18554. Set amplitude scale.
  18555. Available values are:
  18556. @table @samp
  18557. @item lin
  18558. Linear.
  18559. @item log
  18560. Logarithmic.
  18561. @item sqrt
  18562. Square root.
  18563. @item cbrt
  18564. Cubic root.
  18565. @end table
  18566. Default is linear.
  18567. @item draw
  18568. Set the draw mode.
  18569. Available values are:
  18570. @table @samp
  18571. @item scale
  18572. Scale pixel values for each drawn sample.
  18573. @item full
  18574. Draw every sample directly.
  18575. @end table
  18576. Default value is @code{scale}.
  18577. @end table
  18578. @subsection Examples
  18579. @itemize
  18580. @item
  18581. Extract a channel split representation of the wave form of a whole audio track
  18582. in a 1024x800 picture using @command{ffmpeg}:
  18583. @example
  18584. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  18585. @end example
  18586. @end itemize
  18587. @section sidedata, asidedata
  18588. Delete frame side data, or select frames based on it.
  18589. This filter accepts the following options:
  18590. @table @option
  18591. @item mode
  18592. Set mode of operation of the filter.
  18593. Can be one of the following:
  18594. @table @samp
  18595. @item select
  18596. Select every frame with side data of @code{type}.
  18597. @item delete
  18598. Delete side data of @code{type}. If @code{type} is not set, delete all side
  18599. data in the frame.
  18600. @end table
  18601. @item type
  18602. Set side data type used with all modes. Must be set for @code{select} mode. For
  18603. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  18604. in @file{libavutil/frame.h}. For example, to choose
  18605. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  18606. @end table
  18607. @section spectrumsynth
  18608. Synthesize audio from 2 input video spectrums, first input stream represents
  18609. magnitude across time and second represents phase across time.
  18610. The filter will transform from frequency domain as displayed in videos back
  18611. to time domain as presented in audio output.
  18612. This filter is primarily created for reversing processed @ref{showspectrum}
  18613. filter outputs, but can synthesize sound from other spectrograms too.
  18614. But in such case results are going to be poor if the phase data is not
  18615. available, because in such cases phase data need to be recreated, usually
  18616. it's just recreated from random noise.
  18617. For best results use gray only output (@code{channel} color mode in
  18618. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  18619. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  18620. @code{data} option. Inputs videos should generally use @code{fullframe}
  18621. slide mode as that saves resources needed for decoding video.
  18622. The filter accepts the following options:
  18623. @table @option
  18624. @item sample_rate
  18625. Specify sample rate of output audio, the sample rate of audio from which
  18626. spectrum was generated may differ.
  18627. @item channels
  18628. Set number of channels represented in input video spectrums.
  18629. @item scale
  18630. Set scale which was used when generating magnitude input spectrum.
  18631. Can be @code{lin} or @code{log}. Default is @code{log}.
  18632. @item slide
  18633. Set slide which was used when generating inputs spectrums.
  18634. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  18635. Default is @code{fullframe}.
  18636. @item win_func
  18637. Set window function used for resynthesis.
  18638. @item overlap
  18639. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18640. which means optimal overlap for selected window function will be picked.
  18641. @item orientation
  18642. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  18643. Default is @code{vertical}.
  18644. @end table
  18645. @subsection Examples
  18646. @itemize
  18647. @item
  18648. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  18649. then resynthesize videos back to audio with spectrumsynth:
  18650. @example
  18651. 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
  18652. 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
  18653. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  18654. @end example
  18655. @end itemize
  18656. @section split, asplit
  18657. Split input into several identical outputs.
  18658. @code{asplit} works with audio input, @code{split} with video.
  18659. The filter accepts a single parameter which specifies the number of outputs. If
  18660. unspecified, it defaults to 2.
  18661. @subsection Examples
  18662. @itemize
  18663. @item
  18664. Create two separate outputs from the same input:
  18665. @example
  18666. [in] split [out0][out1]
  18667. @end example
  18668. @item
  18669. To create 3 or more outputs, you need to specify the number of
  18670. outputs, like in:
  18671. @example
  18672. [in] asplit=3 [out0][out1][out2]
  18673. @end example
  18674. @item
  18675. Create two separate outputs from the same input, one cropped and
  18676. one padded:
  18677. @example
  18678. [in] split [splitout1][splitout2];
  18679. [splitout1] crop=100:100:0:0 [cropout];
  18680. [splitout2] pad=200:200:100:100 [padout];
  18681. @end example
  18682. @item
  18683. Create 5 copies of the input audio with @command{ffmpeg}:
  18684. @example
  18685. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  18686. @end example
  18687. @end itemize
  18688. @section zmq, azmq
  18689. Receive commands sent through a libzmq client, and forward them to
  18690. filters in the filtergraph.
  18691. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  18692. must be inserted between two video filters, @code{azmq} between two
  18693. audio filters. Both are capable to send messages to any filter type.
  18694. To enable these filters you need to install the libzmq library and
  18695. headers and configure FFmpeg with @code{--enable-libzmq}.
  18696. For more information about libzmq see:
  18697. @url{http://www.zeromq.org/}
  18698. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  18699. receives messages sent through a network interface defined by the
  18700. @option{bind_address} (or the abbreviation "@option{b}") option.
  18701. Default value of this option is @file{tcp://localhost:5555}. You may
  18702. want to alter this value to your needs, but do not forget to escape any
  18703. ':' signs (see @ref{filtergraph escaping}).
  18704. The received message must be in the form:
  18705. @example
  18706. @var{TARGET} @var{COMMAND} [@var{ARG}]
  18707. @end example
  18708. @var{TARGET} specifies the target of the command, usually the name of
  18709. the filter class or a specific filter instance name. The default
  18710. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  18711. but you can override this by using the @samp{filter_name@@id} syntax
  18712. (see @ref{Filtergraph syntax}).
  18713. @var{COMMAND} specifies the name of the command for the target filter.
  18714. @var{ARG} is optional and specifies the optional argument list for the
  18715. given @var{COMMAND}.
  18716. Upon reception, the message is processed and the corresponding command
  18717. is injected into the filtergraph. Depending on the result, the filter
  18718. will send a reply to the client, adopting the format:
  18719. @example
  18720. @var{ERROR_CODE} @var{ERROR_REASON}
  18721. @var{MESSAGE}
  18722. @end example
  18723. @var{MESSAGE} is optional.
  18724. @subsection Examples
  18725. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18726. be used to send commands processed by these filters.
  18727. Consider the following filtergraph generated by @command{ffplay}.
  18728. In this example the last overlay filter has an instance name. All other
  18729. filters will have default instance names.
  18730. @example
  18731. ffplay -dumpgraph 1 -f lavfi "
  18732. color=s=100x100:c=red [l];
  18733. color=s=100x100:c=blue [r];
  18734. nullsrc=s=200x100, zmq [bg];
  18735. [bg][l] overlay [bg+l];
  18736. [bg+l][r] overlay@@my=x=100 "
  18737. @end example
  18738. To change the color of the left side of the video, the following
  18739. command can be used:
  18740. @example
  18741. echo Parsed_color_0 c yellow | tools/zmqsend
  18742. @end example
  18743. To change the right side:
  18744. @example
  18745. echo Parsed_color_1 c pink | tools/zmqsend
  18746. @end example
  18747. To change the position of the right side:
  18748. @example
  18749. echo overlay@@my x 150 | tools/zmqsend
  18750. @end example
  18751. @c man end MULTIMEDIA FILTERS
  18752. @chapter Multimedia Sources
  18753. @c man begin MULTIMEDIA SOURCES
  18754. Below is a description of the currently available multimedia sources.
  18755. @section amovie
  18756. This is the same as @ref{movie} source, except it selects an audio
  18757. stream by default.
  18758. @anchor{movie}
  18759. @section movie
  18760. Read audio and/or video stream(s) from a movie container.
  18761. It accepts the following parameters:
  18762. @table @option
  18763. @item filename
  18764. The name of the resource to read (not necessarily a file; it can also be a
  18765. device or a stream accessed through some protocol).
  18766. @item format_name, f
  18767. Specifies the format assumed for the movie to read, and can be either
  18768. the name of a container or an input device. If not specified, the
  18769. format is guessed from @var{movie_name} or by probing.
  18770. @item seek_point, sp
  18771. Specifies the seek point in seconds. The frames will be output
  18772. starting from this seek point. The parameter is evaluated with
  18773. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18774. postfix. The default value is "0".
  18775. @item streams, s
  18776. Specifies the streams to read. Several streams can be specified,
  18777. separated by "+". The source will then have as many outputs, in the
  18778. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18779. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18780. respectively the default (best suited) video and audio stream. Default
  18781. is "dv", or "da" if the filter is called as "amovie".
  18782. @item stream_index, si
  18783. Specifies the index of the video stream to read. If the value is -1,
  18784. the most suitable video stream will be automatically selected. The default
  18785. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18786. audio instead of video.
  18787. @item loop
  18788. Specifies how many times to read the stream in sequence.
  18789. If the value is 0, the stream will be looped infinitely.
  18790. Default value is "1".
  18791. Note that when the movie is looped the source timestamps are not
  18792. changed, so it will generate non monotonically increasing timestamps.
  18793. @item discontinuity
  18794. Specifies the time difference between frames above which the point is
  18795. considered a timestamp discontinuity which is removed by adjusting the later
  18796. timestamps.
  18797. @end table
  18798. It allows overlaying a second video on top of the main input of
  18799. a filtergraph, as shown in this graph:
  18800. @example
  18801. input -----------> deltapts0 --> overlay --> output
  18802. ^
  18803. |
  18804. movie --> scale--> deltapts1 -------+
  18805. @end example
  18806. @subsection Examples
  18807. @itemize
  18808. @item
  18809. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18810. on top of the input labelled "in":
  18811. @example
  18812. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18813. [in] setpts=PTS-STARTPTS [main];
  18814. [main][over] overlay=16:16 [out]
  18815. @end example
  18816. @item
  18817. Read from a video4linux2 device, and overlay it on top of the input
  18818. labelled "in":
  18819. @example
  18820. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18821. [in] setpts=PTS-STARTPTS [main];
  18822. [main][over] overlay=16:16 [out]
  18823. @end example
  18824. @item
  18825. Read the first video stream and the audio stream with id 0x81 from
  18826. dvd.vob; the video is connected to the pad named "video" and the audio is
  18827. connected to the pad named "audio":
  18828. @example
  18829. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18830. @end example
  18831. @end itemize
  18832. @subsection Commands
  18833. Both movie and amovie support the following commands:
  18834. @table @option
  18835. @item seek
  18836. Perform seek using "av_seek_frame".
  18837. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18838. @itemize
  18839. @item
  18840. @var{stream_index}: If stream_index is -1, a default
  18841. stream is selected, and @var{timestamp} is automatically converted
  18842. from AV_TIME_BASE units to the stream specific time_base.
  18843. @item
  18844. @var{timestamp}: Timestamp in AVStream.time_base units
  18845. or, if no stream is specified, in AV_TIME_BASE units.
  18846. @item
  18847. @var{flags}: Flags which select direction and seeking mode.
  18848. @end itemize
  18849. @item get_duration
  18850. Get movie duration in AV_TIME_BASE units.
  18851. @end table
  18852. @c man end MULTIMEDIA SOURCES