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.

23258 lines
619KB

  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{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @end table
  537. @subsection Examples
  538. @itemize
  539. @item
  540. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  541. the second channel (and any other channels that may be present) unchanged.
  542. @example
  543. adelay=1500|0|500
  544. @end example
  545. @item
  546. Delay second channel by 500 samples, the third channel by 700 samples and leave
  547. the first channel (and any other channels that may be present) unchanged.
  548. @example
  549. adelay=0|500S|700S
  550. @end example
  551. @end itemize
  552. @section aderivative, aintegral
  553. Compute derivative/integral of audio stream.
  554. Applying both filters one after another produces original audio.
  555. @section aecho
  556. Apply echoing to the input audio.
  557. Echoes are reflected sound and can occur naturally amongst mountains
  558. (and sometimes large buildings) when talking or shouting; digital echo
  559. effects emulate this behaviour and are often used to help fill out the
  560. sound of a single instrument or vocal. The time difference between the
  561. original signal and the reflection is the @code{delay}, and the
  562. loudness of the reflected signal is the @code{decay}.
  563. Multiple echoes can have different delays and decays.
  564. A description of the accepted parameters follows.
  565. @table @option
  566. @item in_gain
  567. Set input gain of reflected signal. Default is @code{0.6}.
  568. @item out_gain
  569. Set output gain of reflected signal. Default is @code{0.3}.
  570. @item delays
  571. Set list of time intervals in milliseconds between original signal and reflections
  572. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  573. Default is @code{1000}.
  574. @item decays
  575. Set list of loudness of reflected signals separated by '|'.
  576. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  577. Default is @code{0.5}.
  578. @end table
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Make it sound as if there are twice as many instruments as are actually playing:
  583. @example
  584. aecho=0.8:0.88:60:0.4
  585. @end example
  586. @item
  587. If delay is very short, then it sound like a (metallic) robot playing music:
  588. @example
  589. aecho=0.8:0.88:6:0.4
  590. @end example
  591. @item
  592. A longer delay will sound like an open air concert in the mountains:
  593. @example
  594. aecho=0.8:0.9:1000:0.3
  595. @end example
  596. @item
  597. Same as above but with one more mountain:
  598. @example
  599. aecho=0.8:0.9:1000|1800:0.3|0.25
  600. @end example
  601. @end itemize
  602. @section aemphasis
  603. Audio emphasis filter creates or restores material directly taken from LPs or
  604. emphased CDs with different filter curves. E.g. to store music on vinyl the
  605. signal has to be altered by a filter first to even out the disadvantages of
  606. this recording medium.
  607. Once the material is played back the inverse filter has to be applied to
  608. restore the distortion of the frequency response.
  609. The filter accepts the following options:
  610. @table @option
  611. @item level_in
  612. Set input gain.
  613. @item level_out
  614. Set output gain.
  615. @item mode
  616. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  617. use @code{production} mode. Default is @code{reproduction} mode.
  618. @item type
  619. Set filter type. Selects medium. Can be one of the following:
  620. @table @option
  621. @item col
  622. select Columbia.
  623. @item emi
  624. select EMI.
  625. @item bsi
  626. select BSI (78RPM).
  627. @item riaa
  628. select RIAA.
  629. @item cd
  630. select Compact Disc (CD).
  631. @item 50fm
  632. select 50µs (FM).
  633. @item 75fm
  634. select 75µs (FM).
  635. @item 50kf
  636. select 50µs (FM-KF).
  637. @item 75kf
  638. select 75µs (FM-KF).
  639. @end table
  640. @end table
  641. @section aeval
  642. Modify an audio signal according to the specified expressions.
  643. This filter accepts one or more expressions (one for each channel),
  644. which are evaluated and used to modify a corresponding audio signal.
  645. It accepts the following parameters:
  646. @table @option
  647. @item exprs
  648. Set the '|'-separated expressions list for each separate channel. If
  649. the number of input channels is greater than the number of
  650. expressions, the last specified expression is used for the remaining
  651. output channels.
  652. @item channel_layout, c
  653. Set output channel layout. If not specified, the channel layout is
  654. specified by the number of expressions. If set to @samp{same}, it will
  655. use by default the same input channel layout.
  656. @end table
  657. Each expression in @var{exprs} can contain the following constants and functions:
  658. @table @option
  659. @item ch
  660. channel number of the current expression
  661. @item n
  662. number of the evaluated sample, starting from 0
  663. @item s
  664. sample rate
  665. @item t
  666. time of the evaluated sample expressed in seconds
  667. @item nb_in_channels
  668. @item nb_out_channels
  669. input and output number of channels
  670. @item val(CH)
  671. the value of input channel with number @var{CH}
  672. @end table
  673. Note: this filter is slow. For faster processing you should use a
  674. dedicated filter.
  675. @subsection Examples
  676. @itemize
  677. @item
  678. Half volume:
  679. @example
  680. aeval=val(ch)/2:c=same
  681. @end example
  682. @item
  683. Invert phase of the second channel:
  684. @example
  685. aeval=val(0)|-val(1)
  686. @end example
  687. @end itemize
  688. @anchor{afade}
  689. @section afade
  690. Apply fade-in/out effect to input audio.
  691. A description of the accepted parameters follows.
  692. @table @option
  693. @item type, t
  694. Specify the effect type, can be either @code{in} for fade-in, or
  695. @code{out} for a fade-out effect. Default is @code{in}.
  696. @item start_sample, ss
  697. Specify the number of the start sample for starting to apply the fade
  698. effect. Default is 0.
  699. @item nb_samples, ns
  700. Specify the number of samples for which the fade effect has to last. At
  701. the end of the fade-in effect the output audio will have the same
  702. volume as the input audio, at the end of the fade-out transition
  703. the output audio will be silence. Default is 44100.
  704. @item start_time, st
  705. Specify the start time of the fade effect. Default is 0.
  706. The value must be specified as a time duration; see
  707. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  708. for the accepted syntax.
  709. If set this option is used instead of @var{start_sample}.
  710. @item duration, d
  711. Specify the duration of the fade effect. See
  712. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  713. for the accepted syntax.
  714. At the end of the fade-in effect the output audio will have the same
  715. volume as the input audio, at the end of the fade-out transition
  716. the output audio will be silence.
  717. By default the duration is determined by @var{nb_samples}.
  718. If set this option is used instead of @var{nb_samples}.
  719. @item curve
  720. Set curve for fade transition.
  721. It accepts the following values:
  722. @table @option
  723. @item tri
  724. select triangular, linear slope (default)
  725. @item qsin
  726. select quarter of sine wave
  727. @item hsin
  728. select half of sine wave
  729. @item esin
  730. select exponential sine wave
  731. @item log
  732. select logarithmic
  733. @item ipar
  734. select inverted parabola
  735. @item qua
  736. select quadratic
  737. @item cub
  738. select cubic
  739. @item squ
  740. select square root
  741. @item cbr
  742. select cubic root
  743. @item par
  744. select parabola
  745. @item exp
  746. select exponential
  747. @item iqsin
  748. select inverted quarter of sine wave
  749. @item ihsin
  750. select inverted half of sine wave
  751. @item dese
  752. select double-exponential seat
  753. @item desi
  754. select double-exponential sigmoid
  755. @item losi
  756. select logistic sigmoid
  757. @item nofade
  758. no fade applied
  759. @end table
  760. @end table
  761. @subsection Examples
  762. @itemize
  763. @item
  764. Fade in first 15 seconds of audio:
  765. @example
  766. afade=t=in:ss=0:d=15
  767. @end example
  768. @item
  769. Fade out last 25 seconds of a 900 seconds audio:
  770. @example
  771. afade=t=out:st=875:d=25
  772. @end example
  773. @end itemize
  774. @section afftdn
  775. Denoise audio samples with FFT.
  776. A description of the accepted parameters follows.
  777. @table @option
  778. @item nr
  779. Set the noise reduction in dB, allowed range is 0.01 to 97.
  780. Default value is 12 dB.
  781. @item nf
  782. Set the noise floor in dB, allowed range is -80 to -20.
  783. Default value is -50 dB.
  784. @item nt
  785. Set the noise type.
  786. It accepts the following values:
  787. @table @option
  788. @item w
  789. Select white noise.
  790. @item v
  791. Select vinyl noise.
  792. @item s
  793. Select shellac noise.
  794. @item c
  795. Select custom noise, defined in @code{bn} option.
  796. Default value is white noise.
  797. @end table
  798. @item bn
  799. Set custom band noise for every one of 15 bands.
  800. Bands are separated by ' ' or '|'.
  801. @item rf
  802. Set the residual floor in dB, allowed range is -80 to -20.
  803. Default value is -38 dB.
  804. @item tn
  805. Enable noise tracking. By default is disabled.
  806. With this enabled, noise floor is automatically adjusted.
  807. @item tr
  808. Enable residual tracking. By default is disabled.
  809. @item om
  810. Set the output mode.
  811. It accepts the following values:
  812. @table @option
  813. @item i
  814. Pass input unchanged.
  815. @item o
  816. Pass noise filtered out.
  817. @item n
  818. Pass only noise.
  819. Default value is @var{o}.
  820. @end table
  821. @end table
  822. @subsection Commands
  823. This filter supports the following commands:
  824. @table @option
  825. @item sample_noise, sn
  826. Start or stop measuring noise profile.
  827. Syntax for the command is : "start" or "stop" string.
  828. After measuring noise profile is stopped it will be
  829. automatically applied in filtering.
  830. @item noise_reduction, nr
  831. Change noise reduction. Argument is single float number.
  832. Syntax for the command is : "@var{noise_reduction}"
  833. @item noise_floor, nf
  834. Change noise floor. Argument is single float number.
  835. Syntax for the command is : "@var{noise_floor}"
  836. @item output_mode, om
  837. Change output mode operation.
  838. Syntax for the command is : "i", "o" or "n" string.
  839. @end table
  840. @section afftfilt
  841. Apply arbitrary expressions to samples in frequency domain.
  842. @table @option
  843. @item real
  844. Set frequency domain real expression for each separate channel separated
  845. by '|'. Default is "re".
  846. If the number of input channels is greater than the number of
  847. expressions, the last specified expression is used for the remaining
  848. output channels.
  849. @item imag
  850. Set frequency domain imaginary expression for each separate channel
  851. separated by '|'. Default is "im".
  852. Each expression in @var{real} and @var{imag} can contain the following
  853. constants and functions:
  854. @table @option
  855. @item sr
  856. sample rate
  857. @item b
  858. current frequency bin number
  859. @item nb
  860. number of available bins
  861. @item ch
  862. channel number of the current expression
  863. @item chs
  864. number of channels
  865. @item pts
  866. current frame pts
  867. @item re
  868. current real part of frequency bin of current channel
  869. @item im
  870. current imaginary part of frequency bin of current channel
  871. @item real(b, ch)
  872. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  873. @item imag(b, ch)
  874. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  875. @end table
  876. @item win_size
  877. Set window size.
  878. It accepts the following values:
  879. @table @samp
  880. @item w16
  881. @item w32
  882. @item w64
  883. @item w128
  884. @item w256
  885. @item w512
  886. @item w1024
  887. @item w2048
  888. @item w4096
  889. @item w8192
  890. @item w16384
  891. @item w32768
  892. @item w65536
  893. @end table
  894. Default is @code{w4096}
  895. @item win_func
  896. Set window function. Default is @code{hann}.
  897. @item overlap
  898. Set window overlap. If set to 1, the recommended overlap for selected
  899. window function will be picked. Default is @code{0.75}.
  900. @end table
  901. @subsection Examples
  902. @itemize
  903. @item
  904. Leave almost only low frequencies in audio:
  905. @example
  906. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  907. @end example
  908. @end itemize
  909. @anchor{afir}
  910. @section afir
  911. Apply an arbitrary Frequency Impulse Response filter.
  912. This filter is designed for applying long FIR filters,
  913. up to 60 seconds long.
  914. It can be used as component for digital crossover filters,
  915. room equalization, cross talk cancellation, wavefield synthesis,
  916. auralization, ambiophonics, ambisonics and spatialization.
  917. This filter uses second stream as FIR coefficients.
  918. If second stream holds single channel, it will be used
  919. for all input channels in first stream, otherwise
  920. number of channels in second stream must be same as
  921. number of channels in first stream.
  922. It accepts the following parameters:
  923. @table @option
  924. @item dry
  925. Set dry gain. This sets input gain.
  926. @item wet
  927. Set wet gain. This sets final output gain.
  928. @item length
  929. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  930. @item gtype
  931. Enable applying gain measured from power of IR.
  932. Set which approach to use for auto gain measurement.
  933. @table @option
  934. @item none
  935. Do not apply any gain.
  936. @item peak
  937. select peak gain, very conservative approach. This is default value.
  938. @item dc
  939. select DC gain, limited application.
  940. @item gn
  941. select gain to noise approach, this is most popular one.
  942. @end table
  943. @item irgain
  944. Set gain to be applied to IR coefficients before filtering.
  945. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  946. @item irfmt
  947. Set format of IR stream. Can be @code{mono} or @code{input}.
  948. Default is @code{input}.
  949. @item maxir
  950. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  951. Allowed range is 0.1 to 60 seconds.
  952. @item response
  953. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  954. By default it is disabled.
  955. @item channel
  956. Set for which IR channel to display frequency response. By default is first channel
  957. displayed. This option is used only when @var{response} is enabled.
  958. @item size
  959. Set video stream size. This option is used only when @var{response} is enabled.
  960. @item rate
  961. Set video stream frame rate. This option is used only when @var{response} is enabled.
  962. @item minp
  963. Set minimal partition size used for convolution. Default is @var{8192}.
  964. Allowed range is from @var{8} to @var{32768}.
  965. Lower values decreases latency at cost of higher CPU usage.
  966. @item maxp
  967. Set maximal partition size used for convolution. Default is @var{8192}.
  968. Allowed range is from @var{8} to @var{32768}.
  969. Lower values may increase CPU usage.
  970. @end table
  971. @subsection Examples
  972. @itemize
  973. @item
  974. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  975. @example
  976. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  977. @end example
  978. @end itemize
  979. @anchor{aformat}
  980. @section aformat
  981. Set output format constraints for the input audio. The framework will
  982. negotiate the most appropriate format to minimize conversions.
  983. It accepts the following parameters:
  984. @table @option
  985. @item sample_fmts
  986. A '|'-separated list of requested sample formats.
  987. @item sample_rates
  988. A '|'-separated list of requested sample rates.
  989. @item channel_layouts
  990. A '|'-separated list of requested channel layouts.
  991. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  992. for the required syntax.
  993. @end table
  994. If a parameter is omitted, all values are allowed.
  995. Force the output to either unsigned 8-bit or signed 16-bit stereo
  996. @example
  997. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  998. @end example
  999. @section agate
  1000. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1001. processing reduces disturbing noise between useful signals.
  1002. Gating is done by detecting the volume below a chosen level @var{threshold}
  1003. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1004. floor is set via @var{range}. Because an exact manipulation of the signal
  1005. would cause distortion of the waveform the reduction can be levelled over
  1006. time. This is done by setting @var{attack} and @var{release}.
  1007. @var{attack} determines how long the signal has to fall below the threshold
  1008. before any reduction will occur and @var{release} sets the time the signal
  1009. has to rise above the threshold to reduce the reduction again.
  1010. Shorter signals than the chosen attack time will be left untouched.
  1011. @table @option
  1012. @item level_in
  1013. Set input level before filtering.
  1014. Default is 1. Allowed range is from 0.015625 to 64.
  1015. @item mode
  1016. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1017. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1018. will be amplified, expanding dynamic range in upward direction.
  1019. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1020. @item range
  1021. Set the level of gain reduction when the signal is below the threshold.
  1022. Default is 0.06125. Allowed range is from 0 to 1.
  1023. Setting this to 0 disables reduction and then filter behaves like expander.
  1024. @item threshold
  1025. If a signal rises above this level the gain reduction is released.
  1026. Default is 0.125. Allowed range is from 0 to 1.
  1027. @item ratio
  1028. Set a ratio by which the signal is reduced.
  1029. Default is 2. Allowed range is from 1 to 9000.
  1030. @item attack
  1031. Amount of milliseconds the signal has to rise above the threshold before gain
  1032. reduction stops.
  1033. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1034. @item release
  1035. Amount of milliseconds the signal has to fall below the threshold before the
  1036. reduction is increased again. Default is 250 milliseconds.
  1037. Allowed range is from 0.01 to 9000.
  1038. @item makeup
  1039. Set amount of amplification of signal after processing.
  1040. Default is 1. Allowed range is from 1 to 64.
  1041. @item knee
  1042. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1043. Default is 2.828427125. Allowed range is from 1 to 8.
  1044. @item detection
  1045. Choose if exact signal should be taken for detection or an RMS like one.
  1046. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1047. @item link
  1048. Choose if the average level between all channels or the louder channel affects
  1049. the reduction.
  1050. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1051. @end table
  1052. @section aiir
  1053. Apply an arbitrary Infinite Impulse Response filter.
  1054. It accepts the following parameters:
  1055. @table @option
  1056. @item z
  1057. Set numerator/zeros coefficients.
  1058. @item p
  1059. Set denominator/poles coefficients.
  1060. @item k
  1061. Set channels gains.
  1062. @item dry_gain
  1063. Set input gain.
  1064. @item wet_gain
  1065. Set output gain.
  1066. @item f
  1067. Set coefficients format.
  1068. @table @samp
  1069. @item tf
  1070. transfer function
  1071. @item zp
  1072. Z-plane zeros/poles, cartesian (default)
  1073. @item pr
  1074. Z-plane zeros/poles, polar radians
  1075. @item pd
  1076. Z-plane zeros/poles, polar degrees
  1077. @end table
  1078. @item r
  1079. Set kind of processing.
  1080. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1081. @item e
  1082. Set filtering precision.
  1083. @table @samp
  1084. @item dbl
  1085. double-precision floating-point (default)
  1086. @item flt
  1087. single-precision floating-point
  1088. @item i32
  1089. 32-bit integers
  1090. @item i16
  1091. 16-bit integers
  1092. @end table
  1093. @item response
  1094. Show IR frequency response, magnitude and phase in additional video stream.
  1095. By default it is disabled.
  1096. @item channel
  1097. Set for which IR channel to display frequency response. By default is first channel
  1098. displayed. This option is used only when @var{response} is enabled.
  1099. @item size
  1100. Set video stream size. This option is used only when @var{response} is enabled.
  1101. @end table
  1102. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1103. order.
  1104. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1105. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1106. imaginary unit.
  1107. Different coefficients and gains can be provided for every channel, in such case
  1108. use '|' to separate coefficients or gains. Last provided coefficients will be
  1109. used for all remaining channels.
  1110. @subsection Examples
  1111. @itemize
  1112. @item
  1113. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1114. @example
  1115. 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
  1116. @end example
  1117. @item
  1118. Same as above but in @code{zp} format:
  1119. @example
  1120. 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
  1121. @end example
  1122. @end itemize
  1123. @section alimiter
  1124. The limiter prevents an input signal from rising over a desired threshold.
  1125. This limiter uses lookahead technology to prevent your signal from distorting.
  1126. It means that there is a small delay after the signal is processed. Keep in mind
  1127. that the delay it produces is the attack time you set.
  1128. The filter accepts the following options:
  1129. @table @option
  1130. @item level_in
  1131. Set input gain. Default is 1.
  1132. @item level_out
  1133. Set output gain. Default is 1.
  1134. @item limit
  1135. Don't let signals above this level pass the limiter. Default is 1.
  1136. @item attack
  1137. The limiter will reach its attenuation level in this amount of time in
  1138. milliseconds. Default is 5 milliseconds.
  1139. @item release
  1140. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1141. Default is 50 milliseconds.
  1142. @item asc
  1143. When gain reduction is always needed ASC takes care of releasing to an
  1144. average reduction level rather than reaching a reduction of 0 in the release
  1145. time.
  1146. @item asc_level
  1147. Select how much the release time is affected by ASC, 0 means nearly no changes
  1148. in release time while 1 produces higher release times.
  1149. @item level
  1150. Auto level output signal. Default is enabled.
  1151. This normalizes audio back to 0dB if enabled.
  1152. @end table
  1153. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1154. with @ref{aresample} before applying this filter.
  1155. @section allpass
  1156. Apply a two-pole all-pass filter with central frequency (in Hz)
  1157. @var{frequency}, and filter-width @var{width}.
  1158. An all-pass filter changes the audio's frequency to phase relationship
  1159. without changing its frequency to amplitude relationship.
  1160. The filter accepts the following options:
  1161. @table @option
  1162. @item frequency, f
  1163. Set frequency in Hz.
  1164. @item width_type, t
  1165. Set method to specify band-width of filter.
  1166. @table @option
  1167. @item h
  1168. Hz
  1169. @item q
  1170. Q-Factor
  1171. @item o
  1172. octave
  1173. @item s
  1174. slope
  1175. @item k
  1176. kHz
  1177. @end table
  1178. @item width, w
  1179. Specify the band-width of a filter in width_type units.
  1180. @item channels, c
  1181. Specify which channels to filter, by default all available are filtered.
  1182. @end table
  1183. @subsection Commands
  1184. This filter supports the following commands:
  1185. @table @option
  1186. @item frequency, f
  1187. Change allpass frequency.
  1188. Syntax for the command is : "@var{frequency}"
  1189. @item width_type, t
  1190. Change allpass width_type.
  1191. Syntax for the command is : "@var{width_type}"
  1192. @item width, w
  1193. Change allpass width.
  1194. Syntax for the command is : "@var{width}"
  1195. @end table
  1196. @section aloop
  1197. Loop audio samples.
  1198. The filter accepts the following options:
  1199. @table @option
  1200. @item loop
  1201. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1202. Default is 0.
  1203. @item size
  1204. Set maximal number of samples. Default is 0.
  1205. @item start
  1206. Set first sample of loop. Default is 0.
  1207. @end table
  1208. @anchor{amerge}
  1209. @section amerge
  1210. Merge two or more audio streams into a single multi-channel stream.
  1211. The filter accepts the following options:
  1212. @table @option
  1213. @item inputs
  1214. Set the number of inputs. Default is 2.
  1215. @end table
  1216. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1217. the channel layout of the output will be set accordingly and the channels
  1218. will be reordered as necessary. If the channel layouts of the inputs are not
  1219. disjoint, the output will have all the channels of the first input then all
  1220. the channels of the second input, in that order, and the channel layout of
  1221. the output will be the default value corresponding to the total number of
  1222. channels.
  1223. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1224. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1225. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1226. first input, b1 is the first channel of the second input).
  1227. On the other hand, if both input are in stereo, the output channels will be
  1228. in the default order: a1, a2, b1, b2, and the channel layout will be
  1229. arbitrarily set to 4.0, which may or may not be the expected value.
  1230. All inputs must have the same sample rate, and format.
  1231. If inputs do not have the same duration, the output will stop with the
  1232. shortest.
  1233. @subsection Examples
  1234. @itemize
  1235. @item
  1236. Merge two mono files into a stereo stream:
  1237. @example
  1238. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1239. @end example
  1240. @item
  1241. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1242. @example
  1243. 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
  1244. @end example
  1245. @end itemize
  1246. @section amix
  1247. Mixes multiple audio inputs into a single output.
  1248. Note that this filter only supports float samples (the @var{amerge}
  1249. and @var{pan} audio filters support many formats). If the @var{amix}
  1250. input has integer samples then @ref{aresample} will be automatically
  1251. inserted to perform the conversion to float samples.
  1252. For example
  1253. @example
  1254. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1255. @end example
  1256. will mix 3 input audio streams to a single output with the same duration as the
  1257. first input and a dropout transition time of 3 seconds.
  1258. It accepts the following parameters:
  1259. @table @option
  1260. @item inputs
  1261. The number of inputs. If unspecified, it defaults to 2.
  1262. @item duration
  1263. How to determine the end-of-stream.
  1264. @table @option
  1265. @item longest
  1266. The duration of the longest input. (default)
  1267. @item shortest
  1268. The duration of the shortest input.
  1269. @item first
  1270. The duration of the first input.
  1271. @end table
  1272. @item dropout_transition
  1273. The transition time, in seconds, for volume renormalization when an input
  1274. stream ends. The default value is 2 seconds.
  1275. @item weights
  1276. Specify weight of each input audio stream as sequence.
  1277. Each weight is separated by space. By default all inputs have same weight.
  1278. @end table
  1279. @section amultiply
  1280. Multiply first audio stream with second audio stream and store result
  1281. in output audio stream. Multiplication is done by multiplying each
  1282. sample from first stream with sample at same position from second stream.
  1283. With this element-wise multiplication one can create amplitude fades and
  1284. amplitude modulations.
  1285. @section anequalizer
  1286. High-order parametric multiband equalizer for each channel.
  1287. It accepts the following parameters:
  1288. @table @option
  1289. @item params
  1290. This option string is in format:
  1291. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1292. Each equalizer band is separated by '|'.
  1293. @table @option
  1294. @item chn
  1295. Set channel number to which equalization will be applied.
  1296. If input doesn't have that channel the entry is ignored.
  1297. @item f
  1298. Set central frequency for band.
  1299. If input doesn't have that frequency the entry is ignored.
  1300. @item w
  1301. Set band width in hertz.
  1302. @item g
  1303. Set band gain in dB.
  1304. @item t
  1305. Set filter type for band, optional, can be:
  1306. @table @samp
  1307. @item 0
  1308. Butterworth, this is default.
  1309. @item 1
  1310. Chebyshev type 1.
  1311. @item 2
  1312. Chebyshev type 2.
  1313. @end table
  1314. @end table
  1315. @item curves
  1316. With this option activated frequency response of anequalizer is displayed
  1317. in video stream.
  1318. @item size
  1319. Set video stream size. Only useful if curves option is activated.
  1320. @item mgain
  1321. Set max gain that will be displayed. Only useful if curves option is activated.
  1322. Setting this to a reasonable value makes it possible to display gain which is derived from
  1323. neighbour bands which are too close to each other and thus produce higher gain
  1324. when both are activated.
  1325. @item fscale
  1326. Set frequency scale used to draw frequency response in video output.
  1327. Can be linear or logarithmic. Default is logarithmic.
  1328. @item colors
  1329. Set color for each channel curve which is going to be displayed in video stream.
  1330. This is list of color names separated by space or by '|'.
  1331. Unrecognised or missing colors will be replaced by white color.
  1332. @end table
  1333. @subsection Examples
  1334. @itemize
  1335. @item
  1336. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1337. for first 2 channels using Chebyshev type 1 filter:
  1338. @example
  1339. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1340. @end example
  1341. @end itemize
  1342. @subsection Commands
  1343. This filter supports the following commands:
  1344. @table @option
  1345. @item change
  1346. Alter existing filter parameters.
  1347. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1348. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1349. error is returned.
  1350. @var{freq} set new frequency parameter.
  1351. @var{width} set new width parameter in herz.
  1352. @var{gain} set new gain parameter in dB.
  1353. Full filter invocation with asendcmd may look like this:
  1354. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1355. @end table
  1356. @section anlmdn
  1357. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1358. Each sample is adjusted by looking for other samples with similar contexts. This
  1359. context similarity is defined by comparing their surrounding patches of size
  1360. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1361. The filter accepts the following options.
  1362. @table @option
  1363. @item s
  1364. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1365. @item p
  1366. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1367. Default value is 2 milliseconds.
  1368. @item r
  1369. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1370. Default value is 6 milliseconds.
  1371. @item o
  1372. Set the output mode.
  1373. It accepts the following values:
  1374. @table @option
  1375. @item i
  1376. Pass input unchanged.
  1377. @item o
  1378. Pass noise filtered out.
  1379. @item n
  1380. Pass only noise.
  1381. Default value is @var{o}.
  1382. @end table
  1383. @item m
  1384. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1385. @end table
  1386. @section anull
  1387. Pass the audio source unchanged to the output.
  1388. @section apad
  1389. Pad the end of an audio stream with silence.
  1390. This can be used together with @command{ffmpeg} @option{-shortest} to
  1391. extend audio streams to the same length as the video stream.
  1392. A description of the accepted options follows.
  1393. @table @option
  1394. @item packet_size
  1395. Set silence packet size. Default value is 4096.
  1396. @item pad_len
  1397. Set the number of samples of silence to add to the end. After the
  1398. value is reached, the stream is terminated. This option is mutually
  1399. exclusive with @option{whole_len}.
  1400. @item whole_len
  1401. Set the minimum total number of samples in the output audio stream. If
  1402. the value is longer than the input audio length, silence is added to
  1403. the end, until the value is reached. This option is mutually exclusive
  1404. with @option{pad_len}.
  1405. @item pad_dur
  1406. Specify the duration of samples of silence to add. See
  1407. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1408. for the accepted syntax. Used only if set to non-zero value.
  1409. @item whole_dur
  1410. Specify the minimum total duration in the output audio stream. See
  1411. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1412. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1413. the input audio length, silence is added to the end, until the value is reached.
  1414. This option is mutually exclusive with @option{pad_dur}
  1415. @end table
  1416. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1417. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1418. the input stream indefinitely.
  1419. @subsection Examples
  1420. @itemize
  1421. @item
  1422. Add 1024 samples of silence to the end of the input:
  1423. @example
  1424. apad=pad_len=1024
  1425. @end example
  1426. @item
  1427. Make sure the audio output will contain at least 10000 samples, pad
  1428. the input with silence if required:
  1429. @example
  1430. apad=whole_len=10000
  1431. @end example
  1432. @item
  1433. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1434. video stream will always result the shortest and will be converted
  1435. until the end in the output file when using the @option{shortest}
  1436. option:
  1437. @example
  1438. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1439. @end example
  1440. @end itemize
  1441. @section aphaser
  1442. Add a phasing effect to the input audio.
  1443. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1444. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1445. A description of the accepted parameters follows.
  1446. @table @option
  1447. @item in_gain
  1448. Set input gain. Default is 0.4.
  1449. @item out_gain
  1450. Set output gain. Default is 0.74
  1451. @item delay
  1452. Set delay in milliseconds. Default is 3.0.
  1453. @item decay
  1454. Set decay. Default is 0.4.
  1455. @item speed
  1456. Set modulation speed in Hz. Default is 0.5.
  1457. @item type
  1458. Set modulation type. Default is triangular.
  1459. It accepts the following values:
  1460. @table @samp
  1461. @item triangular, t
  1462. @item sinusoidal, s
  1463. @end table
  1464. @end table
  1465. @section apulsator
  1466. Audio pulsator is something between an autopanner and a tremolo.
  1467. But it can produce funny stereo effects as well. Pulsator changes the volume
  1468. of the left and right channel based on a LFO (low frequency oscillator) with
  1469. different waveforms and shifted phases.
  1470. This filter have the ability to define an offset between left and right
  1471. channel. An offset of 0 means that both LFO shapes match each other.
  1472. The left and right channel are altered equally - a conventional tremolo.
  1473. An offset of 50% means that the shape of the right channel is exactly shifted
  1474. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1475. an autopanner. At 1 both curves match again. Every setting in between moves the
  1476. phase shift gapless between all stages and produces some "bypassing" sounds with
  1477. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1478. the 0.5) the faster the signal passes from the left to the right speaker.
  1479. The filter accepts the following options:
  1480. @table @option
  1481. @item level_in
  1482. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1483. @item level_out
  1484. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1485. @item mode
  1486. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1487. sawup or sawdown. Default is sine.
  1488. @item amount
  1489. Set modulation. Define how much of original signal is affected by the LFO.
  1490. @item offset_l
  1491. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1492. @item offset_r
  1493. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1494. @item width
  1495. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1496. @item timing
  1497. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1498. @item bpm
  1499. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1500. is set to bpm.
  1501. @item ms
  1502. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1503. is set to ms.
  1504. @item hz
  1505. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1506. if timing is set to hz.
  1507. @end table
  1508. @anchor{aresample}
  1509. @section aresample
  1510. Resample the input audio to the specified parameters, using the
  1511. libswresample library. If none are specified then the filter will
  1512. automatically convert between its input and output.
  1513. This filter is also able to stretch/squeeze the audio data to make it match
  1514. the timestamps or to inject silence / cut out audio to make it match the
  1515. timestamps, do a combination of both or do neither.
  1516. The filter accepts the syntax
  1517. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1518. expresses a sample rate and @var{resampler_options} is a list of
  1519. @var{key}=@var{value} pairs, separated by ":". See the
  1520. @ref{Resampler Options,,"Resampler Options" section in the
  1521. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1522. for the complete list of supported options.
  1523. @subsection Examples
  1524. @itemize
  1525. @item
  1526. Resample the input audio to 44100Hz:
  1527. @example
  1528. aresample=44100
  1529. @end example
  1530. @item
  1531. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1532. samples per second compensation:
  1533. @example
  1534. aresample=async=1000
  1535. @end example
  1536. @end itemize
  1537. @section areverse
  1538. Reverse an audio clip.
  1539. Warning: This filter requires memory to buffer the entire clip, so trimming
  1540. is suggested.
  1541. @subsection Examples
  1542. @itemize
  1543. @item
  1544. Take the first 5 seconds of a clip, and reverse it.
  1545. @example
  1546. atrim=end=5,areverse
  1547. @end example
  1548. @end itemize
  1549. @section asetnsamples
  1550. Set the number of samples per each output audio frame.
  1551. The last output packet may contain a different number of samples, as
  1552. the filter will flush all the remaining samples when the input audio
  1553. signals its end.
  1554. The filter accepts the following options:
  1555. @table @option
  1556. @item nb_out_samples, n
  1557. Set the number of frames per each output audio frame. The number is
  1558. intended as the number of samples @emph{per each channel}.
  1559. Default value is 1024.
  1560. @item pad, p
  1561. If set to 1, the filter will pad the last audio frame with zeroes, so
  1562. that the last frame will contain the same number of samples as the
  1563. previous ones. Default value is 1.
  1564. @end table
  1565. For example, to set the number of per-frame samples to 1234 and
  1566. disable padding for the last frame, use:
  1567. @example
  1568. asetnsamples=n=1234:p=0
  1569. @end example
  1570. @section asetrate
  1571. Set the sample rate without altering the PCM data.
  1572. This will result in a change of speed and pitch.
  1573. The filter accepts the following options:
  1574. @table @option
  1575. @item sample_rate, r
  1576. Set the output sample rate. Default is 44100 Hz.
  1577. @end table
  1578. @section ashowinfo
  1579. Show a line containing various information for each input audio frame.
  1580. The input audio is not modified.
  1581. The shown line contains a sequence of key/value pairs of the form
  1582. @var{key}:@var{value}.
  1583. The following values are shown in the output:
  1584. @table @option
  1585. @item n
  1586. The (sequential) number of the input frame, starting from 0.
  1587. @item pts
  1588. The presentation timestamp of the input frame, in time base units; the time base
  1589. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1590. @item pts_time
  1591. The presentation timestamp of the input frame in seconds.
  1592. @item pos
  1593. position of the frame in the input stream, -1 if this information in
  1594. unavailable and/or meaningless (for example in case of synthetic audio)
  1595. @item fmt
  1596. The sample format.
  1597. @item chlayout
  1598. The channel layout.
  1599. @item rate
  1600. The sample rate for the audio frame.
  1601. @item nb_samples
  1602. The number of samples (per channel) in the frame.
  1603. @item checksum
  1604. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1605. audio, the data is treated as if all the planes were concatenated.
  1606. @item plane_checksums
  1607. A list of Adler-32 checksums for each data plane.
  1608. @end table
  1609. @section asoftclip
  1610. Apply audio soft clipping.
  1611. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1612. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1613. This filter accepts the following options:
  1614. @table @option
  1615. @item type
  1616. Set type of soft-clipping.
  1617. It accepts the following values:
  1618. @table @option
  1619. @item tanh
  1620. @item atan
  1621. @item cubic
  1622. @item exp
  1623. @item alg
  1624. @item quintic
  1625. @item sin
  1626. @end table
  1627. @item param
  1628. Set additional parameter which controls sigmoid function.
  1629. @end table
  1630. @section asr
  1631. Automatic Speech Recognition
  1632. This filter uses PocketSphinx for speech recognition. To enable
  1633. compilation of this filter, you need to configure FFmpeg with
  1634. @code{--enable-pocketsphinx}.
  1635. It accepts the following options:
  1636. @table @option
  1637. @item rate
  1638. Set sampling rate of input audio. Defaults is @code{16000}.
  1639. This need to match speech models, otherwise one will get poor results.
  1640. @item hmm
  1641. Set dictionary containing acoustic model files.
  1642. @item dict
  1643. Set pronunciation dictionary.
  1644. @item lm
  1645. Set language model file.
  1646. @item lmctl
  1647. Set language model set.
  1648. @item lmname
  1649. Set which language model to use.
  1650. @item logfn
  1651. Set output for log messages.
  1652. @end table
  1653. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1654. @anchor{astats}
  1655. @section astats
  1656. Display time domain statistical information about the audio channels.
  1657. Statistics are calculated and displayed for each audio channel and,
  1658. where applicable, an overall figure is also given.
  1659. It accepts the following option:
  1660. @table @option
  1661. @item length
  1662. Short window length in seconds, used for peak and trough RMS measurement.
  1663. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1664. @item metadata
  1665. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1666. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1667. disabled.
  1668. Available keys for each channel are:
  1669. DC_offset
  1670. Min_level
  1671. Max_level
  1672. Min_difference
  1673. Max_difference
  1674. Mean_difference
  1675. RMS_difference
  1676. Peak_level
  1677. RMS_peak
  1678. RMS_trough
  1679. Crest_factor
  1680. Flat_factor
  1681. Peak_count
  1682. Bit_depth
  1683. Dynamic_range
  1684. Zero_crossings
  1685. Zero_crossings_rate
  1686. Number_of_NaNs
  1687. Number_of_Infs
  1688. Number_of_denormals
  1689. and for Overall:
  1690. DC_offset
  1691. Min_level
  1692. Max_level
  1693. Min_difference
  1694. Max_difference
  1695. Mean_difference
  1696. RMS_difference
  1697. Peak_level
  1698. RMS_level
  1699. RMS_peak
  1700. RMS_trough
  1701. Flat_factor
  1702. Peak_count
  1703. Bit_depth
  1704. Number_of_samples
  1705. Number_of_NaNs
  1706. Number_of_Infs
  1707. Number_of_denormals
  1708. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1709. this @code{lavfi.astats.Overall.Peak_count}.
  1710. For description what each key means read below.
  1711. @item reset
  1712. Set number of frame after which stats are going to be recalculated.
  1713. Default is disabled.
  1714. @item measure_perchannel
  1715. Select the entries which need to be measured per channel. The metadata keys can
  1716. be used as flags, default is @option{all} which measures everything.
  1717. @option{none} disables all per channel measurement.
  1718. @item measure_overall
  1719. Select the entries which need to be measured overall. The metadata keys can
  1720. be used as flags, default is @option{all} which measures everything.
  1721. @option{none} disables all overall measurement.
  1722. @end table
  1723. A description of each shown parameter follows:
  1724. @table @option
  1725. @item DC offset
  1726. Mean amplitude displacement from zero.
  1727. @item Min level
  1728. Minimal sample level.
  1729. @item Max level
  1730. Maximal sample level.
  1731. @item Min difference
  1732. Minimal difference between two consecutive samples.
  1733. @item Max difference
  1734. Maximal difference between two consecutive samples.
  1735. @item Mean difference
  1736. Mean difference between two consecutive samples.
  1737. The average of each difference between two consecutive samples.
  1738. @item RMS difference
  1739. Root Mean Square difference between two consecutive samples.
  1740. @item Peak level dB
  1741. @item RMS level dB
  1742. Standard peak and RMS level measured in dBFS.
  1743. @item RMS peak dB
  1744. @item RMS trough dB
  1745. Peak and trough values for RMS level measured over a short window.
  1746. @item Crest factor
  1747. Standard ratio of peak to RMS level (note: not in dB).
  1748. @item Flat factor
  1749. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1750. (i.e. either @var{Min level} or @var{Max level}).
  1751. @item Peak count
  1752. Number of occasions (not the number of samples) that the signal attained either
  1753. @var{Min level} or @var{Max level}.
  1754. @item Bit depth
  1755. Overall bit depth of audio. Number of bits used for each sample.
  1756. @item Dynamic range
  1757. Measured dynamic range of audio in dB.
  1758. @item Zero crossings
  1759. Number of points where the waveform crosses the zero level axis.
  1760. @item Zero crossings rate
  1761. Rate of Zero crossings and number of audio samples.
  1762. @end table
  1763. @section atempo
  1764. Adjust audio tempo.
  1765. The filter accepts exactly one parameter, the audio tempo. If not
  1766. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1767. be in the [0.5, 100.0] range.
  1768. Note that tempo greater than 2 will skip some samples rather than
  1769. blend them in. If for any reason this is a concern it is always
  1770. possible to daisy-chain several instances of atempo to achieve the
  1771. desired product tempo.
  1772. @subsection Examples
  1773. @itemize
  1774. @item
  1775. Slow down audio to 80% tempo:
  1776. @example
  1777. atempo=0.8
  1778. @end example
  1779. @item
  1780. To speed up audio to 300% tempo:
  1781. @example
  1782. atempo=3
  1783. @end example
  1784. @item
  1785. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1786. @example
  1787. atempo=sqrt(3),atempo=sqrt(3)
  1788. @end example
  1789. @end itemize
  1790. @section atrim
  1791. Trim the input so that the output contains one continuous subpart of the input.
  1792. It accepts the following parameters:
  1793. @table @option
  1794. @item start
  1795. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1796. sample with the timestamp @var{start} will be the first sample in the output.
  1797. @item end
  1798. Specify time of the first audio sample that will be dropped, i.e. the
  1799. audio sample immediately preceding the one with the timestamp @var{end} will be
  1800. the last sample in the output.
  1801. @item start_pts
  1802. Same as @var{start}, except this option sets the start timestamp in samples
  1803. instead of seconds.
  1804. @item end_pts
  1805. Same as @var{end}, except this option sets the end timestamp in samples instead
  1806. of seconds.
  1807. @item duration
  1808. The maximum duration of the output in seconds.
  1809. @item start_sample
  1810. The number of the first sample that should be output.
  1811. @item end_sample
  1812. The number of the first sample that should be dropped.
  1813. @end table
  1814. @option{start}, @option{end}, and @option{duration} are expressed as time
  1815. duration specifications; see
  1816. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1817. Note that the first two sets of the start/end options and the @option{duration}
  1818. option look at the frame timestamp, while the _sample options simply count the
  1819. samples that pass through the filter. So start/end_pts and start/end_sample will
  1820. give different results when the timestamps are wrong, inexact or do not start at
  1821. zero. Also note that this filter does not modify the timestamps. If you wish
  1822. to have the output timestamps start at zero, insert the asetpts filter after the
  1823. atrim filter.
  1824. If multiple start or end options are set, this filter tries to be greedy and
  1825. keep all samples that match at least one of the specified constraints. To keep
  1826. only the part that matches all the constraints at once, chain multiple atrim
  1827. filters.
  1828. The defaults are such that all the input is kept. So it is possible to set e.g.
  1829. just the end values to keep everything before the specified time.
  1830. Examples:
  1831. @itemize
  1832. @item
  1833. Drop everything except the second minute of input:
  1834. @example
  1835. ffmpeg -i INPUT -af atrim=60:120
  1836. @end example
  1837. @item
  1838. Keep only the first 1000 samples:
  1839. @example
  1840. ffmpeg -i INPUT -af atrim=end_sample=1000
  1841. @end example
  1842. @end itemize
  1843. @section bandpass
  1844. Apply a two-pole Butterworth band-pass filter with central
  1845. frequency @var{frequency}, and (3dB-point) band-width width.
  1846. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1847. instead of the default: constant 0dB peak gain.
  1848. The filter roll off at 6dB per octave (20dB per decade).
  1849. The filter accepts the following options:
  1850. @table @option
  1851. @item frequency, f
  1852. Set the filter's central frequency. Default is @code{3000}.
  1853. @item csg
  1854. Constant skirt gain if set to 1. Defaults to 0.
  1855. @item width_type, t
  1856. Set method to specify band-width of filter.
  1857. @table @option
  1858. @item h
  1859. Hz
  1860. @item q
  1861. Q-Factor
  1862. @item o
  1863. octave
  1864. @item s
  1865. slope
  1866. @item k
  1867. kHz
  1868. @end table
  1869. @item width, w
  1870. Specify the band-width of a filter in width_type units.
  1871. @item channels, c
  1872. Specify which channels to filter, by default all available are filtered.
  1873. @end table
  1874. @subsection Commands
  1875. This filter supports the following commands:
  1876. @table @option
  1877. @item frequency, f
  1878. Change bandpass frequency.
  1879. Syntax for the command is : "@var{frequency}"
  1880. @item width_type, t
  1881. Change bandpass width_type.
  1882. Syntax for the command is : "@var{width_type}"
  1883. @item width, w
  1884. Change bandpass width.
  1885. Syntax for the command is : "@var{width}"
  1886. @end table
  1887. @section bandreject
  1888. Apply a two-pole Butterworth band-reject filter with central
  1889. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1890. The filter roll off at 6dB per octave (20dB per decade).
  1891. The filter accepts the following options:
  1892. @table @option
  1893. @item frequency, f
  1894. Set the filter's central frequency. Default is @code{3000}.
  1895. @item width_type, t
  1896. Set method to specify band-width of filter.
  1897. @table @option
  1898. @item h
  1899. Hz
  1900. @item q
  1901. Q-Factor
  1902. @item o
  1903. octave
  1904. @item s
  1905. slope
  1906. @item k
  1907. kHz
  1908. @end table
  1909. @item width, w
  1910. Specify the band-width of a filter in width_type units.
  1911. @item channels, c
  1912. Specify which channels to filter, by default all available are filtered.
  1913. @end table
  1914. @subsection Commands
  1915. This filter supports the following commands:
  1916. @table @option
  1917. @item frequency, f
  1918. Change bandreject frequency.
  1919. Syntax for the command is : "@var{frequency}"
  1920. @item width_type, t
  1921. Change bandreject width_type.
  1922. Syntax for the command is : "@var{width_type}"
  1923. @item width, w
  1924. Change bandreject width.
  1925. Syntax for the command is : "@var{width}"
  1926. @end table
  1927. @section bass, lowshelf
  1928. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1929. shelving filter with a response similar to that of a standard
  1930. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1931. The filter accepts the following options:
  1932. @table @option
  1933. @item gain, g
  1934. Give the gain at 0 Hz. Its useful range is about -20
  1935. (for a large cut) to +20 (for a large boost).
  1936. Beware of clipping when using a positive gain.
  1937. @item frequency, f
  1938. Set the filter's central frequency and so can be used
  1939. to extend or reduce the frequency range to be boosted or cut.
  1940. The default value is @code{100} Hz.
  1941. @item width_type, t
  1942. Set method to specify band-width of filter.
  1943. @table @option
  1944. @item h
  1945. Hz
  1946. @item q
  1947. Q-Factor
  1948. @item o
  1949. octave
  1950. @item s
  1951. slope
  1952. @item k
  1953. kHz
  1954. @end table
  1955. @item width, w
  1956. Determine how steep is the filter's shelf transition.
  1957. @item channels, c
  1958. Specify which channels to filter, by default all available are filtered.
  1959. @end table
  1960. @subsection Commands
  1961. This filter supports the following commands:
  1962. @table @option
  1963. @item frequency, f
  1964. Change bass frequency.
  1965. Syntax for the command is : "@var{frequency}"
  1966. @item width_type, t
  1967. Change bass width_type.
  1968. Syntax for the command is : "@var{width_type}"
  1969. @item width, w
  1970. Change bass width.
  1971. Syntax for the command is : "@var{width}"
  1972. @item gain, g
  1973. Change bass gain.
  1974. Syntax for the command is : "@var{gain}"
  1975. @end table
  1976. @section biquad
  1977. Apply a biquad IIR filter with the given coefficients.
  1978. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1979. are the numerator and denominator coefficients respectively.
  1980. and @var{channels}, @var{c} specify which channels to filter, by default all
  1981. available are filtered.
  1982. @subsection Commands
  1983. This filter supports the following commands:
  1984. @table @option
  1985. @item a0
  1986. @item a1
  1987. @item a2
  1988. @item b0
  1989. @item b1
  1990. @item b2
  1991. Change biquad parameter.
  1992. Syntax for the command is : "@var{value}"
  1993. @end table
  1994. @section bs2b
  1995. Bauer stereo to binaural transformation, which improves headphone listening of
  1996. stereo audio records.
  1997. To enable compilation of this filter you need to configure FFmpeg with
  1998. @code{--enable-libbs2b}.
  1999. It accepts the following parameters:
  2000. @table @option
  2001. @item profile
  2002. Pre-defined crossfeed level.
  2003. @table @option
  2004. @item default
  2005. Default level (fcut=700, feed=50).
  2006. @item cmoy
  2007. Chu Moy circuit (fcut=700, feed=60).
  2008. @item jmeier
  2009. Jan Meier circuit (fcut=650, feed=95).
  2010. @end table
  2011. @item fcut
  2012. Cut frequency (in Hz).
  2013. @item feed
  2014. Feed level (in Hz).
  2015. @end table
  2016. @section channelmap
  2017. Remap input channels to new locations.
  2018. It accepts the following parameters:
  2019. @table @option
  2020. @item map
  2021. Map channels from input to output. The argument is a '|'-separated list of
  2022. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2023. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2024. channel (e.g. FL for front left) or its index in the input channel layout.
  2025. @var{out_channel} is the name of the output channel or its index in the output
  2026. channel layout. If @var{out_channel} is not given then it is implicitly an
  2027. index, starting with zero and increasing by one for each mapping.
  2028. @item channel_layout
  2029. The channel layout of the output stream.
  2030. @end table
  2031. If no mapping is present, the filter will implicitly map input channels to
  2032. output channels, preserving indices.
  2033. @subsection Examples
  2034. @itemize
  2035. @item
  2036. For example, assuming a 5.1+downmix input MOV file,
  2037. @example
  2038. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2039. @end example
  2040. will create an output WAV file tagged as stereo from the downmix channels of
  2041. the input.
  2042. @item
  2043. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2044. @example
  2045. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2046. @end example
  2047. @end itemize
  2048. @section channelsplit
  2049. Split each channel from an input audio stream into a separate output stream.
  2050. It accepts the following parameters:
  2051. @table @option
  2052. @item channel_layout
  2053. The channel layout of the input stream. The default is "stereo".
  2054. @item channels
  2055. A channel layout describing the channels to be extracted as separate output streams
  2056. or "all" to extract each input channel as a separate stream. The default is "all".
  2057. Choosing channels not present in channel layout in the input will result in an error.
  2058. @end table
  2059. @subsection Examples
  2060. @itemize
  2061. @item
  2062. For example, assuming a stereo input MP3 file,
  2063. @example
  2064. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2065. @end example
  2066. will create an output Matroska file with two audio streams, one containing only
  2067. the left channel and the other the right channel.
  2068. @item
  2069. Split a 5.1 WAV file into per-channel files:
  2070. @example
  2071. ffmpeg -i in.wav -filter_complex
  2072. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2073. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2074. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2075. side_right.wav
  2076. @end example
  2077. @item
  2078. Extract only LFE from a 5.1 WAV file:
  2079. @example
  2080. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2081. -map '[LFE]' lfe.wav
  2082. @end example
  2083. @end itemize
  2084. @section chorus
  2085. Add a chorus effect to the audio.
  2086. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2087. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2088. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2089. The modulation depth defines the range the modulated delay is played before or after
  2090. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2091. sound tuned around the original one, like in a chorus where some vocals are slightly
  2092. off key.
  2093. It accepts the following parameters:
  2094. @table @option
  2095. @item in_gain
  2096. Set input gain. Default is 0.4.
  2097. @item out_gain
  2098. Set output gain. Default is 0.4.
  2099. @item delays
  2100. Set delays. A typical delay is around 40ms to 60ms.
  2101. @item decays
  2102. Set decays.
  2103. @item speeds
  2104. Set speeds.
  2105. @item depths
  2106. Set depths.
  2107. @end table
  2108. @subsection Examples
  2109. @itemize
  2110. @item
  2111. A single delay:
  2112. @example
  2113. chorus=0.7:0.9:55:0.4:0.25:2
  2114. @end example
  2115. @item
  2116. Two delays:
  2117. @example
  2118. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2119. @end example
  2120. @item
  2121. Fuller sounding chorus with three delays:
  2122. @example
  2123. 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
  2124. @end example
  2125. @end itemize
  2126. @section compand
  2127. Compress or expand the audio's dynamic range.
  2128. It accepts the following parameters:
  2129. @table @option
  2130. @item attacks
  2131. @item decays
  2132. A list of times in seconds for each channel over which the instantaneous level
  2133. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2134. increase of volume and @var{decays} refers to decrease of volume. For most
  2135. situations, the attack time (response to the audio getting louder) should be
  2136. shorter than the decay time, because the human ear is more sensitive to sudden
  2137. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2138. a typical value for decay is 0.8 seconds.
  2139. If specified number of attacks & decays is lower than number of channels, the last
  2140. set attack/decay will be used for all remaining channels.
  2141. @item points
  2142. A list of points for the transfer function, specified in dB relative to the
  2143. maximum possible signal amplitude. Each key points list must be defined using
  2144. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2145. @code{x0/y0 x1/y1 x2/y2 ....}
  2146. The input values must be in strictly increasing order but the transfer function
  2147. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2148. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2149. function are @code{-70/-70|-60/-20|1/0}.
  2150. @item soft-knee
  2151. Set the curve radius in dB for all joints. It defaults to 0.01.
  2152. @item gain
  2153. Set the additional gain in dB to be applied at all points on the transfer
  2154. function. This allows for easy adjustment of the overall gain.
  2155. It defaults to 0.
  2156. @item volume
  2157. Set an initial volume, in dB, to be assumed for each channel when filtering
  2158. starts. This permits the user to supply a nominal level initially, so that, for
  2159. example, a very large gain is not applied to initial signal levels before the
  2160. companding has begun to operate. A typical value for audio which is initially
  2161. quiet is -90 dB. It defaults to 0.
  2162. @item delay
  2163. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2164. delayed before being fed to the volume adjuster. Specifying a delay
  2165. approximately equal to the attack/decay times allows the filter to effectively
  2166. operate in predictive rather than reactive mode. It defaults to 0.
  2167. @end table
  2168. @subsection Examples
  2169. @itemize
  2170. @item
  2171. Make music with both quiet and loud passages suitable for listening to in a
  2172. noisy environment:
  2173. @example
  2174. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2175. @end example
  2176. Another example for audio with whisper and explosion parts:
  2177. @example
  2178. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2179. @end example
  2180. @item
  2181. A noise gate for when the noise is at a lower level than the signal:
  2182. @example
  2183. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2184. @end example
  2185. @item
  2186. Here is another noise gate, this time for when the noise is at a higher level
  2187. than the signal (making it, in some ways, similar to squelch):
  2188. @example
  2189. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2190. @end example
  2191. @item
  2192. 2:1 compression starting at -6dB:
  2193. @example
  2194. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2195. @end example
  2196. @item
  2197. 2:1 compression starting at -9dB:
  2198. @example
  2199. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2200. @end example
  2201. @item
  2202. 2:1 compression starting at -12dB:
  2203. @example
  2204. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2205. @end example
  2206. @item
  2207. 2:1 compression starting at -18dB:
  2208. @example
  2209. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2210. @end example
  2211. @item
  2212. 3:1 compression starting at -15dB:
  2213. @example
  2214. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2215. @end example
  2216. @item
  2217. Compressor/Gate:
  2218. @example
  2219. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2220. @end example
  2221. @item
  2222. Expander:
  2223. @example
  2224. 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
  2225. @end example
  2226. @item
  2227. Hard limiter at -6dB:
  2228. @example
  2229. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2230. @end example
  2231. @item
  2232. Hard limiter at -12dB:
  2233. @example
  2234. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2235. @end example
  2236. @item
  2237. Hard noise gate at -35 dB:
  2238. @example
  2239. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2240. @end example
  2241. @item
  2242. Soft limiter:
  2243. @example
  2244. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2245. @end example
  2246. @end itemize
  2247. @section compensationdelay
  2248. Compensation Delay Line is a metric based delay to compensate differing
  2249. positions of microphones or speakers.
  2250. For example, you have recorded guitar with two microphones placed in
  2251. different location. Because the front of sound wave has fixed speed in
  2252. normal conditions, the phasing of microphones can vary and depends on
  2253. their location and interposition. The best sound mix can be achieved when
  2254. these microphones are in phase (synchronized). Note that distance of
  2255. ~30 cm between microphones makes one microphone to capture signal in
  2256. antiphase to another microphone. That makes the final mix sounding moody.
  2257. This filter helps to solve phasing problems by adding different delays
  2258. to each microphone track and make them synchronized.
  2259. The best result can be reached when you take one track as base and
  2260. synchronize other tracks one by one with it.
  2261. Remember that synchronization/delay tolerance depends on sample rate, too.
  2262. Higher sample rates will give more tolerance.
  2263. It accepts the following parameters:
  2264. @table @option
  2265. @item mm
  2266. Set millimeters distance. This is compensation distance for fine tuning.
  2267. Default is 0.
  2268. @item cm
  2269. Set cm distance. This is compensation distance for tightening distance setup.
  2270. Default is 0.
  2271. @item m
  2272. Set meters distance. This is compensation distance for hard distance setup.
  2273. Default is 0.
  2274. @item dry
  2275. Set dry amount. Amount of unprocessed (dry) signal.
  2276. Default is 0.
  2277. @item wet
  2278. Set wet amount. Amount of processed (wet) signal.
  2279. Default is 1.
  2280. @item temp
  2281. Set temperature degree in Celsius. This is the temperature of the environment.
  2282. Default is 20.
  2283. @end table
  2284. @section crossfeed
  2285. Apply headphone crossfeed filter.
  2286. Crossfeed is the process of blending the left and right channels of stereo
  2287. audio recording.
  2288. It is mainly used to reduce extreme stereo separation of low frequencies.
  2289. The intent is to produce more speaker like sound to the listener.
  2290. The filter accepts the following options:
  2291. @table @option
  2292. @item strength
  2293. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2294. This sets gain of low shelf filter for side part of stereo image.
  2295. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2296. @item range
  2297. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2298. This sets cut off frequency of low shelf filter. Default is cut off near
  2299. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2300. @item level_in
  2301. Set input gain. Default is 0.9.
  2302. @item level_out
  2303. Set output gain. Default is 1.
  2304. @end table
  2305. @section crystalizer
  2306. Simple algorithm to expand audio dynamic range.
  2307. The filter accepts the following options:
  2308. @table @option
  2309. @item i
  2310. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2311. (unchanged sound) to 10.0 (maximum effect).
  2312. @item c
  2313. Enable clipping. By default is enabled.
  2314. @end table
  2315. @section dcshift
  2316. Apply a DC shift to the audio.
  2317. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2318. in the recording chain) from the audio. The effect of a DC offset is reduced
  2319. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2320. a signal has a DC offset.
  2321. @table @option
  2322. @item shift
  2323. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2324. the audio.
  2325. @item limitergain
  2326. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2327. used to prevent clipping.
  2328. @end table
  2329. @section drmeter
  2330. Measure audio dynamic range.
  2331. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2332. is found in transition material. And anything less that 8 have very poor dynamics
  2333. and is very compressed.
  2334. The filter accepts the following options:
  2335. @table @option
  2336. @item length
  2337. Set window length in seconds used to split audio into segments of equal length.
  2338. Default is 3 seconds.
  2339. @end table
  2340. @section dynaudnorm
  2341. Dynamic Audio Normalizer.
  2342. This filter applies a certain amount of gain to the input audio in order
  2343. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2344. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2345. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2346. This allows for applying extra gain to the "quiet" sections of the audio
  2347. while avoiding distortions or clipping the "loud" sections. In other words:
  2348. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2349. sections, in the sense that the volume of each section is brought to the
  2350. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2351. this goal *without* applying "dynamic range compressing". It will retain 100%
  2352. of the dynamic range *within* each section of the audio file.
  2353. @table @option
  2354. @item f
  2355. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2356. Default is 500 milliseconds.
  2357. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2358. referred to as frames. This is required, because a peak magnitude has no
  2359. meaning for just a single sample value. Instead, we need to determine the
  2360. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2361. normalizer would simply use the peak magnitude of the complete file, the
  2362. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2363. frame. The length of a frame is specified in milliseconds. By default, the
  2364. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2365. been found to give good results with most files.
  2366. Note that the exact frame length, in number of samples, will be determined
  2367. automatically, based on the sampling rate of the individual input audio file.
  2368. @item g
  2369. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2370. number. Default is 31.
  2371. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2372. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2373. is specified in frames, centered around the current frame. For the sake of
  2374. simplicity, this must be an odd number. Consequently, the default value of 31
  2375. takes into account the current frame, as well as the 15 preceding frames and
  2376. the 15 subsequent frames. Using a larger window results in a stronger
  2377. smoothing effect and thus in less gain variation, i.e. slower gain
  2378. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2379. effect and thus in more gain variation, i.e. faster gain adaptation.
  2380. In other words, the more you increase this value, the more the Dynamic Audio
  2381. Normalizer will behave like a "traditional" normalization filter. On the
  2382. contrary, the more you decrease this value, the more the Dynamic Audio
  2383. Normalizer will behave like a dynamic range compressor.
  2384. @item p
  2385. Set the target peak value. This specifies the highest permissible magnitude
  2386. level for the normalized audio input. This filter will try to approach the
  2387. target peak magnitude as closely as possible, but at the same time it also
  2388. makes sure that the normalized signal will never exceed the peak magnitude.
  2389. A frame's maximum local gain factor is imposed directly by the target peak
  2390. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2391. It is not recommended to go above this value.
  2392. @item m
  2393. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2394. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2395. factor for each input frame, i.e. the maximum gain factor that does not
  2396. result in clipping or distortion. The maximum gain factor is determined by
  2397. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2398. additionally bounds the frame's maximum gain factor by a predetermined
  2399. (global) maximum gain factor. This is done in order to avoid excessive gain
  2400. factors in "silent" or almost silent frames. By default, the maximum gain
  2401. factor is 10.0, For most inputs the default value should be sufficient and
  2402. it usually is not recommended to increase this value. Though, for input
  2403. with an extremely low overall volume level, it may be necessary to allow even
  2404. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2405. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2406. Instead, a "sigmoid" threshold function will be applied. This way, the
  2407. gain factors will smoothly approach the threshold value, but never exceed that
  2408. value.
  2409. @item r
  2410. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2411. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2412. This means that the maximum local gain factor for each frame is defined
  2413. (only) by the frame's highest magnitude sample. This way, the samples can
  2414. be amplified as much as possible without exceeding the maximum signal
  2415. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2416. Normalizer can also take into account the frame's root mean square,
  2417. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2418. determine the power of a time-varying signal. It is therefore considered
  2419. that the RMS is a better approximation of the "perceived loudness" than
  2420. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2421. frames to a constant RMS value, a uniform "perceived loudness" can be
  2422. established. If a target RMS value has been specified, a frame's local gain
  2423. factor is defined as the factor that would result in exactly that RMS value.
  2424. Note, however, that the maximum local gain factor is still restricted by the
  2425. frame's highest magnitude sample, in order to prevent clipping.
  2426. @item n
  2427. Enable channels coupling. By default is enabled.
  2428. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2429. amount. This means the same gain factor will be applied to all channels, i.e.
  2430. the maximum possible gain factor is determined by the "loudest" channel.
  2431. However, in some recordings, it may happen that the volume of the different
  2432. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2433. In this case, this option can be used to disable the channel coupling. This way,
  2434. the gain factor will be determined independently for each channel, depending
  2435. only on the individual channel's highest magnitude sample. This allows for
  2436. harmonizing the volume of the different channels.
  2437. @item c
  2438. Enable DC bias correction. By default is disabled.
  2439. An audio signal (in the time domain) is a sequence of sample values.
  2440. In the Dynamic Audio Normalizer these sample values are represented in the
  2441. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2442. audio signal, or "waveform", should be centered around the zero point.
  2443. That means if we calculate the mean value of all samples in a file, or in a
  2444. single frame, then the result should be 0.0 or at least very close to that
  2445. value. If, however, there is a significant deviation of the mean value from
  2446. 0.0, in either positive or negative direction, this is referred to as a
  2447. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2448. Audio Normalizer provides optional DC bias correction.
  2449. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2450. the mean value, or "DC correction" offset, of each input frame and subtract
  2451. that value from all of the frame's sample values which ensures those samples
  2452. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2453. boundaries, the DC correction offset values will be interpolated smoothly
  2454. between neighbouring frames.
  2455. @item b
  2456. Enable alternative boundary mode. By default is disabled.
  2457. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2458. around each frame. This includes the preceding frames as well as the
  2459. subsequent frames. However, for the "boundary" frames, located at the very
  2460. beginning and at the very end of the audio file, not all neighbouring
  2461. frames are available. In particular, for the first few frames in the audio
  2462. file, the preceding frames are not known. And, similarly, for the last few
  2463. frames in the audio file, the subsequent frames are not known. Thus, the
  2464. question arises which gain factors should be assumed for the missing frames
  2465. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2466. to deal with this situation. The default boundary mode assumes a gain factor
  2467. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2468. "fade out" at the beginning and at the end of the input, respectively.
  2469. @item s
  2470. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2471. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2472. compression. This means that signal peaks will not be pruned and thus the
  2473. full dynamic range will be retained within each local neighbourhood. However,
  2474. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2475. normalization algorithm with a more "traditional" compression.
  2476. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2477. (thresholding) function. If (and only if) the compression feature is enabled,
  2478. all input frames will be processed by a soft knee thresholding function prior
  2479. to the actual normalization process. Put simply, the thresholding function is
  2480. going to prune all samples whose magnitude exceeds a certain threshold value.
  2481. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2482. value. Instead, the threshold value will be adjusted for each individual
  2483. frame.
  2484. In general, smaller parameters result in stronger compression, and vice versa.
  2485. Values below 3.0 are not recommended, because audible distortion may appear.
  2486. @end table
  2487. @section earwax
  2488. Make audio easier to listen to on headphones.
  2489. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2490. so that when listened to on headphones the stereo image is moved from
  2491. inside your head (standard for headphones) to outside and in front of
  2492. the listener (standard for speakers).
  2493. Ported from SoX.
  2494. @section equalizer
  2495. Apply a two-pole peaking equalisation (EQ) filter. With this
  2496. filter, the signal-level at and around a selected frequency can
  2497. be increased or decreased, whilst (unlike bandpass and bandreject
  2498. filters) that at all other frequencies is unchanged.
  2499. In order to produce complex equalisation curves, this filter can
  2500. be given several times, each with a different central frequency.
  2501. The filter accepts the following options:
  2502. @table @option
  2503. @item frequency, f
  2504. Set the filter's central frequency in Hz.
  2505. @item width_type, t
  2506. Set method to specify band-width of filter.
  2507. @table @option
  2508. @item h
  2509. Hz
  2510. @item q
  2511. Q-Factor
  2512. @item o
  2513. octave
  2514. @item s
  2515. slope
  2516. @item k
  2517. kHz
  2518. @end table
  2519. @item width, w
  2520. Specify the band-width of a filter in width_type units.
  2521. @item gain, g
  2522. Set the required gain or attenuation in dB.
  2523. Beware of clipping when using a positive gain.
  2524. @item channels, c
  2525. Specify which channels to filter, by default all available are filtered.
  2526. @end table
  2527. @subsection Examples
  2528. @itemize
  2529. @item
  2530. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2531. @example
  2532. equalizer=f=1000:t=h:width=200:g=-10
  2533. @end example
  2534. @item
  2535. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2536. @example
  2537. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2538. @end example
  2539. @end itemize
  2540. @subsection Commands
  2541. This filter supports the following commands:
  2542. @table @option
  2543. @item frequency, f
  2544. Change equalizer frequency.
  2545. Syntax for the command is : "@var{frequency}"
  2546. @item width_type, t
  2547. Change equalizer width_type.
  2548. Syntax for the command is : "@var{width_type}"
  2549. @item width, w
  2550. Change equalizer width.
  2551. Syntax for the command is : "@var{width}"
  2552. @item gain, g
  2553. Change equalizer gain.
  2554. Syntax for the command is : "@var{gain}"
  2555. @end table
  2556. @section extrastereo
  2557. Linearly increases the difference between left and right channels which
  2558. adds some sort of "live" effect to playback.
  2559. The filter accepts the following options:
  2560. @table @option
  2561. @item m
  2562. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2563. (average of both channels), with 1.0 sound will be unchanged, with
  2564. -1.0 left and right channels will be swapped.
  2565. @item c
  2566. Enable clipping. By default is enabled.
  2567. @end table
  2568. @section firequalizer
  2569. Apply FIR Equalization using arbitrary frequency response.
  2570. The filter accepts the following option:
  2571. @table @option
  2572. @item gain
  2573. Set gain curve equation (in dB). The expression can contain variables:
  2574. @table @option
  2575. @item f
  2576. the evaluated frequency
  2577. @item sr
  2578. sample rate
  2579. @item ch
  2580. channel number, set to 0 when multichannels evaluation is disabled
  2581. @item chid
  2582. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2583. multichannels evaluation is disabled
  2584. @item chs
  2585. number of channels
  2586. @item chlayout
  2587. channel_layout, see libavutil/channel_layout.h
  2588. @end table
  2589. and functions:
  2590. @table @option
  2591. @item gain_interpolate(f)
  2592. interpolate gain on frequency f based on gain_entry
  2593. @item cubic_interpolate(f)
  2594. same as gain_interpolate, but smoother
  2595. @end table
  2596. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2597. @item gain_entry
  2598. Set gain entry for gain_interpolate function. The expression can
  2599. contain functions:
  2600. @table @option
  2601. @item entry(f, g)
  2602. store gain entry at frequency f with value g
  2603. @end table
  2604. This option is also available as command.
  2605. @item delay
  2606. Set filter delay in seconds. Higher value means more accurate.
  2607. Default is @code{0.01}.
  2608. @item accuracy
  2609. Set filter accuracy in Hz. Lower value means more accurate.
  2610. Default is @code{5}.
  2611. @item wfunc
  2612. Set window function. Acceptable values are:
  2613. @table @option
  2614. @item rectangular
  2615. rectangular window, useful when gain curve is already smooth
  2616. @item hann
  2617. hann window (default)
  2618. @item hamming
  2619. hamming window
  2620. @item blackman
  2621. blackman window
  2622. @item nuttall3
  2623. 3-terms continuous 1st derivative nuttall window
  2624. @item mnuttall3
  2625. minimum 3-terms discontinuous nuttall window
  2626. @item nuttall
  2627. 4-terms continuous 1st derivative nuttall window
  2628. @item bnuttall
  2629. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2630. @item bharris
  2631. blackman-harris window
  2632. @item tukey
  2633. tukey window
  2634. @end table
  2635. @item fixed
  2636. If enabled, use fixed number of audio samples. This improves speed when
  2637. filtering with large delay. Default is disabled.
  2638. @item multi
  2639. Enable multichannels evaluation on gain. Default is disabled.
  2640. @item zero_phase
  2641. Enable zero phase mode by subtracting timestamp to compensate delay.
  2642. Default is disabled.
  2643. @item scale
  2644. Set scale used by gain. Acceptable values are:
  2645. @table @option
  2646. @item linlin
  2647. linear frequency, linear gain
  2648. @item linlog
  2649. linear frequency, logarithmic (in dB) gain (default)
  2650. @item loglin
  2651. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2652. @item loglog
  2653. logarithmic frequency, logarithmic gain
  2654. @end table
  2655. @item dumpfile
  2656. Set file for dumping, suitable for gnuplot.
  2657. @item dumpscale
  2658. Set scale for dumpfile. Acceptable values are same with scale option.
  2659. Default is linlog.
  2660. @item fft2
  2661. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2662. Default is disabled.
  2663. @item min_phase
  2664. Enable minimum phase impulse response. Default is disabled.
  2665. @end table
  2666. @subsection Examples
  2667. @itemize
  2668. @item
  2669. lowpass at 1000 Hz:
  2670. @example
  2671. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2672. @end example
  2673. @item
  2674. lowpass at 1000 Hz with gain_entry:
  2675. @example
  2676. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2677. @end example
  2678. @item
  2679. custom equalization:
  2680. @example
  2681. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2682. @end example
  2683. @item
  2684. higher delay with zero phase to compensate delay:
  2685. @example
  2686. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2687. @end example
  2688. @item
  2689. lowpass on left channel, highpass on right channel:
  2690. @example
  2691. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2692. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2693. @end example
  2694. @end itemize
  2695. @section flanger
  2696. Apply a flanging effect to the audio.
  2697. The filter accepts the following options:
  2698. @table @option
  2699. @item delay
  2700. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2701. @item depth
  2702. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2703. @item regen
  2704. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2705. Default value is 0.
  2706. @item width
  2707. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2708. Default value is 71.
  2709. @item speed
  2710. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2711. @item shape
  2712. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2713. Default value is @var{sinusoidal}.
  2714. @item phase
  2715. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2716. Default value is 25.
  2717. @item interp
  2718. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2719. Default is @var{linear}.
  2720. @end table
  2721. @section haas
  2722. Apply Haas effect to audio.
  2723. Note that this makes most sense to apply on mono signals.
  2724. With this filter applied to mono signals it give some directionality and
  2725. stretches its stereo image.
  2726. The filter accepts the following options:
  2727. @table @option
  2728. @item level_in
  2729. Set input level. By default is @var{1}, or 0dB
  2730. @item level_out
  2731. Set output level. By default is @var{1}, or 0dB.
  2732. @item side_gain
  2733. Set gain applied to side part of signal. By default is @var{1}.
  2734. @item middle_source
  2735. Set kind of middle source. Can be one of the following:
  2736. @table @samp
  2737. @item left
  2738. Pick left channel.
  2739. @item right
  2740. Pick right channel.
  2741. @item mid
  2742. Pick middle part signal of stereo image.
  2743. @item side
  2744. Pick side part signal of stereo image.
  2745. @end table
  2746. @item middle_phase
  2747. Change middle phase. By default is disabled.
  2748. @item left_delay
  2749. Set left channel delay. By default is @var{2.05} milliseconds.
  2750. @item left_balance
  2751. Set left channel balance. By default is @var{-1}.
  2752. @item left_gain
  2753. Set left channel gain. By default is @var{1}.
  2754. @item left_phase
  2755. Change left phase. By default is disabled.
  2756. @item right_delay
  2757. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2758. @item right_balance
  2759. Set right channel balance. By default is @var{1}.
  2760. @item right_gain
  2761. Set right channel gain. By default is @var{1}.
  2762. @item right_phase
  2763. Change right phase. By default is enabled.
  2764. @end table
  2765. @section hdcd
  2766. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2767. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2768. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2769. of HDCD, and detects the Transient Filter flag.
  2770. @example
  2771. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2772. @end example
  2773. When using the filter with wav, note the default encoding for wav is 16-bit,
  2774. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2775. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2776. @example
  2777. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2778. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2779. @end example
  2780. The filter accepts the following options:
  2781. @table @option
  2782. @item disable_autoconvert
  2783. Disable any automatic format conversion or resampling in the filter graph.
  2784. @item process_stereo
  2785. Process the stereo channels together. If target_gain does not match between
  2786. channels, consider it invalid and use the last valid target_gain.
  2787. @item cdt_ms
  2788. Set the code detect timer period in ms.
  2789. @item force_pe
  2790. Always extend peaks above -3dBFS even if PE isn't signaled.
  2791. @item analyze_mode
  2792. Replace audio with a solid tone and adjust the amplitude to signal some
  2793. specific aspect of the decoding process. The output file can be loaded in
  2794. an audio editor alongside the original to aid analysis.
  2795. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2796. Modes are:
  2797. @table @samp
  2798. @item 0, off
  2799. Disabled
  2800. @item 1, lle
  2801. Gain adjustment level at each sample
  2802. @item 2, pe
  2803. Samples where peak extend occurs
  2804. @item 3, cdt
  2805. Samples where the code detect timer is active
  2806. @item 4, tgm
  2807. Samples where the target gain does not match between channels
  2808. @end table
  2809. @end table
  2810. @section headphone
  2811. Apply head-related transfer functions (HRTFs) to create virtual
  2812. loudspeakers around the user for binaural listening via headphones.
  2813. The HRIRs are provided via additional streams, for each channel
  2814. one stereo input stream is needed.
  2815. The filter accepts the following options:
  2816. @table @option
  2817. @item map
  2818. Set mapping of input streams for convolution.
  2819. The argument is a '|'-separated list of channel names in order as they
  2820. are given as additional stream inputs for filter.
  2821. This also specify number of input streams. Number of input streams
  2822. must be not less than number of channels in first stream plus one.
  2823. @item gain
  2824. Set gain applied to audio. Value is in dB. Default is 0.
  2825. @item type
  2826. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2827. processing audio in time domain which is slow.
  2828. @var{freq} is processing audio in frequency domain which is fast.
  2829. Default is @var{freq}.
  2830. @item lfe
  2831. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2832. @item size
  2833. Set size of frame in number of samples which will be processed at once.
  2834. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2835. @item hrir
  2836. Set format of hrir stream.
  2837. Default value is @var{stereo}. Alternative value is @var{multich}.
  2838. If value is set to @var{stereo}, number of additional streams should
  2839. be greater or equal to number of input channels in first input stream.
  2840. Also each additional stream should have stereo number of channels.
  2841. If value is set to @var{multich}, number of additional streams should
  2842. be exactly one. Also number of input channels of additional stream
  2843. should be equal or greater than twice number of channels of first input
  2844. stream.
  2845. @end table
  2846. @subsection Examples
  2847. @itemize
  2848. @item
  2849. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2850. each amovie filter use stereo file with IR coefficients as input.
  2851. The files give coefficients for each position of virtual loudspeaker:
  2852. @example
  2853. ffmpeg -i input.wav
  2854. -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"
  2855. output.wav
  2856. @end example
  2857. @item
  2858. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2859. but now in @var{multich} @var{hrir} format.
  2860. @example
  2861. 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"
  2862. output.wav
  2863. @end example
  2864. @end itemize
  2865. @section highpass
  2866. Apply a high-pass filter with 3dB point frequency.
  2867. The filter can be either single-pole, or double-pole (the default).
  2868. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2869. The filter accepts the following options:
  2870. @table @option
  2871. @item frequency, f
  2872. Set frequency in Hz. Default is 3000.
  2873. @item poles, p
  2874. Set number of poles. Default is 2.
  2875. @item width_type, t
  2876. Set method to specify band-width of filter.
  2877. @table @option
  2878. @item h
  2879. Hz
  2880. @item q
  2881. Q-Factor
  2882. @item o
  2883. octave
  2884. @item s
  2885. slope
  2886. @item k
  2887. kHz
  2888. @end table
  2889. @item width, w
  2890. Specify the band-width of a filter in width_type units.
  2891. Applies only to double-pole filter.
  2892. The default is 0.707q and gives a Butterworth response.
  2893. @item channels, c
  2894. Specify which channels to filter, by default all available are filtered.
  2895. @end table
  2896. @subsection Commands
  2897. This filter supports the following commands:
  2898. @table @option
  2899. @item frequency, f
  2900. Change highpass frequency.
  2901. Syntax for the command is : "@var{frequency}"
  2902. @item width_type, t
  2903. Change highpass width_type.
  2904. Syntax for the command is : "@var{width_type}"
  2905. @item width, w
  2906. Change highpass width.
  2907. Syntax for the command is : "@var{width}"
  2908. @end table
  2909. @section join
  2910. Join multiple input streams into one multi-channel stream.
  2911. It accepts the following parameters:
  2912. @table @option
  2913. @item inputs
  2914. The number of input streams. It defaults to 2.
  2915. @item channel_layout
  2916. The desired output channel layout. It defaults to stereo.
  2917. @item map
  2918. Map channels from inputs to output. The argument is a '|'-separated list of
  2919. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2920. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2921. can be either the name of the input channel (e.g. FL for front left) or its
  2922. index in the specified input stream. @var{out_channel} is the name of the output
  2923. channel.
  2924. @end table
  2925. The filter will attempt to guess the mappings when they are not specified
  2926. explicitly. It does so by first trying to find an unused matching input channel
  2927. and if that fails it picks the first unused input channel.
  2928. Join 3 inputs (with properly set channel layouts):
  2929. @example
  2930. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2931. @end example
  2932. Build a 5.1 output from 6 single-channel streams:
  2933. @example
  2934. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2935. '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'
  2936. out
  2937. @end example
  2938. @section ladspa
  2939. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2940. To enable compilation of this filter you need to configure FFmpeg with
  2941. @code{--enable-ladspa}.
  2942. @table @option
  2943. @item file, f
  2944. Specifies the name of LADSPA plugin library to load. If the environment
  2945. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2946. each one of the directories specified by the colon separated list in
  2947. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2948. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2949. @file{/usr/lib/ladspa/}.
  2950. @item plugin, p
  2951. Specifies the plugin within the library. Some libraries contain only
  2952. one plugin, but others contain many of them. If this is not set filter
  2953. will list all available plugins within the specified library.
  2954. @item controls, c
  2955. Set the '|' separated list of controls which are zero or more floating point
  2956. values that determine the behavior of the loaded plugin (for example delay,
  2957. threshold or gain).
  2958. Controls need to be defined using the following syntax:
  2959. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2960. @var{valuei} is the value set on the @var{i}-th control.
  2961. Alternatively they can be also defined using the following syntax:
  2962. @var{value0}|@var{value1}|@var{value2}|..., where
  2963. @var{valuei} is the value set on the @var{i}-th control.
  2964. If @option{controls} is set to @code{help}, all available controls and
  2965. their valid ranges are printed.
  2966. @item sample_rate, s
  2967. Specify the sample rate, default to 44100. Only used if plugin have
  2968. zero inputs.
  2969. @item nb_samples, n
  2970. Set the number of samples per channel per each output frame, default
  2971. is 1024. Only used if plugin have zero inputs.
  2972. @item duration, d
  2973. Set the minimum duration of the sourced audio. See
  2974. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2975. for the accepted syntax.
  2976. Note that the resulting duration may be greater than the specified duration,
  2977. as the generated audio is always cut at the end of a complete frame.
  2978. If not specified, or the expressed duration is negative, the audio is
  2979. supposed to be generated forever.
  2980. Only used if plugin have zero inputs.
  2981. @end table
  2982. @subsection Examples
  2983. @itemize
  2984. @item
  2985. List all available plugins within amp (LADSPA example plugin) library:
  2986. @example
  2987. ladspa=file=amp
  2988. @end example
  2989. @item
  2990. List all available controls and their valid ranges for @code{vcf_notch}
  2991. plugin from @code{VCF} library:
  2992. @example
  2993. ladspa=f=vcf:p=vcf_notch:c=help
  2994. @end example
  2995. @item
  2996. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2997. plugin library:
  2998. @example
  2999. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3000. @end example
  3001. @item
  3002. Add reverberation to the audio using TAP-plugins
  3003. (Tom's Audio Processing plugins):
  3004. @example
  3005. ladspa=file=tap_reverb:tap_reverb
  3006. @end example
  3007. @item
  3008. Generate white noise, with 0.2 amplitude:
  3009. @example
  3010. ladspa=file=cmt:noise_source_white:c=c0=.2
  3011. @end example
  3012. @item
  3013. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3014. @code{C* Audio Plugin Suite} (CAPS) library:
  3015. @example
  3016. ladspa=file=caps:Click:c=c1=20'
  3017. @end example
  3018. @item
  3019. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3020. @example
  3021. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3022. @end example
  3023. @item
  3024. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3025. @code{SWH Plugins} collection:
  3026. @example
  3027. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3028. @end example
  3029. @item
  3030. Attenuate low frequencies using Multiband EQ from Steve Harris
  3031. @code{SWH Plugins} collection:
  3032. @example
  3033. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3034. @end example
  3035. @item
  3036. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3037. (CAPS) library:
  3038. @example
  3039. ladspa=caps:Narrower
  3040. @end example
  3041. @item
  3042. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3043. @example
  3044. ladspa=caps:White:.2
  3045. @end example
  3046. @item
  3047. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3048. @example
  3049. ladspa=caps:Fractal:c=c1=1
  3050. @end example
  3051. @item
  3052. Dynamic volume normalization using @code{VLevel} plugin:
  3053. @example
  3054. ladspa=vlevel-ladspa:vlevel_mono
  3055. @end example
  3056. @end itemize
  3057. @subsection Commands
  3058. This filter supports the following commands:
  3059. @table @option
  3060. @item cN
  3061. Modify the @var{N}-th control value.
  3062. If the specified value is not valid, it is ignored and prior one is kept.
  3063. @end table
  3064. @section loudnorm
  3065. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3066. Support for both single pass (livestreams, files) and double pass (files) modes.
  3067. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3068. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3069. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3070. The filter accepts the following options:
  3071. @table @option
  3072. @item I, i
  3073. Set integrated loudness target.
  3074. Range is -70.0 - -5.0. Default value is -24.0.
  3075. @item LRA, lra
  3076. Set loudness range target.
  3077. Range is 1.0 - 20.0. Default value is 7.0.
  3078. @item TP, tp
  3079. Set maximum true peak.
  3080. Range is -9.0 - +0.0. Default value is -2.0.
  3081. @item measured_I, measured_i
  3082. Measured IL of input file.
  3083. Range is -99.0 - +0.0.
  3084. @item measured_LRA, measured_lra
  3085. Measured LRA of input file.
  3086. Range is 0.0 - 99.0.
  3087. @item measured_TP, measured_tp
  3088. Measured true peak of input file.
  3089. Range is -99.0 - +99.0.
  3090. @item measured_thresh
  3091. Measured threshold of input file.
  3092. Range is -99.0 - +0.0.
  3093. @item offset
  3094. Set offset gain. Gain is applied before the true-peak limiter.
  3095. Range is -99.0 - +99.0. Default is +0.0.
  3096. @item linear
  3097. Normalize linearly if possible.
  3098. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3099. to be specified in order to use this mode.
  3100. Options are true or false. Default is true.
  3101. @item dual_mono
  3102. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3103. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3104. If set to @code{true}, this option will compensate for this effect.
  3105. Multi-channel input files are not affected by this option.
  3106. Options are true or false. Default is false.
  3107. @item print_format
  3108. Set print format for stats. Options are summary, json, or none.
  3109. Default value is none.
  3110. @end table
  3111. @section lowpass
  3112. Apply a low-pass filter with 3dB point frequency.
  3113. The filter can be either single-pole or double-pole (the default).
  3114. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3115. The filter accepts the following options:
  3116. @table @option
  3117. @item frequency, f
  3118. Set frequency in Hz. Default is 500.
  3119. @item poles, p
  3120. Set number of poles. Default is 2.
  3121. @item width_type, t
  3122. Set method to specify band-width of filter.
  3123. @table @option
  3124. @item h
  3125. Hz
  3126. @item q
  3127. Q-Factor
  3128. @item o
  3129. octave
  3130. @item s
  3131. slope
  3132. @item k
  3133. kHz
  3134. @end table
  3135. @item width, w
  3136. Specify the band-width of a filter in width_type units.
  3137. Applies only to double-pole filter.
  3138. The default is 0.707q and gives a Butterworth response.
  3139. @item channels, c
  3140. Specify which channels to filter, by default all available are filtered.
  3141. @end table
  3142. @subsection Examples
  3143. @itemize
  3144. @item
  3145. Lowpass only LFE channel, it LFE is not present it does nothing:
  3146. @example
  3147. lowpass=c=LFE
  3148. @end example
  3149. @end itemize
  3150. @subsection Commands
  3151. This filter supports the following commands:
  3152. @table @option
  3153. @item frequency, f
  3154. Change lowpass frequency.
  3155. Syntax for the command is : "@var{frequency}"
  3156. @item width_type, t
  3157. Change lowpass width_type.
  3158. Syntax for the command is : "@var{width_type}"
  3159. @item width, w
  3160. Change lowpass width.
  3161. Syntax for the command is : "@var{width}"
  3162. @end table
  3163. @section lv2
  3164. Load a LV2 (LADSPA Version 2) plugin.
  3165. To enable compilation of this filter you need to configure FFmpeg with
  3166. @code{--enable-lv2}.
  3167. @table @option
  3168. @item plugin, p
  3169. Specifies the plugin URI. You may need to escape ':'.
  3170. @item controls, c
  3171. Set the '|' separated list of controls which are zero or more floating point
  3172. values that determine the behavior of the loaded plugin (for example delay,
  3173. threshold or gain).
  3174. If @option{controls} is set to @code{help}, all available controls and
  3175. their valid ranges are printed.
  3176. @item sample_rate, s
  3177. Specify the sample rate, default to 44100. Only used if plugin have
  3178. zero inputs.
  3179. @item nb_samples, n
  3180. Set the number of samples per channel per each output frame, default
  3181. is 1024. Only used if plugin have zero inputs.
  3182. @item duration, d
  3183. Set the minimum duration of the sourced audio. See
  3184. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3185. for the accepted syntax.
  3186. Note that the resulting duration may be greater than the specified duration,
  3187. as the generated audio is always cut at the end of a complete frame.
  3188. If not specified, or the expressed duration is negative, the audio is
  3189. supposed to be generated forever.
  3190. Only used if plugin have zero inputs.
  3191. @end table
  3192. @subsection Examples
  3193. @itemize
  3194. @item
  3195. Apply bass enhancer plugin from Calf:
  3196. @example
  3197. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3198. @end example
  3199. @item
  3200. Apply vinyl plugin from Calf:
  3201. @example
  3202. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3203. @end example
  3204. @item
  3205. Apply bit crusher plugin from ArtyFX:
  3206. @example
  3207. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3208. @end example
  3209. @end itemize
  3210. @section mcompand
  3211. Multiband Compress or expand the audio's dynamic range.
  3212. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3213. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3214. response when absent compander action.
  3215. It accepts the following parameters:
  3216. @table @option
  3217. @item args
  3218. This option syntax is:
  3219. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3220. For explanation of each item refer to compand filter documentation.
  3221. @end table
  3222. @anchor{pan}
  3223. @section pan
  3224. Mix channels with specific gain levels. The filter accepts the output
  3225. channel layout followed by a set of channels definitions.
  3226. This filter is also designed to efficiently remap the channels of an audio
  3227. stream.
  3228. The filter accepts parameters of the form:
  3229. "@var{l}|@var{outdef}|@var{outdef}|..."
  3230. @table @option
  3231. @item l
  3232. output channel layout or number of channels
  3233. @item outdef
  3234. output channel specification, of the form:
  3235. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3236. @item out_name
  3237. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3238. number (c0, c1, etc.)
  3239. @item gain
  3240. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3241. @item in_name
  3242. input channel to use, see out_name for details; it is not possible to mix
  3243. named and numbered input channels
  3244. @end table
  3245. If the `=' in a channel specification is replaced by `<', then the gains for
  3246. that specification will be renormalized so that the total is 1, thus
  3247. avoiding clipping noise.
  3248. @subsection Mixing examples
  3249. For example, if you want to down-mix from stereo to mono, but with a bigger
  3250. factor for the left channel:
  3251. @example
  3252. pan=1c|c0=0.9*c0+0.1*c1
  3253. @end example
  3254. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3255. 7-channels surround:
  3256. @example
  3257. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3258. @end example
  3259. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3260. that should be preferred (see "-ac" option) unless you have very specific
  3261. needs.
  3262. @subsection Remapping examples
  3263. The channel remapping will be effective if, and only if:
  3264. @itemize
  3265. @item gain coefficients are zeroes or ones,
  3266. @item only one input per channel output,
  3267. @end itemize
  3268. If all these conditions are satisfied, the filter will notify the user ("Pure
  3269. channel mapping detected"), and use an optimized and lossless method to do the
  3270. remapping.
  3271. For example, if you have a 5.1 source and want a stereo audio stream by
  3272. dropping the extra channels:
  3273. @example
  3274. pan="stereo| c0=FL | c1=FR"
  3275. @end example
  3276. Given the same source, you can also switch front left and front right channels
  3277. and keep the input channel layout:
  3278. @example
  3279. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3280. @end example
  3281. If the input is a stereo audio stream, you can mute the front left channel (and
  3282. still keep the stereo channel layout) with:
  3283. @example
  3284. pan="stereo|c1=c1"
  3285. @end example
  3286. Still with a stereo audio stream input, you can copy the right channel in both
  3287. front left and right:
  3288. @example
  3289. pan="stereo| c0=FR | c1=FR"
  3290. @end example
  3291. @section replaygain
  3292. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3293. outputs it unchanged.
  3294. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3295. @section resample
  3296. Convert the audio sample format, sample rate and channel layout. It is
  3297. not meant to be used directly.
  3298. @section rubberband
  3299. Apply time-stretching and pitch-shifting with librubberband.
  3300. To enable compilation of this filter, you need to configure FFmpeg with
  3301. @code{--enable-librubberband}.
  3302. The filter accepts the following options:
  3303. @table @option
  3304. @item tempo
  3305. Set tempo scale factor.
  3306. @item pitch
  3307. Set pitch scale factor.
  3308. @item transients
  3309. Set transients detector.
  3310. Possible values are:
  3311. @table @var
  3312. @item crisp
  3313. @item mixed
  3314. @item smooth
  3315. @end table
  3316. @item detector
  3317. Set detector.
  3318. Possible values are:
  3319. @table @var
  3320. @item compound
  3321. @item percussive
  3322. @item soft
  3323. @end table
  3324. @item phase
  3325. Set phase.
  3326. Possible values are:
  3327. @table @var
  3328. @item laminar
  3329. @item independent
  3330. @end table
  3331. @item window
  3332. Set processing window size.
  3333. Possible values are:
  3334. @table @var
  3335. @item standard
  3336. @item short
  3337. @item long
  3338. @end table
  3339. @item smoothing
  3340. Set smoothing.
  3341. Possible values are:
  3342. @table @var
  3343. @item off
  3344. @item on
  3345. @end table
  3346. @item formant
  3347. Enable formant preservation when shift pitching.
  3348. Possible values are:
  3349. @table @var
  3350. @item shifted
  3351. @item preserved
  3352. @end table
  3353. @item pitchq
  3354. Set pitch quality.
  3355. Possible values are:
  3356. @table @var
  3357. @item quality
  3358. @item speed
  3359. @item consistency
  3360. @end table
  3361. @item channels
  3362. Set channels.
  3363. Possible values are:
  3364. @table @var
  3365. @item apart
  3366. @item together
  3367. @end table
  3368. @end table
  3369. @section sidechaincompress
  3370. This filter acts like normal compressor but has the ability to compress
  3371. detected signal using second input signal.
  3372. It needs two input streams and returns one output stream.
  3373. First input stream will be processed depending on second stream signal.
  3374. The filtered signal then can be filtered with other filters in later stages of
  3375. processing. See @ref{pan} and @ref{amerge} filter.
  3376. The filter accepts the following options:
  3377. @table @option
  3378. @item level_in
  3379. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3380. @item mode
  3381. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3382. Default is @code{downward}.
  3383. @item threshold
  3384. If a signal of second stream raises above this level it will affect the gain
  3385. reduction of first stream.
  3386. By default is 0.125. Range is between 0.00097563 and 1.
  3387. @item ratio
  3388. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3389. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3390. Default is 2. Range is between 1 and 20.
  3391. @item attack
  3392. Amount of milliseconds the signal has to rise above the threshold before gain
  3393. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3394. @item release
  3395. Amount of milliseconds the signal has to fall below the threshold before
  3396. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3397. @item makeup
  3398. Set the amount by how much signal will be amplified after processing.
  3399. Default is 1. Range is from 1 to 64.
  3400. @item knee
  3401. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3402. Default is 2.82843. Range is between 1 and 8.
  3403. @item link
  3404. Choose if the @code{average} level between all channels of side-chain stream
  3405. or the louder(@code{maximum}) channel of side-chain stream affects the
  3406. reduction. Default is @code{average}.
  3407. @item detection
  3408. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3409. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3410. @item level_sc
  3411. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3412. @item mix
  3413. How much to use compressed signal in output. Default is 1.
  3414. Range is between 0 and 1.
  3415. @end table
  3416. @subsection Examples
  3417. @itemize
  3418. @item
  3419. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3420. depending on the signal of 2nd input and later compressed signal to be
  3421. merged with 2nd input:
  3422. @example
  3423. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3424. @end example
  3425. @end itemize
  3426. @section sidechaingate
  3427. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3428. filter the detected signal before sending it to the gain reduction stage.
  3429. Normally a gate uses the full range signal to detect a level above the
  3430. threshold.
  3431. For example: If you cut all lower frequencies from your sidechain signal
  3432. the gate will decrease the volume of your track only if not enough highs
  3433. appear. With this technique you are able to reduce the resonation of a
  3434. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3435. guitar.
  3436. It needs two input streams and returns one output stream.
  3437. First input stream will be processed depending on second stream signal.
  3438. The filter accepts the following options:
  3439. @table @option
  3440. @item level_in
  3441. Set input level before filtering.
  3442. Default is 1. Allowed range is from 0.015625 to 64.
  3443. @item mode
  3444. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3445. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3446. will be amplified, expanding dynamic range in upward direction.
  3447. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3448. @item range
  3449. Set the level of gain reduction when the signal is below the threshold.
  3450. Default is 0.06125. Allowed range is from 0 to 1.
  3451. Setting this to 0 disables reduction and then filter behaves like expander.
  3452. @item threshold
  3453. If a signal rises above this level the gain reduction is released.
  3454. Default is 0.125. Allowed range is from 0 to 1.
  3455. @item ratio
  3456. Set a ratio about which the signal is reduced.
  3457. Default is 2. Allowed range is from 1 to 9000.
  3458. @item attack
  3459. Amount of milliseconds the signal has to rise above the threshold before gain
  3460. reduction stops.
  3461. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3462. @item release
  3463. Amount of milliseconds the signal has to fall below the threshold before the
  3464. reduction is increased again. Default is 250 milliseconds.
  3465. Allowed range is from 0.01 to 9000.
  3466. @item makeup
  3467. Set amount of amplification of signal after processing.
  3468. Default is 1. Allowed range is from 1 to 64.
  3469. @item knee
  3470. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3471. Default is 2.828427125. Allowed range is from 1 to 8.
  3472. @item detection
  3473. Choose if exact signal should be taken for detection or an RMS like one.
  3474. Default is rms. Can be peak or rms.
  3475. @item link
  3476. Choose if the average level between all channels or the louder channel affects
  3477. the reduction.
  3478. Default is average. Can be average or maximum.
  3479. @item level_sc
  3480. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3481. @end table
  3482. @section silencedetect
  3483. Detect silence in an audio stream.
  3484. This filter logs a message when it detects that the input audio volume is less
  3485. or equal to a noise tolerance value for a duration greater or equal to the
  3486. minimum detected noise duration.
  3487. The printed times and duration are expressed in seconds.
  3488. The filter accepts the following options:
  3489. @table @option
  3490. @item noise, n
  3491. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3492. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3493. @item duration, d
  3494. Set silence duration until notification (default is 2 seconds).
  3495. @item mono, m
  3496. Process each channel separately, instead of combined. By default is disabled.
  3497. @end table
  3498. @subsection Examples
  3499. @itemize
  3500. @item
  3501. Detect 5 seconds of silence with -50dB noise tolerance:
  3502. @example
  3503. silencedetect=n=-50dB:d=5
  3504. @end example
  3505. @item
  3506. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3507. tolerance in @file{silence.mp3}:
  3508. @example
  3509. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3510. @end example
  3511. @end itemize
  3512. @section silenceremove
  3513. Remove silence from the beginning, middle or end of the audio.
  3514. The filter accepts the following options:
  3515. @table @option
  3516. @item start_periods
  3517. This value is used to indicate if audio should be trimmed at beginning of
  3518. the audio. A value of zero indicates no silence should be trimmed from the
  3519. beginning. When specifying a non-zero value, it trims audio up until it
  3520. finds non-silence. Normally, when trimming silence from beginning of audio
  3521. the @var{start_periods} will be @code{1} but it can be increased to higher
  3522. values to trim all audio up to specific count of non-silence periods.
  3523. Default value is @code{0}.
  3524. @item start_duration
  3525. Specify the amount of time that non-silence must be detected before it stops
  3526. trimming audio. By increasing the duration, bursts of noises can be treated
  3527. as silence and trimmed off. Default value is @code{0}.
  3528. @item start_threshold
  3529. This indicates what sample value should be treated as silence. For digital
  3530. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3531. you may wish to increase the value to account for background noise.
  3532. Can be specified in dB (in case "dB" is appended to the specified value)
  3533. or amplitude ratio. Default value is @code{0}.
  3534. @item start_silence
  3535. Specify max duration of silence at beginning that will be kept after
  3536. trimming. Default is 0, which is equal to trimming all samples detected
  3537. as silence.
  3538. @item start_mode
  3539. Specify mode of detection of silence end in start of multi-channel audio.
  3540. Can be @var{any} or @var{all}. Default is @var{any}.
  3541. With @var{any}, any sample that is detected as non-silence will cause
  3542. stopped trimming of silence.
  3543. With @var{all}, only if all channels are detected as non-silence will cause
  3544. stopped trimming of silence.
  3545. @item stop_periods
  3546. Set the count for trimming silence from the end of audio.
  3547. To remove silence from the middle of a file, specify a @var{stop_periods}
  3548. that is negative. This value is then treated as a positive value and is
  3549. used to indicate the effect should restart processing as specified by
  3550. @var{start_periods}, making it suitable for removing periods of silence
  3551. in the middle of the audio.
  3552. Default value is @code{0}.
  3553. @item stop_duration
  3554. Specify a duration of silence that must exist before audio is not copied any
  3555. more. By specifying a higher duration, silence that is wanted can be left in
  3556. the audio.
  3557. Default value is @code{0}.
  3558. @item stop_threshold
  3559. This is the same as @option{start_threshold} but for trimming silence from
  3560. the end of audio.
  3561. Can be specified in dB (in case "dB" is appended to the specified value)
  3562. or amplitude ratio. Default value is @code{0}.
  3563. @item stop_silence
  3564. Specify max duration of silence at end that will be kept after
  3565. trimming. Default is 0, which is equal to trimming all samples detected
  3566. as silence.
  3567. @item stop_mode
  3568. Specify mode of detection of silence start in end of multi-channel audio.
  3569. Can be @var{any} or @var{all}. Default is @var{any}.
  3570. With @var{any}, any sample that is detected as non-silence will cause
  3571. stopped trimming of silence.
  3572. With @var{all}, only if all channels are detected as non-silence will cause
  3573. stopped trimming of silence.
  3574. @item detection
  3575. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3576. and works better with digital silence which is exactly 0.
  3577. Default value is @code{rms}.
  3578. @item window
  3579. Set duration in number of seconds used to calculate size of window in number
  3580. of samples for detecting silence.
  3581. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3582. @end table
  3583. @subsection Examples
  3584. @itemize
  3585. @item
  3586. The following example shows how this filter can be used to start a recording
  3587. that does not contain the delay at the start which usually occurs between
  3588. pressing the record button and the start of the performance:
  3589. @example
  3590. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3591. @end example
  3592. @item
  3593. Trim all silence encountered from beginning to end where there is more than 1
  3594. second of silence in audio:
  3595. @example
  3596. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3597. @end example
  3598. @end itemize
  3599. @section sofalizer
  3600. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3601. loudspeakers around the user for binaural listening via headphones (audio
  3602. formats up to 9 channels supported).
  3603. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3604. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3605. Austrian Academy of Sciences.
  3606. To enable compilation of this filter you need to configure FFmpeg with
  3607. @code{--enable-libmysofa}.
  3608. The filter accepts the following options:
  3609. @table @option
  3610. @item sofa
  3611. Set the SOFA file used for rendering.
  3612. @item gain
  3613. Set gain applied to audio. Value is in dB. Default is 0.
  3614. @item rotation
  3615. Set rotation of virtual loudspeakers in deg. Default is 0.
  3616. @item elevation
  3617. Set elevation of virtual speakers in deg. Default is 0.
  3618. @item radius
  3619. Set distance in meters between loudspeakers and the listener with near-field
  3620. HRTFs. Default is 1.
  3621. @item type
  3622. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3623. processing audio in time domain which is slow.
  3624. @var{freq} is processing audio in frequency domain which is fast.
  3625. Default is @var{freq}.
  3626. @item speakers
  3627. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3628. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3629. Each virtual loudspeaker is described with short channel name following with
  3630. azimuth and elevation in degrees.
  3631. Each virtual loudspeaker description is separated by '|'.
  3632. For example to override front left and front right channel positions use:
  3633. 'speakers=FL 45 15|FR 345 15'.
  3634. Descriptions with unrecognised channel names are ignored.
  3635. @item lfegain
  3636. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3637. @item framesize
  3638. Set custom frame size in number of samples. Default is 1024.
  3639. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3640. is set to @var{freq}.
  3641. @item normalize
  3642. Should all IRs be normalized upon importing SOFA file.
  3643. By default is enabled.
  3644. @item interpolate
  3645. Should nearest IRs be interpolated with neighbor IRs if exact position
  3646. does not match. By default is disabled.
  3647. @item minphase
  3648. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3649. @item anglestep
  3650. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3651. @item radstep
  3652. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3653. @end table
  3654. @subsection Examples
  3655. @itemize
  3656. @item
  3657. Using ClubFritz6 sofa file:
  3658. @example
  3659. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3660. @end example
  3661. @item
  3662. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3663. @example
  3664. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3665. @end example
  3666. @item
  3667. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3668. and also with custom gain:
  3669. @example
  3670. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3671. @end example
  3672. @end itemize
  3673. @section stereotools
  3674. This filter has some handy utilities to manage stereo signals, for converting
  3675. M/S stereo recordings to L/R signal while having control over the parameters
  3676. or spreading the stereo image of master track.
  3677. The filter accepts the following options:
  3678. @table @option
  3679. @item level_in
  3680. Set input level before filtering for both channels. Defaults is 1.
  3681. Allowed range is from 0.015625 to 64.
  3682. @item level_out
  3683. Set output level after filtering for both channels. Defaults is 1.
  3684. Allowed range is from 0.015625 to 64.
  3685. @item balance_in
  3686. Set input balance between both channels. Default is 0.
  3687. Allowed range is from -1 to 1.
  3688. @item balance_out
  3689. Set output balance between both channels. Default is 0.
  3690. Allowed range is from -1 to 1.
  3691. @item softclip
  3692. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3693. clipping. Disabled by default.
  3694. @item mutel
  3695. Mute the left channel. Disabled by default.
  3696. @item muter
  3697. Mute the right channel. Disabled by default.
  3698. @item phasel
  3699. Change the phase of the left channel. Disabled by default.
  3700. @item phaser
  3701. Change the phase of the right channel. Disabled by default.
  3702. @item mode
  3703. Set stereo mode. Available values are:
  3704. @table @samp
  3705. @item lr>lr
  3706. Left/Right to Left/Right, this is default.
  3707. @item lr>ms
  3708. Left/Right to Mid/Side.
  3709. @item ms>lr
  3710. Mid/Side to Left/Right.
  3711. @item lr>ll
  3712. Left/Right to Left/Left.
  3713. @item lr>rr
  3714. Left/Right to Right/Right.
  3715. @item lr>l+r
  3716. Left/Right to Left + Right.
  3717. @item lr>rl
  3718. Left/Right to Right/Left.
  3719. @item ms>ll
  3720. Mid/Side to Left/Left.
  3721. @item ms>rr
  3722. Mid/Side to Right/Right.
  3723. @end table
  3724. @item slev
  3725. Set level of side signal. Default is 1.
  3726. Allowed range is from 0.015625 to 64.
  3727. @item sbal
  3728. Set balance of side signal. Default is 0.
  3729. Allowed range is from -1 to 1.
  3730. @item mlev
  3731. Set level of the middle signal. Default is 1.
  3732. Allowed range is from 0.015625 to 64.
  3733. @item mpan
  3734. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3735. @item base
  3736. Set stereo base between mono and inversed channels. Default is 0.
  3737. Allowed range is from -1 to 1.
  3738. @item delay
  3739. Set delay in milliseconds how much to delay left from right channel and
  3740. vice versa. Default is 0. Allowed range is from -20 to 20.
  3741. @item sclevel
  3742. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3743. @item phase
  3744. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3745. @item bmode_in, bmode_out
  3746. Set balance mode for balance_in/balance_out option.
  3747. Can be one of the following:
  3748. @table @samp
  3749. @item balance
  3750. Classic balance mode. Attenuate one channel at time.
  3751. Gain is raised up to 1.
  3752. @item amplitude
  3753. Similar as classic mode above but gain is raised up to 2.
  3754. @item power
  3755. Equal power distribution, from -6dB to +6dB range.
  3756. @end table
  3757. @end table
  3758. @subsection Examples
  3759. @itemize
  3760. @item
  3761. Apply karaoke like effect:
  3762. @example
  3763. stereotools=mlev=0.015625
  3764. @end example
  3765. @item
  3766. Convert M/S signal to L/R:
  3767. @example
  3768. "stereotools=mode=ms>lr"
  3769. @end example
  3770. @end itemize
  3771. @section stereowiden
  3772. This filter enhance the stereo effect by suppressing signal common to both
  3773. channels and by delaying the signal of left into right and vice versa,
  3774. thereby widening the stereo effect.
  3775. The filter accepts the following options:
  3776. @table @option
  3777. @item delay
  3778. Time in milliseconds of the delay of left signal into right and vice versa.
  3779. Default is 20 milliseconds.
  3780. @item feedback
  3781. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3782. effect of left signal in right output and vice versa which gives widening
  3783. effect. Default is 0.3.
  3784. @item crossfeed
  3785. Cross feed of left into right with inverted phase. This helps in suppressing
  3786. the mono. If the value is 1 it will cancel all the signal common to both
  3787. channels. Default is 0.3.
  3788. @item drymix
  3789. Set level of input signal of original channel. Default is 0.8.
  3790. @end table
  3791. @section superequalizer
  3792. Apply 18 band equalizer.
  3793. The filter accepts the following options:
  3794. @table @option
  3795. @item 1b
  3796. Set 65Hz band gain.
  3797. @item 2b
  3798. Set 92Hz band gain.
  3799. @item 3b
  3800. Set 131Hz band gain.
  3801. @item 4b
  3802. Set 185Hz band gain.
  3803. @item 5b
  3804. Set 262Hz band gain.
  3805. @item 6b
  3806. Set 370Hz band gain.
  3807. @item 7b
  3808. Set 523Hz band gain.
  3809. @item 8b
  3810. Set 740Hz band gain.
  3811. @item 9b
  3812. Set 1047Hz band gain.
  3813. @item 10b
  3814. Set 1480Hz band gain.
  3815. @item 11b
  3816. Set 2093Hz band gain.
  3817. @item 12b
  3818. Set 2960Hz band gain.
  3819. @item 13b
  3820. Set 4186Hz band gain.
  3821. @item 14b
  3822. Set 5920Hz band gain.
  3823. @item 15b
  3824. Set 8372Hz band gain.
  3825. @item 16b
  3826. Set 11840Hz band gain.
  3827. @item 17b
  3828. Set 16744Hz band gain.
  3829. @item 18b
  3830. Set 20000Hz band gain.
  3831. @end table
  3832. @section surround
  3833. Apply audio surround upmix filter.
  3834. This filter allows to produce multichannel output from audio stream.
  3835. The filter accepts the following options:
  3836. @table @option
  3837. @item chl_out
  3838. Set output channel layout. By default, this is @var{5.1}.
  3839. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3840. for the required syntax.
  3841. @item chl_in
  3842. Set input channel layout. By default, this is @var{stereo}.
  3843. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3844. for the required syntax.
  3845. @item level_in
  3846. Set input volume level. By default, this is @var{1}.
  3847. @item level_out
  3848. Set output volume level. By default, this is @var{1}.
  3849. @item lfe
  3850. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3851. @item lfe_low
  3852. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3853. @item lfe_high
  3854. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3855. @item lfe_mode
  3856. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3857. In @var{add} mode, LFE channel is created from input audio and added to output.
  3858. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3859. also all non-LFE output channels are subtracted with output LFE channel.
  3860. @item angle
  3861. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3862. Default is @var{90}.
  3863. @item fc_in
  3864. Set front center input volume. By default, this is @var{1}.
  3865. @item fc_out
  3866. Set front center output volume. By default, this is @var{1}.
  3867. @item fl_in
  3868. Set front left input volume. By default, this is @var{1}.
  3869. @item fl_out
  3870. Set front left output volume. By default, this is @var{1}.
  3871. @item fr_in
  3872. Set front right input volume. By default, this is @var{1}.
  3873. @item fr_out
  3874. Set front right output volume. By default, this is @var{1}.
  3875. @item sl_in
  3876. Set side left input volume. By default, this is @var{1}.
  3877. @item sl_out
  3878. Set side left output volume. By default, this is @var{1}.
  3879. @item sr_in
  3880. Set side right input volume. By default, this is @var{1}.
  3881. @item sr_out
  3882. Set side right output volume. By default, this is @var{1}.
  3883. @item bl_in
  3884. Set back left input volume. By default, this is @var{1}.
  3885. @item bl_out
  3886. Set back left output volume. By default, this is @var{1}.
  3887. @item br_in
  3888. Set back right input volume. By default, this is @var{1}.
  3889. @item br_out
  3890. Set back right output volume. By default, this is @var{1}.
  3891. @item bc_in
  3892. Set back center input volume. By default, this is @var{1}.
  3893. @item bc_out
  3894. Set back center output volume. By default, this is @var{1}.
  3895. @item lfe_in
  3896. Set LFE input volume. By default, this is @var{1}.
  3897. @item lfe_out
  3898. Set LFE output volume. By default, this is @var{1}.
  3899. @item allx
  3900. Set spread usage of stereo image across X axis for all channels.
  3901. @item ally
  3902. Set spread usage of stereo image across Y axis for all channels.
  3903. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3904. Set spread usage of stereo image across X axis for each channel.
  3905. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3906. Set spread usage of stereo image across Y axis for each channel.
  3907. @item win_size
  3908. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3909. @item win_func
  3910. Set window function.
  3911. It accepts the following values:
  3912. @table @samp
  3913. @item rect
  3914. @item bartlett
  3915. @item hann, hanning
  3916. @item hamming
  3917. @item blackman
  3918. @item welch
  3919. @item flattop
  3920. @item bharris
  3921. @item bnuttall
  3922. @item bhann
  3923. @item sine
  3924. @item nuttall
  3925. @item lanczos
  3926. @item gauss
  3927. @item tukey
  3928. @item dolph
  3929. @item cauchy
  3930. @item parzen
  3931. @item poisson
  3932. @item bohman
  3933. @end table
  3934. Default is @code{hann}.
  3935. @item overlap
  3936. Set window overlap. If set to 1, the recommended overlap for selected
  3937. window function will be picked. Default is @code{0.5}.
  3938. @end table
  3939. @section treble, highshelf
  3940. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3941. shelving filter with a response similar to that of a standard
  3942. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3943. The filter accepts the following options:
  3944. @table @option
  3945. @item gain, g
  3946. Give the gain at whichever is the lower of ~22 kHz and the
  3947. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3948. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3949. @item frequency, f
  3950. Set the filter's central frequency and so can be used
  3951. to extend or reduce the frequency range to be boosted or cut.
  3952. The default value is @code{3000} Hz.
  3953. @item width_type, t
  3954. Set method to specify band-width of filter.
  3955. @table @option
  3956. @item h
  3957. Hz
  3958. @item q
  3959. Q-Factor
  3960. @item o
  3961. octave
  3962. @item s
  3963. slope
  3964. @item k
  3965. kHz
  3966. @end table
  3967. @item width, w
  3968. Determine how steep is the filter's shelf transition.
  3969. @item channels, c
  3970. Specify which channels to filter, by default all available are filtered.
  3971. @end table
  3972. @subsection Commands
  3973. This filter supports the following commands:
  3974. @table @option
  3975. @item frequency, f
  3976. Change treble frequency.
  3977. Syntax for the command is : "@var{frequency}"
  3978. @item width_type, t
  3979. Change treble width_type.
  3980. Syntax for the command is : "@var{width_type}"
  3981. @item width, w
  3982. Change treble width.
  3983. Syntax for the command is : "@var{width}"
  3984. @item gain, g
  3985. Change treble gain.
  3986. Syntax for the command is : "@var{gain}"
  3987. @end table
  3988. @section tremolo
  3989. Sinusoidal amplitude modulation.
  3990. The filter accepts the following options:
  3991. @table @option
  3992. @item f
  3993. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3994. (20 Hz or lower) will result in a tremolo effect.
  3995. This filter may also be used as a ring modulator by specifying
  3996. a modulation frequency higher than 20 Hz.
  3997. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3998. @item d
  3999. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4000. Default value is 0.5.
  4001. @end table
  4002. @section vibrato
  4003. Sinusoidal phase modulation.
  4004. The filter accepts the following options:
  4005. @table @option
  4006. @item f
  4007. Modulation frequency in Hertz.
  4008. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4009. @item d
  4010. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4011. Default value is 0.5.
  4012. @end table
  4013. @section volume
  4014. Adjust the input audio volume.
  4015. It accepts the following parameters:
  4016. @table @option
  4017. @item volume
  4018. Set audio volume expression.
  4019. Output values are clipped to the maximum value.
  4020. The output audio volume is given by the relation:
  4021. @example
  4022. @var{output_volume} = @var{volume} * @var{input_volume}
  4023. @end example
  4024. The default value for @var{volume} is "1.0".
  4025. @item precision
  4026. This parameter represents the mathematical precision.
  4027. It determines which input sample formats will be allowed, which affects the
  4028. precision of the volume scaling.
  4029. @table @option
  4030. @item fixed
  4031. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4032. @item float
  4033. 32-bit floating-point; this limits input sample format to FLT. (default)
  4034. @item double
  4035. 64-bit floating-point; this limits input sample format to DBL.
  4036. @end table
  4037. @item replaygain
  4038. Choose the behaviour on encountering ReplayGain side data in input frames.
  4039. @table @option
  4040. @item drop
  4041. Remove ReplayGain side data, ignoring its contents (the default).
  4042. @item ignore
  4043. Ignore ReplayGain side data, but leave it in the frame.
  4044. @item track
  4045. Prefer the track gain, if present.
  4046. @item album
  4047. Prefer the album gain, if present.
  4048. @end table
  4049. @item replaygain_preamp
  4050. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4051. Default value for @var{replaygain_preamp} is 0.0.
  4052. @item eval
  4053. Set when the volume expression is evaluated.
  4054. It accepts the following values:
  4055. @table @samp
  4056. @item once
  4057. only evaluate expression once during the filter initialization, or
  4058. when the @samp{volume} command is sent
  4059. @item frame
  4060. evaluate expression for each incoming frame
  4061. @end table
  4062. Default value is @samp{once}.
  4063. @end table
  4064. The volume expression can contain the following parameters.
  4065. @table @option
  4066. @item n
  4067. frame number (starting at zero)
  4068. @item nb_channels
  4069. number of channels
  4070. @item nb_consumed_samples
  4071. number of samples consumed by the filter
  4072. @item nb_samples
  4073. number of samples in the current frame
  4074. @item pos
  4075. original frame position in the file
  4076. @item pts
  4077. frame PTS
  4078. @item sample_rate
  4079. sample rate
  4080. @item startpts
  4081. PTS at start of stream
  4082. @item startt
  4083. time at start of stream
  4084. @item t
  4085. frame time
  4086. @item tb
  4087. timestamp timebase
  4088. @item volume
  4089. last set volume value
  4090. @end table
  4091. Note that when @option{eval} is set to @samp{once} only the
  4092. @var{sample_rate} and @var{tb} variables are available, all other
  4093. variables will evaluate to NAN.
  4094. @subsection Commands
  4095. This filter supports the following commands:
  4096. @table @option
  4097. @item volume
  4098. Modify the volume expression.
  4099. The command accepts the same syntax of the corresponding option.
  4100. If the specified expression is not valid, it is kept at its current
  4101. value.
  4102. @item replaygain_noclip
  4103. Prevent clipping by limiting the gain applied.
  4104. Default value for @var{replaygain_noclip} is 1.
  4105. @end table
  4106. @subsection Examples
  4107. @itemize
  4108. @item
  4109. Halve the input audio volume:
  4110. @example
  4111. volume=volume=0.5
  4112. volume=volume=1/2
  4113. volume=volume=-6.0206dB
  4114. @end example
  4115. In all the above example the named key for @option{volume} can be
  4116. omitted, for example like in:
  4117. @example
  4118. volume=0.5
  4119. @end example
  4120. @item
  4121. Increase input audio power by 6 decibels using fixed-point precision:
  4122. @example
  4123. volume=volume=6dB:precision=fixed
  4124. @end example
  4125. @item
  4126. Fade volume after time 10 with an annihilation period of 5 seconds:
  4127. @example
  4128. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4129. @end example
  4130. @end itemize
  4131. @section volumedetect
  4132. Detect the volume of the input video.
  4133. The filter has no parameters. The input is not modified. Statistics about
  4134. the volume will be printed in the log when the input stream end is reached.
  4135. In particular it will show the mean volume (root mean square), maximum
  4136. volume (on a per-sample basis), and the beginning of a histogram of the
  4137. registered volume values (from the maximum value to a cumulated 1/1000 of
  4138. the samples).
  4139. All volumes are in decibels relative to the maximum PCM value.
  4140. @subsection Examples
  4141. Here is an excerpt of the output:
  4142. @example
  4143. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4144. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4145. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4146. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4147. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4148. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4149. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4150. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4151. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4152. @end example
  4153. It means that:
  4154. @itemize
  4155. @item
  4156. The mean square energy is approximately -27 dB, or 10^-2.7.
  4157. @item
  4158. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4159. @item
  4160. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4161. @end itemize
  4162. In other words, raising the volume by +4 dB does not cause any clipping,
  4163. raising it by +5 dB causes clipping for 6 samples, etc.
  4164. @c man end AUDIO FILTERS
  4165. @chapter Audio Sources
  4166. @c man begin AUDIO SOURCES
  4167. Below is a description of the currently available audio sources.
  4168. @section abuffer
  4169. Buffer audio frames, and make them available to the filter chain.
  4170. This source is mainly intended for a programmatic use, in particular
  4171. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4172. It accepts the following parameters:
  4173. @table @option
  4174. @item time_base
  4175. The timebase which will be used for timestamps of submitted frames. It must be
  4176. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4177. @item sample_rate
  4178. The sample rate of the incoming audio buffers.
  4179. @item sample_fmt
  4180. The sample format of the incoming audio buffers.
  4181. Either a sample format name or its corresponding integer representation from
  4182. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4183. @item channel_layout
  4184. The channel layout of the incoming audio buffers.
  4185. Either a channel layout name from channel_layout_map in
  4186. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4187. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4188. @item channels
  4189. The number of channels of the incoming audio buffers.
  4190. If both @var{channels} and @var{channel_layout} are specified, then they
  4191. must be consistent.
  4192. @end table
  4193. @subsection Examples
  4194. @example
  4195. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4196. @end example
  4197. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4198. Since the sample format with name "s16p" corresponds to the number
  4199. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4200. equivalent to:
  4201. @example
  4202. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4203. @end example
  4204. @section aevalsrc
  4205. Generate an audio signal specified by an expression.
  4206. This source accepts in input one or more expressions (one for each
  4207. channel), which are evaluated and used to generate a corresponding
  4208. audio signal.
  4209. This source accepts the following options:
  4210. @table @option
  4211. @item exprs
  4212. Set the '|'-separated expressions list for each separate channel. In case the
  4213. @option{channel_layout} option is not specified, the selected channel layout
  4214. depends on the number of provided expressions. Otherwise the last
  4215. specified expression is applied to the remaining output channels.
  4216. @item channel_layout, c
  4217. Set the channel layout. The number of channels in the specified layout
  4218. must be equal to the number of specified expressions.
  4219. @item duration, d
  4220. Set the minimum duration of the sourced audio. See
  4221. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4222. for the accepted syntax.
  4223. Note that the resulting duration may be greater than the specified
  4224. duration, as the generated audio is always cut at the end of a
  4225. complete frame.
  4226. If not specified, or the expressed duration is negative, the audio is
  4227. supposed to be generated forever.
  4228. @item nb_samples, n
  4229. Set the number of samples per channel per each output frame,
  4230. default to 1024.
  4231. @item sample_rate, s
  4232. Specify the sample rate, default to 44100.
  4233. @end table
  4234. Each expression in @var{exprs} can contain the following constants:
  4235. @table @option
  4236. @item n
  4237. number of the evaluated sample, starting from 0
  4238. @item t
  4239. time of the evaluated sample expressed in seconds, starting from 0
  4240. @item s
  4241. sample rate
  4242. @end table
  4243. @subsection Examples
  4244. @itemize
  4245. @item
  4246. Generate silence:
  4247. @example
  4248. aevalsrc=0
  4249. @end example
  4250. @item
  4251. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4252. 8000 Hz:
  4253. @example
  4254. aevalsrc="sin(440*2*PI*t):s=8000"
  4255. @end example
  4256. @item
  4257. Generate a two channels signal, specify the channel layout (Front
  4258. Center + Back Center) explicitly:
  4259. @example
  4260. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4261. @end example
  4262. @item
  4263. Generate white noise:
  4264. @example
  4265. aevalsrc="-2+random(0)"
  4266. @end example
  4267. @item
  4268. Generate an amplitude modulated signal:
  4269. @example
  4270. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4271. @end example
  4272. @item
  4273. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4274. @example
  4275. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4276. @end example
  4277. @end itemize
  4278. @section anullsrc
  4279. The null audio source, return unprocessed audio frames. It is mainly useful
  4280. as a template and to be employed in analysis / debugging tools, or as
  4281. the source for filters which ignore the input data (for example the sox
  4282. synth filter).
  4283. This source accepts the following options:
  4284. @table @option
  4285. @item channel_layout, cl
  4286. Specifies the channel layout, and can be either an integer or a string
  4287. representing a channel layout. The default value of @var{channel_layout}
  4288. is "stereo".
  4289. Check the channel_layout_map definition in
  4290. @file{libavutil/channel_layout.c} for the mapping between strings and
  4291. channel layout values.
  4292. @item sample_rate, r
  4293. Specifies the sample rate, and defaults to 44100.
  4294. @item nb_samples, n
  4295. Set the number of samples per requested frames.
  4296. @end table
  4297. @subsection Examples
  4298. @itemize
  4299. @item
  4300. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4301. @example
  4302. anullsrc=r=48000:cl=4
  4303. @end example
  4304. @item
  4305. Do the same operation with a more obvious syntax:
  4306. @example
  4307. anullsrc=r=48000:cl=mono
  4308. @end example
  4309. @end itemize
  4310. All the parameters need to be explicitly defined.
  4311. @section flite
  4312. Synthesize a voice utterance using the libflite library.
  4313. To enable compilation of this filter you need to configure FFmpeg with
  4314. @code{--enable-libflite}.
  4315. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4316. The filter accepts the following options:
  4317. @table @option
  4318. @item list_voices
  4319. If set to 1, list the names of the available voices and exit
  4320. immediately. Default value is 0.
  4321. @item nb_samples, n
  4322. Set the maximum number of samples per frame. Default value is 512.
  4323. @item textfile
  4324. Set the filename containing the text to speak.
  4325. @item text
  4326. Set the text to speak.
  4327. @item voice, v
  4328. Set the voice to use for the speech synthesis. Default value is
  4329. @code{kal}. See also the @var{list_voices} option.
  4330. @end table
  4331. @subsection Examples
  4332. @itemize
  4333. @item
  4334. Read from file @file{speech.txt}, and synthesize the text using the
  4335. standard flite voice:
  4336. @example
  4337. flite=textfile=speech.txt
  4338. @end example
  4339. @item
  4340. Read the specified text selecting the @code{slt} voice:
  4341. @example
  4342. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4343. @end example
  4344. @item
  4345. Input text to ffmpeg:
  4346. @example
  4347. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4348. @end example
  4349. @item
  4350. Make @file{ffplay} speak the specified text, using @code{flite} and
  4351. the @code{lavfi} device:
  4352. @example
  4353. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4354. @end example
  4355. @end itemize
  4356. For more information about libflite, check:
  4357. @url{http://www.festvox.org/flite/}
  4358. @section anoisesrc
  4359. Generate a noise audio signal.
  4360. The filter accepts the following options:
  4361. @table @option
  4362. @item sample_rate, r
  4363. Specify the sample rate. Default value is 48000 Hz.
  4364. @item amplitude, a
  4365. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4366. is 1.0.
  4367. @item duration, d
  4368. Specify the duration of the generated audio stream. Not specifying this option
  4369. results in noise with an infinite length.
  4370. @item color, colour, c
  4371. Specify the color of noise. Available noise colors are white, pink, brown,
  4372. blue and violet. Default color is white.
  4373. @item seed, s
  4374. Specify a value used to seed the PRNG.
  4375. @item nb_samples, n
  4376. Set the number of samples per each output frame, default is 1024.
  4377. @end table
  4378. @subsection Examples
  4379. @itemize
  4380. @item
  4381. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4382. @example
  4383. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4384. @end example
  4385. @end itemize
  4386. @section hilbert
  4387. Generate odd-tap Hilbert transform FIR coefficients.
  4388. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4389. the signal by 90 degrees.
  4390. This is used in many matrix coding schemes and for analytic signal generation.
  4391. The process is often written as a multiplication by i (or j), the imaginary unit.
  4392. The filter accepts the following options:
  4393. @table @option
  4394. @item sample_rate, s
  4395. Set sample rate, default is 44100.
  4396. @item taps, t
  4397. Set length of FIR filter, default is 22051.
  4398. @item nb_samples, n
  4399. Set number of samples per each frame.
  4400. @item win_func, w
  4401. Set window function to be used when generating FIR coefficients.
  4402. @end table
  4403. @section sinc
  4404. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4405. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4406. The filter accepts the following options:
  4407. @table @option
  4408. @item sample_rate, r
  4409. Set sample rate, default is 44100.
  4410. @item nb_samples, n
  4411. Set number of samples per each frame. Default is 1024.
  4412. @item hp
  4413. Set high-pass frequency. Default is 0.
  4414. @item lp
  4415. Set low-pass frequency. Default is 0.
  4416. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4417. is higher than 0 then filter will create band-pass filter coefficients,
  4418. otherwise band-reject filter coefficients.
  4419. @item phase
  4420. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4421. @item beta
  4422. Set Kaiser window beta.
  4423. @item att
  4424. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4425. @item round
  4426. Enable rounding, by default is disabled.
  4427. @item hptaps
  4428. Set number of taps for high-pass filter.
  4429. @item lptaps
  4430. Set number of taps for low-pass filter.
  4431. @end table
  4432. @section sine
  4433. Generate an audio signal made of a sine wave with amplitude 1/8.
  4434. The audio signal is bit-exact.
  4435. The filter accepts the following options:
  4436. @table @option
  4437. @item frequency, f
  4438. Set the carrier frequency. Default is 440 Hz.
  4439. @item beep_factor, b
  4440. Enable a periodic beep every second with frequency @var{beep_factor} times
  4441. the carrier frequency. Default is 0, meaning the beep is disabled.
  4442. @item sample_rate, r
  4443. Specify the sample rate, default is 44100.
  4444. @item duration, d
  4445. Specify the duration of the generated audio stream.
  4446. @item samples_per_frame
  4447. Set the number of samples per output frame.
  4448. The expression can contain the following constants:
  4449. @table @option
  4450. @item n
  4451. The (sequential) number of the output audio frame, starting from 0.
  4452. @item pts
  4453. The PTS (Presentation TimeStamp) of the output audio frame,
  4454. expressed in @var{TB} units.
  4455. @item t
  4456. The PTS of the output audio frame, expressed in seconds.
  4457. @item TB
  4458. The timebase of the output audio frames.
  4459. @end table
  4460. Default is @code{1024}.
  4461. @end table
  4462. @subsection Examples
  4463. @itemize
  4464. @item
  4465. Generate a simple 440 Hz sine wave:
  4466. @example
  4467. sine
  4468. @end example
  4469. @item
  4470. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4471. @example
  4472. sine=220:4:d=5
  4473. sine=f=220:b=4:d=5
  4474. sine=frequency=220:beep_factor=4:duration=5
  4475. @end example
  4476. @item
  4477. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4478. pattern:
  4479. @example
  4480. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4481. @end example
  4482. @end itemize
  4483. @c man end AUDIO SOURCES
  4484. @chapter Audio Sinks
  4485. @c man begin AUDIO SINKS
  4486. Below is a description of the currently available audio sinks.
  4487. @section abuffersink
  4488. Buffer audio frames, and make them available to the end of filter chain.
  4489. This sink is mainly intended for programmatic use, in particular
  4490. through the interface defined in @file{libavfilter/buffersink.h}
  4491. or the options system.
  4492. It accepts a pointer to an AVABufferSinkContext structure, which
  4493. defines the incoming buffers' formats, to be passed as the opaque
  4494. parameter to @code{avfilter_init_filter} for initialization.
  4495. @section anullsink
  4496. Null audio sink; do absolutely nothing with the input audio. It is
  4497. mainly useful as a template and for use in analysis / debugging
  4498. tools.
  4499. @c man end AUDIO SINKS
  4500. @chapter Video Filters
  4501. @c man begin VIDEO FILTERS
  4502. When you configure your FFmpeg build, you can disable any of the
  4503. existing filters using @code{--disable-filters}.
  4504. The configure output will show the video filters included in your
  4505. build.
  4506. Below is a description of the currently available video filters.
  4507. @section alphaextract
  4508. Extract the alpha component from the input as a grayscale video. This
  4509. is especially useful with the @var{alphamerge} filter.
  4510. @section alphamerge
  4511. Add or replace the alpha component of the primary input with the
  4512. grayscale value of a second input. This is intended for use with
  4513. @var{alphaextract} to allow the transmission or storage of frame
  4514. sequences that have alpha in a format that doesn't support an alpha
  4515. channel.
  4516. For example, to reconstruct full frames from a normal YUV-encoded video
  4517. and a separate video created with @var{alphaextract}, you might use:
  4518. @example
  4519. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4520. @end example
  4521. Since this filter is designed for reconstruction, it operates on frame
  4522. sequences without considering timestamps, and terminates when either
  4523. input reaches end of stream. This will cause problems if your encoding
  4524. pipeline drops frames. If you're trying to apply an image as an
  4525. overlay to a video stream, consider the @var{overlay} filter instead.
  4526. @section amplify
  4527. Amplify differences between current pixel and pixels of adjacent frames in
  4528. same pixel location.
  4529. This filter accepts the following options:
  4530. @table @option
  4531. @item radius
  4532. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4533. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4534. @item factor
  4535. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4536. @item threshold
  4537. Set threshold for difference amplification. Any difference greater or equal to
  4538. this value will not alter source pixel. Default is 10.
  4539. Allowed range is from 0 to 65535.
  4540. @item tolerance
  4541. Set tolerance for difference amplification. Any difference lower to
  4542. this value will not alter source pixel. Default is 0.
  4543. Allowed range is from 0 to 65535.
  4544. @item low
  4545. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4546. This option controls maximum possible value that will decrease source pixel value.
  4547. @item high
  4548. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4549. This option controls maximum possible value that will increase source pixel value.
  4550. @item planes
  4551. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4552. @end table
  4553. @section ass
  4554. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4555. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4556. Substation Alpha) subtitles files.
  4557. This filter accepts the following option in addition to the common options from
  4558. the @ref{subtitles} filter:
  4559. @table @option
  4560. @item shaping
  4561. Set the shaping engine
  4562. Available values are:
  4563. @table @samp
  4564. @item auto
  4565. The default libass shaping engine, which is the best available.
  4566. @item simple
  4567. Fast, font-agnostic shaper that can do only substitutions
  4568. @item complex
  4569. Slower shaper using OpenType for substitutions and positioning
  4570. @end table
  4571. The default is @code{auto}.
  4572. @end table
  4573. @section atadenoise
  4574. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4575. The filter accepts the following options:
  4576. @table @option
  4577. @item 0a
  4578. Set threshold A for 1st plane. Default is 0.02.
  4579. Valid range is 0 to 0.3.
  4580. @item 0b
  4581. Set threshold B for 1st plane. Default is 0.04.
  4582. Valid range is 0 to 5.
  4583. @item 1a
  4584. Set threshold A for 2nd plane. Default is 0.02.
  4585. Valid range is 0 to 0.3.
  4586. @item 1b
  4587. Set threshold B for 2nd plane. Default is 0.04.
  4588. Valid range is 0 to 5.
  4589. @item 2a
  4590. Set threshold A for 3rd plane. Default is 0.02.
  4591. Valid range is 0 to 0.3.
  4592. @item 2b
  4593. Set threshold B for 3rd plane. Default is 0.04.
  4594. Valid range is 0 to 5.
  4595. Threshold A is designed to react on abrupt changes in the input signal and
  4596. threshold B is designed to react on continuous changes in the input signal.
  4597. @item s
  4598. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4599. number in range [5, 129].
  4600. @item p
  4601. Set what planes of frame filter will use for averaging. Default is all.
  4602. @end table
  4603. @section avgblur
  4604. Apply average blur filter.
  4605. The filter accepts the following options:
  4606. @table @option
  4607. @item sizeX
  4608. Set horizontal radius size.
  4609. @item planes
  4610. Set which planes to filter. By default all planes are filtered.
  4611. @item sizeY
  4612. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4613. Default is @code{0}.
  4614. @end table
  4615. @section bbox
  4616. Compute the bounding box for the non-black pixels in the input frame
  4617. luminance plane.
  4618. This filter computes the bounding box containing all the pixels with a
  4619. luminance value greater than the minimum allowed value.
  4620. The parameters describing the bounding box are printed on the filter
  4621. log.
  4622. The filter accepts the following option:
  4623. @table @option
  4624. @item min_val
  4625. Set the minimal luminance value. Default is @code{16}.
  4626. @end table
  4627. @section bitplanenoise
  4628. Show and measure bit plane noise.
  4629. The filter accepts the following options:
  4630. @table @option
  4631. @item bitplane
  4632. Set which plane to analyze. Default is @code{1}.
  4633. @item filter
  4634. Filter out noisy pixels from @code{bitplane} set above.
  4635. Default is disabled.
  4636. @end table
  4637. @section blackdetect
  4638. Detect video intervals that are (almost) completely black. Can be
  4639. useful to detect chapter transitions, commercials, or invalid
  4640. recordings. Output lines contains the time for the start, end and
  4641. duration of the detected black interval expressed in seconds.
  4642. In order to display the output lines, you need to set the loglevel at
  4643. least to the AV_LOG_INFO value.
  4644. The filter accepts the following options:
  4645. @table @option
  4646. @item black_min_duration, d
  4647. Set the minimum detected black duration expressed in seconds. It must
  4648. be a non-negative floating point number.
  4649. Default value is 2.0.
  4650. @item picture_black_ratio_th, pic_th
  4651. Set the threshold for considering a picture "black".
  4652. Express the minimum value for the ratio:
  4653. @example
  4654. @var{nb_black_pixels} / @var{nb_pixels}
  4655. @end example
  4656. for which a picture is considered black.
  4657. Default value is 0.98.
  4658. @item pixel_black_th, pix_th
  4659. Set the threshold for considering a pixel "black".
  4660. The threshold expresses the maximum pixel luminance value for which a
  4661. pixel is considered "black". The provided value is scaled according to
  4662. the following equation:
  4663. @example
  4664. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4665. @end example
  4666. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4667. the input video format, the range is [0-255] for YUV full-range
  4668. formats and [16-235] for YUV non full-range formats.
  4669. Default value is 0.10.
  4670. @end table
  4671. The following example sets the maximum pixel threshold to the minimum
  4672. value, and detects only black intervals of 2 or more seconds:
  4673. @example
  4674. blackdetect=d=2:pix_th=0.00
  4675. @end example
  4676. @section blackframe
  4677. Detect frames that are (almost) completely black. Can be useful to
  4678. detect chapter transitions or commercials. Output lines consist of
  4679. the frame number of the detected frame, the percentage of blackness,
  4680. the position in the file if known or -1 and the timestamp in seconds.
  4681. In order to display the output lines, you need to set the loglevel at
  4682. least to the AV_LOG_INFO value.
  4683. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4684. The value represents the percentage of pixels in the picture that
  4685. are below the threshold value.
  4686. It accepts the following parameters:
  4687. @table @option
  4688. @item amount
  4689. The percentage of the pixels that have to be below the threshold; it defaults to
  4690. @code{98}.
  4691. @item threshold, thresh
  4692. The threshold below which a pixel value is considered black; it defaults to
  4693. @code{32}.
  4694. @end table
  4695. @section blend, tblend
  4696. Blend two video frames into each other.
  4697. The @code{blend} filter takes two input streams and outputs one
  4698. stream, the first input is the "top" layer and second input is
  4699. "bottom" layer. By default, the output terminates when the longest input terminates.
  4700. The @code{tblend} (time blend) filter takes two consecutive frames
  4701. from one single stream, and outputs the result obtained by blending
  4702. the new frame on top of the old frame.
  4703. A description of the accepted options follows.
  4704. @table @option
  4705. @item c0_mode
  4706. @item c1_mode
  4707. @item c2_mode
  4708. @item c3_mode
  4709. @item all_mode
  4710. Set blend mode for specific pixel component or all pixel components in case
  4711. of @var{all_mode}. Default value is @code{normal}.
  4712. Available values for component modes are:
  4713. @table @samp
  4714. @item addition
  4715. @item grainmerge
  4716. @item and
  4717. @item average
  4718. @item burn
  4719. @item darken
  4720. @item difference
  4721. @item grainextract
  4722. @item divide
  4723. @item dodge
  4724. @item freeze
  4725. @item exclusion
  4726. @item extremity
  4727. @item glow
  4728. @item hardlight
  4729. @item hardmix
  4730. @item heat
  4731. @item lighten
  4732. @item linearlight
  4733. @item multiply
  4734. @item multiply128
  4735. @item negation
  4736. @item normal
  4737. @item or
  4738. @item overlay
  4739. @item phoenix
  4740. @item pinlight
  4741. @item reflect
  4742. @item screen
  4743. @item softlight
  4744. @item subtract
  4745. @item vividlight
  4746. @item xor
  4747. @end table
  4748. @item c0_opacity
  4749. @item c1_opacity
  4750. @item c2_opacity
  4751. @item c3_opacity
  4752. @item all_opacity
  4753. Set blend opacity for specific pixel component or all pixel components in case
  4754. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4755. @item c0_expr
  4756. @item c1_expr
  4757. @item c2_expr
  4758. @item c3_expr
  4759. @item all_expr
  4760. Set blend expression for specific pixel component or all pixel components in case
  4761. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4762. The expressions can use the following variables:
  4763. @table @option
  4764. @item N
  4765. The sequential number of the filtered frame, starting from @code{0}.
  4766. @item X
  4767. @item Y
  4768. the coordinates of the current sample
  4769. @item W
  4770. @item H
  4771. the width and height of currently filtered plane
  4772. @item SW
  4773. @item SH
  4774. Width and height scale for the plane being filtered. It is the
  4775. ratio between the dimensions of the current plane to the luma plane,
  4776. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4777. the luma plane and @code{0.5,0.5} for the chroma planes.
  4778. @item T
  4779. Time of the current frame, expressed in seconds.
  4780. @item TOP, A
  4781. Value of pixel component at current location for first video frame (top layer).
  4782. @item BOTTOM, B
  4783. Value of pixel component at current location for second video frame (bottom layer).
  4784. @end table
  4785. @end table
  4786. The @code{blend} filter also supports the @ref{framesync} options.
  4787. @subsection Examples
  4788. @itemize
  4789. @item
  4790. Apply transition from bottom layer to top layer in first 10 seconds:
  4791. @example
  4792. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4793. @end example
  4794. @item
  4795. Apply linear horizontal transition from top layer to bottom layer:
  4796. @example
  4797. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4798. @end example
  4799. @item
  4800. Apply 1x1 checkerboard effect:
  4801. @example
  4802. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4803. @end example
  4804. @item
  4805. Apply uncover left effect:
  4806. @example
  4807. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4808. @end example
  4809. @item
  4810. Apply uncover down effect:
  4811. @example
  4812. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4813. @end example
  4814. @item
  4815. Apply uncover up-left effect:
  4816. @example
  4817. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4818. @end example
  4819. @item
  4820. Split diagonally video and shows top and bottom layer on each side:
  4821. @example
  4822. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4823. @end example
  4824. @item
  4825. Display differences between the current and the previous frame:
  4826. @example
  4827. tblend=all_mode=grainextract
  4828. @end example
  4829. @end itemize
  4830. @section bm3d
  4831. Denoise frames using Block-Matching 3D algorithm.
  4832. The filter accepts the following options.
  4833. @table @option
  4834. @item sigma
  4835. Set denoising strength. Default value is 1.
  4836. Allowed range is from 0 to 999.9.
  4837. The denoising algorithm is very sensitive to sigma, so adjust it
  4838. according to the source.
  4839. @item block
  4840. Set local patch size. This sets dimensions in 2D.
  4841. @item bstep
  4842. Set sliding step for processing blocks. Default value is 4.
  4843. Allowed range is from 1 to 64.
  4844. Smaller values allows processing more reference blocks and is slower.
  4845. @item group
  4846. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4847. When set to 1, no block matching is done. Larger values allows more blocks
  4848. in single group.
  4849. Allowed range is from 1 to 256.
  4850. @item range
  4851. Set radius for search block matching. Default is 9.
  4852. Allowed range is from 1 to INT32_MAX.
  4853. @item mstep
  4854. Set step between two search locations for block matching. Default is 1.
  4855. Allowed range is from 1 to 64. Smaller is slower.
  4856. @item thmse
  4857. Set threshold of mean square error for block matching. Valid range is 0 to
  4858. INT32_MAX.
  4859. @item hdthr
  4860. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4861. Larger values results in stronger hard-thresholding filtering in frequency
  4862. domain.
  4863. @item estim
  4864. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4865. Default is @code{basic}.
  4866. @item ref
  4867. If enabled, filter will use 2nd stream for block matching.
  4868. Default is disabled for @code{basic} value of @var{estim} option,
  4869. and always enabled if value of @var{estim} is @code{final}.
  4870. @item planes
  4871. Set planes to filter. Default is all available except alpha.
  4872. @end table
  4873. @subsection Examples
  4874. @itemize
  4875. @item
  4876. Basic filtering with bm3d:
  4877. @example
  4878. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4879. @end example
  4880. @item
  4881. Same as above, but filtering only luma:
  4882. @example
  4883. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4884. @end example
  4885. @item
  4886. Same as above, but with both estimation modes:
  4887. @example
  4888. 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
  4889. @end example
  4890. @item
  4891. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4892. @example
  4893. 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
  4894. @end example
  4895. @end itemize
  4896. @section boxblur
  4897. Apply a boxblur algorithm to the input video.
  4898. It accepts the following parameters:
  4899. @table @option
  4900. @item luma_radius, lr
  4901. @item luma_power, lp
  4902. @item chroma_radius, cr
  4903. @item chroma_power, cp
  4904. @item alpha_radius, ar
  4905. @item alpha_power, ap
  4906. @end table
  4907. A description of the accepted options follows.
  4908. @table @option
  4909. @item luma_radius, lr
  4910. @item chroma_radius, cr
  4911. @item alpha_radius, ar
  4912. Set an expression for the box radius in pixels used for blurring the
  4913. corresponding input plane.
  4914. The radius value must be a non-negative number, and must not be
  4915. greater than the value of the expression @code{min(w,h)/2} for the
  4916. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4917. planes.
  4918. Default value for @option{luma_radius} is "2". If not specified,
  4919. @option{chroma_radius} and @option{alpha_radius} default to the
  4920. corresponding value set for @option{luma_radius}.
  4921. The expressions can contain the following constants:
  4922. @table @option
  4923. @item w
  4924. @item h
  4925. The input width and height in pixels.
  4926. @item cw
  4927. @item ch
  4928. The input chroma image width and height in pixels.
  4929. @item hsub
  4930. @item vsub
  4931. The horizontal and vertical chroma subsample values. For example, for the
  4932. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4933. @end table
  4934. @item luma_power, lp
  4935. @item chroma_power, cp
  4936. @item alpha_power, ap
  4937. Specify how many times the boxblur filter is applied to the
  4938. corresponding plane.
  4939. Default value for @option{luma_power} is 2. If not specified,
  4940. @option{chroma_power} and @option{alpha_power} default to the
  4941. corresponding value set for @option{luma_power}.
  4942. A value of 0 will disable the effect.
  4943. @end table
  4944. @subsection Examples
  4945. @itemize
  4946. @item
  4947. Apply a boxblur filter with the luma, chroma, and alpha radii
  4948. set to 2:
  4949. @example
  4950. boxblur=luma_radius=2:luma_power=1
  4951. boxblur=2:1
  4952. @end example
  4953. @item
  4954. Set the luma radius to 2, and alpha and chroma radius to 0:
  4955. @example
  4956. boxblur=2:1:cr=0:ar=0
  4957. @end example
  4958. @item
  4959. Set the luma and chroma radii to a fraction of the video dimension:
  4960. @example
  4961. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4962. @end example
  4963. @end itemize
  4964. @section bwdif
  4965. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4966. Deinterlacing Filter").
  4967. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4968. interpolation algorithms.
  4969. It accepts the following parameters:
  4970. @table @option
  4971. @item mode
  4972. The interlacing mode to adopt. It accepts one of the following values:
  4973. @table @option
  4974. @item 0, send_frame
  4975. Output one frame for each frame.
  4976. @item 1, send_field
  4977. Output one frame for each field.
  4978. @end table
  4979. The default value is @code{send_field}.
  4980. @item parity
  4981. The picture field parity assumed for the input interlaced video. It accepts one
  4982. of the following values:
  4983. @table @option
  4984. @item 0, tff
  4985. Assume the top field is first.
  4986. @item 1, bff
  4987. Assume the bottom field is first.
  4988. @item -1, auto
  4989. Enable automatic detection of field parity.
  4990. @end table
  4991. The default value is @code{auto}.
  4992. If the interlacing is unknown or the decoder does not export this information,
  4993. top field first will be assumed.
  4994. @item deint
  4995. Specify which frames to deinterlace. Accept one of the following
  4996. values:
  4997. @table @option
  4998. @item 0, all
  4999. Deinterlace all frames.
  5000. @item 1, interlaced
  5001. Only deinterlace frames marked as interlaced.
  5002. @end table
  5003. The default value is @code{all}.
  5004. @end table
  5005. @section chromahold
  5006. Remove all color information for all colors except for certain one.
  5007. The filter accepts the following options:
  5008. @table @option
  5009. @item color
  5010. The color which will not be replaced with neutral chroma.
  5011. @item similarity
  5012. Similarity percentage with the above color.
  5013. 0.01 matches only the exact key color, while 1.0 matches everything.
  5014. @item blend
  5015. Blend percentage.
  5016. 0.0 makes pixels either fully gray, or not gray at all.
  5017. Higher values result in more preserved color.
  5018. @item yuv
  5019. Signals that the color passed is already in YUV instead of RGB.
  5020. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5021. This can be used to pass exact YUV values as hexadecimal numbers.
  5022. @end table
  5023. @section chromakey
  5024. YUV colorspace color/chroma keying.
  5025. The filter accepts the following options:
  5026. @table @option
  5027. @item color
  5028. The color which will be replaced with transparency.
  5029. @item similarity
  5030. Similarity percentage with the key color.
  5031. 0.01 matches only the exact key color, while 1.0 matches everything.
  5032. @item blend
  5033. Blend percentage.
  5034. 0.0 makes pixels either fully transparent, or not transparent at all.
  5035. Higher values result in semi-transparent pixels, with a higher transparency
  5036. the more similar the pixels color is to the key color.
  5037. @item yuv
  5038. Signals that the color passed is already in YUV instead of RGB.
  5039. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5040. This can be used to pass exact YUV values as hexadecimal numbers.
  5041. @end table
  5042. @subsection Examples
  5043. @itemize
  5044. @item
  5045. Make every green pixel in the input image transparent:
  5046. @example
  5047. ffmpeg -i input.png -vf chromakey=green out.png
  5048. @end example
  5049. @item
  5050. Overlay a greenscreen-video on top of a static black background.
  5051. @example
  5052. 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
  5053. @end example
  5054. @end itemize
  5055. @section chromashift
  5056. Shift chroma pixels horizontally and/or vertically.
  5057. The filter accepts the following options:
  5058. @table @option
  5059. @item cbh
  5060. Set amount to shift chroma-blue horizontally.
  5061. @item cbv
  5062. Set amount to shift chroma-blue vertically.
  5063. @item crh
  5064. Set amount to shift chroma-red horizontally.
  5065. @item crv
  5066. Set amount to shift chroma-red vertically.
  5067. @item edge
  5068. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5069. @end table
  5070. @section ciescope
  5071. Display CIE color diagram with pixels overlaid onto it.
  5072. The filter accepts the following options:
  5073. @table @option
  5074. @item system
  5075. Set color system.
  5076. @table @samp
  5077. @item ntsc, 470m
  5078. @item ebu, 470bg
  5079. @item smpte
  5080. @item 240m
  5081. @item apple
  5082. @item widergb
  5083. @item cie1931
  5084. @item rec709, hdtv
  5085. @item uhdtv, rec2020
  5086. @end table
  5087. @item cie
  5088. Set CIE system.
  5089. @table @samp
  5090. @item xyy
  5091. @item ucs
  5092. @item luv
  5093. @end table
  5094. @item gamuts
  5095. Set what gamuts to draw.
  5096. See @code{system} option for available values.
  5097. @item size, s
  5098. Set ciescope size, by default set to 512.
  5099. @item intensity, i
  5100. Set intensity used to map input pixel values to CIE diagram.
  5101. @item contrast
  5102. Set contrast used to draw tongue colors that are out of active color system gamut.
  5103. @item corrgamma
  5104. Correct gamma displayed on scope, by default enabled.
  5105. @item showwhite
  5106. Show white point on CIE diagram, by default disabled.
  5107. @item gamma
  5108. Set input gamma. Used only with XYZ input color space.
  5109. @end table
  5110. @section codecview
  5111. Visualize information exported by some codecs.
  5112. Some codecs can export information through frames using side-data or other
  5113. means. For example, some MPEG based codecs export motion vectors through the
  5114. @var{export_mvs} flag in the codec @option{flags2} option.
  5115. The filter accepts the following option:
  5116. @table @option
  5117. @item mv
  5118. Set motion vectors to visualize.
  5119. Available flags for @var{mv} are:
  5120. @table @samp
  5121. @item pf
  5122. forward predicted MVs of P-frames
  5123. @item bf
  5124. forward predicted MVs of B-frames
  5125. @item bb
  5126. backward predicted MVs of B-frames
  5127. @end table
  5128. @item qp
  5129. Display quantization parameters using the chroma planes.
  5130. @item mv_type, mvt
  5131. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5132. Available flags for @var{mv_type} are:
  5133. @table @samp
  5134. @item fp
  5135. forward predicted MVs
  5136. @item bp
  5137. backward predicted MVs
  5138. @end table
  5139. @item frame_type, ft
  5140. Set frame type to visualize motion vectors of.
  5141. Available flags for @var{frame_type} are:
  5142. @table @samp
  5143. @item if
  5144. intra-coded frames (I-frames)
  5145. @item pf
  5146. predicted frames (P-frames)
  5147. @item bf
  5148. bi-directionally predicted frames (B-frames)
  5149. @end table
  5150. @end table
  5151. @subsection Examples
  5152. @itemize
  5153. @item
  5154. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5155. @example
  5156. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5157. @end example
  5158. @item
  5159. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5160. @example
  5161. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5162. @end example
  5163. @end itemize
  5164. @section colorbalance
  5165. Modify intensity of primary colors (red, green and blue) of input frames.
  5166. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5167. regions for the red-cyan, green-magenta or blue-yellow balance.
  5168. A positive adjustment value shifts the balance towards the primary color, a negative
  5169. value towards the complementary color.
  5170. The filter accepts the following options:
  5171. @table @option
  5172. @item rs
  5173. @item gs
  5174. @item bs
  5175. Adjust red, green and blue shadows (darkest pixels).
  5176. @item rm
  5177. @item gm
  5178. @item bm
  5179. Adjust red, green and blue midtones (medium pixels).
  5180. @item rh
  5181. @item gh
  5182. @item bh
  5183. Adjust red, green and blue highlights (brightest pixels).
  5184. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5185. @end table
  5186. @subsection Examples
  5187. @itemize
  5188. @item
  5189. Add red color cast to shadows:
  5190. @example
  5191. colorbalance=rs=.3
  5192. @end example
  5193. @end itemize
  5194. @section colorkey
  5195. RGB colorspace color keying.
  5196. The filter accepts the following options:
  5197. @table @option
  5198. @item color
  5199. The color which will be replaced with transparency.
  5200. @item similarity
  5201. Similarity percentage with the key color.
  5202. 0.01 matches only the exact key color, while 1.0 matches everything.
  5203. @item blend
  5204. Blend percentage.
  5205. 0.0 makes pixels either fully transparent, or not transparent at all.
  5206. Higher values result in semi-transparent pixels, with a higher transparency
  5207. the more similar the pixels color is to the key color.
  5208. @end table
  5209. @subsection Examples
  5210. @itemize
  5211. @item
  5212. Make every green pixel in the input image transparent:
  5213. @example
  5214. ffmpeg -i input.png -vf colorkey=green out.png
  5215. @end example
  5216. @item
  5217. Overlay a greenscreen-video on top of a static background image.
  5218. @example
  5219. 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
  5220. @end example
  5221. @end itemize
  5222. @section colorhold
  5223. Remove all color information for all RGB colors except for certain one.
  5224. The filter accepts the following options:
  5225. @table @option
  5226. @item color
  5227. The color which will not be replaced with neutral gray.
  5228. @item similarity
  5229. Similarity percentage with the above color.
  5230. 0.01 matches only the exact key color, while 1.0 matches everything.
  5231. @item blend
  5232. Blend percentage. 0.0 makes pixels fully gray.
  5233. Higher values result in more preserved color.
  5234. @end table
  5235. @section colorlevels
  5236. Adjust video input frames using levels.
  5237. The filter accepts the following options:
  5238. @table @option
  5239. @item rimin
  5240. @item gimin
  5241. @item bimin
  5242. @item aimin
  5243. Adjust red, green, blue and alpha input black point.
  5244. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5245. @item rimax
  5246. @item gimax
  5247. @item bimax
  5248. @item aimax
  5249. Adjust red, green, blue and alpha input white point.
  5250. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5251. Input levels are used to lighten highlights (bright tones), darken shadows
  5252. (dark tones), change the balance of bright and dark tones.
  5253. @item romin
  5254. @item gomin
  5255. @item bomin
  5256. @item aomin
  5257. Adjust red, green, blue and alpha output black point.
  5258. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5259. @item romax
  5260. @item gomax
  5261. @item bomax
  5262. @item aomax
  5263. Adjust red, green, blue and alpha output white point.
  5264. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5265. Output levels allows manual selection of a constrained output level range.
  5266. @end table
  5267. @subsection Examples
  5268. @itemize
  5269. @item
  5270. Make video output darker:
  5271. @example
  5272. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5273. @end example
  5274. @item
  5275. Increase contrast:
  5276. @example
  5277. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5278. @end example
  5279. @item
  5280. Make video output lighter:
  5281. @example
  5282. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5283. @end example
  5284. @item
  5285. Increase brightness:
  5286. @example
  5287. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5288. @end example
  5289. @end itemize
  5290. @section colorchannelmixer
  5291. Adjust video input frames by re-mixing color channels.
  5292. This filter modifies a color channel by adding the values associated to
  5293. the other channels of the same pixels. For example if the value to
  5294. modify is red, the output value will be:
  5295. @example
  5296. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5297. @end example
  5298. The filter accepts the following options:
  5299. @table @option
  5300. @item rr
  5301. @item rg
  5302. @item rb
  5303. @item ra
  5304. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5305. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5306. @item gr
  5307. @item gg
  5308. @item gb
  5309. @item ga
  5310. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5311. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5312. @item br
  5313. @item bg
  5314. @item bb
  5315. @item ba
  5316. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5317. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5318. @item ar
  5319. @item ag
  5320. @item ab
  5321. @item aa
  5322. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5323. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5324. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5325. @end table
  5326. @subsection Examples
  5327. @itemize
  5328. @item
  5329. Convert source to grayscale:
  5330. @example
  5331. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5332. @end example
  5333. @item
  5334. Simulate sepia tones:
  5335. @example
  5336. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5337. @end example
  5338. @end itemize
  5339. @section colormatrix
  5340. Convert color matrix.
  5341. The filter accepts the following options:
  5342. @table @option
  5343. @item src
  5344. @item dst
  5345. Specify the source and destination color matrix. Both values must be
  5346. specified.
  5347. The accepted values are:
  5348. @table @samp
  5349. @item bt709
  5350. BT.709
  5351. @item fcc
  5352. FCC
  5353. @item bt601
  5354. BT.601
  5355. @item bt470
  5356. BT.470
  5357. @item bt470bg
  5358. BT.470BG
  5359. @item smpte170m
  5360. SMPTE-170M
  5361. @item smpte240m
  5362. SMPTE-240M
  5363. @item bt2020
  5364. BT.2020
  5365. @end table
  5366. @end table
  5367. For example to convert from BT.601 to SMPTE-240M, use the command:
  5368. @example
  5369. colormatrix=bt601:smpte240m
  5370. @end example
  5371. @section colorspace
  5372. Convert colorspace, transfer characteristics or color primaries.
  5373. Input video needs to have an even size.
  5374. The filter accepts the following options:
  5375. @table @option
  5376. @anchor{all}
  5377. @item all
  5378. Specify all color properties at once.
  5379. The accepted values are:
  5380. @table @samp
  5381. @item bt470m
  5382. BT.470M
  5383. @item bt470bg
  5384. BT.470BG
  5385. @item bt601-6-525
  5386. BT.601-6 525
  5387. @item bt601-6-625
  5388. BT.601-6 625
  5389. @item bt709
  5390. BT.709
  5391. @item smpte170m
  5392. SMPTE-170M
  5393. @item smpte240m
  5394. SMPTE-240M
  5395. @item bt2020
  5396. BT.2020
  5397. @end table
  5398. @anchor{space}
  5399. @item space
  5400. Specify output colorspace.
  5401. The accepted values are:
  5402. @table @samp
  5403. @item bt709
  5404. BT.709
  5405. @item fcc
  5406. FCC
  5407. @item bt470bg
  5408. BT.470BG or BT.601-6 625
  5409. @item smpte170m
  5410. SMPTE-170M or BT.601-6 525
  5411. @item smpte240m
  5412. SMPTE-240M
  5413. @item ycgco
  5414. YCgCo
  5415. @item bt2020ncl
  5416. BT.2020 with non-constant luminance
  5417. @end table
  5418. @anchor{trc}
  5419. @item trc
  5420. Specify output transfer characteristics.
  5421. The accepted values are:
  5422. @table @samp
  5423. @item bt709
  5424. BT.709
  5425. @item bt470m
  5426. BT.470M
  5427. @item bt470bg
  5428. BT.470BG
  5429. @item gamma22
  5430. Constant gamma of 2.2
  5431. @item gamma28
  5432. Constant gamma of 2.8
  5433. @item smpte170m
  5434. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5435. @item smpte240m
  5436. SMPTE-240M
  5437. @item srgb
  5438. SRGB
  5439. @item iec61966-2-1
  5440. iec61966-2-1
  5441. @item iec61966-2-4
  5442. iec61966-2-4
  5443. @item xvycc
  5444. xvycc
  5445. @item bt2020-10
  5446. BT.2020 for 10-bits content
  5447. @item bt2020-12
  5448. BT.2020 for 12-bits content
  5449. @end table
  5450. @anchor{primaries}
  5451. @item primaries
  5452. Specify output color primaries.
  5453. The accepted values are:
  5454. @table @samp
  5455. @item bt709
  5456. BT.709
  5457. @item bt470m
  5458. BT.470M
  5459. @item bt470bg
  5460. BT.470BG or BT.601-6 625
  5461. @item smpte170m
  5462. SMPTE-170M or BT.601-6 525
  5463. @item smpte240m
  5464. SMPTE-240M
  5465. @item film
  5466. film
  5467. @item smpte431
  5468. SMPTE-431
  5469. @item smpte432
  5470. SMPTE-432
  5471. @item bt2020
  5472. BT.2020
  5473. @item jedec-p22
  5474. JEDEC P22 phosphors
  5475. @end table
  5476. @anchor{range}
  5477. @item range
  5478. Specify output color range.
  5479. The accepted values are:
  5480. @table @samp
  5481. @item tv
  5482. TV (restricted) range
  5483. @item mpeg
  5484. MPEG (restricted) range
  5485. @item pc
  5486. PC (full) range
  5487. @item jpeg
  5488. JPEG (full) range
  5489. @end table
  5490. @item format
  5491. Specify output color format.
  5492. The accepted values are:
  5493. @table @samp
  5494. @item yuv420p
  5495. YUV 4:2:0 planar 8-bits
  5496. @item yuv420p10
  5497. YUV 4:2:0 planar 10-bits
  5498. @item yuv420p12
  5499. YUV 4:2:0 planar 12-bits
  5500. @item yuv422p
  5501. YUV 4:2:2 planar 8-bits
  5502. @item yuv422p10
  5503. YUV 4:2:2 planar 10-bits
  5504. @item yuv422p12
  5505. YUV 4:2:2 planar 12-bits
  5506. @item yuv444p
  5507. YUV 4:4:4 planar 8-bits
  5508. @item yuv444p10
  5509. YUV 4:4:4 planar 10-bits
  5510. @item yuv444p12
  5511. YUV 4:4:4 planar 12-bits
  5512. @end table
  5513. @item fast
  5514. Do a fast conversion, which skips gamma/primary correction. This will take
  5515. significantly less CPU, but will be mathematically incorrect. To get output
  5516. compatible with that produced by the colormatrix filter, use fast=1.
  5517. @item dither
  5518. Specify dithering mode.
  5519. The accepted values are:
  5520. @table @samp
  5521. @item none
  5522. No dithering
  5523. @item fsb
  5524. Floyd-Steinberg dithering
  5525. @end table
  5526. @item wpadapt
  5527. Whitepoint adaptation mode.
  5528. The accepted values are:
  5529. @table @samp
  5530. @item bradford
  5531. Bradford whitepoint adaptation
  5532. @item vonkries
  5533. von Kries whitepoint adaptation
  5534. @item identity
  5535. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5536. @end table
  5537. @item iall
  5538. Override all input properties at once. Same accepted values as @ref{all}.
  5539. @item ispace
  5540. Override input colorspace. Same accepted values as @ref{space}.
  5541. @item iprimaries
  5542. Override input color primaries. Same accepted values as @ref{primaries}.
  5543. @item itrc
  5544. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5545. @item irange
  5546. Override input color range. Same accepted values as @ref{range}.
  5547. @end table
  5548. The filter converts the transfer characteristics, color space and color
  5549. primaries to the specified user values. The output value, if not specified,
  5550. is set to a default value based on the "all" property. If that property is
  5551. also not specified, the filter will log an error. The output color range and
  5552. format default to the same value as the input color range and format. The
  5553. input transfer characteristics, color space, color primaries and color range
  5554. should be set on the input data. If any of these are missing, the filter will
  5555. log an error and no conversion will take place.
  5556. For example to convert the input to SMPTE-240M, use the command:
  5557. @example
  5558. colorspace=smpte240m
  5559. @end example
  5560. @section convolution
  5561. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5562. The filter accepts the following options:
  5563. @table @option
  5564. @item 0m
  5565. @item 1m
  5566. @item 2m
  5567. @item 3m
  5568. Set matrix for each plane.
  5569. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5570. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5571. @item 0rdiv
  5572. @item 1rdiv
  5573. @item 2rdiv
  5574. @item 3rdiv
  5575. Set multiplier for calculated value for each plane.
  5576. If unset or 0, it will be sum of all matrix elements.
  5577. @item 0bias
  5578. @item 1bias
  5579. @item 2bias
  5580. @item 3bias
  5581. Set bias for each plane. This value is added to the result of the multiplication.
  5582. Useful for making the overall image brighter or darker. Default is 0.0.
  5583. @item 0mode
  5584. @item 1mode
  5585. @item 2mode
  5586. @item 3mode
  5587. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5588. Default is @var{square}.
  5589. @end table
  5590. @subsection Examples
  5591. @itemize
  5592. @item
  5593. Apply sharpen:
  5594. @example
  5595. 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"
  5596. @end example
  5597. @item
  5598. Apply blur:
  5599. @example
  5600. 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"
  5601. @end example
  5602. @item
  5603. Apply edge enhance:
  5604. @example
  5605. 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"
  5606. @end example
  5607. @item
  5608. Apply edge detect:
  5609. @example
  5610. 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"
  5611. @end example
  5612. @item
  5613. Apply laplacian edge detector which includes diagonals:
  5614. @example
  5615. 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"
  5616. @end example
  5617. @item
  5618. Apply emboss:
  5619. @example
  5620. 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"
  5621. @end example
  5622. @end itemize
  5623. @section convolve
  5624. Apply 2D convolution of video stream in frequency domain using second stream
  5625. as impulse.
  5626. The filter accepts the following options:
  5627. @table @option
  5628. @item planes
  5629. Set which planes to process.
  5630. @item impulse
  5631. Set which impulse video frames will be processed, can be @var{first}
  5632. or @var{all}. Default is @var{all}.
  5633. @end table
  5634. The @code{convolve} filter also supports the @ref{framesync} options.
  5635. @section copy
  5636. Copy the input video source unchanged to the output. This is mainly useful for
  5637. testing purposes.
  5638. @anchor{coreimage}
  5639. @section coreimage
  5640. Video filtering on GPU using Apple's CoreImage API on OSX.
  5641. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5642. processed by video hardware. However, software-based OpenGL implementations
  5643. exist which means there is no guarantee for hardware processing. It depends on
  5644. the respective OSX.
  5645. There are many filters and image generators provided by Apple that come with a
  5646. large variety of options. The filter has to be referenced by its name along
  5647. with its options.
  5648. The coreimage filter accepts the following options:
  5649. @table @option
  5650. @item list_filters
  5651. List all available filters and generators along with all their respective
  5652. options as well as possible minimum and maximum values along with the default
  5653. values.
  5654. @example
  5655. list_filters=true
  5656. @end example
  5657. @item filter
  5658. Specify all filters by their respective name and options.
  5659. Use @var{list_filters} to determine all valid filter names and options.
  5660. Numerical options are specified by a float value and are automatically clamped
  5661. to their respective value range. Vector and color options have to be specified
  5662. by a list of space separated float values. Character escaping has to be done.
  5663. A special option name @code{default} is available to use default options for a
  5664. filter.
  5665. It is required to specify either @code{default} or at least one of the filter options.
  5666. All omitted options are used with their default values.
  5667. The syntax of the filter string is as follows:
  5668. @example
  5669. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5670. @end example
  5671. @item output_rect
  5672. Specify a rectangle where the output of the filter chain is copied into the
  5673. input image. It is given by a list of space separated float values:
  5674. @example
  5675. output_rect=x\ y\ width\ height
  5676. @end example
  5677. If not given, the output rectangle equals the dimensions of the input image.
  5678. The output rectangle is automatically cropped at the borders of the input
  5679. image. Negative values are valid for each component.
  5680. @example
  5681. output_rect=25\ 25\ 100\ 100
  5682. @end example
  5683. @end table
  5684. Several filters can be chained for successive processing without GPU-HOST
  5685. transfers allowing for fast processing of complex filter chains.
  5686. Currently, only filters with zero (generators) or exactly one (filters) input
  5687. image and one output image are supported. Also, transition filters are not yet
  5688. usable as intended.
  5689. Some filters generate output images with additional padding depending on the
  5690. respective filter kernel. The padding is automatically removed to ensure the
  5691. filter output has the same size as the input image.
  5692. For image generators, the size of the output image is determined by the
  5693. previous output image of the filter chain or the input image of the whole
  5694. filterchain, respectively. The generators do not use the pixel information of
  5695. this image to generate their output. However, the generated output is
  5696. blended onto this image, resulting in partial or complete coverage of the
  5697. output image.
  5698. The @ref{coreimagesrc} video source can be used for generating input images
  5699. which are directly fed into the filter chain. By using it, providing input
  5700. images by another video source or an input video is not required.
  5701. @subsection Examples
  5702. @itemize
  5703. @item
  5704. List all filters available:
  5705. @example
  5706. coreimage=list_filters=true
  5707. @end example
  5708. @item
  5709. Use the CIBoxBlur filter with default options to blur an image:
  5710. @example
  5711. coreimage=filter=CIBoxBlur@@default
  5712. @end example
  5713. @item
  5714. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5715. its center at 100x100 and a radius of 50 pixels:
  5716. @example
  5717. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5718. @end example
  5719. @item
  5720. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5721. given as complete and escaped command-line for Apple's standard bash shell:
  5722. @example
  5723. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5724. @end example
  5725. @end itemize
  5726. @section crop
  5727. Crop the input video to given dimensions.
  5728. It accepts the following parameters:
  5729. @table @option
  5730. @item w, out_w
  5731. The width of the output video. It defaults to @code{iw}.
  5732. This expression is evaluated only once during the filter
  5733. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5734. @item h, out_h
  5735. The height of the output video. It defaults to @code{ih}.
  5736. This expression is evaluated only once during the filter
  5737. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5738. @item x
  5739. The horizontal position, in the input video, of the left edge of the output
  5740. video. It defaults to @code{(in_w-out_w)/2}.
  5741. This expression is evaluated per-frame.
  5742. @item y
  5743. The vertical position, in the input video, of the top edge of the output video.
  5744. It defaults to @code{(in_h-out_h)/2}.
  5745. This expression is evaluated per-frame.
  5746. @item keep_aspect
  5747. If set to 1 will force the output display aspect ratio
  5748. to be the same of the input, by changing the output sample aspect
  5749. ratio. It defaults to 0.
  5750. @item exact
  5751. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5752. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5753. It defaults to 0.
  5754. @end table
  5755. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5756. expressions containing the following constants:
  5757. @table @option
  5758. @item x
  5759. @item y
  5760. The computed values for @var{x} and @var{y}. They are evaluated for
  5761. each new frame.
  5762. @item in_w
  5763. @item in_h
  5764. The input width and height.
  5765. @item iw
  5766. @item ih
  5767. These are the same as @var{in_w} and @var{in_h}.
  5768. @item out_w
  5769. @item out_h
  5770. The output (cropped) width and height.
  5771. @item ow
  5772. @item oh
  5773. These are the same as @var{out_w} and @var{out_h}.
  5774. @item a
  5775. same as @var{iw} / @var{ih}
  5776. @item sar
  5777. input sample aspect ratio
  5778. @item dar
  5779. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5780. @item hsub
  5781. @item vsub
  5782. horizontal and vertical chroma subsample values. For example for the
  5783. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5784. @item n
  5785. The number of the input frame, starting from 0.
  5786. @item pos
  5787. the position in the file of the input frame, NAN if unknown
  5788. @item t
  5789. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5790. @end table
  5791. The expression for @var{out_w} may depend on the value of @var{out_h},
  5792. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5793. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5794. evaluated after @var{out_w} and @var{out_h}.
  5795. The @var{x} and @var{y} parameters specify the expressions for the
  5796. position of the top-left corner of the output (non-cropped) area. They
  5797. are evaluated for each frame. If the evaluated value is not valid, it
  5798. is approximated to the nearest valid value.
  5799. The expression for @var{x} may depend on @var{y}, and the expression
  5800. for @var{y} may depend on @var{x}.
  5801. @subsection Examples
  5802. @itemize
  5803. @item
  5804. Crop area with size 100x100 at position (12,34).
  5805. @example
  5806. crop=100:100:12:34
  5807. @end example
  5808. Using named options, the example above becomes:
  5809. @example
  5810. crop=w=100:h=100:x=12:y=34
  5811. @end example
  5812. @item
  5813. Crop the central input area with size 100x100:
  5814. @example
  5815. crop=100:100
  5816. @end example
  5817. @item
  5818. Crop the central input area with size 2/3 of the input video:
  5819. @example
  5820. crop=2/3*in_w:2/3*in_h
  5821. @end example
  5822. @item
  5823. Crop the input video central square:
  5824. @example
  5825. crop=out_w=in_h
  5826. crop=in_h
  5827. @end example
  5828. @item
  5829. Delimit the rectangle with the top-left corner placed at position
  5830. 100:100 and the right-bottom corner corresponding to the right-bottom
  5831. corner of the input image.
  5832. @example
  5833. crop=in_w-100:in_h-100:100:100
  5834. @end example
  5835. @item
  5836. Crop 10 pixels from the left and right borders, and 20 pixels from
  5837. the top and bottom borders
  5838. @example
  5839. crop=in_w-2*10:in_h-2*20
  5840. @end example
  5841. @item
  5842. Keep only the bottom right quarter of the input image:
  5843. @example
  5844. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5845. @end example
  5846. @item
  5847. Crop height for getting Greek harmony:
  5848. @example
  5849. crop=in_w:1/PHI*in_w
  5850. @end example
  5851. @item
  5852. Apply trembling effect:
  5853. @example
  5854. 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)
  5855. @end example
  5856. @item
  5857. Apply erratic camera effect depending on timestamp:
  5858. @example
  5859. 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)"
  5860. @end example
  5861. @item
  5862. Set x depending on the value of y:
  5863. @example
  5864. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5865. @end example
  5866. @end itemize
  5867. @subsection Commands
  5868. This filter supports the following commands:
  5869. @table @option
  5870. @item w, out_w
  5871. @item h, out_h
  5872. @item x
  5873. @item y
  5874. Set width/height of the output video and the horizontal/vertical position
  5875. in the input video.
  5876. The command accepts the same syntax of the corresponding option.
  5877. If the specified expression is not valid, it is kept at its current
  5878. value.
  5879. @end table
  5880. @section cropdetect
  5881. Auto-detect the crop size.
  5882. It calculates the necessary cropping parameters and prints the
  5883. recommended parameters via the logging system. The detected dimensions
  5884. correspond to the non-black area of the input video.
  5885. It accepts the following parameters:
  5886. @table @option
  5887. @item limit
  5888. Set higher black value threshold, which can be optionally specified
  5889. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5890. value greater to the set value is considered non-black. It defaults to 24.
  5891. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5892. on the bitdepth of the pixel format.
  5893. @item round
  5894. The value which the width/height should be divisible by. It defaults to
  5895. 16. The offset is automatically adjusted to center the video. Use 2 to
  5896. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5897. encoding to most video codecs.
  5898. @item reset_count, reset
  5899. Set the counter that determines after how many frames cropdetect will
  5900. reset the previously detected largest video area and start over to
  5901. detect the current optimal crop area. Default value is 0.
  5902. This can be useful when channel logos distort the video area. 0
  5903. indicates 'never reset', and returns the largest area encountered during
  5904. playback.
  5905. @end table
  5906. @anchor{cue}
  5907. @section cue
  5908. Delay video filtering until a given wallclock timestamp. The filter first
  5909. passes on @option{preroll} amount of frames, then it buffers at most
  5910. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5911. it forwards the buffered frames and also any subsequent frames coming in its
  5912. input.
  5913. The filter can be used synchronize the output of multiple ffmpeg processes for
  5914. realtime output devices like decklink. By putting the delay in the filtering
  5915. chain and pre-buffering frames the process can pass on data to output almost
  5916. immediately after the target wallclock timestamp is reached.
  5917. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5918. some use cases.
  5919. @table @option
  5920. @item cue
  5921. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5922. @item preroll
  5923. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5924. @item buffer
  5925. The maximum duration of content to buffer before waiting for the cue expressed
  5926. in seconds. Default is 0.
  5927. @end table
  5928. @anchor{curves}
  5929. @section curves
  5930. Apply color adjustments using curves.
  5931. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5932. component (red, green and blue) has its values defined by @var{N} key points
  5933. tied from each other using a smooth curve. The x-axis represents the pixel
  5934. values from the input frame, and the y-axis the new pixel values to be set for
  5935. the output frame.
  5936. By default, a component curve is defined by the two points @var{(0;0)} and
  5937. @var{(1;1)}. This creates a straight line where each original pixel value is
  5938. "adjusted" to its own value, which means no change to the image.
  5939. The filter allows you to redefine these two points and add some more. A new
  5940. curve (using a natural cubic spline interpolation) will be define to pass
  5941. smoothly through all these new coordinates. The new defined points needs to be
  5942. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5943. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5944. the vector spaces, the values will be clipped accordingly.
  5945. The filter accepts the following options:
  5946. @table @option
  5947. @item preset
  5948. Select one of the available color presets. This option can be used in addition
  5949. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5950. options takes priority on the preset values.
  5951. Available presets are:
  5952. @table @samp
  5953. @item none
  5954. @item color_negative
  5955. @item cross_process
  5956. @item darker
  5957. @item increase_contrast
  5958. @item lighter
  5959. @item linear_contrast
  5960. @item medium_contrast
  5961. @item negative
  5962. @item strong_contrast
  5963. @item vintage
  5964. @end table
  5965. Default is @code{none}.
  5966. @item master, m
  5967. Set the master key points. These points will define a second pass mapping. It
  5968. is sometimes called a "luminance" or "value" mapping. It can be used with
  5969. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5970. post-processing LUT.
  5971. @item red, r
  5972. Set the key points for the red component.
  5973. @item green, g
  5974. Set the key points for the green component.
  5975. @item blue, b
  5976. Set the key points for the blue component.
  5977. @item all
  5978. Set the key points for all components (not including master).
  5979. Can be used in addition to the other key points component
  5980. options. In this case, the unset component(s) will fallback on this
  5981. @option{all} setting.
  5982. @item psfile
  5983. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5984. @item plot
  5985. Save Gnuplot script of the curves in specified file.
  5986. @end table
  5987. To avoid some filtergraph syntax conflicts, each key points list need to be
  5988. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5989. @subsection Examples
  5990. @itemize
  5991. @item
  5992. Increase slightly the middle level of blue:
  5993. @example
  5994. curves=blue='0/0 0.5/0.58 1/1'
  5995. @end example
  5996. @item
  5997. Vintage effect:
  5998. @example
  5999. 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'
  6000. @end example
  6001. Here we obtain the following coordinates for each components:
  6002. @table @var
  6003. @item red
  6004. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6005. @item green
  6006. @code{(0;0) (0.50;0.48) (1;1)}
  6007. @item blue
  6008. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6009. @end table
  6010. @item
  6011. The previous example can also be achieved with the associated built-in preset:
  6012. @example
  6013. curves=preset=vintage
  6014. @end example
  6015. @item
  6016. Or simply:
  6017. @example
  6018. curves=vintage
  6019. @end example
  6020. @item
  6021. Use a Photoshop preset and redefine the points of the green component:
  6022. @example
  6023. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6024. @end example
  6025. @item
  6026. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6027. and @command{gnuplot}:
  6028. @example
  6029. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6030. gnuplot -p /tmp/curves.plt
  6031. @end example
  6032. @end itemize
  6033. @section datascope
  6034. Video data analysis filter.
  6035. This filter shows hexadecimal pixel values of part of video.
  6036. The filter accepts the following options:
  6037. @table @option
  6038. @item size, s
  6039. Set output video size.
  6040. @item x
  6041. Set x offset from where to pick pixels.
  6042. @item y
  6043. Set y offset from where to pick pixels.
  6044. @item mode
  6045. Set scope mode, can be one of the following:
  6046. @table @samp
  6047. @item mono
  6048. Draw hexadecimal pixel values with white color on black background.
  6049. @item color
  6050. Draw hexadecimal pixel values with input video pixel color on black
  6051. background.
  6052. @item color2
  6053. Draw hexadecimal pixel values on color background picked from input video,
  6054. the text color is picked in such way so its always visible.
  6055. @end table
  6056. @item axis
  6057. Draw rows and columns numbers on left and top of video.
  6058. @item opacity
  6059. Set background opacity.
  6060. @end table
  6061. @section dctdnoiz
  6062. Denoise frames using 2D DCT (frequency domain filtering).
  6063. This filter is not designed for real time.
  6064. The filter accepts the following options:
  6065. @table @option
  6066. @item sigma, s
  6067. Set the noise sigma constant.
  6068. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6069. coefficient (absolute value) below this threshold with be dropped.
  6070. If you need a more advanced filtering, see @option{expr}.
  6071. Default is @code{0}.
  6072. @item overlap
  6073. Set number overlapping pixels for each block. Since the filter can be slow, you
  6074. may want to reduce this value, at the cost of a less effective filter and the
  6075. risk of various artefacts.
  6076. If the overlapping value doesn't permit processing the whole input width or
  6077. height, a warning will be displayed and according borders won't be denoised.
  6078. Default value is @var{blocksize}-1, which is the best possible setting.
  6079. @item expr, e
  6080. Set the coefficient factor expression.
  6081. For each coefficient of a DCT block, this expression will be evaluated as a
  6082. multiplier value for the coefficient.
  6083. If this is option is set, the @option{sigma} option will be ignored.
  6084. The absolute value of the coefficient can be accessed through the @var{c}
  6085. variable.
  6086. @item n
  6087. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6088. @var{blocksize}, which is the width and height of the processed blocks.
  6089. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6090. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6091. on the speed processing. Also, a larger block size does not necessarily means a
  6092. better de-noising.
  6093. @end table
  6094. @subsection Examples
  6095. Apply a denoise with a @option{sigma} of @code{4.5}:
  6096. @example
  6097. dctdnoiz=4.5
  6098. @end example
  6099. The same operation can be achieved using the expression system:
  6100. @example
  6101. dctdnoiz=e='gte(c, 4.5*3)'
  6102. @end example
  6103. Violent denoise using a block size of @code{16x16}:
  6104. @example
  6105. dctdnoiz=15:n=4
  6106. @end example
  6107. @section deband
  6108. Remove banding artifacts from input video.
  6109. It works by replacing banded pixels with average value of referenced pixels.
  6110. The filter accepts the following options:
  6111. @table @option
  6112. @item 1thr
  6113. @item 2thr
  6114. @item 3thr
  6115. @item 4thr
  6116. Set banding detection threshold for each plane. Default is 0.02.
  6117. Valid range is 0.00003 to 0.5.
  6118. If difference between current pixel and reference pixel is less than threshold,
  6119. it will be considered as banded.
  6120. @item range, r
  6121. Banding detection range in pixels. Default is 16. If positive, random number
  6122. in range 0 to set value will be used. If negative, exact absolute value
  6123. will be used.
  6124. The range defines square of four pixels around current pixel.
  6125. @item direction, d
  6126. Set direction in radians from which four pixel will be compared. If positive,
  6127. random direction from 0 to set direction will be picked. If negative, exact of
  6128. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6129. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6130. column.
  6131. @item blur, b
  6132. If enabled, current pixel is compared with average value of all four
  6133. surrounding pixels. The default is enabled. If disabled current pixel is
  6134. compared with all four surrounding pixels. The pixel is considered banded
  6135. if only all four differences with surrounding pixels are less than threshold.
  6136. @item coupling, c
  6137. If enabled, current pixel is changed if and only if all pixel components are banded,
  6138. e.g. banding detection threshold is triggered for all color components.
  6139. The default is disabled.
  6140. @end table
  6141. @section deblock
  6142. Remove blocking artifacts from input video.
  6143. The filter accepts the following options:
  6144. @table @option
  6145. @item filter
  6146. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6147. This controls what kind of deblocking is applied.
  6148. @item block
  6149. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6150. @item alpha
  6151. @item beta
  6152. @item gamma
  6153. @item delta
  6154. Set blocking detection thresholds. Allowed range is 0 to 1.
  6155. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6156. Using higher threshold gives more deblocking strength.
  6157. Setting @var{alpha} controls threshold detection at exact edge of block.
  6158. Remaining options controls threshold detection near the edge. Each one for
  6159. below/above or left/right. Setting any of those to @var{0} disables
  6160. deblocking.
  6161. @item planes
  6162. Set planes to filter. Default is to filter all available planes.
  6163. @end table
  6164. @subsection Examples
  6165. @itemize
  6166. @item
  6167. Deblock using weak filter and block size of 4 pixels.
  6168. @example
  6169. deblock=filter=weak:block=4
  6170. @end example
  6171. @item
  6172. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6173. deblocking more edges.
  6174. @example
  6175. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6176. @end example
  6177. @item
  6178. Similar as above, but filter only first plane.
  6179. @example
  6180. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6181. @end example
  6182. @item
  6183. Similar as above, but filter only second and third plane.
  6184. @example
  6185. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6186. @end example
  6187. @end itemize
  6188. @anchor{decimate}
  6189. @section decimate
  6190. Drop duplicated frames at regular intervals.
  6191. The filter accepts the following options:
  6192. @table @option
  6193. @item cycle
  6194. Set the number of frames from which one will be dropped. Setting this to
  6195. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6196. Default is @code{5}.
  6197. @item dupthresh
  6198. Set the threshold for duplicate detection. If the difference metric for a frame
  6199. is less than or equal to this value, then it is declared as duplicate. Default
  6200. is @code{1.1}
  6201. @item scthresh
  6202. Set scene change threshold. Default is @code{15}.
  6203. @item blockx
  6204. @item blocky
  6205. Set the size of the x and y-axis blocks used during metric calculations.
  6206. Larger blocks give better noise suppression, but also give worse detection of
  6207. small movements. Must be a power of two. Default is @code{32}.
  6208. @item ppsrc
  6209. Mark main input as a pre-processed input and activate clean source input
  6210. stream. This allows the input to be pre-processed with various filters to help
  6211. the metrics calculation while keeping the frame selection lossless. When set to
  6212. @code{1}, the first stream is for the pre-processed input, and the second
  6213. stream is the clean source from where the kept frames are chosen. Default is
  6214. @code{0}.
  6215. @item chroma
  6216. Set whether or not chroma is considered in the metric calculations. Default is
  6217. @code{1}.
  6218. @end table
  6219. @section deconvolve
  6220. Apply 2D deconvolution of video stream in frequency domain using second stream
  6221. as impulse.
  6222. The filter accepts the following options:
  6223. @table @option
  6224. @item planes
  6225. Set which planes to process.
  6226. @item impulse
  6227. Set which impulse video frames will be processed, can be @var{first}
  6228. or @var{all}. Default is @var{all}.
  6229. @item noise
  6230. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6231. and height are not same and not power of 2 or if stream prior to convolving
  6232. had noise.
  6233. @end table
  6234. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6235. @section dedot
  6236. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6237. It accepts the following options:
  6238. @table @option
  6239. @item m
  6240. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6241. @var{rainbows} for cross-color reduction.
  6242. @item lt
  6243. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6244. @item tl
  6245. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6246. @item tc
  6247. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6248. @item ct
  6249. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6250. @end table
  6251. @section deflate
  6252. Apply deflate effect to the video.
  6253. This filter replaces the pixel by the local(3x3) average by taking into account
  6254. only values lower than the pixel.
  6255. It accepts the following options:
  6256. @table @option
  6257. @item threshold0
  6258. @item threshold1
  6259. @item threshold2
  6260. @item threshold3
  6261. Limit the maximum change for each plane, default is 65535.
  6262. If 0, plane will remain unchanged.
  6263. @end table
  6264. @section deflicker
  6265. Remove temporal frame luminance variations.
  6266. It accepts the following options:
  6267. @table @option
  6268. @item size, s
  6269. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6270. @item mode, m
  6271. Set averaging mode to smooth temporal luminance variations.
  6272. Available values are:
  6273. @table @samp
  6274. @item am
  6275. Arithmetic mean
  6276. @item gm
  6277. Geometric mean
  6278. @item hm
  6279. Harmonic mean
  6280. @item qm
  6281. Quadratic mean
  6282. @item cm
  6283. Cubic mean
  6284. @item pm
  6285. Power mean
  6286. @item median
  6287. Median
  6288. @end table
  6289. @item bypass
  6290. Do not actually modify frame. Useful when one only wants metadata.
  6291. @end table
  6292. @section dejudder
  6293. Remove judder produced by partially interlaced telecined content.
  6294. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6295. source was partially telecined content then the output of @code{pullup,dejudder}
  6296. will have a variable frame rate. May change the recorded frame rate of the
  6297. container. Aside from that change, this filter will not affect constant frame
  6298. rate video.
  6299. The option available in this filter is:
  6300. @table @option
  6301. @item cycle
  6302. Specify the length of the window over which the judder repeats.
  6303. Accepts any integer greater than 1. Useful values are:
  6304. @table @samp
  6305. @item 4
  6306. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6307. @item 5
  6308. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6309. @item 20
  6310. If a mixture of the two.
  6311. @end table
  6312. The default is @samp{4}.
  6313. @end table
  6314. @section delogo
  6315. Suppress a TV station logo by a simple interpolation of the surrounding
  6316. pixels. Just set a rectangle covering the logo and watch it disappear
  6317. (and sometimes something even uglier appear - your mileage may vary).
  6318. It accepts the following parameters:
  6319. @table @option
  6320. @item x
  6321. @item y
  6322. Specify the top left corner coordinates of the logo. They must be
  6323. specified.
  6324. @item w
  6325. @item h
  6326. Specify the width and height of the logo to clear. They must be
  6327. specified.
  6328. @item band, t
  6329. Specify the thickness of the fuzzy edge of the rectangle (added to
  6330. @var{w} and @var{h}). The default value is 1. This option is
  6331. deprecated, setting higher values should no longer be necessary and
  6332. is not recommended.
  6333. @item show
  6334. When set to 1, a green rectangle is drawn on the screen to simplify
  6335. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6336. The default value is 0.
  6337. The rectangle is drawn on the outermost pixels which will be (partly)
  6338. replaced with interpolated values. The values of the next pixels
  6339. immediately outside this rectangle in each direction will be used to
  6340. compute the interpolated pixel values inside the rectangle.
  6341. @end table
  6342. @subsection Examples
  6343. @itemize
  6344. @item
  6345. Set a rectangle covering the area with top left corner coordinates 0,0
  6346. and size 100x77, and a band of size 10:
  6347. @example
  6348. delogo=x=0:y=0:w=100:h=77:band=10
  6349. @end example
  6350. @end itemize
  6351. @section deshake
  6352. Attempt to fix small changes in horizontal and/or vertical shift. This
  6353. filter helps remove camera shake from hand-holding a camera, bumping a
  6354. tripod, moving on a vehicle, etc.
  6355. The filter accepts the following options:
  6356. @table @option
  6357. @item x
  6358. @item y
  6359. @item w
  6360. @item h
  6361. Specify a rectangular area where to limit the search for motion
  6362. vectors.
  6363. If desired the search for motion vectors can be limited to a
  6364. rectangular area of the frame defined by its top left corner, width
  6365. and height. These parameters have the same meaning as the drawbox
  6366. filter which can be used to visualise the position of the bounding
  6367. box.
  6368. This is useful when simultaneous movement of subjects within the frame
  6369. might be confused for camera motion by the motion vector search.
  6370. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6371. then the full frame is used. This allows later options to be set
  6372. without specifying the bounding box for the motion vector search.
  6373. Default - search the whole frame.
  6374. @item rx
  6375. @item ry
  6376. Specify the maximum extent of movement in x and y directions in the
  6377. range 0-64 pixels. Default 16.
  6378. @item edge
  6379. Specify how to generate pixels to fill blanks at the edge of the
  6380. frame. Available values are:
  6381. @table @samp
  6382. @item blank, 0
  6383. Fill zeroes at blank locations
  6384. @item original, 1
  6385. Original image at blank locations
  6386. @item clamp, 2
  6387. Extruded edge value at blank locations
  6388. @item mirror, 3
  6389. Mirrored edge at blank locations
  6390. @end table
  6391. Default value is @samp{mirror}.
  6392. @item blocksize
  6393. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6394. default 8.
  6395. @item contrast
  6396. Specify the contrast threshold for blocks. Only blocks with more than
  6397. the specified contrast (difference between darkest and lightest
  6398. pixels) will be considered. Range 1-255, default 125.
  6399. @item search
  6400. Specify the search strategy. Available values are:
  6401. @table @samp
  6402. @item exhaustive, 0
  6403. Set exhaustive search
  6404. @item less, 1
  6405. Set less exhaustive search.
  6406. @end table
  6407. Default value is @samp{exhaustive}.
  6408. @item filename
  6409. If set then a detailed log of the motion search is written to the
  6410. specified file.
  6411. @end table
  6412. @section despill
  6413. Remove unwanted contamination of foreground colors, caused by reflected color of
  6414. greenscreen or bluescreen.
  6415. This filter accepts the following options:
  6416. @table @option
  6417. @item type
  6418. Set what type of despill to use.
  6419. @item mix
  6420. Set how spillmap will be generated.
  6421. @item expand
  6422. Set how much to get rid of still remaining spill.
  6423. @item red
  6424. Controls amount of red in spill area.
  6425. @item green
  6426. Controls amount of green in spill area.
  6427. Should be -1 for greenscreen.
  6428. @item blue
  6429. Controls amount of blue in spill area.
  6430. Should be -1 for bluescreen.
  6431. @item brightness
  6432. Controls brightness of spill area, preserving colors.
  6433. @item alpha
  6434. Modify alpha from generated spillmap.
  6435. @end table
  6436. @section detelecine
  6437. Apply an exact inverse of the telecine operation. It requires a predefined
  6438. pattern specified using the pattern option which must be the same as that passed
  6439. to the telecine filter.
  6440. This filter accepts the following options:
  6441. @table @option
  6442. @item first_field
  6443. @table @samp
  6444. @item top, t
  6445. top field first
  6446. @item bottom, b
  6447. bottom field first
  6448. The default value is @code{top}.
  6449. @end table
  6450. @item pattern
  6451. A string of numbers representing the pulldown pattern you wish to apply.
  6452. The default value is @code{23}.
  6453. @item start_frame
  6454. A number representing position of the first frame with respect to the telecine
  6455. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6456. @end table
  6457. @section dilation
  6458. Apply dilation effect to the video.
  6459. This filter replaces the pixel by the local(3x3) maximum.
  6460. It accepts the following options:
  6461. @table @option
  6462. @item threshold0
  6463. @item threshold1
  6464. @item threshold2
  6465. @item threshold3
  6466. Limit the maximum change for each plane, default is 65535.
  6467. If 0, plane will remain unchanged.
  6468. @item coordinates
  6469. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6470. pixels are used.
  6471. Flags to local 3x3 coordinates maps like this:
  6472. 1 2 3
  6473. 4 5
  6474. 6 7 8
  6475. @end table
  6476. @section displace
  6477. Displace pixels as indicated by second and third input stream.
  6478. It takes three input streams and outputs one stream, the first input is the
  6479. source, and second and third input are displacement maps.
  6480. The second input specifies how much to displace pixels along the
  6481. x-axis, while the third input specifies how much to displace pixels
  6482. along the y-axis.
  6483. If one of displacement map streams terminates, last frame from that
  6484. displacement map will be used.
  6485. Note that once generated, displacements maps can be reused over and over again.
  6486. A description of the accepted options follows.
  6487. @table @option
  6488. @item edge
  6489. Set displace behavior for pixels that are out of range.
  6490. Available values are:
  6491. @table @samp
  6492. @item blank
  6493. Missing pixels are replaced by black pixels.
  6494. @item smear
  6495. Adjacent pixels will spread out to replace missing pixels.
  6496. @item wrap
  6497. Out of range pixels are wrapped so they point to pixels of other side.
  6498. @item mirror
  6499. Out of range pixels will be replaced with mirrored pixels.
  6500. @end table
  6501. Default is @samp{smear}.
  6502. @end table
  6503. @subsection Examples
  6504. @itemize
  6505. @item
  6506. Add ripple effect to rgb input of video size hd720:
  6507. @example
  6508. 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
  6509. @end example
  6510. @item
  6511. Add wave effect to rgb input of video size hd720:
  6512. @example
  6513. 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
  6514. @end example
  6515. @end itemize
  6516. @section drawbox
  6517. Draw a colored box on the input image.
  6518. It accepts the following parameters:
  6519. @table @option
  6520. @item x
  6521. @item y
  6522. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6523. @item width, w
  6524. @item height, h
  6525. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6526. the input width and height. It defaults to 0.
  6527. @item color, c
  6528. Specify the color of the box to write. For the general syntax of this option,
  6529. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6530. value @code{invert} is used, the box edge color is the same as the
  6531. video with inverted luma.
  6532. @item thickness, t
  6533. The expression which sets the thickness of the box edge.
  6534. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6535. See below for the list of accepted constants.
  6536. @item replace
  6537. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6538. will overwrite the video's color and alpha pixels.
  6539. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6540. @end table
  6541. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6542. following constants:
  6543. @table @option
  6544. @item dar
  6545. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6546. @item hsub
  6547. @item vsub
  6548. horizontal and vertical chroma subsample values. For example for the
  6549. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6550. @item in_h, ih
  6551. @item in_w, iw
  6552. The input width and height.
  6553. @item sar
  6554. The input sample aspect ratio.
  6555. @item x
  6556. @item y
  6557. The x and y offset coordinates where the box is drawn.
  6558. @item w
  6559. @item h
  6560. The width and height of the drawn box.
  6561. @item t
  6562. The thickness of the drawn box.
  6563. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6564. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6565. @end table
  6566. @subsection Examples
  6567. @itemize
  6568. @item
  6569. Draw a black box around the edge of the input image:
  6570. @example
  6571. drawbox
  6572. @end example
  6573. @item
  6574. Draw a box with color red and an opacity of 50%:
  6575. @example
  6576. drawbox=10:20:200:60:red@@0.5
  6577. @end example
  6578. The previous example can be specified as:
  6579. @example
  6580. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6581. @end example
  6582. @item
  6583. Fill the box with pink color:
  6584. @example
  6585. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6586. @end example
  6587. @item
  6588. Draw a 2-pixel red 2.40:1 mask:
  6589. @example
  6590. 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
  6591. @end example
  6592. @end itemize
  6593. @section drawgrid
  6594. Draw a grid on the input image.
  6595. It accepts the following parameters:
  6596. @table @option
  6597. @item x
  6598. @item y
  6599. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6600. @item width, w
  6601. @item height, h
  6602. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6603. input width and height, respectively, minus @code{thickness}, so image gets
  6604. framed. Default to 0.
  6605. @item color, c
  6606. Specify the color of the grid. For the general syntax of this option,
  6607. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6608. value @code{invert} is used, the grid color is the same as the
  6609. video with inverted luma.
  6610. @item thickness, t
  6611. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6612. See below for the list of accepted constants.
  6613. @item replace
  6614. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6615. will overwrite the video's color and alpha pixels.
  6616. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6617. @end table
  6618. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6619. following constants:
  6620. @table @option
  6621. @item dar
  6622. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6623. @item hsub
  6624. @item vsub
  6625. horizontal and vertical chroma subsample values. For example for the
  6626. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6627. @item in_h, ih
  6628. @item in_w, iw
  6629. The input grid cell width and height.
  6630. @item sar
  6631. The input sample aspect ratio.
  6632. @item x
  6633. @item y
  6634. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6635. @item w
  6636. @item h
  6637. The width and height of the drawn cell.
  6638. @item t
  6639. The thickness of the drawn cell.
  6640. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6641. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6642. @end table
  6643. @subsection Examples
  6644. @itemize
  6645. @item
  6646. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6647. @example
  6648. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6649. @end example
  6650. @item
  6651. Draw a white 3x3 grid with an opacity of 50%:
  6652. @example
  6653. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6654. @end example
  6655. @end itemize
  6656. @anchor{drawtext}
  6657. @section drawtext
  6658. Draw a text string or text from a specified file on top of a video, using the
  6659. libfreetype library.
  6660. To enable compilation of this filter, you need to configure FFmpeg with
  6661. @code{--enable-libfreetype}.
  6662. To enable default font fallback and the @var{font} option you need to
  6663. configure FFmpeg with @code{--enable-libfontconfig}.
  6664. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6665. @code{--enable-libfribidi}.
  6666. @subsection Syntax
  6667. It accepts the following parameters:
  6668. @table @option
  6669. @item box
  6670. Used to draw a box around text using the background color.
  6671. The value must be either 1 (enable) or 0 (disable).
  6672. The default value of @var{box} is 0.
  6673. @item boxborderw
  6674. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6675. The default value of @var{boxborderw} is 0.
  6676. @item boxcolor
  6677. The color to be used for drawing box around text. For the syntax of this
  6678. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6679. The default value of @var{boxcolor} is "white".
  6680. @item line_spacing
  6681. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6682. The default value of @var{line_spacing} is 0.
  6683. @item borderw
  6684. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6685. The default value of @var{borderw} is 0.
  6686. @item bordercolor
  6687. Set the color to be used for drawing border around text. For the syntax of this
  6688. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6689. The default value of @var{bordercolor} is "black".
  6690. @item expansion
  6691. Select how the @var{text} is expanded. Can be either @code{none},
  6692. @code{strftime} (deprecated) or
  6693. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6694. below for details.
  6695. @item basetime
  6696. Set a start time for the count. Value is in microseconds. Only applied
  6697. in the deprecated strftime expansion mode. To emulate in normal expansion
  6698. mode use the @code{pts} function, supplying the start time (in seconds)
  6699. as the second argument.
  6700. @item fix_bounds
  6701. If true, check and fix text coords to avoid clipping.
  6702. @item fontcolor
  6703. The color to be used for drawing fonts. For the syntax of this option, check
  6704. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6705. The default value of @var{fontcolor} is "black".
  6706. @item fontcolor_expr
  6707. String which is expanded the same way as @var{text} to obtain dynamic
  6708. @var{fontcolor} value. By default this option has empty value and is not
  6709. processed. When this option is set, it overrides @var{fontcolor} option.
  6710. @item font
  6711. The font family to be used for drawing text. By default Sans.
  6712. @item fontfile
  6713. The font file to be used for drawing text. The path must be included.
  6714. This parameter is mandatory if the fontconfig support is disabled.
  6715. @item alpha
  6716. Draw the text applying alpha blending. The value can
  6717. be a number between 0.0 and 1.0.
  6718. The expression accepts the same variables @var{x, y} as well.
  6719. The default value is 1.
  6720. Please see @var{fontcolor_expr}.
  6721. @item fontsize
  6722. The font size to be used for drawing text.
  6723. The default value of @var{fontsize} is 16.
  6724. @item text_shaping
  6725. If set to 1, attempt to shape the text (for example, reverse the order of
  6726. right-to-left text and join Arabic characters) before drawing it.
  6727. Otherwise, just draw the text exactly as given.
  6728. By default 1 (if supported).
  6729. @item ft_load_flags
  6730. The flags to be used for loading the fonts.
  6731. The flags map the corresponding flags supported by libfreetype, and are
  6732. a combination of the following values:
  6733. @table @var
  6734. @item default
  6735. @item no_scale
  6736. @item no_hinting
  6737. @item render
  6738. @item no_bitmap
  6739. @item vertical_layout
  6740. @item force_autohint
  6741. @item crop_bitmap
  6742. @item pedantic
  6743. @item ignore_global_advance_width
  6744. @item no_recurse
  6745. @item ignore_transform
  6746. @item monochrome
  6747. @item linear_design
  6748. @item no_autohint
  6749. @end table
  6750. Default value is "default".
  6751. For more information consult the documentation for the FT_LOAD_*
  6752. libfreetype flags.
  6753. @item shadowcolor
  6754. The color to be used for drawing a shadow behind the drawn text. For the
  6755. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6756. ffmpeg-utils manual,ffmpeg-utils}.
  6757. The default value of @var{shadowcolor} is "black".
  6758. @item shadowx
  6759. @item shadowy
  6760. The x and y offsets for the text shadow position with respect to the
  6761. position of the text. They can be either positive or negative
  6762. values. The default value for both is "0".
  6763. @item start_number
  6764. The starting frame number for the n/frame_num variable. The default value
  6765. is "0".
  6766. @item tabsize
  6767. The size in number of spaces to use for rendering the tab.
  6768. Default value is 4.
  6769. @item timecode
  6770. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6771. format. It can be used with or without text parameter. @var{timecode_rate}
  6772. option must be specified.
  6773. @item timecode_rate, rate, r
  6774. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6775. integer. Minimum value is "1".
  6776. Drop-frame timecode is supported for frame rates 30 & 60.
  6777. @item tc24hmax
  6778. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6779. Default is 0 (disabled).
  6780. @item text
  6781. The text string to be drawn. The text must be a sequence of UTF-8
  6782. encoded characters.
  6783. This parameter is mandatory if no file is specified with the parameter
  6784. @var{textfile}.
  6785. @item textfile
  6786. A text file containing text to be drawn. The text must be a sequence
  6787. of UTF-8 encoded characters.
  6788. This parameter is mandatory if no text string is specified with the
  6789. parameter @var{text}.
  6790. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6791. @item reload
  6792. If set to 1, the @var{textfile} will be reloaded before each frame.
  6793. Be sure to update it atomically, or it may be read partially, or even fail.
  6794. @item x
  6795. @item y
  6796. The expressions which specify the offsets where text will be drawn
  6797. within the video frame. They are relative to the top/left border of the
  6798. output image.
  6799. The default value of @var{x} and @var{y} is "0".
  6800. See below for the list of accepted constants and functions.
  6801. @end table
  6802. The parameters for @var{x} and @var{y} are expressions containing the
  6803. following constants and functions:
  6804. @table @option
  6805. @item dar
  6806. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6807. @item hsub
  6808. @item vsub
  6809. horizontal and vertical chroma subsample values. For example for the
  6810. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6811. @item line_h, lh
  6812. the height of each text line
  6813. @item main_h, h, H
  6814. the input height
  6815. @item main_w, w, W
  6816. the input width
  6817. @item max_glyph_a, ascent
  6818. the maximum distance from the baseline to the highest/upper grid
  6819. coordinate used to place a glyph outline point, for all the rendered
  6820. glyphs.
  6821. It is a positive value, due to the grid's orientation with the Y axis
  6822. upwards.
  6823. @item max_glyph_d, descent
  6824. the maximum distance from the baseline to the lowest grid coordinate
  6825. used to place a glyph outline point, for all the rendered glyphs.
  6826. This is a negative value, due to the grid's orientation, with the Y axis
  6827. upwards.
  6828. @item max_glyph_h
  6829. maximum glyph height, that is the maximum height for all the glyphs
  6830. contained in the rendered text, it is equivalent to @var{ascent} -
  6831. @var{descent}.
  6832. @item max_glyph_w
  6833. maximum glyph width, that is the maximum width for all the glyphs
  6834. contained in the rendered text
  6835. @item n
  6836. the number of input frame, starting from 0
  6837. @item rand(min, max)
  6838. return a random number included between @var{min} and @var{max}
  6839. @item sar
  6840. The input sample aspect ratio.
  6841. @item t
  6842. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6843. @item text_h, th
  6844. the height of the rendered text
  6845. @item text_w, tw
  6846. the width of the rendered text
  6847. @item x
  6848. @item y
  6849. the x and y offset coordinates where the text is drawn.
  6850. These parameters allow the @var{x} and @var{y} expressions to refer
  6851. each other, so you can for example specify @code{y=x/dar}.
  6852. @end table
  6853. @anchor{drawtext_expansion}
  6854. @subsection Text expansion
  6855. If @option{expansion} is set to @code{strftime},
  6856. the filter recognizes strftime() sequences in the provided text and
  6857. expands them accordingly. Check the documentation of strftime(). This
  6858. feature is deprecated.
  6859. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6860. If @option{expansion} is set to @code{normal} (which is the default),
  6861. the following expansion mechanism is used.
  6862. The backslash character @samp{\}, followed by any character, always expands to
  6863. the second character.
  6864. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6865. braces is a function name, possibly followed by arguments separated by ':'.
  6866. If the arguments contain special characters or delimiters (':' or '@}'),
  6867. they should be escaped.
  6868. Note that they probably must also be escaped as the value for the
  6869. @option{text} option in the filter argument string and as the filter
  6870. argument in the filtergraph description, and possibly also for the shell,
  6871. that makes up to four levels of escaping; using a text file avoids these
  6872. problems.
  6873. The following functions are available:
  6874. @table @command
  6875. @item expr, e
  6876. The expression evaluation result.
  6877. It must take one argument specifying the expression to be evaluated,
  6878. which accepts the same constants and functions as the @var{x} and
  6879. @var{y} values. Note that not all constants should be used, for
  6880. example the text size is not known when evaluating the expression, so
  6881. the constants @var{text_w} and @var{text_h} will have an undefined
  6882. value.
  6883. @item expr_int_format, eif
  6884. Evaluate the expression's value and output as formatted integer.
  6885. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6886. The second argument specifies the output format. Allowed values are @samp{x},
  6887. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6888. @code{printf} function.
  6889. The third parameter is optional and sets the number of positions taken by the output.
  6890. It can be used to add padding with zeros from the left.
  6891. @item gmtime
  6892. The time at which the filter is running, expressed in UTC.
  6893. It can accept an argument: a strftime() format string.
  6894. @item localtime
  6895. The time at which the filter is running, expressed in the local time zone.
  6896. It can accept an argument: a strftime() format string.
  6897. @item metadata
  6898. Frame metadata. Takes one or two arguments.
  6899. The first argument is mandatory and specifies the metadata key.
  6900. The second argument is optional and specifies a default value, used when the
  6901. metadata key is not found or empty.
  6902. @item n, frame_num
  6903. The frame number, starting from 0.
  6904. @item pict_type
  6905. A 1 character description of the current picture type.
  6906. @item pts
  6907. The timestamp of the current frame.
  6908. It can take up to three arguments.
  6909. The first argument is the format of the timestamp; it defaults to @code{flt}
  6910. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6911. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6912. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6913. @code{localtime} stands for the timestamp of the frame formatted as
  6914. local time zone time.
  6915. The second argument is an offset added to the timestamp.
  6916. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6917. supplied to present the hour part of the formatted timestamp in 24h format
  6918. (00-23).
  6919. If the format is set to @code{localtime} or @code{gmtime},
  6920. a third argument may be supplied: a strftime() format string.
  6921. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6922. @end table
  6923. @subsection Commands
  6924. This filter supports altering parameters via commands:
  6925. @table @option
  6926. @item reinit
  6927. Alter existing filter parameters.
  6928. Syntax for the argument is the same as for filter invocation, e.g.
  6929. @example
  6930. fontsize=56:fontcolor=green:text='Hello World'
  6931. @end example
  6932. Full filter invocation with sendcmd would look like this:
  6933. @example
  6934. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  6935. @end example
  6936. @end table
  6937. If the entire argument can't be parsed or applied as valid values then the filter will
  6938. continue with its existing parameters.
  6939. @subsection Examples
  6940. @itemize
  6941. @item
  6942. Draw "Test Text" with font FreeSerif, using the default values for the
  6943. optional parameters.
  6944. @example
  6945. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6946. @end example
  6947. @item
  6948. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6949. and y=50 (counting from the top-left corner of the screen), text is
  6950. yellow with a red box around it. Both the text and the box have an
  6951. opacity of 20%.
  6952. @example
  6953. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6954. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6955. @end example
  6956. Note that the double quotes are not necessary if spaces are not used
  6957. within the parameter list.
  6958. @item
  6959. Show the text at the center of the video frame:
  6960. @example
  6961. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6962. @end example
  6963. @item
  6964. Show the text at a random position, switching to a new position every 30 seconds:
  6965. @example
  6966. 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)"
  6967. @end example
  6968. @item
  6969. Show a text line sliding from right to left in the last row of the video
  6970. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6971. with no newlines.
  6972. @example
  6973. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6974. @end example
  6975. @item
  6976. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6977. @example
  6978. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6979. @end example
  6980. @item
  6981. Draw a single green letter "g", at the center of the input video.
  6982. The glyph baseline is placed at half screen height.
  6983. @example
  6984. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6985. @end example
  6986. @item
  6987. Show text for 1 second every 3 seconds:
  6988. @example
  6989. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6990. @end example
  6991. @item
  6992. Use fontconfig to set the font. Note that the colons need to be escaped.
  6993. @example
  6994. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6995. @end example
  6996. @item
  6997. Print the date of a real-time encoding (see strftime(3)):
  6998. @example
  6999. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7000. @end example
  7001. @item
  7002. Show text fading in and out (appearing/disappearing):
  7003. @example
  7004. #!/bin/sh
  7005. DS=1.0 # display start
  7006. DE=10.0 # display end
  7007. FID=1.5 # fade in duration
  7008. FOD=5 # fade out duration
  7009. 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 @}"
  7010. @end example
  7011. @item
  7012. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7013. and the @option{fontsize} value are included in the @option{y} offset.
  7014. @example
  7015. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7016. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7017. @end example
  7018. @end itemize
  7019. For more information about libfreetype, check:
  7020. @url{http://www.freetype.org/}.
  7021. For more information about fontconfig, check:
  7022. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7023. For more information about libfribidi, check:
  7024. @url{http://fribidi.org/}.
  7025. @section edgedetect
  7026. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7027. The filter accepts the following options:
  7028. @table @option
  7029. @item low
  7030. @item high
  7031. Set low and high threshold values used by the Canny thresholding
  7032. algorithm.
  7033. The high threshold selects the "strong" edge pixels, which are then
  7034. connected through 8-connectivity with the "weak" edge pixels selected
  7035. by the low threshold.
  7036. @var{low} and @var{high} threshold values must be chosen in the range
  7037. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7038. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7039. is @code{50/255}.
  7040. @item mode
  7041. Define the drawing mode.
  7042. @table @samp
  7043. @item wires
  7044. Draw white/gray wires on black background.
  7045. @item colormix
  7046. Mix the colors to create a paint/cartoon effect.
  7047. @item canny
  7048. Apply Canny edge detector on all selected planes.
  7049. @end table
  7050. Default value is @var{wires}.
  7051. @item planes
  7052. Select planes for filtering. By default all available planes are filtered.
  7053. @end table
  7054. @subsection Examples
  7055. @itemize
  7056. @item
  7057. Standard edge detection with custom values for the hysteresis thresholding:
  7058. @example
  7059. edgedetect=low=0.1:high=0.4
  7060. @end example
  7061. @item
  7062. Painting effect without thresholding:
  7063. @example
  7064. edgedetect=mode=colormix:high=0
  7065. @end example
  7066. @end itemize
  7067. @section eq
  7068. Set brightness, contrast, saturation and approximate gamma adjustment.
  7069. The filter accepts the following options:
  7070. @table @option
  7071. @item contrast
  7072. Set the contrast expression. The value must be a float value in range
  7073. @code{-2.0} to @code{2.0}. The default value is "1".
  7074. @item brightness
  7075. Set the brightness expression. The value must be a float value in
  7076. range @code{-1.0} to @code{1.0}. The default value is "0".
  7077. @item saturation
  7078. Set the saturation expression. The value must be a float in
  7079. range @code{0.0} to @code{3.0}. The default value is "1".
  7080. @item gamma
  7081. Set the gamma expression. The value must be a float in range
  7082. @code{0.1} to @code{10.0}. The default value is "1".
  7083. @item gamma_r
  7084. Set the gamma expression for red. The value must be a float in
  7085. range @code{0.1} to @code{10.0}. The default value is "1".
  7086. @item gamma_g
  7087. Set the gamma expression for green. The value must be a float in range
  7088. @code{0.1} to @code{10.0}. The default value is "1".
  7089. @item gamma_b
  7090. Set the gamma expression for blue. The value must be a float in range
  7091. @code{0.1} to @code{10.0}. The default value is "1".
  7092. @item gamma_weight
  7093. Set the gamma weight expression. It can be used to reduce the effect
  7094. of a high gamma value on bright image areas, e.g. keep them from
  7095. getting overamplified and just plain white. The value must be a float
  7096. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7097. gamma correction all the way down while @code{1.0} leaves it at its
  7098. full strength. Default is "1".
  7099. @item eval
  7100. Set when the expressions for brightness, contrast, saturation and
  7101. gamma expressions are evaluated.
  7102. It accepts the following values:
  7103. @table @samp
  7104. @item init
  7105. only evaluate expressions once during the filter initialization or
  7106. when a command is processed
  7107. @item frame
  7108. evaluate expressions for each incoming frame
  7109. @end table
  7110. Default value is @samp{init}.
  7111. @end table
  7112. The expressions accept the following parameters:
  7113. @table @option
  7114. @item n
  7115. frame count of the input frame starting from 0
  7116. @item pos
  7117. byte position of the corresponding packet in the input file, NAN if
  7118. unspecified
  7119. @item r
  7120. frame rate of the input video, NAN if the input frame rate is unknown
  7121. @item t
  7122. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7123. @end table
  7124. @subsection Commands
  7125. The filter supports the following commands:
  7126. @table @option
  7127. @item contrast
  7128. Set the contrast expression.
  7129. @item brightness
  7130. Set the brightness expression.
  7131. @item saturation
  7132. Set the saturation expression.
  7133. @item gamma
  7134. Set the gamma expression.
  7135. @item gamma_r
  7136. Set the gamma_r expression.
  7137. @item gamma_g
  7138. Set gamma_g expression.
  7139. @item gamma_b
  7140. Set gamma_b expression.
  7141. @item gamma_weight
  7142. Set gamma_weight expression.
  7143. The command accepts the same syntax of the corresponding option.
  7144. If the specified expression is not valid, it is kept at its current
  7145. value.
  7146. @end table
  7147. @section erosion
  7148. Apply erosion effect to the video.
  7149. This filter replaces the pixel by the local(3x3) minimum.
  7150. It accepts the following options:
  7151. @table @option
  7152. @item threshold0
  7153. @item threshold1
  7154. @item threshold2
  7155. @item threshold3
  7156. Limit the maximum change for each plane, default is 65535.
  7157. If 0, plane will remain unchanged.
  7158. @item coordinates
  7159. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7160. pixels are used.
  7161. Flags to local 3x3 coordinates maps like this:
  7162. 1 2 3
  7163. 4 5
  7164. 6 7 8
  7165. @end table
  7166. @section extractplanes
  7167. Extract color channel components from input video stream into
  7168. separate grayscale video streams.
  7169. The filter accepts the following option:
  7170. @table @option
  7171. @item planes
  7172. Set plane(s) to extract.
  7173. Available values for planes are:
  7174. @table @samp
  7175. @item y
  7176. @item u
  7177. @item v
  7178. @item a
  7179. @item r
  7180. @item g
  7181. @item b
  7182. @end table
  7183. Choosing planes not available in the input will result in an error.
  7184. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7185. with @code{y}, @code{u}, @code{v} planes at same time.
  7186. @end table
  7187. @subsection Examples
  7188. @itemize
  7189. @item
  7190. Extract luma, u and v color channel component from input video frame
  7191. into 3 grayscale outputs:
  7192. @example
  7193. 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
  7194. @end example
  7195. @end itemize
  7196. @section elbg
  7197. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7198. For each input image, the filter will compute the optimal mapping from
  7199. the input to the output given the codebook length, that is the number
  7200. of distinct output colors.
  7201. This filter accepts the following options.
  7202. @table @option
  7203. @item codebook_length, l
  7204. Set codebook length. The value must be a positive integer, and
  7205. represents the number of distinct output colors. Default value is 256.
  7206. @item nb_steps, n
  7207. Set the maximum number of iterations to apply for computing the optimal
  7208. mapping. The higher the value the better the result and the higher the
  7209. computation time. Default value is 1.
  7210. @item seed, s
  7211. Set a random seed, must be an integer included between 0 and
  7212. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7213. will try to use a good random seed on a best effort basis.
  7214. @item pal8
  7215. Set pal8 output pixel format. This option does not work with codebook
  7216. length greater than 256.
  7217. @end table
  7218. @section entropy
  7219. Measure graylevel entropy in histogram of color channels of video frames.
  7220. It accepts the following parameters:
  7221. @table @option
  7222. @item mode
  7223. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7224. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7225. between neighbour histogram values.
  7226. @end table
  7227. @section fade
  7228. Apply a fade-in/out effect to the input video.
  7229. It accepts the following parameters:
  7230. @table @option
  7231. @item type, t
  7232. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7233. effect.
  7234. Default is @code{in}.
  7235. @item start_frame, s
  7236. Specify the number of the frame to start applying the fade
  7237. effect at. Default is 0.
  7238. @item nb_frames, n
  7239. The number of frames that the fade effect lasts. At the end of the
  7240. fade-in effect, the output video will have the same intensity as the input video.
  7241. At the end of the fade-out transition, the output video will be filled with the
  7242. selected @option{color}.
  7243. Default is 25.
  7244. @item alpha
  7245. If set to 1, fade only alpha channel, if one exists on the input.
  7246. Default value is 0.
  7247. @item start_time, st
  7248. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7249. effect. If both start_frame and start_time are specified, the fade will start at
  7250. whichever comes last. Default is 0.
  7251. @item duration, d
  7252. The number of seconds for which the fade effect has to last. At the end of the
  7253. fade-in effect the output video will have the same intensity as the input video,
  7254. at the end of the fade-out transition the output video will be filled with the
  7255. selected @option{color}.
  7256. If both duration and nb_frames are specified, duration is used. Default is 0
  7257. (nb_frames is used by default).
  7258. @item color, c
  7259. Specify the color of the fade. Default is "black".
  7260. @end table
  7261. @subsection Examples
  7262. @itemize
  7263. @item
  7264. Fade in the first 30 frames of video:
  7265. @example
  7266. fade=in:0:30
  7267. @end example
  7268. The command above is equivalent to:
  7269. @example
  7270. fade=t=in:s=0:n=30
  7271. @end example
  7272. @item
  7273. Fade out the last 45 frames of a 200-frame video:
  7274. @example
  7275. fade=out:155:45
  7276. fade=type=out:start_frame=155:nb_frames=45
  7277. @end example
  7278. @item
  7279. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7280. @example
  7281. fade=in:0:25, fade=out:975:25
  7282. @end example
  7283. @item
  7284. Make the first 5 frames yellow, then fade in from frame 5-24:
  7285. @example
  7286. fade=in:5:20:color=yellow
  7287. @end example
  7288. @item
  7289. Fade in alpha over first 25 frames of video:
  7290. @example
  7291. fade=in:0:25:alpha=1
  7292. @end example
  7293. @item
  7294. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7295. @example
  7296. fade=t=in:st=5.5:d=0.5
  7297. @end example
  7298. @end itemize
  7299. @section fftfilt
  7300. Apply arbitrary expressions to samples in frequency domain
  7301. @table @option
  7302. @item dc_Y
  7303. Adjust the dc value (gain) of the luma plane of the image. The filter
  7304. accepts an integer value in range @code{0} to @code{1000}. The default
  7305. value is set to @code{0}.
  7306. @item dc_U
  7307. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7308. filter accepts an integer value in range @code{0} to @code{1000}. The
  7309. default value is set to @code{0}.
  7310. @item dc_V
  7311. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7312. filter accepts an integer value in range @code{0} to @code{1000}. The
  7313. default value is set to @code{0}.
  7314. @item weight_Y
  7315. Set the frequency domain weight expression for the luma plane.
  7316. @item weight_U
  7317. Set the frequency domain weight expression for the 1st chroma plane.
  7318. @item weight_V
  7319. Set the frequency domain weight expression for the 2nd chroma plane.
  7320. @item eval
  7321. Set when the expressions are evaluated.
  7322. It accepts the following values:
  7323. @table @samp
  7324. @item init
  7325. Only evaluate expressions once during the filter initialization.
  7326. @item frame
  7327. Evaluate expressions for each incoming frame.
  7328. @end table
  7329. Default value is @samp{init}.
  7330. The filter accepts the following variables:
  7331. @item X
  7332. @item Y
  7333. The coordinates of the current sample.
  7334. @item W
  7335. @item H
  7336. The width and height of the image.
  7337. @item N
  7338. The number of input frame, starting from 0.
  7339. @end table
  7340. @subsection Examples
  7341. @itemize
  7342. @item
  7343. High-pass:
  7344. @example
  7345. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7346. @end example
  7347. @item
  7348. Low-pass:
  7349. @example
  7350. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7351. @end example
  7352. @item
  7353. Sharpen:
  7354. @example
  7355. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7356. @end example
  7357. @item
  7358. Blur:
  7359. @example
  7360. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7361. @end example
  7362. @end itemize
  7363. @section fftdnoiz
  7364. Denoise frames using 3D FFT (frequency domain filtering).
  7365. The filter accepts the following options:
  7366. @table @option
  7367. @item sigma
  7368. Set the noise sigma constant. This sets denoising strength.
  7369. Default value is 1. Allowed range is from 0 to 30.
  7370. Using very high sigma with low overlap may give blocking artifacts.
  7371. @item amount
  7372. Set amount of denoising. By default all detected noise is reduced.
  7373. Default value is 1. Allowed range is from 0 to 1.
  7374. @item block
  7375. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7376. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7377. block size in pixels is 2^4 which is 16.
  7378. @item overlap
  7379. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7380. @item prev
  7381. Set number of previous frames to use for denoising. By default is set to 0.
  7382. @item next
  7383. Set number of next frames to to use for denoising. By default is set to 0.
  7384. @item planes
  7385. Set planes which will be filtered, by default are all available filtered
  7386. except alpha.
  7387. @end table
  7388. @section field
  7389. Extract a single field from an interlaced image using stride
  7390. arithmetic to avoid wasting CPU time. The output frames are marked as
  7391. non-interlaced.
  7392. The filter accepts the following options:
  7393. @table @option
  7394. @item type
  7395. Specify whether to extract the top (if the value is @code{0} or
  7396. @code{top}) or the bottom field (if the value is @code{1} or
  7397. @code{bottom}).
  7398. @end table
  7399. @section fieldhint
  7400. Create new frames by copying the top and bottom fields from surrounding frames
  7401. supplied as numbers by the hint file.
  7402. @table @option
  7403. @item hint
  7404. Set file containing hints: absolute/relative frame numbers.
  7405. There must be one line for each frame in a clip. Each line must contain two
  7406. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7407. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7408. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7409. for @code{relative} mode. First number tells from which frame to pick up top
  7410. field and second number tells from which frame to pick up bottom field.
  7411. If optionally followed by @code{+} output frame will be marked as interlaced,
  7412. else if followed by @code{-} output frame will be marked as progressive, else
  7413. it will be marked same as input frame.
  7414. If line starts with @code{#} or @code{;} that line is skipped.
  7415. @item mode
  7416. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7417. @end table
  7418. Example of first several lines of @code{hint} file for @code{relative} mode:
  7419. @example
  7420. 0,0 - # first frame
  7421. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7422. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7423. 1,0 -
  7424. 0,0 -
  7425. 0,0 -
  7426. 1,0 -
  7427. 1,0 -
  7428. 1,0 -
  7429. 0,0 -
  7430. 0,0 -
  7431. 1,0 -
  7432. 1,0 -
  7433. 1,0 -
  7434. 0,0 -
  7435. @end example
  7436. @section fieldmatch
  7437. Field matching filter for inverse telecine. It is meant to reconstruct the
  7438. progressive frames from a telecined stream. The filter does not drop duplicated
  7439. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7440. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7441. The separation of the field matching and the decimation is notably motivated by
  7442. the possibility of inserting a de-interlacing filter fallback between the two.
  7443. If the source has mixed telecined and real interlaced content,
  7444. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7445. But these remaining combed frames will be marked as interlaced, and thus can be
  7446. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7447. In addition to the various configuration options, @code{fieldmatch} can take an
  7448. optional second stream, activated through the @option{ppsrc} option. If
  7449. enabled, the frames reconstruction will be based on the fields and frames from
  7450. this second stream. This allows the first input to be pre-processed in order to
  7451. help the various algorithms of the filter, while keeping the output lossless
  7452. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7453. or brightness/contrast adjustments can help.
  7454. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7455. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7456. which @code{fieldmatch} is based on. While the semantic and usage are very
  7457. close, some behaviour and options names can differ.
  7458. The @ref{decimate} filter currently only works for constant frame rate input.
  7459. If your input has mixed telecined (30fps) and progressive content with a lower
  7460. framerate like 24fps use the following filterchain to produce the necessary cfr
  7461. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7462. The filter accepts the following options:
  7463. @table @option
  7464. @item order
  7465. Specify the assumed field order of the input stream. Available values are:
  7466. @table @samp
  7467. @item auto
  7468. Auto detect parity (use FFmpeg's internal parity value).
  7469. @item bff
  7470. Assume bottom field first.
  7471. @item tff
  7472. Assume top field first.
  7473. @end table
  7474. Note that it is sometimes recommended not to trust the parity announced by the
  7475. stream.
  7476. Default value is @var{auto}.
  7477. @item mode
  7478. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7479. sense that it won't risk creating jerkiness due to duplicate frames when
  7480. possible, but if there are bad edits or blended fields it will end up
  7481. outputting combed frames when a good match might actually exist. On the other
  7482. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7483. but will almost always find a good frame if there is one. The other values are
  7484. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7485. jerkiness and creating duplicate frames versus finding good matches in sections
  7486. with bad edits, orphaned fields, blended fields, etc.
  7487. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7488. Available values are:
  7489. @table @samp
  7490. @item pc
  7491. 2-way matching (p/c)
  7492. @item pc_n
  7493. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7494. @item pc_u
  7495. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7496. @item pc_n_ub
  7497. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7498. still combed (p/c + n + u/b)
  7499. @item pcn
  7500. 3-way matching (p/c/n)
  7501. @item pcn_ub
  7502. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7503. detected as combed (p/c/n + u/b)
  7504. @end table
  7505. The parenthesis at the end indicate the matches that would be used for that
  7506. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7507. @var{top}).
  7508. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7509. the slowest.
  7510. Default value is @var{pc_n}.
  7511. @item ppsrc
  7512. Mark the main input stream as a pre-processed input, and enable the secondary
  7513. input stream as the clean source to pick the fields from. See the filter
  7514. introduction for more details. It is similar to the @option{clip2} feature from
  7515. VFM/TFM.
  7516. Default value is @code{0} (disabled).
  7517. @item field
  7518. Set the field to match from. It is recommended to set this to the same value as
  7519. @option{order} unless you experience matching failures with that setting. In
  7520. certain circumstances changing the field that is used to match from can have a
  7521. large impact on matching performance. Available values are:
  7522. @table @samp
  7523. @item auto
  7524. Automatic (same value as @option{order}).
  7525. @item bottom
  7526. Match from the bottom field.
  7527. @item top
  7528. Match from the top field.
  7529. @end table
  7530. Default value is @var{auto}.
  7531. @item mchroma
  7532. Set whether or not chroma is included during the match comparisons. In most
  7533. cases it is recommended to leave this enabled. You should set this to @code{0}
  7534. only if your clip has bad chroma problems such as heavy rainbowing or other
  7535. artifacts. Setting this to @code{0} could also be used to speed things up at
  7536. the cost of some accuracy.
  7537. Default value is @code{1}.
  7538. @item y0
  7539. @item y1
  7540. These define an exclusion band which excludes the lines between @option{y0} and
  7541. @option{y1} from being included in the field matching decision. An exclusion
  7542. band can be used to ignore subtitles, a logo, or other things that may
  7543. interfere with the matching. @option{y0} sets the starting scan line and
  7544. @option{y1} sets the ending line; all lines in between @option{y0} and
  7545. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7546. @option{y0} and @option{y1} to the same value will disable the feature.
  7547. @option{y0} and @option{y1} defaults to @code{0}.
  7548. @item scthresh
  7549. Set the scene change detection threshold as a percentage of maximum change on
  7550. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7551. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7552. @option{scthresh} is @code{[0.0, 100.0]}.
  7553. Default value is @code{12.0}.
  7554. @item combmatch
  7555. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7556. account the combed scores of matches when deciding what match to use as the
  7557. final match. Available values are:
  7558. @table @samp
  7559. @item none
  7560. No final matching based on combed scores.
  7561. @item sc
  7562. Combed scores are only used when a scene change is detected.
  7563. @item full
  7564. Use combed scores all the time.
  7565. @end table
  7566. Default is @var{sc}.
  7567. @item combdbg
  7568. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7569. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7570. Available values are:
  7571. @table @samp
  7572. @item none
  7573. No forced calculation.
  7574. @item pcn
  7575. Force p/c/n calculations.
  7576. @item pcnub
  7577. Force p/c/n/u/b calculations.
  7578. @end table
  7579. Default value is @var{none}.
  7580. @item cthresh
  7581. This is the area combing threshold used for combed frame detection. This
  7582. essentially controls how "strong" or "visible" combing must be to be detected.
  7583. Larger values mean combing must be more visible and smaller values mean combing
  7584. can be less visible or strong and still be detected. Valid settings are from
  7585. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7586. be detected as combed). This is basically a pixel difference value. A good
  7587. range is @code{[8, 12]}.
  7588. Default value is @code{9}.
  7589. @item chroma
  7590. Sets whether or not chroma is considered in the combed frame decision. Only
  7591. disable this if your source has chroma problems (rainbowing, etc.) that are
  7592. causing problems for the combed frame detection with chroma enabled. Actually,
  7593. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7594. where there is chroma only combing in the source.
  7595. Default value is @code{0}.
  7596. @item blockx
  7597. @item blocky
  7598. Respectively set the x-axis and y-axis size of the window used during combed
  7599. frame detection. This has to do with the size of the area in which
  7600. @option{combpel} pixels are required to be detected as combed for a frame to be
  7601. declared combed. See the @option{combpel} parameter description for more info.
  7602. Possible values are any number that is a power of 2 starting at 4 and going up
  7603. to 512.
  7604. Default value is @code{16}.
  7605. @item combpel
  7606. The number of combed pixels inside any of the @option{blocky} by
  7607. @option{blockx} size blocks on the frame for the frame to be detected as
  7608. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7609. setting controls "how much" combing there must be in any localized area (a
  7610. window defined by the @option{blockx} and @option{blocky} settings) on the
  7611. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7612. which point no frames will ever be detected as combed). This setting is known
  7613. as @option{MI} in TFM/VFM vocabulary.
  7614. Default value is @code{80}.
  7615. @end table
  7616. @anchor{p/c/n/u/b meaning}
  7617. @subsection p/c/n/u/b meaning
  7618. @subsubsection p/c/n
  7619. We assume the following telecined stream:
  7620. @example
  7621. Top fields: 1 2 2 3 4
  7622. Bottom fields: 1 2 3 4 4
  7623. @end example
  7624. The numbers correspond to the progressive frame the fields relate to. Here, the
  7625. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7626. When @code{fieldmatch} is configured to run a matching from bottom
  7627. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7628. @example
  7629. Input stream:
  7630. T 1 2 2 3 4
  7631. B 1 2 3 4 4 <-- matching reference
  7632. Matches: c c n n c
  7633. Output stream:
  7634. T 1 2 3 4 4
  7635. B 1 2 3 4 4
  7636. @end example
  7637. As a result of the field matching, we can see that some frames get duplicated.
  7638. To perform a complete inverse telecine, you need to rely on a decimation filter
  7639. after this operation. See for instance the @ref{decimate} filter.
  7640. The same operation now matching from top fields (@option{field}=@var{top})
  7641. looks like this:
  7642. @example
  7643. Input stream:
  7644. T 1 2 2 3 4 <-- matching reference
  7645. B 1 2 3 4 4
  7646. Matches: c c p p c
  7647. Output stream:
  7648. T 1 2 2 3 4
  7649. B 1 2 2 3 4
  7650. @end example
  7651. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7652. basically, they refer to the frame and field of the opposite parity:
  7653. @itemize
  7654. @item @var{p} matches the field of the opposite parity in the previous frame
  7655. @item @var{c} matches the field of the opposite parity in the current frame
  7656. @item @var{n} matches the field of the opposite parity in the next frame
  7657. @end itemize
  7658. @subsubsection u/b
  7659. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7660. from the opposite parity flag. In the following examples, we assume that we are
  7661. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7662. 'x' is placed above and below each matched fields.
  7663. With bottom matching (@option{field}=@var{bottom}):
  7664. @example
  7665. Match: c p n b u
  7666. x x x x x
  7667. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7668. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7669. x x x x x
  7670. Output frames:
  7671. 2 1 2 2 2
  7672. 2 2 2 1 3
  7673. @end example
  7674. With top matching (@option{field}=@var{top}):
  7675. @example
  7676. Match: c p n b u
  7677. x x x x x
  7678. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7679. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7680. x x x x x
  7681. Output frames:
  7682. 2 2 2 1 2
  7683. 2 1 3 2 2
  7684. @end example
  7685. @subsection Examples
  7686. Simple IVTC of a top field first telecined stream:
  7687. @example
  7688. fieldmatch=order=tff:combmatch=none, decimate
  7689. @end example
  7690. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7691. @example
  7692. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7693. @end example
  7694. @section fieldorder
  7695. Transform the field order of the input video.
  7696. It accepts the following parameters:
  7697. @table @option
  7698. @item order
  7699. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7700. for bottom field first.
  7701. @end table
  7702. The default value is @samp{tff}.
  7703. The transformation is done by shifting the picture content up or down
  7704. by one line, and filling the remaining line with appropriate picture content.
  7705. This method is consistent with most broadcast field order converters.
  7706. If the input video is not flagged as being interlaced, or it is already
  7707. flagged as being of the required output field order, then this filter does
  7708. not alter the incoming video.
  7709. It is very useful when converting to or from PAL DV material,
  7710. which is bottom field first.
  7711. For example:
  7712. @example
  7713. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7714. @end example
  7715. @section fifo, afifo
  7716. Buffer input images and send them when they are requested.
  7717. It is mainly useful when auto-inserted by the libavfilter
  7718. framework.
  7719. It does not take parameters.
  7720. @section fillborders
  7721. Fill borders of the input video, without changing video stream dimensions.
  7722. Sometimes video can have garbage at the four edges and you may not want to
  7723. crop video input to keep size multiple of some number.
  7724. This filter accepts the following options:
  7725. @table @option
  7726. @item left
  7727. Number of pixels to fill from left border.
  7728. @item right
  7729. Number of pixels to fill from right border.
  7730. @item top
  7731. Number of pixels to fill from top border.
  7732. @item bottom
  7733. Number of pixels to fill from bottom border.
  7734. @item mode
  7735. Set fill mode.
  7736. It accepts the following values:
  7737. @table @samp
  7738. @item smear
  7739. fill pixels using outermost pixels
  7740. @item mirror
  7741. fill pixels using mirroring
  7742. @item fixed
  7743. fill pixels with constant value
  7744. @end table
  7745. Default is @var{smear}.
  7746. @item color
  7747. Set color for pixels in fixed mode. Default is @var{black}.
  7748. @end table
  7749. @section find_rect
  7750. Find a rectangular object
  7751. It accepts the following options:
  7752. @table @option
  7753. @item object
  7754. Filepath of the object image, needs to be in gray8.
  7755. @item threshold
  7756. Detection threshold, default is 0.5.
  7757. @item mipmaps
  7758. Number of mipmaps, default is 3.
  7759. @item xmin, ymin, xmax, ymax
  7760. Specifies the rectangle in which to search.
  7761. @end table
  7762. @subsection Examples
  7763. @itemize
  7764. @item
  7765. Generate a representative palette of a given video using @command{ffmpeg}:
  7766. @example
  7767. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7768. @end example
  7769. @end itemize
  7770. @section cover_rect
  7771. Cover a rectangular object
  7772. It accepts the following options:
  7773. @table @option
  7774. @item cover
  7775. Filepath of the optional cover image, needs to be in yuv420.
  7776. @item mode
  7777. Set covering mode.
  7778. It accepts the following values:
  7779. @table @samp
  7780. @item cover
  7781. cover it by the supplied image
  7782. @item blur
  7783. cover it by interpolating the surrounding pixels
  7784. @end table
  7785. Default value is @var{blur}.
  7786. @end table
  7787. @subsection Examples
  7788. @itemize
  7789. @item
  7790. Generate a representative palette of a given video using @command{ffmpeg}:
  7791. @example
  7792. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7793. @end example
  7794. @end itemize
  7795. @section floodfill
  7796. Flood area with values of same pixel components with another values.
  7797. It accepts the following options:
  7798. @table @option
  7799. @item x
  7800. Set pixel x coordinate.
  7801. @item y
  7802. Set pixel y coordinate.
  7803. @item s0
  7804. Set source #0 component value.
  7805. @item s1
  7806. Set source #1 component value.
  7807. @item s2
  7808. Set source #2 component value.
  7809. @item s3
  7810. Set source #3 component value.
  7811. @item d0
  7812. Set destination #0 component value.
  7813. @item d1
  7814. Set destination #1 component value.
  7815. @item d2
  7816. Set destination #2 component value.
  7817. @item d3
  7818. Set destination #3 component value.
  7819. @end table
  7820. @anchor{format}
  7821. @section format
  7822. Convert the input video to one of the specified pixel formats.
  7823. Libavfilter will try to pick one that is suitable as input to
  7824. the next filter.
  7825. It accepts the following parameters:
  7826. @table @option
  7827. @item pix_fmts
  7828. A '|'-separated list of pixel format names, such as
  7829. "pix_fmts=yuv420p|monow|rgb24".
  7830. @end table
  7831. @subsection Examples
  7832. @itemize
  7833. @item
  7834. Convert the input video to the @var{yuv420p} format
  7835. @example
  7836. format=pix_fmts=yuv420p
  7837. @end example
  7838. Convert the input video to any of the formats in the list
  7839. @example
  7840. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7841. @end example
  7842. @end itemize
  7843. @anchor{fps}
  7844. @section fps
  7845. Convert the video to specified constant frame rate by duplicating or dropping
  7846. frames as necessary.
  7847. It accepts the following parameters:
  7848. @table @option
  7849. @item fps
  7850. The desired output frame rate. The default is @code{25}.
  7851. @item start_time
  7852. Assume the first PTS should be the given value, in seconds. This allows for
  7853. padding/trimming at the start of stream. By default, no assumption is made
  7854. about the first frame's expected PTS, so no padding or trimming is done.
  7855. For example, this could be set to 0 to pad the beginning with duplicates of
  7856. the first frame if a video stream starts after the audio stream or to trim any
  7857. frames with a negative PTS.
  7858. @item round
  7859. Timestamp (PTS) rounding method.
  7860. Possible values are:
  7861. @table @option
  7862. @item zero
  7863. round towards 0
  7864. @item inf
  7865. round away from 0
  7866. @item down
  7867. round towards -infinity
  7868. @item up
  7869. round towards +infinity
  7870. @item near
  7871. round to nearest
  7872. @end table
  7873. The default is @code{near}.
  7874. @item eof_action
  7875. Action performed when reading the last frame.
  7876. Possible values are:
  7877. @table @option
  7878. @item round
  7879. Use same timestamp rounding method as used for other frames.
  7880. @item pass
  7881. Pass through last frame if input duration has not been reached yet.
  7882. @end table
  7883. The default is @code{round}.
  7884. @end table
  7885. Alternatively, the options can be specified as a flat string:
  7886. @var{fps}[:@var{start_time}[:@var{round}]].
  7887. See also the @ref{setpts} filter.
  7888. @subsection Examples
  7889. @itemize
  7890. @item
  7891. A typical usage in order to set the fps to 25:
  7892. @example
  7893. fps=fps=25
  7894. @end example
  7895. @item
  7896. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7897. @example
  7898. fps=fps=film:round=near
  7899. @end example
  7900. @end itemize
  7901. @section framepack
  7902. Pack two different video streams into a stereoscopic video, setting proper
  7903. metadata on supported codecs. The two views should have the same size and
  7904. framerate and processing will stop when the shorter video ends. Please note
  7905. that you may conveniently adjust view properties with the @ref{scale} and
  7906. @ref{fps} filters.
  7907. It accepts the following parameters:
  7908. @table @option
  7909. @item format
  7910. The desired packing format. Supported values are:
  7911. @table @option
  7912. @item sbs
  7913. The views are next to each other (default).
  7914. @item tab
  7915. The views are on top of each other.
  7916. @item lines
  7917. The views are packed by line.
  7918. @item columns
  7919. The views are packed by column.
  7920. @item frameseq
  7921. The views are temporally interleaved.
  7922. @end table
  7923. @end table
  7924. Some examples:
  7925. @example
  7926. # Convert left and right views into a frame-sequential video
  7927. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7928. # Convert views into a side-by-side video with the same output resolution as the input
  7929. 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
  7930. @end example
  7931. @section framerate
  7932. Change the frame rate by interpolating new video output frames from the source
  7933. frames.
  7934. This filter is not designed to function correctly with interlaced media. If
  7935. you wish to change the frame rate of interlaced media then you are required
  7936. to deinterlace before this filter and re-interlace after this filter.
  7937. A description of the accepted options follows.
  7938. @table @option
  7939. @item fps
  7940. Specify the output frames per second. This option can also be specified
  7941. as a value alone. The default is @code{50}.
  7942. @item interp_start
  7943. Specify the start of a range where the output frame will be created as a
  7944. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7945. the default is @code{15}.
  7946. @item interp_end
  7947. Specify the end of a range where the output frame will be created as a
  7948. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7949. the default is @code{240}.
  7950. @item scene
  7951. Specify the level at which a scene change is detected as a value between
  7952. 0 and 100 to indicate a new scene; a low value reflects a low
  7953. probability for the current frame to introduce a new scene, while a higher
  7954. value means the current frame is more likely to be one.
  7955. The default is @code{8.2}.
  7956. @item flags
  7957. Specify flags influencing the filter process.
  7958. Available value for @var{flags} is:
  7959. @table @option
  7960. @item scene_change_detect, scd
  7961. Enable scene change detection using the value of the option @var{scene}.
  7962. This flag is enabled by default.
  7963. @end table
  7964. @end table
  7965. @section framestep
  7966. Select one frame every N-th frame.
  7967. This filter accepts the following option:
  7968. @table @option
  7969. @item step
  7970. Select frame after every @code{step} frames.
  7971. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7972. @end table
  7973. @section freezedetect
  7974. Detect frozen video.
  7975. This filter logs a message and sets frame metadata when it detects that the
  7976. input video has no significant change in content during a specified duration.
  7977. Video freeze detection calculates the mean average absolute difference of all
  7978. the components of video frames and compares it to a noise floor.
  7979. The printed times and duration are expressed in seconds. The
  7980. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  7981. whose timestamp equals or exceeds the detection duration and it contains the
  7982. timestamp of the first frame of the freeze. The
  7983. @code{lavfi.freezedetect.freeze_duration} and
  7984. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  7985. after the freeze.
  7986. The filter accepts the following options:
  7987. @table @option
  7988. @item noise, n
  7989. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  7990. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  7991. 0.001.
  7992. @item duration, d
  7993. Set freeze duration until notification (default is 2 seconds).
  7994. @end table
  7995. @anchor{frei0r}
  7996. @section frei0r
  7997. Apply a frei0r effect to the input video.
  7998. To enable the compilation of this filter, you need to install the frei0r
  7999. header and configure FFmpeg with @code{--enable-frei0r}.
  8000. It accepts the following parameters:
  8001. @table @option
  8002. @item filter_name
  8003. The name of the frei0r effect to load. If the environment variable
  8004. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8005. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8006. Otherwise, the standard frei0r paths are searched, in this order:
  8007. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8008. @file{/usr/lib/frei0r-1/}.
  8009. @item filter_params
  8010. A '|'-separated list of parameters to pass to the frei0r effect.
  8011. @end table
  8012. A frei0r effect parameter can be a boolean (its value is either
  8013. "y" or "n"), a double, a color (specified as
  8014. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8015. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8016. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8017. a position (specified as @var{X}/@var{Y}, where
  8018. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8019. The number and types of parameters depend on the loaded effect. If an
  8020. effect parameter is not specified, the default value is set.
  8021. @subsection Examples
  8022. @itemize
  8023. @item
  8024. Apply the distort0r effect, setting the first two double parameters:
  8025. @example
  8026. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8027. @end example
  8028. @item
  8029. Apply the colordistance effect, taking a color as the first parameter:
  8030. @example
  8031. frei0r=colordistance:0.2/0.3/0.4
  8032. frei0r=colordistance:violet
  8033. frei0r=colordistance:0x112233
  8034. @end example
  8035. @item
  8036. Apply the perspective effect, specifying the top left and top right image
  8037. positions:
  8038. @example
  8039. frei0r=perspective:0.2/0.2|0.8/0.2
  8040. @end example
  8041. @end itemize
  8042. For more information, see
  8043. @url{http://frei0r.dyne.org}
  8044. @section fspp
  8045. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8046. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8047. processing filter, one of them is performed once per block, not per pixel.
  8048. This allows for much higher speed.
  8049. The filter accepts the following options:
  8050. @table @option
  8051. @item quality
  8052. Set quality. This option defines the number of levels for averaging. It accepts
  8053. an integer in the range 4-5. Default value is @code{4}.
  8054. @item qp
  8055. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8056. If not set, the filter will use the QP from the video stream (if available).
  8057. @item strength
  8058. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8059. more details but also more artifacts, while higher values make the image smoother
  8060. but also blurrier. Default value is @code{0} − PSNR optimal.
  8061. @item use_bframe_qp
  8062. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8063. option may cause flicker since the B-Frames have often larger QP. Default is
  8064. @code{0} (not enabled).
  8065. @end table
  8066. @section gblur
  8067. Apply Gaussian blur filter.
  8068. The filter accepts the following options:
  8069. @table @option
  8070. @item sigma
  8071. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8072. @item steps
  8073. Set number of steps for Gaussian approximation. Default is @code{1}.
  8074. @item planes
  8075. Set which planes to filter. By default all planes are filtered.
  8076. @item sigmaV
  8077. Set vertical sigma, if negative it will be same as @code{sigma}.
  8078. Default is @code{-1}.
  8079. @end table
  8080. @section geq
  8081. Apply generic equation to each pixel.
  8082. The filter accepts the following options:
  8083. @table @option
  8084. @item lum_expr, lum
  8085. Set the luminance expression.
  8086. @item cb_expr, cb
  8087. Set the chrominance blue expression.
  8088. @item cr_expr, cr
  8089. Set the chrominance red expression.
  8090. @item alpha_expr, a
  8091. Set the alpha expression.
  8092. @item red_expr, r
  8093. Set the red expression.
  8094. @item green_expr, g
  8095. Set the green expression.
  8096. @item blue_expr, b
  8097. Set the blue expression.
  8098. @end table
  8099. The colorspace is selected according to the specified options. If one
  8100. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8101. options is specified, the filter will automatically select a YCbCr
  8102. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8103. @option{blue_expr} options is specified, it will select an RGB
  8104. colorspace.
  8105. If one of the chrominance expression is not defined, it falls back on the other
  8106. one. If no alpha expression is specified it will evaluate to opaque value.
  8107. If none of chrominance expressions are specified, they will evaluate
  8108. to the luminance expression.
  8109. The expressions can use the following variables and functions:
  8110. @table @option
  8111. @item N
  8112. The sequential number of the filtered frame, starting from @code{0}.
  8113. @item X
  8114. @item Y
  8115. The coordinates of the current sample.
  8116. @item W
  8117. @item H
  8118. The width and height of the image.
  8119. @item SW
  8120. @item SH
  8121. Width and height scale depending on the currently filtered plane. It is the
  8122. ratio between the corresponding luma plane number of pixels and the current
  8123. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8124. @code{0.5,0.5} for chroma planes.
  8125. @item T
  8126. Time of the current frame, expressed in seconds.
  8127. @item p(x, y)
  8128. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8129. plane.
  8130. @item lum(x, y)
  8131. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8132. plane.
  8133. @item cb(x, y)
  8134. Return the value of the pixel at location (@var{x},@var{y}) of the
  8135. blue-difference chroma plane. Return 0 if there is no such plane.
  8136. @item cr(x, y)
  8137. Return the value of the pixel at location (@var{x},@var{y}) of the
  8138. red-difference chroma plane. Return 0 if there is no such plane.
  8139. @item r(x, y)
  8140. @item g(x, y)
  8141. @item b(x, y)
  8142. Return the value of the pixel at location (@var{x},@var{y}) of the
  8143. red/green/blue component. Return 0 if there is no such component.
  8144. @item alpha(x, y)
  8145. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8146. plane. Return 0 if there is no such plane.
  8147. @end table
  8148. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8149. automatically clipped to the closer edge.
  8150. @subsection Examples
  8151. @itemize
  8152. @item
  8153. Flip the image horizontally:
  8154. @example
  8155. geq=p(W-X\,Y)
  8156. @end example
  8157. @item
  8158. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8159. wavelength of 100 pixels:
  8160. @example
  8161. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8162. @end example
  8163. @item
  8164. Generate a fancy enigmatic moving light:
  8165. @example
  8166. 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
  8167. @end example
  8168. @item
  8169. Generate a quick emboss effect:
  8170. @example
  8171. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8172. @end example
  8173. @item
  8174. Modify RGB components depending on pixel position:
  8175. @example
  8176. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8177. @end example
  8178. @item
  8179. Create a radial gradient that is the same size as the input (also see
  8180. the @ref{vignette} filter):
  8181. @example
  8182. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8183. @end example
  8184. @end itemize
  8185. @section gradfun
  8186. Fix the banding artifacts that are sometimes introduced into nearly flat
  8187. regions by truncation to 8-bit color depth.
  8188. Interpolate the gradients that should go where the bands are, and
  8189. dither them.
  8190. It is designed for playback only. Do not use it prior to
  8191. lossy compression, because compression tends to lose the dither and
  8192. bring back the bands.
  8193. It accepts the following parameters:
  8194. @table @option
  8195. @item strength
  8196. The maximum amount by which the filter will change any one pixel. This is also
  8197. the threshold for detecting nearly flat regions. Acceptable values range from
  8198. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8199. valid range.
  8200. @item radius
  8201. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8202. gradients, but also prevents the filter from modifying the pixels near detailed
  8203. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8204. values will be clipped to the valid range.
  8205. @end table
  8206. Alternatively, the options can be specified as a flat string:
  8207. @var{strength}[:@var{radius}]
  8208. @subsection Examples
  8209. @itemize
  8210. @item
  8211. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8212. @example
  8213. gradfun=3.5:8
  8214. @end example
  8215. @item
  8216. Specify radius, omitting the strength (which will fall-back to the default
  8217. value):
  8218. @example
  8219. gradfun=radius=8
  8220. @end example
  8221. @end itemize
  8222. @section graphmonitor, agraphmonitor
  8223. Show various filtergraph stats.
  8224. With this filter one can debug complete filtergraph.
  8225. Especially issues with links filling with queued frames.
  8226. The filter accepts the following options:
  8227. @table @option
  8228. @item size, s
  8229. Set video output size. Default is @var{hd720}.
  8230. @item opacity, o
  8231. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8232. @item mode, m
  8233. Set output mode, can be @var{fulll} or @var{compact}.
  8234. In @var{compact} mode only filters with some queued frames have displayed stats.
  8235. @item flags, f
  8236. Set flags which enable which stats are shown in video.
  8237. Available values for flags are:
  8238. @table @samp
  8239. @item queue
  8240. Display number of queued frames in each link.
  8241. @item frame_count_in
  8242. Display number of frames taken from filter.
  8243. @item frame_count_out
  8244. Display number of frames given out from filter.
  8245. @item pts
  8246. Display current filtered frame pts.
  8247. @item time
  8248. Display current filtered frame time.
  8249. @item timebase
  8250. Display time base for filter link.
  8251. @item format
  8252. Display used format for filter link.
  8253. @item size
  8254. Display video size or number of audio channels in case of audio used by filter link.
  8255. @item rate
  8256. Display video frame rate or sample rate in case of audio used by filter link.
  8257. @end table
  8258. @item rate, r
  8259. Set upper limit for video rate of output stream, Default value is @var{25}.
  8260. This guarantee that output video frame rate will not be higher than this value.
  8261. @end table
  8262. @section greyedge
  8263. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8264. and corrects the scene colors accordingly.
  8265. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8266. The filter accepts the following options:
  8267. @table @option
  8268. @item difford
  8269. The order of differentiation to be applied on the scene. Must be chosen in the range
  8270. [0,2] and default value is 1.
  8271. @item minknorm
  8272. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8273. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8274. max value instead of calculating Minkowski distance.
  8275. @item sigma
  8276. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8277. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8278. can't be equal to 0 if @var{difford} is greater than 0.
  8279. @end table
  8280. @subsection Examples
  8281. @itemize
  8282. @item
  8283. Grey Edge:
  8284. @example
  8285. greyedge=difford=1:minknorm=5:sigma=2
  8286. @end example
  8287. @item
  8288. Max Edge:
  8289. @example
  8290. greyedge=difford=1:minknorm=0:sigma=2
  8291. @end example
  8292. @end itemize
  8293. @anchor{haldclut}
  8294. @section haldclut
  8295. Apply a Hald CLUT to a video stream.
  8296. First input is the video stream to process, and second one is the Hald CLUT.
  8297. The Hald CLUT input can be a simple picture or a complete video stream.
  8298. The filter accepts the following options:
  8299. @table @option
  8300. @item shortest
  8301. Force termination when the shortest input terminates. Default is @code{0}.
  8302. @item repeatlast
  8303. Continue applying the last CLUT after the end of the stream. A value of
  8304. @code{0} disable the filter after the last frame of the CLUT is reached.
  8305. Default is @code{1}.
  8306. @end table
  8307. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8308. filters share the same internals).
  8309. This filter also supports the @ref{framesync} options.
  8310. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8311. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8312. @subsection Workflow examples
  8313. @subsubsection Hald CLUT video stream
  8314. Generate an identity Hald CLUT stream altered with various effects:
  8315. @example
  8316. 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
  8317. @end example
  8318. Note: make sure you use a lossless codec.
  8319. Then use it with @code{haldclut} to apply it on some random stream:
  8320. @example
  8321. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8322. @end example
  8323. The Hald CLUT will be applied to the 10 first seconds (duration of
  8324. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8325. to the remaining frames of the @code{mandelbrot} stream.
  8326. @subsubsection Hald CLUT with preview
  8327. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8328. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8329. biggest possible square starting at the top left of the picture. The remaining
  8330. padding pixels (bottom or right) will be ignored. This area can be used to add
  8331. a preview of the Hald CLUT.
  8332. Typically, the following generated Hald CLUT will be supported by the
  8333. @code{haldclut} filter:
  8334. @example
  8335. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8336. pad=iw+320 [padded_clut];
  8337. smptebars=s=320x256, split [a][b];
  8338. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8339. [main][b] overlay=W-320" -frames:v 1 clut.png
  8340. @end example
  8341. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8342. bars are displayed on the right-top, and below the same color bars processed by
  8343. the color changes.
  8344. Then, the effect of this Hald CLUT can be visualized with:
  8345. @example
  8346. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8347. @end example
  8348. @section hflip
  8349. Flip the input video horizontally.
  8350. For example, to horizontally flip the input video with @command{ffmpeg}:
  8351. @example
  8352. ffmpeg -i in.avi -vf "hflip" out.avi
  8353. @end example
  8354. @section histeq
  8355. This filter applies a global color histogram equalization on a
  8356. per-frame basis.
  8357. It can be used to correct video that has a compressed range of pixel
  8358. intensities. The filter redistributes the pixel intensities to
  8359. equalize their distribution across the intensity range. It may be
  8360. viewed as an "automatically adjusting contrast filter". This filter is
  8361. useful only for correcting degraded or poorly captured source
  8362. video.
  8363. The filter accepts the following options:
  8364. @table @option
  8365. @item strength
  8366. Determine the amount of equalization to be applied. As the strength
  8367. is reduced, the distribution of pixel intensities more-and-more
  8368. approaches that of the input frame. The value must be a float number
  8369. in the range [0,1] and defaults to 0.200.
  8370. @item intensity
  8371. Set the maximum intensity that can generated and scale the output
  8372. values appropriately. The strength should be set as desired and then
  8373. the intensity can be limited if needed to avoid washing-out. The value
  8374. must be a float number in the range [0,1] and defaults to 0.210.
  8375. @item antibanding
  8376. Set the antibanding level. If enabled the filter will randomly vary
  8377. the luminance of output pixels by a small amount to avoid banding of
  8378. the histogram. Possible values are @code{none}, @code{weak} or
  8379. @code{strong}. It defaults to @code{none}.
  8380. @end table
  8381. @section histogram
  8382. Compute and draw a color distribution histogram for the input video.
  8383. The computed histogram is a representation of the color component
  8384. distribution in an image.
  8385. Standard histogram displays the color components distribution in an image.
  8386. Displays color graph for each color component. Shows distribution of
  8387. the Y, U, V, A or R, G, B components, depending on input format, in the
  8388. current frame. Below each graph a color component scale meter is shown.
  8389. The filter accepts the following options:
  8390. @table @option
  8391. @item level_height
  8392. Set height of level. Default value is @code{200}.
  8393. Allowed range is [50, 2048].
  8394. @item scale_height
  8395. Set height of color scale. Default value is @code{12}.
  8396. Allowed range is [0, 40].
  8397. @item display_mode
  8398. Set display mode.
  8399. It accepts the following values:
  8400. @table @samp
  8401. @item stack
  8402. Per color component graphs are placed below each other.
  8403. @item parade
  8404. Per color component graphs are placed side by side.
  8405. @item overlay
  8406. Presents information identical to that in the @code{parade}, except
  8407. that the graphs representing color components are superimposed directly
  8408. over one another.
  8409. @end table
  8410. Default is @code{stack}.
  8411. @item levels_mode
  8412. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8413. Default is @code{linear}.
  8414. @item components
  8415. Set what color components to display.
  8416. Default is @code{7}.
  8417. @item fgopacity
  8418. Set foreground opacity. Default is @code{0.7}.
  8419. @item bgopacity
  8420. Set background opacity. Default is @code{0.5}.
  8421. @end table
  8422. @subsection Examples
  8423. @itemize
  8424. @item
  8425. Calculate and draw histogram:
  8426. @example
  8427. ffplay -i input -vf histogram
  8428. @end example
  8429. @end itemize
  8430. @anchor{hqdn3d}
  8431. @section hqdn3d
  8432. This is a high precision/quality 3d denoise filter. It aims to reduce
  8433. image noise, producing smooth images and making still images really
  8434. still. It should enhance compressibility.
  8435. It accepts the following optional parameters:
  8436. @table @option
  8437. @item luma_spatial
  8438. A non-negative floating point number which specifies spatial luma strength.
  8439. It defaults to 4.0.
  8440. @item chroma_spatial
  8441. A non-negative floating point number which specifies spatial chroma strength.
  8442. It defaults to 3.0*@var{luma_spatial}/4.0.
  8443. @item luma_tmp
  8444. A floating point number which specifies luma temporal strength. It defaults to
  8445. 6.0*@var{luma_spatial}/4.0.
  8446. @item chroma_tmp
  8447. A floating point number which specifies chroma temporal strength. It defaults to
  8448. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8449. @end table
  8450. @anchor{hwdownload}
  8451. @section hwdownload
  8452. Download hardware frames to system memory.
  8453. The input must be in hardware frames, and the output a non-hardware format.
  8454. Not all formats will be supported on the output - it may be necessary to insert
  8455. an additional @option{format} filter immediately following in the graph to get
  8456. the output in a supported format.
  8457. @section hwmap
  8458. Map hardware frames to system memory or to another device.
  8459. This filter has several different modes of operation; which one is used depends
  8460. on the input and output formats:
  8461. @itemize
  8462. @item
  8463. Hardware frame input, normal frame output
  8464. Map the input frames to system memory and pass them to the output. If the
  8465. original hardware frame is later required (for example, after overlaying
  8466. something else on part of it), the @option{hwmap} filter can be used again
  8467. in the next mode to retrieve it.
  8468. @item
  8469. Normal frame input, hardware frame output
  8470. If the input is actually a software-mapped hardware frame, then unmap it -
  8471. that is, return the original hardware frame.
  8472. Otherwise, a device must be provided. Create new hardware surfaces on that
  8473. device for the output, then map them back to the software format at the input
  8474. and give those frames to the preceding filter. This will then act like the
  8475. @option{hwupload} filter, but may be able to avoid an additional copy when
  8476. the input is already in a compatible format.
  8477. @item
  8478. Hardware frame input and output
  8479. A device must be supplied for the output, either directly or with the
  8480. @option{derive_device} option. The input and output devices must be of
  8481. different types and compatible - the exact meaning of this is
  8482. system-dependent, but typically it means that they must refer to the same
  8483. underlying hardware context (for example, refer to the same graphics card).
  8484. If the input frames were originally created on the output device, then unmap
  8485. to retrieve the original frames.
  8486. Otherwise, map the frames to the output device - create new hardware frames
  8487. on the output corresponding to the frames on the input.
  8488. @end itemize
  8489. The following additional parameters are accepted:
  8490. @table @option
  8491. @item mode
  8492. Set the frame mapping mode. Some combination of:
  8493. @table @var
  8494. @item read
  8495. The mapped frame should be readable.
  8496. @item write
  8497. The mapped frame should be writeable.
  8498. @item overwrite
  8499. The mapping will always overwrite the entire frame.
  8500. This may improve performance in some cases, as the original contents of the
  8501. frame need not be loaded.
  8502. @item direct
  8503. The mapping must not involve any copying.
  8504. Indirect mappings to copies of frames are created in some cases where either
  8505. direct mapping is not possible or it would have unexpected properties.
  8506. Setting this flag ensures that the mapping is direct and will fail if that is
  8507. not possible.
  8508. @end table
  8509. Defaults to @var{read+write} if not specified.
  8510. @item derive_device @var{type}
  8511. Rather than using the device supplied at initialisation, instead derive a new
  8512. device of type @var{type} from the device the input frames exist on.
  8513. @item reverse
  8514. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8515. and map them back to the source. This may be necessary in some cases where
  8516. a mapping in one direction is required but only the opposite direction is
  8517. supported by the devices being used.
  8518. This option is dangerous - it may break the preceding filter in undefined
  8519. ways if there are any additional constraints on that filter's output.
  8520. Do not use it without fully understanding the implications of its use.
  8521. @end table
  8522. @anchor{hwupload}
  8523. @section hwupload
  8524. Upload system memory frames to hardware surfaces.
  8525. The device to upload to must be supplied when the filter is initialised. If
  8526. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8527. option.
  8528. @anchor{hwupload_cuda}
  8529. @section hwupload_cuda
  8530. Upload system memory frames to a CUDA device.
  8531. It accepts the following optional parameters:
  8532. @table @option
  8533. @item device
  8534. The number of the CUDA device to use
  8535. @end table
  8536. @section hqx
  8537. Apply a high-quality magnification filter designed for pixel art. This filter
  8538. was originally created by Maxim Stepin.
  8539. It accepts the following option:
  8540. @table @option
  8541. @item n
  8542. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8543. @code{hq3x} and @code{4} for @code{hq4x}.
  8544. Default is @code{3}.
  8545. @end table
  8546. @section hstack
  8547. Stack input videos horizontally.
  8548. All streams must be of same pixel format and of same height.
  8549. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8550. to create same output.
  8551. The filter accept the following option:
  8552. @table @option
  8553. @item inputs
  8554. Set number of input streams. Default is 2.
  8555. @item shortest
  8556. If set to 1, force the output to terminate when the shortest input
  8557. terminates. Default value is 0.
  8558. @end table
  8559. @section hue
  8560. Modify the hue and/or the saturation of the input.
  8561. It accepts the following parameters:
  8562. @table @option
  8563. @item h
  8564. Specify the hue angle as a number of degrees. It accepts an expression,
  8565. and defaults to "0".
  8566. @item s
  8567. Specify the saturation in the [-10,10] range. It accepts an expression and
  8568. defaults to "1".
  8569. @item H
  8570. Specify the hue angle as a number of radians. It accepts an
  8571. expression, and defaults to "0".
  8572. @item b
  8573. Specify the brightness in the [-10,10] range. It accepts an expression and
  8574. defaults to "0".
  8575. @end table
  8576. @option{h} and @option{H} are mutually exclusive, and can't be
  8577. specified at the same time.
  8578. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8579. expressions containing the following constants:
  8580. @table @option
  8581. @item n
  8582. frame count of the input frame starting from 0
  8583. @item pts
  8584. presentation timestamp of the input frame expressed in time base units
  8585. @item r
  8586. frame rate of the input video, NAN if the input frame rate is unknown
  8587. @item t
  8588. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8589. @item tb
  8590. time base of the input video
  8591. @end table
  8592. @subsection Examples
  8593. @itemize
  8594. @item
  8595. Set the hue to 90 degrees and the saturation to 1.0:
  8596. @example
  8597. hue=h=90:s=1
  8598. @end example
  8599. @item
  8600. Same command but expressing the hue in radians:
  8601. @example
  8602. hue=H=PI/2:s=1
  8603. @end example
  8604. @item
  8605. Rotate hue and make the saturation swing between 0
  8606. and 2 over a period of 1 second:
  8607. @example
  8608. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8609. @end example
  8610. @item
  8611. Apply a 3 seconds saturation fade-in effect starting at 0:
  8612. @example
  8613. hue="s=min(t/3\,1)"
  8614. @end example
  8615. The general fade-in expression can be written as:
  8616. @example
  8617. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8618. @end example
  8619. @item
  8620. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8621. @example
  8622. hue="s=max(0\, min(1\, (8-t)/3))"
  8623. @end example
  8624. The general fade-out expression can be written as:
  8625. @example
  8626. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8627. @end example
  8628. @end itemize
  8629. @subsection Commands
  8630. This filter supports the following commands:
  8631. @table @option
  8632. @item b
  8633. @item s
  8634. @item h
  8635. @item H
  8636. Modify the hue and/or the saturation and/or brightness of the input video.
  8637. The command accepts the same syntax of the corresponding option.
  8638. If the specified expression is not valid, it is kept at its current
  8639. value.
  8640. @end table
  8641. @section hysteresis
  8642. Grow first stream into second stream by connecting components.
  8643. This makes it possible to build more robust edge masks.
  8644. This filter accepts the following options:
  8645. @table @option
  8646. @item planes
  8647. Set which planes will be processed as bitmap, unprocessed planes will be
  8648. copied from first stream.
  8649. By default value 0xf, all planes will be processed.
  8650. @item threshold
  8651. Set threshold which is used in filtering. If pixel component value is higher than
  8652. this value filter algorithm for connecting components is activated.
  8653. By default value is 0.
  8654. @end table
  8655. @section idet
  8656. Detect video interlacing type.
  8657. This filter tries to detect if the input frames are interlaced, progressive,
  8658. top or bottom field first. It will also try to detect fields that are
  8659. repeated between adjacent frames (a sign of telecine).
  8660. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8661. Multiple frame detection incorporates the classification history of previous frames.
  8662. The filter will log these metadata values:
  8663. @table @option
  8664. @item single.current_frame
  8665. Detected type of current frame using single-frame detection. One of:
  8666. ``tff'' (top field first), ``bff'' (bottom field first),
  8667. ``progressive'', or ``undetermined''
  8668. @item single.tff
  8669. Cumulative number of frames detected as top field first using single-frame detection.
  8670. @item multiple.tff
  8671. Cumulative number of frames detected as top field first using multiple-frame detection.
  8672. @item single.bff
  8673. Cumulative number of frames detected as bottom field first using single-frame detection.
  8674. @item multiple.current_frame
  8675. Detected type of current frame using multiple-frame detection. One of:
  8676. ``tff'' (top field first), ``bff'' (bottom field first),
  8677. ``progressive'', or ``undetermined''
  8678. @item multiple.bff
  8679. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8680. @item single.progressive
  8681. Cumulative number of frames detected as progressive using single-frame detection.
  8682. @item multiple.progressive
  8683. Cumulative number of frames detected as progressive using multiple-frame detection.
  8684. @item single.undetermined
  8685. Cumulative number of frames that could not be classified using single-frame detection.
  8686. @item multiple.undetermined
  8687. Cumulative number of frames that could not be classified using multiple-frame detection.
  8688. @item repeated.current_frame
  8689. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8690. @item repeated.neither
  8691. Cumulative number of frames with no repeated field.
  8692. @item repeated.top
  8693. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8694. @item repeated.bottom
  8695. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8696. @end table
  8697. The filter accepts the following options:
  8698. @table @option
  8699. @item intl_thres
  8700. Set interlacing threshold.
  8701. @item prog_thres
  8702. Set progressive threshold.
  8703. @item rep_thres
  8704. Threshold for repeated field detection.
  8705. @item half_life
  8706. Number of frames after which a given frame's contribution to the
  8707. statistics is halved (i.e., it contributes only 0.5 to its
  8708. classification). The default of 0 means that all frames seen are given
  8709. full weight of 1.0 forever.
  8710. @item analyze_interlaced_flag
  8711. When this is not 0 then idet will use the specified number of frames to determine
  8712. if the interlaced flag is accurate, it will not count undetermined frames.
  8713. If the flag is found to be accurate it will be used without any further
  8714. computations, if it is found to be inaccurate it will be cleared without any
  8715. further computations. This allows inserting the idet filter as a low computational
  8716. method to clean up the interlaced flag
  8717. @end table
  8718. @section il
  8719. Deinterleave or interleave fields.
  8720. This filter allows one to process interlaced images fields without
  8721. deinterlacing them. Deinterleaving splits the input frame into 2
  8722. fields (so called half pictures). Odd lines are moved to the top
  8723. half of the output image, even lines to the bottom half.
  8724. You can process (filter) them independently and then re-interleave them.
  8725. The filter accepts the following options:
  8726. @table @option
  8727. @item luma_mode, l
  8728. @item chroma_mode, c
  8729. @item alpha_mode, a
  8730. Available values for @var{luma_mode}, @var{chroma_mode} and
  8731. @var{alpha_mode} are:
  8732. @table @samp
  8733. @item none
  8734. Do nothing.
  8735. @item deinterleave, d
  8736. Deinterleave fields, placing one above the other.
  8737. @item interleave, i
  8738. Interleave fields. Reverse the effect of deinterleaving.
  8739. @end table
  8740. Default value is @code{none}.
  8741. @item luma_swap, ls
  8742. @item chroma_swap, cs
  8743. @item alpha_swap, as
  8744. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8745. @end table
  8746. @section inflate
  8747. Apply inflate effect to the video.
  8748. This filter replaces the pixel by the local(3x3) average by taking into account
  8749. only values higher than the pixel.
  8750. It accepts the following options:
  8751. @table @option
  8752. @item threshold0
  8753. @item threshold1
  8754. @item threshold2
  8755. @item threshold3
  8756. Limit the maximum change for each plane, default is 65535.
  8757. If 0, plane will remain unchanged.
  8758. @end table
  8759. @section interlace
  8760. Simple interlacing filter from progressive contents. This interleaves upper (or
  8761. lower) lines from odd frames with lower (or upper) lines from even frames,
  8762. halving the frame rate and preserving image height.
  8763. @example
  8764. Original Original New Frame
  8765. Frame 'j' Frame 'j+1' (tff)
  8766. ========== =========== ==================
  8767. Line 0 --------------------> Frame 'j' Line 0
  8768. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8769. Line 2 ---------------------> Frame 'j' Line 2
  8770. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8771. ... ... ...
  8772. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8773. @end example
  8774. It accepts the following optional parameters:
  8775. @table @option
  8776. @item scan
  8777. This determines whether the interlaced frame is taken from the even
  8778. (tff - default) or odd (bff) lines of the progressive frame.
  8779. @item lowpass
  8780. Vertical lowpass filter to avoid twitter interlacing and
  8781. reduce moire patterns.
  8782. @table @samp
  8783. @item 0, off
  8784. Disable vertical lowpass filter
  8785. @item 1, linear
  8786. Enable linear filter (default)
  8787. @item 2, complex
  8788. Enable complex filter. This will slightly less reduce twitter and moire
  8789. but better retain detail and subjective sharpness impression.
  8790. @end table
  8791. @end table
  8792. @section kerndeint
  8793. Deinterlace input video by applying Donald Graft's adaptive kernel
  8794. deinterling. Work on interlaced parts of a video to produce
  8795. progressive frames.
  8796. The description of the accepted parameters follows.
  8797. @table @option
  8798. @item thresh
  8799. Set the threshold which affects the filter's tolerance when
  8800. determining if a pixel line must be processed. It must be an integer
  8801. in the range [0,255] and defaults to 10. A value of 0 will result in
  8802. applying the process on every pixels.
  8803. @item map
  8804. Paint pixels exceeding the threshold value to white if set to 1.
  8805. Default is 0.
  8806. @item order
  8807. Set the fields order. Swap fields if set to 1, leave fields alone if
  8808. 0. Default is 0.
  8809. @item sharp
  8810. Enable additional sharpening if set to 1. Default is 0.
  8811. @item twoway
  8812. Enable twoway sharpening if set to 1. Default is 0.
  8813. @end table
  8814. @subsection Examples
  8815. @itemize
  8816. @item
  8817. Apply default values:
  8818. @example
  8819. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8820. @end example
  8821. @item
  8822. Enable additional sharpening:
  8823. @example
  8824. kerndeint=sharp=1
  8825. @end example
  8826. @item
  8827. Paint processed pixels in white:
  8828. @example
  8829. kerndeint=map=1
  8830. @end example
  8831. @end itemize
  8832. @section lagfun
  8833. Slowly update darker pixels.
  8834. This filter makes short flashes of light appear longer.
  8835. This filter accepts the following options:
  8836. @table @option
  8837. @item decay
  8838. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  8839. @item planes
  8840. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  8841. @end table
  8842. @section lenscorrection
  8843. Correct radial lens distortion
  8844. This filter can be used to correct for radial distortion as can result from the use
  8845. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8846. one can use tools available for example as part of opencv or simply trial-and-error.
  8847. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8848. and extract the k1 and k2 coefficients from the resulting matrix.
  8849. Note that effectively the same filter is available in the open-source tools Krita and
  8850. Digikam from the KDE project.
  8851. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8852. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8853. brightness distribution, so you may want to use both filters together in certain
  8854. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8855. be applied before or after lens correction.
  8856. @subsection Options
  8857. The filter accepts the following options:
  8858. @table @option
  8859. @item cx
  8860. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8861. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8862. width. Default is 0.5.
  8863. @item cy
  8864. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8865. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8866. height. Default is 0.5.
  8867. @item k1
  8868. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8869. no correction. Default is 0.
  8870. @item k2
  8871. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8872. 0 means no correction. Default is 0.
  8873. @end table
  8874. The formula that generates the correction is:
  8875. @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)
  8876. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8877. distances from the focal point in the source and target images, respectively.
  8878. @section lensfun
  8879. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8880. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8881. to apply the lens correction. The filter will load the lensfun database and
  8882. query it to find the corresponding camera and lens entries in the database. As
  8883. long as these entries can be found with the given options, the filter can
  8884. perform corrections on frames. Note that incomplete strings will result in the
  8885. filter choosing the best match with the given options, and the filter will
  8886. output the chosen camera and lens models (logged with level "info"). You must
  8887. provide the make, camera model, and lens model as they are required.
  8888. The filter accepts the following options:
  8889. @table @option
  8890. @item make
  8891. The make of the camera (for example, "Canon"). This option is required.
  8892. @item model
  8893. The model of the camera (for example, "Canon EOS 100D"). This option is
  8894. required.
  8895. @item lens_model
  8896. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8897. option is required.
  8898. @item mode
  8899. The type of correction to apply. The following values are valid options:
  8900. @table @samp
  8901. @item vignetting
  8902. Enables fixing lens vignetting.
  8903. @item geometry
  8904. Enables fixing lens geometry. This is the default.
  8905. @item subpixel
  8906. Enables fixing chromatic aberrations.
  8907. @item vig_geo
  8908. Enables fixing lens vignetting and lens geometry.
  8909. @item vig_subpixel
  8910. Enables fixing lens vignetting and chromatic aberrations.
  8911. @item distortion
  8912. Enables fixing both lens geometry and chromatic aberrations.
  8913. @item all
  8914. Enables all possible corrections.
  8915. @end table
  8916. @item focal_length
  8917. The focal length of the image/video (zoom; expected constant for video). For
  8918. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8919. range should be chosen when using that lens. Default 18.
  8920. @item aperture
  8921. The aperture of the image/video (expected constant for video). Note that
  8922. aperture is only used for vignetting correction. Default 3.5.
  8923. @item focus_distance
  8924. The focus distance of the image/video (expected constant for video). Note that
  8925. focus distance is only used for vignetting and only slightly affects the
  8926. vignetting correction process. If unknown, leave it at the default value (which
  8927. is 1000).
  8928. @item scale
  8929. The scale factor which is applied after transformation. After correction the
  8930. video is no longer necessarily rectangular. This parameter controls how much of
  8931. the resulting image is visible. The value 0 means that a value will be chosen
  8932. automatically such that there is little or no unmapped area in the output
  8933. image. 1.0 means that no additional scaling is done. Lower values may result
  8934. in more of the corrected image being visible, while higher values may avoid
  8935. unmapped areas in the output.
  8936. @item target_geometry
  8937. The target geometry of the output image/video. The following values are valid
  8938. options:
  8939. @table @samp
  8940. @item rectilinear (default)
  8941. @item fisheye
  8942. @item panoramic
  8943. @item equirectangular
  8944. @item fisheye_orthographic
  8945. @item fisheye_stereographic
  8946. @item fisheye_equisolid
  8947. @item fisheye_thoby
  8948. @end table
  8949. @item reverse
  8950. Apply the reverse of image correction (instead of correcting distortion, apply
  8951. it).
  8952. @item interpolation
  8953. The type of interpolation used when correcting distortion. The following values
  8954. are valid options:
  8955. @table @samp
  8956. @item nearest
  8957. @item linear (default)
  8958. @item lanczos
  8959. @end table
  8960. @end table
  8961. @subsection Examples
  8962. @itemize
  8963. @item
  8964. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8965. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8966. aperture of "8.0".
  8967. @example
  8968. 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
  8969. @end example
  8970. @item
  8971. Apply the same as before, but only for the first 5 seconds of video.
  8972. @example
  8973. 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
  8974. @end example
  8975. @end itemize
  8976. @section libvmaf
  8977. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8978. score between two input videos.
  8979. The obtained VMAF score is printed through the logging system.
  8980. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8981. After installing the library it can be enabled using:
  8982. @code{./configure --enable-libvmaf --enable-version3}.
  8983. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8984. The filter has following options:
  8985. @table @option
  8986. @item model_path
  8987. Set the model path which is to be used for SVM.
  8988. Default value: @code{"vmaf_v0.6.1.pkl"}
  8989. @item log_path
  8990. Set the file path to be used to store logs.
  8991. @item log_fmt
  8992. Set the format of the log file (xml or json).
  8993. @item enable_transform
  8994. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  8995. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  8996. Default value: @code{false}
  8997. @item phone_model
  8998. Invokes the phone model which will generate VMAF scores higher than in the
  8999. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9000. @item psnr
  9001. Enables computing psnr along with vmaf.
  9002. @item ssim
  9003. Enables computing ssim along with vmaf.
  9004. @item ms_ssim
  9005. Enables computing ms_ssim along with vmaf.
  9006. @item pool
  9007. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9008. @item n_threads
  9009. Set number of threads to be used when computing vmaf.
  9010. @item n_subsample
  9011. Set interval for frame subsampling used when computing vmaf.
  9012. @item enable_conf_interval
  9013. Enables confidence interval.
  9014. @end table
  9015. This filter also supports the @ref{framesync} options.
  9016. On the below examples the input file @file{main.mpg} being processed is
  9017. compared with the reference file @file{ref.mpg}.
  9018. @example
  9019. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9020. @end example
  9021. Example with options:
  9022. @example
  9023. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9024. @end example
  9025. @section limiter
  9026. Limits the pixel components values to the specified range [min, max].
  9027. The filter accepts the following options:
  9028. @table @option
  9029. @item min
  9030. Lower bound. Defaults to the lowest allowed value for the input.
  9031. @item max
  9032. Upper bound. Defaults to the highest allowed value for the input.
  9033. @item planes
  9034. Specify which planes will be processed. Defaults to all available.
  9035. @end table
  9036. @section loop
  9037. Loop video frames.
  9038. The filter accepts the following options:
  9039. @table @option
  9040. @item loop
  9041. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9042. Default is 0.
  9043. @item size
  9044. Set maximal size in number of frames. Default is 0.
  9045. @item start
  9046. Set first frame of loop. Default is 0.
  9047. @end table
  9048. @subsection Examples
  9049. @itemize
  9050. @item
  9051. Loop single first frame infinitely:
  9052. @example
  9053. loop=loop=-1:size=1:start=0
  9054. @end example
  9055. @item
  9056. Loop single first frame 10 times:
  9057. @example
  9058. loop=loop=10:size=1:start=0
  9059. @end example
  9060. @item
  9061. Loop 10 first frames 5 times:
  9062. @example
  9063. loop=loop=5:size=10:start=0
  9064. @end example
  9065. @end itemize
  9066. @section lut1d
  9067. Apply a 1D LUT to an input video.
  9068. The filter accepts the following options:
  9069. @table @option
  9070. @item file
  9071. Set the 1D LUT file name.
  9072. Currently supported formats:
  9073. @table @samp
  9074. @item cube
  9075. Iridas
  9076. @item csp
  9077. cineSpace
  9078. @end table
  9079. @item interp
  9080. Select interpolation mode.
  9081. Available values are:
  9082. @table @samp
  9083. @item nearest
  9084. Use values from the nearest defined point.
  9085. @item linear
  9086. Interpolate values using the linear interpolation.
  9087. @item cosine
  9088. Interpolate values using the cosine interpolation.
  9089. @item cubic
  9090. Interpolate values using the cubic interpolation.
  9091. @item spline
  9092. Interpolate values using the spline interpolation.
  9093. @end table
  9094. @end table
  9095. @anchor{lut3d}
  9096. @section lut3d
  9097. Apply a 3D LUT to an input video.
  9098. The filter accepts the following options:
  9099. @table @option
  9100. @item file
  9101. Set the 3D LUT file name.
  9102. Currently supported formats:
  9103. @table @samp
  9104. @item 3dl
  9105. AfterEffects
  9106. @item cube
  9107. Iridas
  9108. @item dat
  9109. DaVinci
  9110. @item m3d
  9111. Pandora
  9112. @item csp
  9113. cineSpace
  9114. @end table
  9115. @item interp
  9116. Select interpolation mode.
  9117. Available values are:
  9118. @table @samp
  9119. @item nearest
  9120. Use values from the nearest defined point.
  9121. @item trilinear
  9122. Interpolate values using the 8 points defining a cube.
  9123. @item tetrahedral
  9124. Interpolate values using a tetrahedron.
  9125. @end table
  9126. @end table
  9127. @section lumakey
  9128. Turn certain luma values into transparency.
  9129. The filter accepts the following options:
  9130. @table @option
  9131. @item threshold
  9132. Set the luma which will be used as base for transparency.
  9133. Default value is @code{0}.
  9134. @item tolerance
  9135. Set the range of luma values to be keyed out.
  9136. Default value is @code{0}.
  9137. @item softness
  9138. Set the range of softness. Default value is @code{0}.
  9139. Use this to control gradual transition from zero to full transparency.
  9140. @end table
  9141. @section lut, lutrgb, lutyuv
  9142. Compute a look-up table for binding each pixel component input value
  9143. to an output value, and apply it to the input video.
  9144. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9145. to an RGB input video.
  9146. These filters accept the following parameters:
  9147. @table @option
  9148. @item c0
  9149. set first pixel component expression
  9150. @item c1
  9151. set second pixel component expression
  9152. @item c2
  9153. set third pixel component expression
  9154. @item c3
  9155. set fourth pixel component expression, corresponds to the alpha component
  9156. @item r
  9157. set red component expression
  9158. @item g
  9159. set green component expression
  9160. @item b
  9161. set blue component expression
  9162. @item a
  9163. alpha component expression
  9164. @item y
  9165. set Y/luminance component expression
  9166. @item u
  9167. set U/Cb component expression
  9168. @item v
  9169. set V/Cr component expression
  9170. @end table
  9171. Each of them specifies the expression to use for computing the lookup table for
  9172. the corresponding pixel component values.
  9173. The exact component associated to each of the @var{c*} options depends on the
  9174. format in input.
  9175. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9176. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9177. The expressions can contain the following constants and functions:
  9178. @table @option
  9179. @item w
  9180. @item h
  9181. The input width and height.
  9182. @item val
  9183. The input value for the pixel component.
  9184. @item clipval
  9185. The input value, clipped to the @var{minval}-@var{maxval} range.
  9186. @item maxval
  9187. The maximum value for the pixel component.
  9188. @item minval
  9189. The minimum value for the pixel component.
  9190. @item negval
  9191. The negated value for the pixel component value, clipped to the
  9192. @var{minval}-@var{maxval} range; it corresponds to the expression
  9193. "maxval-clipval+minval".
  9194. @item clip(val)
  9195. The computed value in @var{val}, clipped to the
  9196. @var{minval}-@var{maxval} range.
  9197. @item gammaval(gamma)
  9198. The computed gamma correction value of the pixel component value,
  9199. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9200. expression
  9201. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9202. @end table
  9203. All expressions default to "val".
  9204. @subsection Examples
  9205. @itemize
  9206. @item
  9207. Negate input video:
  9208. @example
  9209. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9210. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9211. @end example
  9212. The above is the same as:
  9213. @example
  9214. lutrgb="r=negval:g=negval:b=negval"
  9215. lutyuv="y=negval:u=negval:v=negval"
  9216. @end example
  9217. @item
  9218. Negate luminance:
  9219. @example
  9220. lutyuv=y=negval
  9221. @end example
  9222. @item
  9223. Remove chroma components, turning the video into a graytone image:
  9224. @example
  9225. lutyuv="u=128:v=128"
  9226. @end example
  9227. @item
  9228. Apply a luma burning effect:
  9229. @example
  9230. lutyuv="y=2*val"
  9231. @end example
  9232. @item
  9233. Remove green and blue components:
  9234. @example
  9235. lutrgb="g=0:b=0"
  9236. @end example
  9237. @item
  9238. Set a constant alpha channel value on input:
  9239. @example
  9240. format=rgba,lutrgb=a="maxval-minval/2"
  9241. @end example
  9242. @item
  9243. Correct luminance gamma by a factor of 0.5:
  9244. @example
  9245. lutyuv=y=gammaval(0.5)
  9246. @end example
  9247. @item
  9248. Discard least significant bits of luma:
  9249. @example
  9250. lutyuv=y='bitand(val, 128+64+32)'
  9251. @end example
  9252. @item
  9253. Technicolor like effect:
  9254. @example
  9255. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9256. @end example
  9257. @end itemize
  9258. @section lut2, tlut2
  9259. The @code{lut2} filter takes two input streams and outputs one
  9260. stream.
  9261. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9262. from one single stream.
  9263. This filter accepts the following parameters:
  9264. @table @option
  9265. @item c0
  9266. set first pixel component expression
  9267. @item c1
  9268. set second pixel component expression
  9269. @item c2
  9270. set third pixel component expression
  9271. @item c3
  9272. set fourth pixel component expression, corresponds to the alpha component
  9273. @item d
  9274. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9275. which means bit depth is automatically picked from first input format.
  9276. @end table
  9277. Each of them specifies the expression to use for computing the lookup table for
  9278. the corresponding pixel component values.
  9279. The exact component associated to each of the @var{c*} options depends on the
  9280. format in inputs.
  9281. The expressions can contain the following constants:
  9282. @table @option
  9283. @item w
  9284. @item h
  9285. The input width and height.
  9286. @item x
  9287. The first input value for the pixel component.
  9288. @item y
  9289. The second input value for the pixel component.
  9290. @item bdx
  9291. The first input video bit depth.
  9292. @item bdy
  9293. The second input video bit depth.
  9294. @end table
  9295. All expressions default to "x".
  9296. @subsection Examples
  9297. @itemize
  9298. @item
  9299. Highlight differences between two RGB video streams:
  9300. @example
  9301. 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)'
  9302. @end example
  9303. @item
  9304. Highlight differences between two YUV video streams:
  9305. @example
  9306. 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)'
  9307. @end example
  9308. @item
  9309. Show max difference between two video streams:
  9310. @example
  9311. 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)))'
  9312. @end example
  9313. @end itemize
  9314. @section maskedclamp
  9315. Clamp the first input stream with the second input and third input stream.
  9316. Returns the value of first stream to be between second input
  9317. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9318. This filter accepts the following options:
  9319. @table @option
  9320. @item undershoot
  9321. Default value is @code{0}.
  9322. @item overshoot
  9323. Default value is @code{0}.
  9324. @item planes
  9325. Set which planes will be processed as bitmap, unprocessed planes will be
  9326. copied from first stream.
  9327. By default value 0xf, all planes will be processed.
  9328. @end table
  9329. @section maskedmerge
  9330. Merge the first input stream with the second input stream using per pixel
  9331. weights in the third input stream.
  9332. A value of 0 in the third stream pixel component means that pixel component
  9333. from first stream is returned unchanged, while maximum value (eg. 255 for
  9334. 8-bit videos) means that pixel component from second stream is returned
  9335. unchanged. Intermediate values define the amount of merging between both
  9336. input stream's pixel components.
  9337. This filter accepts the following options:
  9338. @table @option
  9339. @item planes
  9340. Set which planes will be processed as bitmap, unprocessed planes will be
  9341. copied from first stream.
  9342. By default value 0xf, all planes will be processed.
  9343. @end table
  9344. @section maskfun
  9345. Create mask from input video.
  9346. For example it is useful to create motion masks after @code{tblend} filter.
  9347. This filter accepts the following options:
  9348. @table @option
  9349. @item low
  9350. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9351. @item high
  9352. Set high threshold. Any pixel component higher than this value will be set to max value
  9353. allowed for current pixel format.
  9354. @item planes
  9355. Set planes to filter, by default all available planes are filtered.
  9356. @item fill
  9357. Fill all frame pixels with this value.
  9358. @item sum
  9359. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9360. average, output frame will be completely filled with value set by @var{fill} option.
  9361. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9362. @end table
  9363. @section mcdeint
  9364. Apply motion-compensation deinterlacing.
  9365. It needs one field per frame as input and must thus be used together
  9366. with yadif=1/3 or equivalent.
  9367. This filter accepts the following options:
  9368. @table @option
  9369. @item mode
  9370. Set the deinterlacing mode.
  9371. It accepts one of the following values:
  9372. @table @samp
  9373. @item fast
  9374. @item medium
  9375. @item slow
  9376. use iterative motion estimation
  9377. @item extra_slow
  9378. like @samp{slow}, but use multiple reference frames.
  9379. @end table
  9380. Default value is @samp{fast}.
  9381. @item parity
  9382. Set the picture field parity assumed for the input video. It must be
  9383. one of the following values:
  9384. @table @samp
  9385. @item 0, tff
  9386. assume top field first
  9387. @item 1, bff
  9388. assume bottom field first
  9389. @end table
  9390. Default value is @samp{bff}.
  9391. @item qp
  9392. Set per-block quantization parameter (QP) used by the internal
  9393. encoder.
  9394. Higher values should result in a smoother motion vector field but less
  9395. optimal individual vectors. Default value is 1.
  9396. @end table
  9397. @section mergeplanes
  9398. Merge color channel components from several video streams.
  9399. The filter accepts up to 4 input streams, and merge selected input
  9400. planes to the output video.
  9401. This filter accepts the following options:
  9402. @table @option
  9403. @item mapping
  9404. Set input to output plane mapping. Default is @code{0}.
  9405. The mappings is specified as a bitmap. It should be specified as a
  9406. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9407. mapping for the first plane of the output stream. 'A' sets the number of
  9408. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9409. corresponding input to use (from 0 to 3). The rest of the mappings is
  9410. similar, 'Bb' describes the mapping for the output stream second
  9411. plane, 'Cc' describes the mapping for the output stream third plane and
  9412. 'Dd' describes the mapping for the output stream fourth plane.
  9413. @item format
  9414. Set output pixel format. Default is @code{yuva444p}.
  9415. @end table
  9416. @subsection Examples
  9417. @itemize
  9418. @item
  9419. Merge three gray video streams of same width and height into single video stream:
  9420. @example
  9421. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9422. @end example
  9423. @item
  9424. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9425. @example
  9426. [a0][a1]mergeplanes=0x00010210:yuva444p
  9427. @end example
  9428. @item
  9429. Swap Y and A plane in yuva444p stream:
  9430. @example
  9431. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9432. @end example
  9433. @item
  9434. Swap U and V plane in yuv420p stream:
  9435. @example
  9436. format=yuv420p,mergeplanes=0x000201:yuv420p
  9437. @end example
  9438. @item
  9439. Cast a rgb24 clip to yuv444p:
  9440. @example
  9441. format=rgb24,mergeplanes=0x000102:yuv444p
  9442. @end example
  9443. @end itemize
  9444. @section mestimate
  9445. Estimate and export motion vectors using block matching algorithms.
  9446. Motion vectors are stored in frame side data to be used by other filters.
  9447. This filter accepts the following options:
  9448. @table @option
  9449. @item method
  9450. Specify the motion estimation method. Accepts one of the following values:
  9451. @table @samp
  9452. @item esa
  9453. Exhaustive search algorithm.
  9454. @item tss
  9455. Three step search algorithm.
  9456. @item tdls
  9457. Two dimensional logarithmic search algorithm.
  9458. @item ntss
  9459. New three step search algorithm.
  9460. @item fss
  9461. Four step search algorithm.
  9462. @item ds
  9463. Diamond search algorithm.
  9464. @item hexbs
  9465. Hexagon-based search algorithm.
  9466. @item epzs
  9467. Enhanced predictive zonal search algorithm.
  9468. @item umh
  9469. Uneven multi-hexagon search algorithm.
  9470. @end table
  9471. Default value is @samp{esa}.
  9472. @item mb_size
  9473. Macroblock size. Default @code{16}.
  9474. @item search_param
  9475. Search parameter. Default @code{7}.
  9476. @end table
  9477. @section midequalizer
  9478. Apply Midway Image Equalization effect using two video streams.
  9479. Midway Image Equalization adjusts a pair of images to have the same
  9480. histogram, while maintaining their dynamics as much as possible. It's
  9481. useful for e.g. matching exposures from a pair of stereo cameras.
  9482. This filter has two inputs and one output, which must be of same pixel format, but
  9483. may be of different sizes. The output of filter is first input adjusted with
  9484. midway histogram of both inputs.
  9485. This filter accepts the following option:
  9486. @table @option
  9487. @item planes
  9488. Set which planes to process. Default is @code{15}, which is all available planes.
  9489. @end table
  9490. @section minterpolate
  9491. Convert the video to specified frame rate using motion interpolation.
  9492. This filter accepts the following options:
  9493. @table @option
  9494. @item fps
  9495. 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}.
  9496. @item mi_mode
  9497. Motion interpolation mode. Following values are accepted:
  9498. @table @samp
  9499. @item dup
  9500. Duplicate previous or next frame for interpolating new ones.
  9501. @item blend
  9502. Blend source frames. Interpolated frame is mean of previous and next frames.
  9503. @item mci
  9504. Motion compensated interpolation. Following options are effective when this mode is selected:
  9505. @table @samp
  9506. @item mc_mode
  9507. Motion compensation mode. Following values are accepted:
  9508. @table @samp
  9509. @item obmc
  9510. Overlapped block motion compensation.
  9511. @item aobmc
  9512. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9513. @end table
  9514. Default mode is @samp{obmc}.
  9515. @item me_mode
  9516. Motion estimation mode. Following values are accepted:
  9517. @table @samp
  9518. @item bidir
  9519. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9520. @item bilat
  9521. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9522. @end table
  9523. Default mode is @samp{bilat}.
  9524. @item me
  9525. The algorithm to be used for motion estimation. Following values are accepted:
  9526. @table @samp
  9527. @item esa
  9528. Exhaustive search algorithm.
  9529. @item tss
  9530. Three step search algorithm.
  9531. @item tdls
  9532. Two dimensional logarithmic search algorithm.
  9533. @item ntss
  9534. New three step search algorithm.
  9535. @item fss
  9536. Four step search algorithm.
  9537. @item ds
  9538. Diamond search algorithm.
  9539. @item hexbs
  9540. Hexagon-based search algorithm.
  9541. @item epzs
  9542. Enhanced predictive zonal search algorithm.
  9543. @item umh
  9544. Uneven multi-hexagon search algorithm.
  9545. @end table
  9546. Default algorithm is @samp{epzs}.
  9547. @item mb_size
  9548. Macroblock size. Default @code{16}.
  9549. @item search_param
  9550. Motion estimation search parameter. Default @code{32}.
  9551. @item vsbmc
  9552. 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).
  9553. @end table
  9554. @end table
  9555. @item scd
  9556. 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:
  9557. @table @samp
  9558. @item none
  9559. Disable scene change detection.
  9560. @item fdiff
  9561. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9562. @end table
  9563. Default method is @samp{fdiff}.
  9564. @item scd_threshold
  9565. Scene change detection threshold. Default is @code{5.0}.
  9566. @end table
  9567. @section mix
  9568. Mix several video input streams into one video stream.
  9569. A description of the accepted options follows.
  9570. @table @option
  9571. @item nb_inputs
  9572. The number of inputs. If unspecified, it defaults to 2.
  9573. @item weights
  9574. Specify weight of each input video stream as sequence.
  9575. Each weight is separated by space. If number of weights
  9576. is smaller than number of @var{frames} last specified
  9577. weight will be used for all remaining unset weights.
  9578. @item scale
  9579. Specify scale, if it is set it will be multiplied with sum
  9580. of each weight multiplied with pixel values to give final destination
  9581. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9582. @item duration
  9583. Specify how end of stream is determined.
  9584. @table @samp
  9585. @item longest
  9586. The duration of the longest input. (default)
  9587. @item shortest
  9588. The duration of the shortest input.
  9589. @item first
  9590. The duration of the first input.
  9591. @end table
  9592. @end table
  9593. @section mpdecimate
  9594. Drop frames that do not differ greatly from the previous frame in
  9595. order to reduce frame rate.
  9596. The main use of this filter is for very-low-bitrate encoding
  9597. (e.g. streaming over dialup modem), but it could in theory be used for
  9598. fixing movies that were inverse-telecined incorrectly.
  9599. A description of the accepted options follows.
  9600. @table @option
  9601. @item max
  9602. Set the maximum number of consecutive frames which can be dropped (if
  9603. positive), or the minimum interval between dropped frames (if
  9604. negative). If the value is 0, the frame is dropped disregarding the
  9605. number of previous sequentially dropped frames.
  9606. Default value is 0.
  9607. @item hi
  9608. @item lo
  9609. @item frac
  9610. Set the dropping threshold values.
  9611. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9612. represent actual pixel value differences, so a threshold of 64
  9613. corresponds to 1 unit of difference for each pixel, or the same spread
  9614. out differently over the block.
  9615. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9616. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9617. meaning the whole image) differ by more than a threshold of @option{lo}.
  9618. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9619. 64*5, and default value for @option{frac} is 0.33.
  9620. @end table
  9621. @section negate
  9622. Negate (invert) the input video.
  9623. It accepts the following option:
  9624. @table @option
  9625. @item negate_alpha
  9626. With value 1, it negates the alpha component, if present. Default value is 0.
  9627. @end table
  9628. @anchor{nlmeans}
  9629. @section nlmeans
  9630. Denoise frames using Non-Local Means algorithm.
  9631. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9632. context similarity is defined by comparing their surrounding patches of size
  9633. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9634. around the pixel.
  9635. Note that the research area defines centers for patches, which means some
  9636. patches will be made of pixels outside that research area.
  9637. The filter accepts the following options.
  9638. @table @option
  9639. @item s
  9640. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9641. @item p
  9642. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9643. @item pc
  9644. Same as @option{p} but for chroma planes.
  9645. The default value is @var{0} and means automatic.
  9646. @item r
  9647. Set research size. Default is 15. Must be odd number in range [0, 99].
  9648. @item rc
  9649. Same as @option{r} but for chroma planes.
  9650. The default value is @var{0} and means automatic.
  9651. @end table
  9652. @section nnedi
  9653. Deinterlace video using neural network edge directed interpolation.
  9654. This filter accepts the following options:
  9655. @table @option
  9656. @item weights
  9657. Mandatory option, without binary file filter can not work.
  9658. Currently file can be found here:
  9659. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9660. @item deint
  9661. Set which frames to deinterlace, by default it is @code{all}.
  9662. Can be @code{all} or @code{interlaced}.
  9663. @item field
  9664. Set mode of operation.
  9665. Can be one of the following:
  9666. @table @samp
  9667. @item af
  9668. Use frame flags, both fields.
  9669. @item a
  9670. Use frame flags, single field.
  9671. @item t
  9672. Use top field only.
  9673. @item b
  9674. Use bottom field only.
  9675. @item tf
  9676. Use both fields, top first.
  9677. @item bf
  9678. Use both fields, bottom first.
  9679. @end table
  9680. @item planes
  9681. Set which planes to process, by default filter process all frames.
  9682. @item nsize
  9683. Set size of local neighborhood around each pixel, used by the predictor neural
  9684. network.
  9685. Can be one of the following:
  9686. @table @samp
  9687. @item s8x6
  9688. @item s16x6
  9689. @item s32x6
  9690. @item s48x6
  9691. @item s8x4
  9692. @item s16x4
  9693. @item s32x4
  9694. @end table
  9695. @item nns
  9696. Set the number of neurons in predictor neural network.
  9697. Can be one of the following:
  9698. @table @samp
  9699. @item n16
  9700. @item n32
  9701. @item n64
  9702. @item n128
  9703. @item n256
  9704. @end table
  9705. @item qual
  9706. Controls the number of different neural network predictions that are blended
  9707. together to compute the final output value. Can be @code{fast}, default or
  9708. @code{slow}.
  9709. @item etype
  9710. Set which set of weights to use in the predictor.
  9711. Can be one of the following:
  9712. @table @samp
  9713. @item a
  9714. weights trained to minimize absolute error
  9715. @item s
  9716. weights trained to minimize squared error
  9717. @end table
  9718. @item pscrn
  9719. Controls whether or not the prescreener neural network is used to decide
  9720. which pixels should be processed by the predictor neural network and which
  9721. can be handled by simple cubic interpolation.
  9722. The prescreener is trained to know whether cubic interpolation will be
  9723. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9724. The computational complexity of the prescreener nn is much less than that of
  9725. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9726. using the prescreener generally results in much faster processing.
  9727. The prescreener is pretty accurate, so the difference between using it and not
  9728. using it is almost always unnoticeable.
  9729. Can be one of the following:
  9730. @table @samp
  9731. @item none
  9732. @item original
  9733. @item new
  9734. @end table
  9735. Default is @code{new}.
  9736. @item fapprox
  9737. Set various debugging flags.
  9738. @end table
  9739. @section noformat
  9740. Force libavfilter not to use any of the specified pixel formats for the
  9741. input to the next filter.
  9742. It accepts the following parameters:
  9743. @table @option
  9744. @item pix_fmts
  9745. A '|'-separated list of pixel format names, such as
  9746. pix_fmts=yuv420p|monow|rgb24".
  9747. @end table
  9748. @subsection Examples
  9749. @itemize
  9750. @item
  9751. Force libavfilter to use a format different from @var{yuv420p} for the
  9752. input to the vflip filter:
  9753. @example
  9754. noformat=pix_fmts=yuv420p,vflip
  9755. @end example
  9756. @item
  9757. Convert the input video to any of the formats not contained in the list:
  9758. @example
  9759. noformat=yuv420p|yuv444p|yuv410p
  9760. @end example
  9761. @end itemize
  9762. @section noise
  9763. Add noise on video input frame.
  9764. The filter accepts the following options:
  9765. @table @option
  9766. @item all_seed
  9767. @item c0_seed
  9768. @item c1_seed
  9769. @item c2_seed
  9770. @item c3_seed
  9771. Set noise seed for specific pixel component or all pixel components in case
  9772. of @var{all_seed}. Default value is @code{123457}.
  9773. @item all_strength, alls
  9774. @item c0_strength, c0s
  9775. @item c1_strength, c1s
  9776. @item c2_strength, c2s
  9777. @item c3_strength, c3s
  9778. Set noise strength for specific pixel component or all pixel components in case
  9779. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9780. @item all_flags, allf
  9781. @item c0_flags, c0f
  9782. @item c1_flags, c1f
  9783. @item c2_flags, c2f
  9784. @item c3_flags, c3f
  9785. Set pixel component flags or set flags for all components if @var{all_flags}.
  9786. Available values for component flags are:
  9787. @table @samp
  9788. @item a
  9789. averaged temporal noise (smoother)
  9790. @item p
  9791. mix random noise with a (semi)regular pattern
  9792. @item t
  9793. temporal noise (noise pattern changes between frames)
  9794. @item u
  9795. uniform noise (gaussian otherwise)
  9796. @end table
  9797. @end table
  9798. @subsection Examples
  9799. Add temporal and uniform noise to input video:
  9800. @example
  9801. noise=alls=20:allf=t+u
  9802. @end example
  9803. @section normalize
  9804. Normalize RGB video (aka histogram stretching, contrast stretching).
  9805. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9806. For each channel of each frame, the filter computes the input range and maps
  9807. it linearly to the user-specified output range. The output range defaults
  9808. to the full dynamic range from pure black to pure white.
  9809. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9810. changes in brightness) caused when small dark or bright objects enter or leave
  9811. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9812. video camera, and, like a video camera, it may cause a period of over- or
  9813. under-exposure of the video.
  9814. The R,G,B channels can be normalized independently, which may cause some
  9815. color shifting, or linked together as a single channel, which prevents
  9816. color shifting. Linked normalization preserves hue. Independent normalization
  9817. does not, so it can be used to remove some color casts. Independent and linked
  9818. normalization can be combined in any ratio.
  9819. The normalize filter accepts the following options:
  9820. @table @option
  9821. @item blackpt
  9822. @item whitept
  9823. Colors which define the output range. The minimum input value is mapped to
  9824. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9825. The defaults are black and white respectively. Specifying white for
  9826. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9827. normalized video. Shades of grey can be used to reduce the dynamic range
  9828. (contrast). Specifying saturated colors here can create some interesting
  9829. effects.
  9830. @item smoothing
  9831. The number of previous frames to use for temporal smoothing. The input range
  9832. of each channel is smoothed using a rolling average over the current frame
  9833. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9834. smoothing).
  9835. @item independence
  9836. Controls the ratio of independent (color shifting) channel normalization to
  9837. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9838. independent. Defaults to 1.0 (fully independent).
  9839. @item strength
  9840. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9841. expensive no-op. Defaults to 1.0 (full strength).
  9842. @end table
  9843. @subsection Examples
  9844. Stretch video contrast to use the full dynamic range, with no temporal
  9845. smoothing; may flicker depending on the source content:
  9846. @example
  9847. normalize=blackpt=black:whitept=white:smoothing=0
  9848. @end example
  9849. As above, but with 50 frames of temporal smoothing; flicker should be
  9850. reduced, depending on the source content:
  9851. @example
  9852. normalize=blackpt=black:whitept=white:smoothing=50
  9853. @end example
  9854. As above, but with hue-preserving linked channel normalization:
  9855. @example
  9856. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9857. @end example
  9858. As above, but with half strength:
  9859. @example
  9860. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9861. @end example
  9862. Map the darkest input color to red, the brightest input color to cyan:
  9863. @example
  9864. normalize=blackpt=red:whitept=cyan
  9865. @end example
  9866. @section null
  9867. Pass the video source unchanged to the output.
  9868. @section ocr
  9869. Optical Character Recognition
  9870. This filter uses Tesseract for optical character recognition. To enable
  9871. compilation of this filter, you need to configure FFmpeg with
  9872. @code{--enable-libtesseract}.
  9873. It accepts the following options:
  9874. @table @option
  9875. @item datapath
  9876. Set datapath to tesseract data. Default is to use whatever was
  9877. set at installation.
  9878. @item language
  9879. Set language, default is "eng".
  9880. @item whitelist
  9881. Set character whitelist.
  9882. @item blacklist
  9883. Set character blacklist.
  9884. @end table
  9885. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9886. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  9887. @section ocv
  9888. Apply a video transform using libopencv.
  9889. To enable this filter, install the libopencv library and headers and
  9890. configure FFmpeg with @code{--enable-libopencv}.
  9891. It accepts the following parameters:
  9892. @table @option
  9893. @item filter_name
  9894. The name of the libopencv filter to apply.
  9895. @item filter_params
  9896. The parameters to pass to the libopencv filter. If not specified, the default
  9897. values are assumed.
  9898. @end table
  9899. Refer to the official libopencv documentation for more precise
  9900. information:
  9901. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9902. Several libopencv filters are supported; see the following subsections.
  9903. @anchor{dilate}
  9904. @subsection dilate
  9905. Dilate an image by using a specific structuring element.
  9906. It corresponds to the libopencv function @code{cvDilate}.
  9907. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9908. @var{struct_el} represents a structuring element, and has the syntax:
  9909. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9910. @var{cols} and @var{rows} represent the number of columns and rows of
  9911. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9912. point, and @var{shape} the shape for the structuring element. @var{shape}
  9913. must be "rect", "cross", "ellipse", or "custom".
  9914. If the value for @var{shape} is "custom", it must be followed by a
  9915. string of the form "=@var{filename}". The file with name
  9916. @var{filename} is assumed to represent a binary image, with each
  9917. printable character corresponding to a bright pixel. When a custom
  9918. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9919. or columns and rows of the read file are assumed instead.
  9920. The default value for @var{struct_el} is "3x3+0x0/rect".
  9921. @var{nb_iterations} specifies the number of times the transform is
  9922. applied to the image, and defaults to 1.
  9923. Some examples:
  9924. @example
  9925. # Use the default values
  9926. ocv=dilate
  9927. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9928. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9929. # Read the shape from the file diamond.shape, iterating two times.
  9930. # The file diamond.shape may contain a pattern of characters like this
  9931. # *
  9932. # ***
  9933. # *****
  9934. # ***
  9935. # *
  9936. # The specified columns and rows are ignored
  9937. # but the anchor point coordinates are not
  9938. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9939. @end example
  9940. @subsection erode
  9941. Erode an image by using a specific structuring element.
  9942. It corresponds to the libopencv function @code{cvErode}.
  9943. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9944. with the same syntax and semantics as the @ref{dilate} filter.
  9945. @subsection smooth
  9946. Smooth the input video.
  9947. The filter takes the following parameters:
  9948. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9949. @var{type} is the type of smooth filter to apply, and must be one of
  9950. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9951. or "bilateral". The default value is "gaussian".
  9952. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9953. depend on the smooth type. @var{param1} and
  9954. @var{param2} accept integer positive values or 0. @var{param3} and
  9955. @var{param4} accept floating point values.
  9956. The default value for @var{param1} is 3. The default value for the
  9957. other parameters is 0.
  9958. These parameters correspond to the parameters assigned to the
  9959. libopencv function @code{cvSmooth}.
  9960. @section oscilloscope
  9961. 2D Video Oscilloscope.
  9962. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9963. It accepts the following parameters:
  9964. @table @option
  9965. @item x
  9966. Set scope center x position.
  9967. @item y
  9968. Set scope center y position.
  9969. @item s
  9970. Set scope size, relative to frame diagonal.
  9971. @item t
  9972. Set scope tilt/rotation.
  9973. @item o
  9974. Set trace opacity.
  9975. @item tx
  9976. Set trace center x position.
  9977. @item ty
  9978. Set trace center y position.
  9979. @item tw
  9980. Set trace width, relative to width of frame.
  9981. @item th
  9982. Set trace height, relative to height of frame.
  9983. @item c
  9984. Set which components to trace. By default it traces first three components.
  9985. @item g
  9986. Draw trace grid. By default is enabled.
  9987. @item st
  9988. Draw some statistics. By default is enabled.
  9989. @item sc
  9990. Draw scope. By default is enabled.
  9991. @end table
  9992. @subsection Examples
  9993. @itemize
  9994. @item
  9995. Inspect full first row of video frame.
  9996. @example
  9997. oscilloscope=x=0.5:y=0:s=1
  9998. @end example
  9999. @item
  10000. Inspect full last row of video frame.
  10001. @example
  10002. oscilloscope=x=0.5:y=1:s=1
  10003. @end example
  10004. @item
  10005. Inspect full 5th line of video frame of height 1080.
  10006. @example
  10007. oscilloscope=x=0.5:y=5/1080:s=1
  10008. @end example
  10009. @item
  10010. Inspect full last column of video frame.
  10011. @example
  10012. oscilloscope=x=1:y=0.5:s=1:t=1
  10013. @end example
  10014. @end itemize
  10015. @anchor{overlay}
  10016. @section overlay
  10017. Overlay one video on top of another.
  10018. It takes two inputs and has one output. The first input is the "main"
  10019. video on which the second input is overlaid.
  10020. It accepts the following parameters:
  10021. A description of the accepted options follows.
  10022. @table @option
  10023. @item x
  10024. @item y
  10025. Set the expression for the x and y coordinates of the overlaid video
  10026. on the main video. Default value is "0" for both expressions. In case
  10027. the expression is invalid, it is set to a huge value (meaning that the
  10028. overlay will not be displayed within the output visible area).
  10029. @item eof_action
  10030. See @ref{framesync}.
  10031. @item eval
  10032. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10033. It accepts the following values:
  10034. @table @samp
  10035. @item init
  10036. only evaluate expressions once during the filter initialization or
  10037. when a command is processed
  10038. @item frame
  10039. evaluate expressions for each incoming frame
  10040. @end table
  10041. Default value is @samp{frame}.
  10042. @item shortest
  10043. See @ref{framesync}.
  10044. @item format
  10045. Set the format for the output video.
  10046. It accepts the following values:
  10047. @table @samp
  10048. @item yuv420
  10049. force YUV420 output
  10050. @item yuv422
  10051. force YUV422 output
  10052. @item yuv444
  10053. force YUV444 output
  10054. @item rgb
  10055. force packed RGB output
  10056. @item gbrp
  10057. force planar RGB output
  10058. @item auto
  10059. automatically pick format
  10060. @end table
  10061. Default value is @samp{yuv420}.
  10062. @item repeatlast
  10063. See @ref{framesync}.
  10064. @item alpha
  10065. Set format of alpha of the overlaid video, it can be @var{straight} or
  10066. @var{premultiplied}. Default is @var{straight}.
  10067. @end table
  10068. The @option{x}, and @option{y} expressions can contain the following
  10069. parameters.
  10070. @table @option
  10071. @item main_w, W
  10072. @item main_h, H
  10073. The main input width and height.
  10074. @item overlay_w, w
  10075. @item overlay_h, h
  10076. The overlay input width and height.
  10077. @item x
  10078. @item y
  10079. The computed values for @var{x} and @var{y}. They are evaluated for
  10080. each new frame.
  10081. @item hsub
  10082. @item vsub
  10083. horizontal and vertical chroma subsample values of the output
  10084. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10085. @var{vsub} is 1.
  10086. @item n
  10087. the number of input frame, starting from 0
  10088. @item pos
  10089. the position in the file of the input frame, NAN if unknown
  10090. @item t
  10091. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10092. @end table
  10093. This filter also supports the @ref{framesync} options.
  10094. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10095. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10096. when @option{eval} is set to @samp{init}.
  10097. Be aware that frames are taken from each input video in timestamp
  10098. order, hence, if their initial timestamps differ, it is a good idea
  10099. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10100. have them begin in the same zero timestamp, as the example for
  10101. the @var{movie} filter does.
  10102. You can chain together more overlays but you should test the
  10103. efficiency of such approach.
  10104. @subsection Commands
  10105. This filter supports the following commands:
  10106. @table @option
  10107. @item x
  10108. @item y
  10109. Modify the x and y of the overlay input.
  10110. The command accepts the same syntax of the corresponding option.
  10111. If the specified expression is not valid, it is kept at its current
  10112. value.
  10113. @end table
  10114. @subsection Examples
  10115. @itemize
  10116. @item
  10117. Draw the overlay at 10 pixels from the bottom right corner of the main
  10118. video:
  10119. @example
  10120. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10121. @end example
  10122. Using named options the example above becomes:
  10123. @example
  10124. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10125. @end example
  10126. @item
  10127. Insert a transparent PNG logo in the bottom left corner of the input,
  10128. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10129. @example
  10130. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10131. @end example
  10132. @item
  10133. Insert 2 different transparent PNG logos (second logo on bottom
  10134. right corner) using the @command{ffmpeg} tool:
  10135. @example
  10136. 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
  10137. @end example
  10138. @item
  10139. Add a transparent color layer on top of the main video; @code{WxH}
  10140. must specify the size of the main input to the overlay filter:
  10141. @example
  10142. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10143. @end example
  10144. @item
  10145. Play an original video and a filtered version (here with the deshake
  10146. filter) side by side using the @command{ffplay} tool:
  10147. @example
  10148. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10149. @end example
  10150. The above command is the same as:
  10151. @example
  10152. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10153. @end example
  10154. @item
  10155. Make a sliding overlay appearing from the left to the right top part of the
  10156. screen starting since time 2:
  10157. @example
  10158. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10159. @end example
  10160. @item
  10161. Compose output by putting two input videos side to side:
  10162. @example
  10163. ffmpeg -i left.avi -i right.avi -filter_complex "
  10164. nullsrc=size=200x100 [background];
  10165. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10166. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10167. [background][left] overlay=shortest=1 [background+left];
  10168. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10169. "
  10170. @end example
  10171. @item
  10172. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10173. @example
  10174. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10175. -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]'
  10176. masked.avi
  10177. @end example
  10178. @item
  10179. Chain several overlays in cascade:
  10180. @example
  10181. nullsrc=s=200x200 [bg];
  10182. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10183. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10184. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10185. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10186. [in3] null, [mid2] overlay=100:100 [out0]
  10187. @end example
  10188. @end itemize
  10189. @section owdenoise
  10190. Apply Overcomplete Wavelet denoiser.
  10191. The filter accepts the following options:
  10192. @table @option
  10193. @item depth
  10194. Set depth.
  10195. Larger depth values will denoise lower frequency components more, but
  10196. slow down filtering.
  10197. Must be an int in the range 8-16, default is @code{8}.
  10198. @item luma_strength, ls
  10199. Set luma strength.
  10200. Must be a double value in the range 0-1000, default is @code{1.0}.
  10201. @item chroma_strength, cs
  10202. Set chroma strength.
  10203. Must be a double value in the range 0-1000, default is @code{1.0}.
  10204. @end table
  10205. @anchor{pad}
  10206. @section pad
  10207. Add paddings to the input image, and place the original input at the
  10208. provided @var{x}, @var{y} coordinates.
  10209. It accepts the following parameters:
  10210. @table @option
  10211. @item width, w
  10212. @item height, h
  10213. Specify an expression for the size of the output image with the
  10214. paddings added. If the value for @var{width} or @var{height} is 0, the
  10215. corresponding input size is used for the output.
  10216. The @var{width} expression can reference the value set by the
  10217. @var{height} expression, and vice versa.
  10218. The default value of @var{width} and @var{height} is 0.
  10219. @item x
  10220. @item y
  10221. Specify the offsets to place the input image at within the padded area,
  10222. with respect to the top/left border of the output image.
  10223. The @var{x} expression can reference the value set by the @var{y}
  10224. expression, and vice versa.
  10225. The default value of @var{x} and @var{y} is 0.
  10226. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10227. so the input image is centered on the padded area.
  10228. @item color
  10229. Specify the color of the padded area. For the syntax of this option,
  10230. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10231. manual,ffmpeg-utils}.
  10232. The default value of @var{color} is "black".
  10233. @item eval
  10234. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10235. It accepts the following values:
  10236. @table @samp
  10237. @item init
  10238. Only evaluate expressions once during the filter initialization or when
  10239. a command is processed.
  10240. @item frame
  10241. Evaluate expressions for each incoming frame.
  10242. @end table
  10243. Default value is @samp{init}.
  10244. @item aspect
  10245. Pad to aspect instead to a resolution.
  10246. @end table
  10247. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10248. options are expressions containing the following constants:
  10249. @table @option
  10250. @item in_w
  10251. @item in_h
  10252. The input video width and height.
  10253. @item iw
  10254. @item ih
  10255. These are the same as @var{in_w} and @var{in_h}.
  10256. @item out_w
  10257. @item out_h
  10258. The output width and height (the size of the padded area), as
  10259. specified by the @var{width} and @var{height} expressions.
  10260. @item ow
  10261. @item oh
  10262. These are the same as @var{out_w} and @var{out_h}.
  10263. @item x
  10264. @item y
  10265. The x and y offsets as specified by the @var{x} and @var{y}
  10266. expressions, or NAN if not yet specified.
  10267. @item a
  10268. same as @var{iw} / @var{ih}
  10269. @item sar
  10270. input sample aspect ratio
  10271. @item dar
  10272. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10273. @item hsub
  10274. @item vsub
  10275. The horizontal and vertical chroma subsample values. For example for the
  10276. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10277. @end table
  10278. @subsection Examples
  10279. @itemize
  10280. @item
  10281. Add paddings with the color "violet" to the input video. The output video
  10282. size is 640x480, and the top-left corner of the input video is placed at
  10283. column 0, row 40
  10284. @example
  10285. pad=640:480:0:40:violet
  10286. @end example
  10287. The example above is equivalent to the following command:
  10288. @example
  10289. pad=width=640:height=480:x=0:y=40:color=violet
  10290. @end example
  10291. @item
  10292. Pad the input to get an output with dimensions increased by 3/2,
  10293. and put the input video at the center of the padded area:
  10294. @example
  10295. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10296. @end example
  10297. @item
  10298. Pad the input to get a squared output with size equal to the maximum
  10299. value between the input width and height, and put the input video at
  10300. the center of the padded area:
  10301. @example
  10302. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10303. @end example
  10304. @item
  10305. Pad the input to get a final w/h ratio of 16:9:
  10306. @example
  10307. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10308. @end example
  10309. @item
  10310. In case of anamorphic video, in order to set the output display aspect
  10311. correctly, it is necessary to use @var{sar} in the expression,
  10312. according to the relation:
  10313. @example
  10314. (ih * X / ih) * sar = output_dar
  10315. X = output_dar / sar
  10316. @end example
  10317. Thus the previous example needs to be modified to:
  10318. @example
  10319. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10320. @end example
  10321. @item
  10322. Double the output size and put the input video in the bottom-right
  10323. corner of the output padded area:
  10324. @example
  10325. pad="2*iw:2*ih:ow-iw:oh-ih"
  10326. @end example
  10327. @end itemize
  10328. @anchor{palettegen}
  10329. @section palettegen
  10330. Generate one palette for a whole video stream.
  10331. It accepts the following options:
  10332. @table @option
  10333. @item max_colors
  10334. Set the maximum number of colors to quantize in the palette.
  10335. Note: the palette will still contain 256 colors; the unused palette entries
  10336. will be black.
  10337. @item reserve_transparent
  10338. Create a palette of 255 colors maximum and reserve the last one for
  10339. transparency. Reserving the transparency color is useful for GIF optimization.
  10340. If not set, the maximum of colors in the palette will be 256. You probably want
  10341. to disable this option for a standalone image.
  10342. Set by default.
  10343. @item transparency_color
  10344. Set the color that will be used as background for transparency.
  10345. @item stats_mode
  10346. Set statistics mode.
  10347. It accepts the following values:
  10348. @table @samp
  10349. @item full
  10350. Compute full frame histograms.
  10351. @item diff
  10352. Compute histograms only for the part that differs from previous frame. This
  10353. might be relevant to give more importance to the moving part of your input if
  10354. the background is static.
  10355. @item single
  10356. Compute new histogram for each frame.
  10357. @end table
  10358. Default value is @var{full}.
  10359. @end table
  10360. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10361. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10362. color quantization of the palette. This information is also visible at
  10363. @var{info} logging level.
  10364. @subsection Examples
  10365. @itemize
  10366. @item
  10367. Generate a representative palette of a given video using @command{ffmpeg}:
  10368. @example
  10369. ffmpeg -i input.mkv -vf palettegen palette.png
  10370. @end example
  10371. @end itemize
  10372. @section paletteuse
  10373. Use a palette to downsample an input video stream.
  10374. The filter takes two inputs: one video stream and a palette. The palette must
  10375. be a 256 pixels image.
  10376. It accepts the following options:
  10377. @table @option
  10378. @item dither
  10379. Select dithering mode. Available algorithms are:
  10380. @table @samp
  10381. @item bayer
  10382. Ordered 8x8 bayer dithering (deterministic)
  10383. @item heckbert
  10384. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10385. Note: this dithering is sometimes considered "wrong" and is included as a
  10386. reference.
  10387. @item floyd_steinberg
  10388. Floyd and Steingberg dithering (error diffusion)
  10389. @item sierra2
  10390. Frankie Sierra dithering v2 (error diffusion)
  10391. @item sierra2_4a
  10392. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10393. @end table
  10394. Default is @var{sierra2_4a}.
  10395. @item bayer_scale
  10396. When @var{bayer} dithering is selected, this option defines the scale of the
  10397. pattern (how much the crosshatch pattern is visible). A low value means more
  10398. visible pattern for less banding, and higher value means less visible pattern
  10399. at the cost of more banding.
  10400. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10401. @item diff_mode
  10402. If set, define the zone to process
  10403. @table @samp
  10404. @item rectangle
  10405. Only the changing rectangle will be reprocessed. This is similar to GIF
  10406. cropping/offsetting compression mechanism. This option can be useful for speed
  10407. if only a part of the image is changing, and has use cases such as limiting the
  10408. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10409. moving scene (it leads to more deterministic output if the scene doesn't change
  10410. much, and as a result less moving noise and better GIF compression).
  10411. @end table
  10412. Default is @var{none}.
  10413. @item new
  10414. Take new palette for each output frame.
  10415. @item alpha_threshold
  10416. Sets the alpha threshold for transparency. Alpha values above this threshold
  10417. will be treated as completely opaque, and values below this threshold will be
  10418. treated as completely transparent.
  10419. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10420. @end table
  10421. @subsection Examples
  10422. @itemize
  10423. @item
  10424. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10425. using @command{ffmpeg}:
  10426. @example
  10427. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10428. @end example
  10429. @end itemize
  10430. @section perspective
  10431. Correct perspective of video not recorded perpendicular to the screen.
  10432. A description of the accepted parameters follows.
  10433. @table @option
  10434. @item x0
  10435. @item y0
  10436. @item x1
  10437. @item y1
  10438. @item x2
  10439. @item y2
  10440. @item x3
  10441. @item y3
  10442. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10443. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10444. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10445. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10446. then the corners of the source will be sent to the specified coordinates.
  10447. The expressions can use the following variables:
  10448. @table @option
  10449. @item W
  10450. @item H
  10451. the width and height of video frame.
  10452. @item in
  10453. Input frame count.
  10454. @item on
  10455. Output frame count.
  10456. @end table
  10457. @item interpolation
  10458. Set interpolation for perspective correction.
  10459. It accepts the following values:
  10460. @table @samp
  10461. @item linear
  10462. @item cubic
  10463. @end table
  10464. Default value is @samp{linear}.
  10465. @item sense
  10466. Set interpretation of coordinate options.
  10467. It accepts the following values:
  10468. @table @samp
  10469. @item 0, source
  10470. Send point in the source specified by the given coordinates to
  10471. the corners of the destination.
  10472. @item 1, destination
  10473. Send the corners of the source to the point in the destination specified
  10474. by the given coordinates.
  10475. Default value is @samp{source}.
  10476. @end table
  10477. @item eval
  10478. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10479. It accepts the following values:
  10480. @table @samp
  10481. @item init
  10482. only evaluate expressions once during the filter initialization or
  10483. when a command is processed
  10484. @item frame
  10485. evaluate expressions for each incoming frame
  10486. @end table
  10487. Default value is @samp{init}.
  10488. @end table
  10489. @section phase
  10490. Delay interlaced video by one field time so that the field order changes.
  10491. The intended use is to fix PAL movies that have been captured with the
  10492. opposite field order to the film-to-video transfer.
  10493. A description of the accepted parameters follows.
  10494. @table @option
  10495. @item mode
  10496. Set phase mode.
  10497. It accepts the following values:
  10498. @table @samp
  10499. @item t
  10500. Capture field order top-first, transfer bottom-first.
  10501. Filter will delay the bottom field.
  10502. @item b
  10503. Capture field order bottom-first, transfer top-first.
  10504. Filter will delay the top field.
  10505. @item p
  10506. Capture and transfer with the same field order. This mode only exists
  10507. for the documentation of the other options to refer to, but if you
  10508. actually select it, the filter will faithfully do nothing.
  10509. @item a
  10510. Capture field order determined automatically by field flags, transfer
  10511. opposite.
  10512. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10513. basis using field flags. If no field information is available,
  10514. then this works just like @samp{u}.
  10515. @item u
  10516. Capture unknown or varying, transfer opposite.
  10517. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10518. analyzing the images and selecting the alternative that produces best
  10519. match between the fields.
  10520. @item T
  10521. Capture top-first, transfer unknown or varying.
  10522. Filter selects among @samp{t} and @samp{p} using image analysis.
  10523. @item B
  10524. Capture bottom-first, transfer unknown or varying.
  10525. Filter selects among @samp{b} and @samp{p} using image analysis.
  10526. @item A
  10527. Capture determined by field flags, transfer unknown or varying.
  10528. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10529. image analysis. If no field information is available, then this works just
  10530. like @samp{U}. This is the default mode.
  10531. @item U
  10532. Both capture and transfer unknown or varying.
  10533. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10534. @end table
  10535. @end table
  10536. @section pixdesctest
  10537. Pixel format descriptor test filter, mainly useful for internal
  10538. testing. The output video should be equal to the input video.
  10539. For example:
  10540. @example
  10541. format=monow, pixdesctest
  10542. @end example
  10543. can be used to test the monowhite pixel format descriptor definition.
  10544. @section pixscope
  10545. Display sample values of color channels. Mainly useful for checking color
  10546. and levels. Minimum supported resolution is 640x480.
  10547. The filters accept the following options:
  10548. @table @option
  10549. @item x
  10550. Set scope X position, relative offset on X axis.
  10551. @item y
  10552. Set scope Y position, relative offset on Y axis.
  10553. @item w
  10554. Set scope width.
  10555. @item h
  10556. Set scope height.
  10557. @item o
  10558. Set window opacity. This window also holds statistics about pixel area.
  10559. @item wx
  10560. Set window X position, relative offset on X axis.
  10561. @item wy
  10562. Set window Y position, relative offset on Y axis.
  10563. @end table
  10564. @section pp
  10565. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10566. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10567. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10568. Each subfilter and some options have a short and a long name that can be used
  10569. interchangeably, i.e. dr/dering are the same.
  10570. The filters accept the following options:
  10571. @table @option
  10572. @item subfilters
  10573. Set postprocessing subfilters string.
  10574. @end table
  10575. All subfilters share common options to determine their scope:
  10576. @table @option
  10577. @item a/autoq
  10578. Honor the quality commands for this subfilter.
  10579. @item c/chrom
  10580. Do chrominance filtering, too (default).
  10581. @item y/nochrom
  10582. Do luminance filtering only (no chrominance).
  10583. @item n/noluma
  10584. Do chrominance filtering only (no luminance).
  10585. @end table
  10586. These options can be appended after the subfilter name, separated by a '|'.
  10587. Available subfilters are:
  10588. @table @option
  10589. @item hb/hdeblock[|difference[|flatness]]
  10590. Horizontal deblocking filter
  10591. @table @option
  10592. @item difference
  10593. Difference factor where higher values mean more deblocking (default: @code{32}).
  10594. @item flatness
  10595. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10596. @end table
  10597. @item vb/vdeblock[|difference[|flatness]]
  10598. Vertical deblocking filter
  10599. @table @option
  10600. @item difference
  10601. Difference factor where higher values mean more deblocking (default: @code{32}).
  10602. @item flatness
  10603. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10604. @end table
  10605. @item ha/hadeblock[|difference[|flatness]]
  10606. Accurate horizontal deblocking filter
  10607. @table @option
  10608. @item difference
  10609. Difference factor where higher values mean more deblocking (default: @code{32}).
  10610. @item flatness
  10611. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10612. @end table
  10613. @item va/vadeblock[|difference[|flatness]]
  10614. Accurate vertical deblocking filter
  10615. @table @option
  10616. @item difference
  10617. Difference factor where higher values mean more deblocking (default: @code{32}).
  10618. @item flatness
  10619. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10620. @end table
  10621. @end table
  10622. The horizontal and vertical deblocking filters share the difference and
  10623. flatness values so you cannot set different horizontal and vertical
  10624. thresholds.
  10625. @table @option
  10626. @item h1/x1hdeblock
  10627. Experimental horizontal deblocking filter
  10628. @item v1/x1vdeblock
  10629. Experimental vertical deblocking filter
  10630. @item dr/dering
  10631. Deringing filter
  10632. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10633. @table @option
  10634. @item threshold1
  10635. larger -> stronger filtering
  10636. @item threshold2
  10637. larger -> stronger filtering
  10638. @item threshold3
  10639. larger -> stronger filtering
  10640. @end table
  10641. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10642. @table @option
  10643. @item f/fullyrange
  10644. Stretch luminance to @code{0-255}.
  10645. @end table
  10646. @item lb/linblenddeint
  10647. Linear blend deinterlacing filter that deinterlaces the given block by
  10648. filtering all lines with a @code{(1 2 1)} filter.
  10649. @item li/linipoldeint
  10650. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10651. linearly interpolating every second line.
  10652. @item ci/cubicipoldeint
  10653. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10654. cubically interpolating every second line.
  10655. @item md/mediandeint
  10656. Median deinterlacing filter that deinterlaces the given block by applying a
  10657. median filter to every second line.
  10658. @item fd/ffmpegdeint
  10659. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10660. second line with a @code{(-1 4 2 4 -1)} filter.
  10661. @item l5/lowpass5
  10662. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10663. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10664. @item fq/forceQuant[|quantizer]
  10665. Overrides the quantizer table from the input with the constant quantizer you
  10666. specify.
  10667. @table @option
  10668. @item quantizer
  10669. Quantizer to use
  10670. @end table
  10671. @item de/default
  10672. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10673. @item fa/fast
  10674. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10675. @item ac
  10676. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10677. @end table
  10678. @subsection Examples
  10679. @itemize
  10680. @item
  10681. Apply horizontal and vertical deblocking, deringing and automatic
  10682. brightness/contrast:
  10683. @example
  10684. pp=hb/vb/dr/al
  10685. @end example
  10686. @item
  10687. Apply default filters without brightness/contrast correction:
  10688. @example
  10689. pp=de/-al
  10690. @end example
  10691. @item
  10692. Apply default filters and temporal denoiser:
  10693. @example
  10694. pp=default/tmpnoise|1|2|3
  10695. @end example
  10696. @item
  10697. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10698. automatically depending on available CPU time:
  10699. @example
  10700. pp=hb|y/vb|a
  10701. @end example
  10702. @end itemize
  10703. @section pp7
  10704. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10705. similar to spp = 6 with 7 point DCT, where only the center sample is
  10706. used after IDCT.
  10707. The filter accepts the following options:
  10708. @table @option
  10709. @item qp
  10710. Force a constant quantization parameter. It accepts an integer in range
  10711. 0 to 63. If not set, the filter will use the QP from the video stream
  10712. (if available).
  10713. @item mode
  10714. Set thresholding mode. Available modes are:
  10715. @table @samp
  10716. @item hard
  10717. Set hard thresholding.
  10718. @item soft
  10719. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10720. @item medium
  10721. Set medium thresholding (good results, default).
  10722. @end table
  10723. @end table
  10724. @section premultiply
  10725. Apply alpha premultiply effect to input video stream using first plane
  10726. of second stream as alpha.
  10727. Both streams must have same dimensions and same pixel format.
  10728. The filter accepts the following option:
  10729. @table @option
  10730. @item planes
  10731. Set which planes will be processed, unprocessed planes will be copied.
  10732. By default value 0xf, all planes will be processed.
  10733. @item inplace
  10734. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10735. @end table
  10736. @section prewitt
  10737. Apply prewitt operator to input video stream.
  10738. The filter accepts the following option:
  10739. @table @option
  10740. @item planes
  10741. Set which planes will be processed, unprocessed planes will be copied.
  10742. By default value 0xf, all planes will be processed.
  10743. @item scale
  10744. Set value which will be multiplied with filtered result.
  10745. @item delta
  10746. Set value which will be added to filtered result.
  10747. @end table
  10748. @anchor{program_opencl}
  10749. @section program_opencl
  10750. Filter video using an OpenCL program.
  10751. @table @option
  10752. @item source
  10753. OpenCL program source file.
  10754. @item kernel
  10755. Kernel name in program.
  10756. @item inputs
  10757. Number of inputs to the filter. Defaults to 1.
  10758. @item size, s
  10759. Size of output frames. Defaults to the same as the first input.
  10760. @end table
  10761. The program source file must contain a kernel function with the given name,
  10762. which will be run once for each plane of the output. Each run on a plane
  10763. gets enqueued as a separate 2D global NDRange with one work-item for each
  10764. pixel to be generated. The global ID offset for each work-item is therefore
  10765. the coordinates of a pixel in the destination image.
  10766. The kernel function needs to take the following arguments:
  10767. @itemize
  10768. @item
  10769. Destination image, @var{__write_only image2d_t}.
  10770. This image will become the output; the kernel should write all of it.
  10771. @item
  10772. Frame index, @var{unsigned int}.
  10773. This is a counter starting from zero and increasing by one for each frame.
  10774. @item
  10775. Source images, @var{__read_only image2d_t}.
  10776. These are the most recent images on each input. The kernel may read from
  10777. them to generate the output, but they can't be written to.
  10778. @end itemize
  10779. Example programs:
  10780. @itemize
  10781. @item
  10782. Copy the input to the output (output must be the same size as the input).
  10783. @verbatim
  10784. __kernel void copy(__write_only image2d_t destination,
  10785. unsigned int index,
  10786. __read_only image2d_t source)
  10787. {
  10788. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10789. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10790. float4 value = read_imagef(source, sampler, location);
  10791. write_imagef(destination, location, value);
  10792. }
  10793. @end verbatim
  10794. @item
  10795. Apply a simple transformation, rotating the input by an amount increasing
  10796. with the index counter. Pixel values are linearly interpolated by the
  10797. sampler, and the output need not have the same dimensions as the input.
  10798. @verbatim
  10799. __kernel void rotate_image(__write_only image2d_t dst,
  10800. unsigned int index,
  10801. __read_only image2d_t src)
  10802. {
  10803. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10804. CLK_FILTER_LINEAR);
  10805. float angle = (float)index / 100.0f;
  10806. float2 dst_dim = convert_float2(get_image_dim(dst));
  10807. float2 src_dim = convert_float2(get_image_dim(src));
  10808. float2 dst_cen = dst_dim / 2.0f;
  10809. float2 src_cen = src_dim / 2.0f;
  10810. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10811. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10812. float2 src_pos = {
  10813. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10814. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10815. };
  10816. src_pos = src_pos * src_dim / dst_dim;
  10817. float2 src_loc = src_pos + src_cen;
  10818. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10819. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10820. write_imagef(dst, dst_loc, 0.5f);
  10821. else
  10822. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10823. }
  10824. @end verbatim
  10825. @item
  10826. Blend two inputs together, with the amount of each input used varying
  10827. with the index counter.
  10828. @verbatim
  10829. __kernel void blend_images(__write_only image2d_t dst,
  10830. unsigned int index,
  10831. __read_only image2d_t src1,
  10832. __read_only image2d_t src2)
  10833. {
  10834. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10835. CLK_FILTER_LINEAR);
  10836. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10837. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10838. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10839. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10840. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10841. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10842. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10843. }
  10844. @end verbatim
  10845. @end itemize
  10846. @section pseudocolor
  10847. Alter frame colors in video with pseudocolors.
  10848. This filter accept the following options:
  10849. @table @option
  10850. @item c0
  10851. set pixel first component expression
  10852. @item c1
  10853. set pixel second component expression
  10854. @item c2
  10855. set pixel third component expression
  10856. @item c3
  10857. set pixel fourth component expression, corresponds to the alpha component
  10858. @item i
  10859. set component to use as base for altering colors
  10860. @end table
  10861. Each of them specifies the expression to use for computing the lookup table for
  10862. the corresponding pixel component values.
  10863. The expressions can contain the following constants and functions:
  10864. @table @option
  10865. @item w
  10866. @item h
  10867. The input width and height.
  10868. @item val
  10869. The input value for the pixel component.
  10870. @item ymin, umin, vmin, amin
  10871. The minimum allowed component value.
  10872. @item ymax, umax, vmax, amax
  10873. The maximum allowed component value.
  10874. @end table
  10875. All expressions default to "val".
  10876. @subsection Examples
  10877. @itemize
  10878. @item
  10879. Change too high luma values to gradient:
  10880. @example
  10881. 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'"
  10882. @end example
  10883. @end itemize
  10884. @section psnr
  10885. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10886. Ratio) between two input videos.
  10887. This filter takes in input two input videos, the first input is
  10888. considered the "main" source and is passed unchanged to the
  10889. output. The second input is used as a "reference" video for computing
  10890. the PSNR.
  10891. Both video inputs must have the same resolution and pixel format for
  10892. this filter to work correctly. Also it assumes that both inputs
  10893. have the same number of frames, which are compared one by one.
  10894. The obtained average PSNR is printed through the logging system.
  10895. The filter stores the accumulated MSE (mean squared error) of each
  10896. frame, and at the end of the processing it is averaged across all frames
  10897. equally, and the following formula is applied to obtain the PSNR:
  10898. @example
  10899. PSNR = 10*log10(MAX^2/MSE)
  10900. @end example
  10901. Where MAX is the average of the maximum values of each component of the
  10902. image.
  10903. The description of the accepted parameters follows.
  10904. @table @option
  10905. @item stats_file, f
  10906. If specified the filter will use the named file to save the PSNR of
  10907. each individual frame. When filename equals "-" the data is sent to
  10908. standard output.
  10909. @item stats_version
  10910. Specifies which version of the stats file format to use. Details of
  10911. each format are written below.
  10912. Default value is 1.
  10913. @item stats_add_max
  10914. Determines whether the max value is output to the stats log.
  10915. Default value is 0.
  10916. Requires stats_version >= 2. If this is set and stats_version < 2,
  10917. the filter will return an error.
  10918. @end table
  10919. This filter also supports the @ref{framesync} options.
  10920. The file printed if @var{stats_file} is selected, contains a sequence of
  10921. key/value pairs of the form @var{key}:@var{value} for each compared
  10922. couple of frames.
  10923. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10924. the list of per-frame-pair stats, with key value pairs following the frame
  10925. format with the following parameters:
  10926. @table @option
  10927. @item psnr_log_version
  10928. The version of the log file format. Will match @var{stats_version}.
  10929. @item fields
  10930. A comma separated list of the per-frame-pair parameters included in
  10931. the log.
  10932. @end table
  10933. A description of each shown per-frame-pair parameter follows:
  10934. @table @option
  10935. @item n
  10936. sequential number of the input frame, starting from 1
  10937. @item mse_avg
  10938. Mean Square Error pixel-by-pixel average difference of the compared
  10939. frames, averaged over all the image components.
  10940. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10941. Mean Square Error pixel-by-pixel average difference of the compared
  10942. frames for the component specified by the suffix.
  10943. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10944. Peak Signal to Noise ratio of the compared frames for the component
  10945. specified by the suffix.
  10946. @item max_avg, max_y, max_u, max_v
  10947. Maximum allowed value for each channel, and average over all
  10948. channels.
  10949. @end table
  10950. For example:
  10951. @example
  10952. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10953. [main][ref] psnr="stats_file=stats.log" [out]
  10954. @end example
  10955. On this example the input file being processed is compared with the
  10956. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10957. is stored in @file{stats.log}.
  10958. @anchor{pullup}
  10959. @section pullup
  10960. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10961. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10962. content.
  10963. The pullup filter is designed to take advantage of future context in making
  10964. its decisions. This filter is stateless in the sense that it does not lock
  10965. onto a pattern to follow, but it instead looks forward to the following
  10966. fields in order to identify matches and rebuild progressive frames.
  10967. To produce content with an even framerate, insert the fps filter after
  10968. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10969. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10970. The filter accepts the following options:
  10971. @table @option
  10972. @item jl
  10973. @item jr
  10974. @item jt
  10975. @item jb
  10976. These options set the amount of "junk" to ignore at the left, right, top, and
  10977. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10978. while top and bottom are in units of 2 lines.
  10979. The default is 8 pixels on each side.
  10980. @item sb
  10981. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10982. filter generating an occasional mismatched frame, but it may also cause an
  10983. excessive number of frames to be dropped during high motion sequences.
  10984. Conversely, setting it to -1 will make filter match fields more easily.
  10985. This may help processing of video where there is slight blurring between
  10986. the fields, but may also cause there to be interlaced frames in the output.
  10987. Default value is @code{0}.
  10988. @item mp
  10989. Set the metric plane to use. It accepts the following values:
  10990. @table @samp
  10991. @item l
  10992. Use luma plane.
  10993. @item u
  10994. Use chroma blue plane.
  10995. @item v
  10996. Use chroma red plane.
  10997. @end table
  10998. This option may be set to use chroma plane instead of the default luma plane
  10999. for doing filter's computations. This may improve accuracy on very clean
  11000. source material, but more likely will decrease accuracy, especially if there
  11001. is chroma noise (rainbow effect) or any grayscale video.
  11002. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11003. load and make pullup usable in realtime on slow machines.
  11004. @end table
  11005. For best results (without duplicated frames in the output file) it is
  11006. necessary to change the output frame rate. For example, to inverse
  11007. telecine NTSC input:
  11008. @example
  11009. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11010. @end example
  11011. @section qp
  11012. Change video quantization parameters (QP).
  11013. The filter accepts the following option:
  11014. @table @option
  11015. @item qp
  11016. Set expression for quantization parameter.
  11017. @end table
  11018. The expression is evaluated through the eval API and can contain, among others,
  11019. the following constants:
  11020. @table @var
  11021. @item known
  11022. 1 if index is not 129, 0 otherwise.
  11023. @item qp
  11024. Sequential index starting from -129 to 128.
  11025. @end table
  11026. @subsection Examples
  11027. @itemize
  11028. @item
  11029. Some equation like:
  11030. @example
  11031. qp=2+2*sin(PI*qp)
  11032. @end example
  11033. @end itemize
  11034. @section random
  11035. Flush video frames from internal cache of frames into a random order.
  11036. No frame is discarded.
  11037. Inspired by @ref{frei0r} nervous filter.
  11038. @table @option
  11039. @item frames
  11040. Set size in number of frames of internal cache, in range from @code{2} to
  11041. @code{512}. Default is @code{30}.
  11042. @item seed
  11043. Set seed for random number generator, must be an integer included between
  11044. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11045. less than @code{0}, the filter will try to use a good random seed on a
  11046. best effort basis.
  11047. @end table
  11048. @section readeia608
  11049. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11050. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11051. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11052. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11053. @table @option
  11054. @item lavfi.readeia608.X.cc
  11055. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11056. @item lavfi.readeia608.X.line
  11057. The number of the line on which the EIA-608 data was identified and read.
  11058. @end table
  11059. This filter accepts the following options:
  11060. @table @option
  11061. @item scan_min
  11062. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11063. @item scan_max
  11064. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11065. @item mac
  11066. Set minimal acceptable amplitude change for sync codes detection.
  11067. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11068. @item spw
  11069. Set the ratio of width reserved for sync code detection.
  11070. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11071. @item mhd
  11072. Set the max peaks height difference for sync code detection.
  11073. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11074. @item mpd
  11075. Set max peaks period difference for sync code detection.
  11076. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11077. @item msd
  11078. Set the first two max start code bits differences.
  11079. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11080. @item bhd
  11081. Set the minimum ratio of bits height compared to 3rd start code bit.
  11082. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11083. @item th_w
  11084. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11085. @item th_b
  11086. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11087. @item chp
  11088. Enable checking the parity bit. In the event of a parity error, the filter will output
  11089. @code{0x00} for that character. Default is false.
  11090. @end table
  11091. @subsection Examples
  11092. @itemize
  11093. @item
  11094. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11095. @example
  11096. 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
  11097. @end example
  11098. @end itemize
  11099. @section readvitc
  11100. Read vertical interval timecode (VITC) information from the top lines of a
  11101. video frame.
  11102. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11103. timecode value, if a valid timecode has been detected. Further metadata key
  11104. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11105. timecode data has been found or not.
  11106. This filter accepts the following options:
  11107. @table @option
  11108. @item scan_max
  11109. Set the maximum number of lines to scan for VITC data. If the value is set to
  11110. @code{-1} the full video frame is scanned. Default is @code{45}.
  11111. @item thr_b
  11112. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11113. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11114. @item thr_w
  11115. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11116. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11117. @end table
  11118. @subsection Examples
  11119. @itemize
  11120. @item
  11121. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11122. draw @code{--:--:--:--} as a placeholder:
  11123. @example
  11124. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11125. @end example
  11126. @end itemize
  11127. @section remap
  11128. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11129. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11130. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11131. value for pixel will be used for destination pixel.
  11132. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11133. will have Xmap/Ymap video stream dimensions.
  11134. Xmap and Ymap input video streams are 16bit depth, single channel.
  11135. @section removegrain
  11136. The removegrain filter is a spatial denoiser for progressive video.
  11137. @table @option
  11138. @item m0
  11139. Set mode for the first plane.
  11140. @item m1
  11141. Set mode for the second plane.
  11142. @item m2
  11143. Set mode for the third plane.
  11144. @item m3
  11145. Set mode for the fourth plane.
  11146. @end table
  11147. Range of mode is from 0 to 24. Description of each mode follows:
  11148. @table @var
  11149. @item 0
  11150. Leave input plane unchanged. Default.
  11151. @item 1
  11152. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11153. @item 2
  11154. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11155. @item 3
  11156. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11157. @item 4
  11158. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11159. This is equivalent to a median filter.
  11160. @item 5
  11161. Line-sensitive clipping giving the minimal change.
  11162. @item 6
  11163. Line-sensitive clipping, intermediate.
  11164. @item 7
  11165. Line-sensitive clipping, intermediate.
  11166. @item 8
  11167. Line-sensitive clipping, intermediate.
  11168. @item 9
  11169. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11170. @item 10
  11171. Replaces the target pixel with the closest neighbour.
  11172. @item 11
  11173. [1 2 1] horizontal and vertical kernel blur.
  11174. @item 12
  11175. Same as mode 11.
  11176. @item 13
  11177. Bob mode, interpolates top field from the line where the neighbours
  11178. pixels are the closest.
  11179. @item 14
  11180. Bob mode, interpolates bottom field from the line where the neighbours
  11181. pixels are the closest.
  11182. @item 15
  11183. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11184. interpolation formula.
  11185. @item 16
  11186. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11187. interpolation formula.
  11188. @item 17
  11189. Clips the pixel with the minimum and maximum of respectively the maximum and
  11190. minimum of each pair of opposite neighbour pixels.
  11191. @item 18
  11192. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11193. the current pixel is minimal.
  11194. @item 19
  11195. Replaces the pixel with the average of its 8 neighbours.
  11196. @item 20
  11197. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11198. @item 21
  11199. Clips pixels using the averages of opposite neighbour.
  11200. @item 22
  11201. Same as mode 21 but simpler and faster.
  11202. @item 23
  11203. Small edge and halo removal, but reputed useless.
  11204. @item 24
  11205. Similar as 23.
  11206. @end table
  11207. @section removelogo
  11208. Suppress a TV station logo, using an image file to determine which
  11209. pixels comprise the logo. It works by filling in the pixels that
  11210. comprise the logo with neighboring pixels.
  11211. The filter accepts the following options:
  11212. @table @option
  11213. @item filename, f
  11214. Set the filter bitmap file, which can be any image format supported by
  11215. libavformat. The width and height of the image file must match those of the
  11216. video stream being processed.
  11217. @end table
  11218. Pixels in the provided bitmap image with a value of zero are not
  11219. considered part of the logo, non-zero pixels are considered part of
  11220. the logo. If you use white (255) for the logo and black (0) for the
  11221. rest, you will be safe. For making the filter bitmap, it is
  11222. recommended to take a screen capture of a black frame with the logo
  11223. visible, and then using a threshold filter followed by the erode
  11224. filter once or twice.
  11225. If needed, little splotches can be fixed manually. Remember that if
  11226. logo pixels are not covered, the filter quality will be much
  11227. reduced. Marking too many pixels as part of the logo does not hurt as
  11228. much, but it will increase the amount of blurring needed to cover over
  11229. the image and will destroy more information than necessary, and extra
  11230. pixels will slow things down on a large logo.
  11231. @section repeatfields
  11232. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11233. fields based on its value.
  11234. @section reverse
  11235. Reverse a video clip.
  11236. Warning: This filter requires memory to buffer the entire clip, so trimming
  11237. is suggested.
  11238. @subsection Examples
  11239. @itemize
  11240. @item
  11241. Take the first 5 seconds of a clip, and reverse it.
  11242. @example
  11243. trim=end=5,reverse
  11244. @end example
  11245. @end itemize
  11246. @section rgbashift
  11247. Shift R/G/B/A pixels horizontally and/or vertically.
  11248. The filter accepts the following options:
  11249. @table @option
  11250. @item rh
  11251. Set amount to shift red horizontally.
  11252. @item rv
  11253. Set amount to shift red vertically.
  11254. @item gh
  11255. Set amount to shift green horizontally.
  11256. @item gv
  11257. Set amount to shift green vertically.
  11258. @item bh
  11259. Set amount to shift blue horizontally.
  11260. @item bv
  11261. Set amount to shift blue vertically.
  11262. @item ah
  11263. Set amount to shift alpha horizontally.
  11264. @item av
  11265. Set amount to shift alpha vertically.
  11266. @item edge
  11267. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11268. @end table
  11269. @section roberts
  11270. Apply roberts cross operator to input video stream.
  11271. The filter accepts the following option:
  11272. @table @option
  11273. @item planes
  11274. Set which planes will be processed, unprocessed planes will be copied.
  11275. By default value 0xf, all planes will be processed.
  11276. @item scale
  11277. Set value which will be multiplied with filtered result.
  11278. @item delta
  11279. Set value which will be added to filtered result.
  11280. @end table
  11281. @section rotate
  11282. Rotate video by an arbitrary angle expressed in radians.
  11283. The filter accepts the following options:
  11284. A description of the optional parameters follows.
  11285. @table @option
  11286. @item angle, a
  11287. Set an expression for the angle by which to rotate the input video
  11288. clockwise, expressed as a number of radians. A negative value will
  11289. result in a counter-clockwise rotation. By default it is set to "0".
  11290. This expression is evaluated for each frame.
  11291. @item out_w, ow
  11292. Set the output width expression, default value is "iw".
  11293. This expression is evaluated just once during configuration.
  11294. @item out_h, oh
  11295. Set the output height expression, default value is "ih".
  11296. This expression is evaluated just once during configuration.
  11297. @item bilinear
  11298. Enable bilinear interpolation if set to 1, a value of 0 disables
  11299. it. Default value is 1.
  11300. @item fillcolor, c
  11301. Set the color used to fill the output area not covered by the rotated
  11302. image. For the general syntax of this option, check the
  11303. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11304. If the special value "none" is selected then no
  11305. background is printed (useful for example if the background is never shown).
  11306. Default value is "black".
  11307. @end table
  11308. The expressions for the angle and the output size can contain the
  11309. following constants and functions:
  11310. @table @option
  11311. @item n
  11312. sequential number of the input frame, starting from 0. It is always NAN
  11313. before the first frame is filtered.
  11314. @item t
  11315. time in seconds of the input frame, it is set to 0 when the filter is
  11316. configured. It is always NAN before the first frame is filtered.
  11317. @item hsub
  11318. @item vsub
  11319. horizontal and vertical chroma subsample values. For example for the
  11320. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11321. @item in_w, iw
  11322. @item in_h, ih
  11323. the input video width and height
  11324. @item out_w, ow
  11325. @item out_h, oh
  11326. the output width and height, that is the size of the padded area as
  11327. specified by the @var{width} and @var{height} expressions
  11328. @item rotw(a)
  11329. @item roth(a)
  11330. the minimal width/height required for completely containing the input
  11331. video rotated by @var{a} radians.
  11332. These are only available when computing the @option{out_w} and
  11333. @option{out_h} expressions.
  11334. @end table
  11335. @subsection Examples
  11336. @itemize
  11337. @item
  11338. Rotate the input by PI/6 radians clockwise:
  11339. @example
  11340. rotate=PI/6
  11341. @end example
  11342. @item
  11343. Rotate the input by PI/6 radians counter-clockwise:
  11344. @example
  11345. rotate=-PI/6
  11346. @end example
  11347. @item
  11348. Rotate the input by 45 degrees clockwise:
  11349. @example
  11350. rotate=45*PI/180
  11351. @end example
  11352. @item
  11353. Apply a constant rotation with period T, starting from an angle of PI/3:
  11354. @example
  11355. rotate=PI/3+2*PI*t/T
  11356. @end example
  11357. @item
  11358. Make the input video rotation oscillating with a period of T
  11359. seconds and an amplitude of A radians:
  11360. @example
  11361. rotate=A*sin(2*PI/T*t)
  11362. @end example
  11363. @item
  11364. Rotate the video, output size is chosen so that the whole rotating
  11365. input video is always completely contained in the output:
  11366. @example
  11367. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11368. @end example
  11369. @item
  11370. Rotate the video, reduce the output size so that no background is ever
  11371. shown:
  11372. @example
  11373. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11374. @end example
  11375. @end itemize
  11376. @subsection Commands
  11377. The filter supports the following commands:
  11378. @table @option
  11379. @item a, angle
  11380. Set the angle expression.
  11381. The command accepts the same syntax of the corresponding option.
  11382. If the specified expression is not valid, it is kept at its current
  11383. value.
  11384. @end table
  11385. @section sab
  11386. Apply Shape Adaptive Blur.
  11387. The filter accepts the following options:
  11388. @table @option
  11389. @item luma_radius, lr
  11390. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11391. value is 1.0. A greater value will result in a more blurred image, and
  11392. in slower processing.
  11393. @item luma_pre_filter_radius, lpfr
  11394. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11395. value is 1.0.
  11396. @item luma_strength, ls
  11397. Set luma maximum difference between pixels to still be considered, must
  11398. be a value in the 0.1-100.0 range, default value is 1.0.
  11399. @item chroma_radius, cr
  11400. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11401. greater value will result in a more blurred image, and in slower
  11402. processing.
  11403. @item chroma_pre_filter_radius, cpfr
  11404. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11405. @item chroma_strength, cs
  11406. Set chroma maximum difference between pixels to still be considered,
  11407. must be a value in the -0.9-100.0 range.
  11408. @end table
  11409. Each chroma option value, if not explicitly specified, is set to the
  11410. corresponding luma option value.
  11411. @anchor{scale}
  11412. @section scale
  11413. Scale (resize) the input video, using the libswscale library.
  11414. The scale filter forces the output display aspect ratio to be the same
  11415. of the input, by changing the output sample aspect ratio.
  11416. If the input image format is different from the format requested by
  11417. the next filter, the scale filter will convert the input to the
  11418. requested format.
  11419. @subsection Options
  11420. The filter accepts the following options, or any of the options
  11421. supported by the libswscale scaler.
  11422. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11423. the complete list of scaler options.
  11424. @table @option
  11425. @item width, w
  11426. @item height, h
  11427. Set the output video dimension expression. Default value is the input
  11428. dimension.
  11429. If the @var{width} or @var{w} value is 0, the input width is used for
  11430. the output. If the @var{height} or @var{h} value is 0, the input height
  11431. is used for the output.
  11432. If one and only one of the values is -n with n >= 1, the scale filter
  11433. will use a value that maintains the aspect ratio of the input image,
  11434. calculated from the other specified dimension. After that it will,
  11435. however, make sure that the calculated dimension is divisible by n and
  11436. adjust the value if necessary.
  11437. If both values are -n with n >= 1, the behavior will be identical to
  11438. both values being set to 0 as previously detailed.
  11439. See below for the list of accepted constants for use in the dimension
  11440. expression.
  11441. @item eval
  11442. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11443. @table @samp
  11444. @item init
  11445. Only evaluate expressions once during the filter initialization or when a command is processed.
  11446. @item frame
  11447. Evaluate expressions for each incoming frame.
  11448. @end table
  11449. Default value is @samp{init}.
  11450. @item interl
  11451. Set the interlacing mode. It accepts the following values:
  11452. @table @samp
  11453. @item 1
  11454. Force interlaced aware scaling.
  11455. @item 0
  11456. Do not apply interlaced scaling.
  11457. @item -1
  11458. Select interlaced aware scaling depending on whether the source frames
  11459. are flagged as interlaced or not.
  11460. @end table
  11461. Default value is @samp{0}.
  11462. @item flags
  11463. Set libswscale scaling flags. See
  11464. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11465. complete list of values. If not explicitly specified the filter applies
  11466. the default flags.
  11467. @item param0, param1
  11468. Set libswscale input parameters for scaling algorithms that need them. See
  11469. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11470. complete documentation. If not explicitly specified the filter applies
  11471. empty parameters.
  11472. @item size, s
  11473. Set the video size. For the syntax of this option, check the
  11474. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11475. @item in_color_matrix
  11476. @item out_color_matrix
  11477. Set in/output YCbCr color space type.
  11478. This allows the autodetected value to be overridden as well as allows forcing
  11479. a specific value used for the output and encoder.
  11480. If not specified, the color space type depends on the pixel format.
  11481. Possible values:
  11482. @table @samp
  11483. @item auto
  11484. Choose automatically.
  11485. @item bt709
  11486. Format conforming to International Telecommunication Union (ITU)
  11487. Recommendation BT.709.
  11488. @item fcc
  11489. Set color space conforming to the United States Federal Communications
  11490. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11491. @item bt601
  11492. Set color space conforming to:
  11493. @itemize
  11494. @item
  11495. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11496. @item
  11497. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11498. @item
  11499. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11500. @end itemize
  11501. @item smpte240m
  11502. Set color space conforming to SMPTE ST 240:1999.
  11503. @end table
  11504. @item in_range
  11505. @item out_range
  11506. Set in/output YCbCr sample range.
  11507. This allows the autodetected value to be overridden as well as allows forcing
  11508. a specific value used for the output and encoder. If not specified, the
  11509. range depends on the pixel format. Possible values:
  11510. @table @samp
  11511. @item auto/unknown
  11512. Choose automatically.
  11513. @item jpeg/full/pc
  11514. Set full range (0-255 in case of 8-bit luma).
  11515. @item mpeg/limited/tv
  11516. Set "MPEG" range (16-235 in case of 8-bit luma).
  11517. @end table
  11518. @item force_original_aspect_ratio
  11519. Enable decreasing or increasing output video width or height if necessary to
  11520. keep the original aspect ratio. Possible values:
  11521. @table @samp
  11522. @item disable
  11523. Scale the video as specified and disable this feature.
  11524. @item decrease
  11525. The output video dimensions will automatically be decreased if needed.
  11526. @item increase
  11527. The output video dimensions will automatically be increased if needed.
  11528. @end table
  11529. One useful instance of this option is that when you know a specific device's
  11530. maximum allowed resolution, you can use this to limit the output video to
  11531. that, while retaining the aspect ratio. For example, device A allows
  11532. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11533. decrease) and specifying 1280x720 to the command line makes the output
  11534. 1280x533.
  11535. Please note that this is a different thing than specifying -1 for @option{w}
  11536. or @option{h}, you still need to specify the output resolution for this option
  11537. to work.
  11538. @end table
  11539. The values of the @option{w} and @option{h} options are expressions
  11540. containing the following constants:
  11541. @table @var
  11542. @item in_w
  11543. @item in_h
  11544. The input width and height
  11545. @item iw
  11546. @item ih
  11547. These are the same as @var{in_w} and @var{in_h}.
  11548. @item out_w
  11549. @item out_h
  11550. The output (scaled) width and height
  11551. @item ow
  11552. @item oh
  11553. These are the same as @var{out_w} and @var{out_h}
  11554. @item a
  11555. The same as @var{iw} / @var{ih}
  11556. @item sar
  11557. input sample aspect ratio
  11558. @item dar
  11559. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11560. @item hsub
  11561. @item vsub
  11562. horizontal and vertical input chroma subsample values. For example for the
  11563. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11564. @item ohsub
  11565. @item ovsub
  11566. horizontal and vertical output chroma subsample values. For example for the
  11567. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11568. @end table
  11569. @subsection Examples
  11570. @itemize
  11571. @item
  11572. Scale the input video to a size of 200x100
  11573. @example
  11574. scale=w=200:h=100
  11575. @end example
  11576. This is equivalent to:
  11577. @example
  11578. scale=200:100
  11579. @end example
  11580. or:
  11581. @example
  11582. scale=200x100
  11583. @end example
  11584. @item
  11585. Specify a size abbreviation for the output size:
  11586. @example
  11587. scale=qcif
  11588. @end example
  11589. which can also be written as:
  11590. @example
  11591. scale=size=qcif
  11592. @end example
  11593. @item
  11594. Scale the input to 2x:
  11595. @example
  11596. scale=w=2*iw:h=2*ih
  11597. @end example
  11598. @item
  11599. The above is the same as:
  11600. @example
  11601. scale=2*in_w:2*in_h
  11602. @end example
  11603. @item
  11604. Scale the input to 2x with forced interlaced scaling:
  11605. @example
  11606. scale=2*iw:2*ih:interl=1
  11607. @end example
  11608. @item
  11609. Scale the input to half size:
  11610. @example
  11611. scale=w=iw/2:h=ih/2
  11612. @end example
  11613. @item
  11614. Increase the width, and set the height to the same size:
  11615. @example
  11616. scale=3/2*iw:ow
  11617. @end example
  11618. @item
  11619. Seek Greek harmony:
  11620. @example
  11621. scale=iw:1/PHI*iw
  11622. scale=ih*PHI:ih
  11623. @end example
  11624. @item
  11625. Increase the height, and set the width to 3/2 of the height:
  11626. @example
  11627. scale=w=3/2*oh:h=3/5*ih
  11628. @end example
  11629. @item
  11630. Increase the size, making the size a multiple of the chroma
  11631. subsample values:
  11632. @example
  11633. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11634. @end example
  11635. @item
  11636. Increase the width to a maximum of 500 pixels,
  11637. keeping the same aspect ratio as the input:
  11638. @example
  11639. scale=w='min(500\, iw*3/2):h=-1'
  11640. @end example
  11641. @item
  11642. Make pixels square by combining scale and setsar:
  11643. @example
  11644. scale='trunc(ih*dar):ih',setsar=1/1
  11645. @end example
  11646. @item
  11647. Make pixels square by combining scale and setsar,
  11648. making sure the resulting resolution is even (required by some codecs):
  11649. @example
  11650. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11651. @end example
  11652. @end itemize
  11653. @subsection Commands
  11654. This filter supports the following commands:
  11655. @table @option
  11656. @item width, w
  11657. @item height, h
  11658. Set the output video dimension expression.
  11659. The command accepts the same syntax of the corresponding option.
  11660. If the specified expression is not valid, it is kept at its current
  11661. value.
  11662. @end table
  11663. @section scale_npp
  11664. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11665. format conversion on CUDA video frames. Setting the output width and height
  11666. works in the same way as for the @var{scale} filter.
  11667. The following additional options are accepted:
  11668. @table @option
  11669. @item format
  11670. The pixel format of the output CUDA frames. If set to the string "same" (the
  11671. default), the input format will be kept. Note that automatic format negotiation
  11672. and conversion is not yet supported for hardware frames
  11673. @item interp_algo
  11674. The interpolation algorithm used for resizing. One of the following:
  11675. @table @option
  11676. @item nn
  11677. Nearest neighbour.
  11678. @item linear
  11679. @item cubic
  11680. @item cubic2p_bspline
  11681. 2-parameter cubic (B=1, C=0)
  11682. @item cubic2p_catmullrom
  11683. 2-parameter cubic (B=0, C=1/2)
  11684. @item cubic2p_b05c03
  11685. 2-parameter cubic (B=1/2, C=3/10)
  11686. @item super
  11687. Supersampling
  11688. @item lanczos
  11689. @end table
  11690. @end table
  11691. @section scale2ref
  11692. Scale (resize) the input video, based on a reference video.
  11693. See the scale filter for available options, scale2ref supports the same but
  11694. uses the reference video instead of the main input as basis. scale2ref also
  11695. supports the following additional constants for the @option{w} and
  11696. @option{h} options:
  11697. @table @var
  11698. @item main_w
  11699. @item main_h
  11700. The main input video's width and height
  11701. @item main_a
  11702. The same as @var{main_w} / @var{main_h}
  11703. @item main_sar
  11704. The main input video's sample aspect ratio
  11705. @item main_dar, mdar
  11706. The main input video's display aspect ratio. Calculated from
  11707. @code{(main_w / main_h) * main_sar}.
  11708. @item main_hsub
  11709. @item main_vsub
  11710. The main input video's horizontal and vertical chroma subsample values.
  11711. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11712. is 1.
  11713. @end table
  11714. @subsection Examples
  11715. @itemize
  11716. @item
  11717. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11718. @example
  11719. 'scale2ref[b][a];[a][b]overlay'
  11720. @end example
  11721. @item
  11722. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  11723. @example
  11724. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  11725. @end example
  11726. @end itemize
  11727. @anchor{selectivecolor}
  11728. @section selectivecolor
  11729. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11730. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11731. by the "purity" of the color (that is, how saturated it already is).
  11732. This filter is similar to the Adobe Photoshop Selective Color tool.
  11733. The filter accepts the following options:
  11734. @table @option
  11735. @item correction_method
  11736. Select color correction method.
  11737. Available values are:
  11738. @table @samp
  11739. @item absolute
  11740. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11741. component value).
  11742. @item relative
  11743. Specified adjustments are relative to the original component value.
  11744. @end table
  11745. Default is @code{absolute}.
  11746. @item reds
  11747. Adjustments for red pixels (pixels where the red component is the maximum)
  11748. @item yellows
  11749. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11750. @item greens
  11751. Adjustments for green pixels (pixels where the green component is the maximum)
  11752. @item cyans
  11753. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11754. @item blues
  11755. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11756. @item magentas
  11757. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11758. @item whites
  11759. Adjustments for white pixels (pixels where all components are greater than 128)
  11760. @item neutrals
  11761. Adjustments for all pixels except pure black and pure white
  11762. @item blacks
  11763. Adjustments for black pixels (pixels where all components are lesser than 128)
  11764. @item psfile
  11765. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11766. @end table
  11767. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11768. 4 space separated floating point adjustment values in the [-1,1] range,
  11769. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11770. pixels of its range.
  11771. @subsection Examples
  11772. @itemize
  11773. @item
  11774. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11775. increase magenta by 27% in blue areas:
  11776. @example
  11777. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11778. @end example
  11779. @item
  11780. Use a Photoshop selective color preset:
  11781. @example
  11782. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11783. @end example
  11784. @end itemize
  11785. @anchor{separatefields}
  11786. @section separatefields
  11787. The @code{separatefields} takes a frame-based video input and splits
  11788. each frame into its components fields, producing a new half height clip
  11789. with twice the frame rate and twice the frame count.
  11790. This filter use field-dominance information in frame to decide which
  11791. of each pair of fields to place first in the output.
  11792. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11793. @section setdar, setsar
  11794. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11795. output video.
  11796. This is done by changing the specified Sample (aka Pixel) Aspect
  11797. Ratio, according to the following equation:
  11798. @example
  11799. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11800. @end example
  11801. Keep in mind that the @code{setdar} filter does not modify the pixel
  11802. dimensions of the video frame. Also, the display aspect ratio set by
  11803. this filter may be changed by later filters in the filterchain,
  11804. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11805. applied.
  11806. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11807. the filter output video.
  11808. Note that as a consequence of the application of this filter, the
  11809. output display aspect ratio will change according to the equation
  11810. above.
  11811. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11812. filter may be changed by later filters in the filterchain, e.g. if
  11813. another "setsar" or a "setdar" filter is applied.
  11814. It accepts the following parameters:
  11815. @table @option
  11816. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11817. Set the aspect ratio used by the filter.
  11818. The parameter can be a floating point number string, an expression, or
  11819. a string of the form @var{num}:@var{den}, where @var{num} and
  11820. @var{den} are the numerator and denominator of the aspect ratio. If
  11821. the parameter is not specified, it is assumed the value "0".
  11822. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11823. should be escaped.
  11824. @item max
  11825. Set the maximum integer value to use for expressing numerator and
  11826. denominator when reducing the expressed aspect ratio to a rational.
  11827. Default value is @code{100}.
  11828. @end table
  11829. The parameter @var{sar} is an expression containing
  11830. the following constants:
  11831. @table @option
  11832. @item E, PI, PHI
  11833. These are approximated values for the mathematical constants e
  11834. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11835. @item w, h
  11836. The input width and height.
  11837. @item a
  11838. These are the same as @var{w} / @var{h}.
  11839. @item sar
  11840. The input sample aspect ratio.
  11841. @item dar
  11842. The input display aspect ratio. It is the same as
  11843. (@var{w} / @var{h}) * @var{sar}.
  11844. @item hsub, vsub
  11845. Horizontal and vertical chroma subsample values. For example, for the
  11846. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11847. @end table
  11848. @subsection Examples
  11849. @itemize
  11850. @item
  11851. To change the display aspect ratio to 16:9, specify one of the following:
  11852. @example
  11853. setdar=dar=1.77777
  11854. setdar=dar=16/9
  11855. @end example
  11856. @item
  11857. To change the sample aspect ratio to 10:11, specify:
  11858. @example
  11859. setsar=sar=10/11
  11860. @end example
  11861. @item
  11862. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11863. 1000 in the aspect ratio reduction, use the command:
  11864. @example
  11865. setdar=ratio=16/9:max=1000
  11866. @end example
  11867. @end itemize
  11868. @anchor{setfield}
  11869. @section setfield
  11870. Force field for the output video frame.
  11871. The @code{setfield} filter marks the interlace type field for the
  11872. output frames. It does not change the input frame, but only sets the
  11873. corresponding property, which affects how the frame is treated by
  11874. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11875. The filter accepts the following options:
  11876. @table @option
  11877. @item mode
  11878. Available values are:
  11879. @table @samp
  11880. @item auto
  11881. Keep the same field property.
  11882. @item bff
  11883. Mark the frame as bottom-field-first.
  11884. @item tff
  11885. Mark the frame as top-field-first.
  11886. @item prog
  11887. Mark the frame as progressive.
  11888. @end table
  11889. @end table
  11890. @anchor{setparams}
  11891. @section setparams
  11892. Force frame parameter for the output video frame.
  11893. The @code{setparams} filter marks interlace and color range for the
  11894. output frames. It does not change the input frame, but only sets the
  11895. corresponding property, which affects how the frame is treated by
  11896. filters/encoders.
  11897. @table @option
  11898. @item field_mode
  11899. Available values are:
  11900. @table @samp
  11901. @item auto
  11902. Keep the same field property (default).
  11903. @item bff
  11904. Mark the frame as bottom-field-first.
  11905. @item tff
  11906. Mark the frame as top-field-first.
  11907. @item prog
  11908. Mark the frame as progressive.
  11909. @end table
  11910. @item range
  11911. Available values are:
  11912. @table @samp
  11913. @item auto
  11914. Keep the same color range property (default).
  11915. @item unspecified, unknown
  11916. Mark the frame as unspecified color range.
  11917. @item limited, tv, mpeg
  11918. Mark the frame as limited range.
  11919. @item full, pc, jpeg
  11920. Mark the frame as full range.
  11921. @end table
  11922. @item color_primaries
  11923. Set the color primaries.
  11924. Available values are:
  11925. @table @samp
  11926. @item auto
  11927. Keep the same color primaries property (default).
  11928. @item bt709
  11929. @item unknown
  11930. @item bt470m
  11931. @item bt470bg
  11932. @item smpte170m
  11933. @item smpte240m
  11934. @item film
  11935. @item bt2020
  11936. @item smpte428
  11937. @item smpte431
  11938. @item smpte432
  11939. @item jedec-p22
  11940. @end table
  11941. @item color_trc
  11942. Set the color transfer.
  11943. Available values are:
  11944. @table @samp
  11945. @item auto
  11946. Keep the same color trc property (default).
  11947. @item bt709
  11948. @item unknown
  11949. @item bt470m
  11950. @item bt470bg
  11951. @item smpte170m
  11952. @item smpte240m
  11953. @item linear
  11954. @item log100
  11955. @item log316
  11956. @item iec61966-2-4
  11957. @item bt1361e
  11958. @item iec61966-2-1
  11959. @item bt2020-10
  11960. @item bt2020-12
  11961. @item smpte2084
  11962. @item smpte428
  11963. @item arib-std-b67
  11964. @end table
  11965. @item colorspace
  11966. Set the colorspace.
  11967. Available values are:
  11968. @table @samp
  11969. @item auto
  11970. Keep the same colorspace property (default).
  11971. @item gbr
  11972. @item bt709
  11973. @item unknown
  11974. @item fcc
  11975. @item bt470bg
  11976. @item smpte170m
  11977. @item smpte240m
  11978. @item ycgco
  11979. @item bt2020nc
  11980. @item bt2020c
  11981. @item smpte2085
  11982. @item chroma-derived-nc
  11983. @item chroma-derived-c
  11984. @item ictcp
  11985. @end table
  11986. @end table
  11987. @section showinfo
  11988. Show a line containing various information for each input video frame.
  11989. The input video is not modified.
  11990. This filter supports the following options:
  11991. @table @option
  11992. @item checksum
  11993. Calculate checksums of each plane. By default enabled.
  11994. @end table
  11995. The shown line contains a sequence of key/value pairs of the form
  11996. @var{key}:@var{value}.
  11997. The following values are shown in the output:
  11998. @table @option
  11999. @item n
  12000. The (sequential) number of the input frame, starting from 0.
  12001. @item pts
  12002. The Presentation TimeStamp of the input frame, expressed as a number of
  12003. time base units. The time base unit depends on the filter input pad.
  12004. @item pts_time
  12005. The Presentation TimeStamp of the input frame, expressed as a number of
  12006. seconds.
  12007. @item pos
  12008. The position of the frame in the input stream, or -1 if this information is
  12009. unavailable and/or meaningless (for example in case of synthetic video).
  12010. @item fmt
  12011. The pixel format name.
  12012. @item sar
  12013. The sample aspect ratio of the input frame, expressed in the form
  12014. @var{num}/@var{den}.
  12015. @item s
  12016. The size of the input frame. For the syntax of this option, check the
  12017. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12018. @item i
  12019. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12020. for bottom field first).
  12021. @item iskey
  12022. This is 1 if the frame is a key frame, 0 otherwise.
  12023. @item type
  12024. The picture type of the input frame ("I" for an I-frame, "P" for a
  12025. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12026. Also refer to the documentation of the @code{AVPictureType} enum and of
  12027. the @code{av_get_picture_type_char} function defined in
  12028. @file{libavutil/avutil.h}.
  12029. @item checksum
  12030. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12031. @item plane_checksum
  12032. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12033. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12034. @end table
  12035. @section showpalette
  12036. Displays the 256 colors palette of each frame. This filter is only relevant for
  12037. @var{pal8} pixel format frames.
  12038. It accepts the following option:
  12039. @table @option
  12040. @item s
  12041. Set the size of the box used to represent one palette color entry. Default is
  12042. @code{30} (for a @code{30x30} pixel box).
  12043. @end table
  12044. @section shuffleframes
  12045. Reorder and/or duplicate and/or drop video frames.
  12046. It accepts the following parameters:
  12047. @table @option
  12048. @item mapping
  12049. Set the destination indexes of input frames.
  12050. This is space or '|' separated list of indexes that maps input frames to output
  12051. frames. Number of indexes also sets maximal value that each index may have.
  12052. '-1' index have special meaning and that is to drop frame.
  12053. @end table
  12054. The first frame has the index 0. The default is to keep the input unchanged.
  12055. @subsection Examples
  12056. @itemize
  12057. @item
  12058. Swap second and third frame of every three frames of the input:
  12059. @example
  12060. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12061. @end example
  12062. @item
  12063. Swap 10th and 1st frame of every ten frames of the input:
  12064. @example
  12065. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12066. @end example
  12067. @end itemize
  12068. @section shuffleplanes
  12069. Reorder and/or duplicate video planes.
  12070. It accepts the following parameters:
  12071. @table @option
  12072. @item map0
  12073. The index of the input plane to be used as the first output plane.
  12074. @item map1
  12075. The index of the input plane to be used as the second output plane.
  12076. @item map2
  12077. The index of the input plane to be used as the third output plane.
  12078. @item map3
  12079. The index of the input plane to be used as the fourth output plane.
  12080. @end table
  12081. The first plane has the index 0. The default is to keep the input unchanged.
  12082. @subsection Examples
  12083. @itemize
  12084. @item
  12085. Swap the second and third planes of the input:
  12086. @example
  12087. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12088. @end example
  12089. @end itemize
  12090. @anchor{signalstats}
  12091. @section signalstats
  12092. Evaluate various visual metrics that assist in determining issues associated
  12093. with the digitization of analog video media.
  12094. By default the filter will log these metadata values:
  12095. @table @option
  12096. @item YMIN
  12097. Display the minimal Y value contained within the input frame. Expressed in
  12098. range of [0-255].
  12099. @item YLOW
  12100. Display the Y value at the 10% percentile within the input frame. Expressed in
  12101. range of [0-255].
  12102. @item YAVG
  12103. Display the average Y value within the input frame. Expressed in range of
  12104. [0-255].
  12105. @item YHIGH
  12106. Display the Y value at the 90% percentile within the input frame. Expressed in
  12107. range of [0-255].
  12108. @item YMAX
  12109. Display the maximum Y value contained within the input frame. Expressed in
  12110. range of [0-255].
  12111. @item UMIN
  12112. Display the minimal U value contained within the input frame. Expressed in
  12113. range of [0-255].
  12114. @item ULOW
  12115. Display the U value at the 10% percentile within the input frame. Expressed in
  12116. range of [0-255].
  12117. @item UAVG
  12118. Display the average U value within the input frame. Expressed in range of
  12119. [0-255].
  12120. @item UHIGH
  12121. Display the U value at the 90% percentile within the input frame. Expressed in
  12122. range of [0-255].
  12123. @item UMAX
  12124. Display the maximum U value contained within the input frame. Expressed in
  12125. range of [0-255].
  12126. @item VMIN
  12127. Display the minimal V value contained within the input frame. Expressed in
  12128. range of [0-255].
  12129. @item VLOW
  12130. Display the V value at the 10% percentile within the input frame. Expressed in
  12131. range of [0-255].
  12132. @item VAVG
  12133. Display the average V value within the input frame. Expressed in range of
  12134. [0-255].
  12135. @item VHIGH
  12136. Display the V value at the 90% percentile within the input frame. Expressed in
  12137. range of [0-255].
  12138. @item VMAX
  12139. Display the maximum V value contained within the input frame. Expressed in
  12140. range of [0-255].
  12141. @item SATMIN
  12142. Display the minimal saturation value contained within the input frame.
  12143. Expressed in range of [0-~181.02].
  12144. @item SATLOW
  12145. Display the saturation value at the 10% percentile within the input frame.
  12146. Expressed in range of [0-~181.02].
  12147. @item SATAVG
  12148. Display the average saturation value within the input frame. Expressed in range
  12149. of [0-~181.02].
  12150. @item SATHIGH
  12151. Display the saturation value at the 90% percentile within the input frame.
  12152. Expressed in range of [0-~181.02].
  12153. @item SATMAX
  12154. Display the maximum saturation value contained within the input frame.
  12155. Expressed in range of [0-~181.02].
  12156. @item HUEMED
  12157. Display the median value for hue within the input frame. Expressed in range of
  12158. [0-360].
  12159. @item HUEAVG
  12160. Display the average value for hue within the input frame. Expressed in range of
  12161. [0-360].
  12162. @item YDIF
  12163. Display the average of sample value difference between all values of the Y
  12164. plane in the current frame and corresponding values of the previous input frame.
  12165. Expressed in range of [0-255].
  12166. @item UDIF
  12167. Display the average of sample value difference between all values of the U
  12168. plane in the current frame and corresponding values of the previous input frame.
  12169. Expressed in range of [0-255].
  12170. @item VDIF
  12171. Display the average of sample value difference between all values of the V
  12172. plane in the current frame and corresponding values of the previous input frame.
  12173. Expressed in range of [0-255].
  12174. @item YBITDEPTH
  12175. Display bit depth of Y plane in current frame.
  12176. Expressed in range of [0-16].
  12177. @item UBITDEPTH
  12178. Display bit depth of U plane in current frame.
  12179. Expressed in range of [0-16].
  12180. @item VBITDEPTH
  12181. Display bit depth of V plane in current frame.
  12182. Expressed in range of [0-16].
  12183. @end table
  12184. The filter accepts the following options:
  12185. @table @option
  12186. @item stat
  12187. @item out
  12188. @option{stat} specify an additional form of image analysis.
  12189. @option{out} output video with the specified type of pixel highlighted.
  12190. Both options accept the following values:
  12191. @table @samp
  12192. @item tout
  12193. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12194. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12195. include the results of video dropouts, head clogs, or tape tracking issues.
  12196. @item vrep
  12197. Identify @var{vertical line repetition}. Vertical line repetition includes
  12198. similar rows of pixels within a frame. In born-digital video vertical line
  12199. repetition is common, but this pattern is uncommon in video digitized from an
  12200. analog source. When it occurs in video that results from the digitization of an
  12201. analog source it can indicate concealment from a dropout compensator.
  12202. @item brng
  12203. Identify pixels that fall outside of legal broadcast range.
  12204. @end table
  12205. @item color, c
  12206. Set the highlight color for the @option{out} option. The default color is
  12207. yellow.
  12208. @end table
  12209. @subsection Examples
  12210. @itemize
  12211. @item
  12212. Output data of various video metrics:
  12213. @example
  12214. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12215. @end example
  12216. @item
  12217. Output specific data about the minimum and maximum values of the Y plane per frame:
  12218. @example
  12219. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12220. @end example
  12221. @item
  12222. Playback video while highlighting pixels that are outside of broadcast range in red.
  12223. @example
  12224. ffplay example.mov -vf signalstats="out=brng:color=red"
  12225. @end example
  12226. @item
  12227. Playback video with signalstats metadata drawn over the frame.
  12228. @example
  12229. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12230. @end example
  12231. The contents of signalstat_drawtext.txt used in the command are:
  12232. @example
  12233. time %@{pts:hms@}
  12234. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12235. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12236. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12237. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12238. @end example
  12239. @end itemize
  12240. @anchor{signature}
  12241. @section signature
  12242. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12243. input. In this case the matching between the inputs can be calculated additionally.
  12244. The filter always passes through the first input. The signature of each stream can
  12245. be written into a file.
  12246. It accepts the following options:
  12247. @table @option
  12248. @item detectmode
  12249. Enable or disable the matching process.
  12250. Available values are:
  12251. @table @samp
  12252. @item off
  12253. Disable the calculation of a matching (default).
  12254. @item full
  12255. Calculate the matching for the whole video and output whether the whole video
  12256. matches or only parts.
  12257. @item fast
  12258. Calculate only until a matching is found or the video ends. Should be faster in
  12259. some cases.
  12260. @end table
  12261. @item nb_inputs
  12262. Set the number of inputs. The option value must be a non negative integer.
  12263. Default value is 1.
  12264. @item filename
  12265. Set the path to which the output is written. If there is more than one input,
  12266. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12267. integer), that will be replaced with the input number. If no filename is
  12268. specified, no output will be written. This is the default.
  12269. @item format
  12270. Choose the output format.
  12271. Available values are:
  12272. @table @samp
  12273. @item binary
  12274. Use the specified binary representation (default).
  12275. @item xml
  12276. Use the specified xml representation.
  12277. @end table
  12278. @item th_d
  12279. Set threshold to detect one word as similar. The option value must be an integer
  12280. greater than zero. The default value is 9000.
  12281. @item th_dc
  12282. Set threshold to detect all words as similar. The option value must be an integer
  12283. greater than zero. The default value is 60000.
  12284. @item th_xh
  12285. Set threshold to detect frames as similar. The option value must be an integer
  12286. greater than zero. The default value is 116.
  12287. @item th_di
  12288. Set the minimum length of a sequence in frames to recognize it as matching
  12289. sequence. The option value must be a non negative integer value.
  12290. The default value is 0.
  12291. @item th_it
  12292. Set the minimum relation, that matching frames to all frames must have.
  12293. The option value must be a double value between 0 and 1. The default value is 0.5.
  12294. @end table
  12295. @subsection Examples
  12296. @itemize
  12297. @item
  12298. To calculate the signature of an input video and store it in signature.bin:
  12299. @example
  12300. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12301. @end example
  12302. @item
  12303. To detect whether two videos match and store the signatures in XML format in
  12304. signature0.xml and signature1.xml:
  12305. @example
  12306. 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 -
  12307. @end example
  12308. @end itemize
  12309. @anchor{smartblur}
  12310. @section smartblur
  12311. Blur the input video without impacting the outlines.
  12312. It accepts the following options:
  12313. @table @option
  12314. @item luma_radius, lr
  12315. Set the luma radius. The option value must be a float number in
  12316. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12317. used to blur the image (slower if larger). Default value is 1.0.
  12318. @item luma_strength, ls
  12319. Set the luma strength. The option value must be a float number
  12320. in the range [-1.0,1.0] that configures the blurring. A value included
  12321. in [0.0,1.0] will blur the image whereas a value included in
  12322. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12323. @item luma_threshold, lt
  12324. Set the luma threshold used as a coefficient to determine
  12325. whether a pixel should be blurred or not. The option value must be an
  12326. integer in the range [-30,30]. A value of 0 will filter all the image,
  12327. a value included in [0,30] will filter flat areas and a value included
  12328. in [-30,0] will filter edges. Default value is 0.
  12329. @item chroma_radius, cr
  12330. Set the chroma radius. The option value must be a float number in
  12331. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12332. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12333. @item chroma_strength, cs
  12334. Set the chroma strength. The option value must be a float number
  12335. in the range [-1.0,1.0] that configures the blurring. A value included
  12336. in [0.0,1.0] will blur the image whereas a value included in
  12337. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12338. @item chroma_threshold, ct
  12339. Set the chroma threshold used as a coefficient to determine
  12340. whether a pixel should be blurred or not. The option value must be an
  12341. integer in the range [-30,30]. A value of 0 will filter all the image,
  12342. a value included in [0,30] will filter flat areas and a value included
  12343. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12344. @end table
  12345. If a chroma option is not explicitly set, the corresponding luma value
  12346. is set.
  12347. @section ssim
  12348. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12349. This filter takes in input two input videos, the first input is
  12350. considered the "main" source and is passed unchanged to the
  12351. output. The second input is used as a "reference" video for computing
  12352. the SSIM.
  12353. Both video inputs must have the same resolution and pixel format for
  12354. this filter to work correctly. Also it assumes that both inputs
  12355. have the same number of frames, which are compared one by one.
  12356. The filter stores the calculated SSIM of each frame.
  12357. The description of the accepted parameters follows.
  12358. @table @option
  12359. @item stats_file, f
  12360. If specified the filter will use the named file to save the SSIM of
  12361. each individual frame. When filename equals "-" the data is sent to
  12362. standard output.
  12363. @end table
  12364. The file printed if @var{stats_file} is selected, contains a sequence of
  12365. key/value pairs of the form @var{key}:@var{value} for each compared
  12366. couple of frames.
  12367. A description of each shown parameter follows:
  12368. @table @option
  12369. @item n
  12370. sequential number of the input frame, starting from 1
  12371. @item Y, U, V, R, G, B
  12372. SSIM of the compared frames for the component specified by the suffix.
  12373. @item All
  12374. SSIM of the compared frames for the whole frame.
  12375. @item dB
  12376. Same as above but in dB representation.
  12377. @end table
  12378. This filter also supports the @ref{framesync} options.
  12379. For example:
  12380. @example
  12381. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12382. [main][ref] ssim="stats_file=stats.log" [out]
  12383. @end example
  12384. On this example the input file being processed is compared with the
  12385. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12386. is stored in @file{stats.log}.
  12387. Another example with both psnr and ssim at same time:
  12388. @example
  12389. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12390. @end example
  12391. @section stereo3d
  12392. Convert between different stereoscopic image formats.
  12393. The filters accept the following options:
  12394. @table @option
  12395. @item in
  12396. Set stereoscopic image format of input.
  12397. Available values for input image formats are:
  12398. @table @samp
  12399. @item sbsl
  12400. side by side parallel (left eye left, right eye right)
  12401. @item sbsr
  12402. side by side crosseye (right eye left, left eye right)
  12403. @item sbs2l
  12404. side by side parallel with half width resolution
  12405. (left eye left, right eye right)
  12406. @item sbs2r
  12407. side by side crosseye with half width resolution
  12408. (right eye left, left eye right)
  12409. @item abl
  12410. above-below (left eye above, right eye below)
  12411. @item abr
  12412. above-below (right eye above, left eye below)
  12413. @item ab2l
  12414. above-below with half height resolution
  12415. (left eye above, right eye below)
  12416. @item ab2r
  12417. above-below with half height resolution
  12418. (right eye above, left eye below)
  12419. @item al
  12420. alternating frames (left eye first, right eye second)
  12421. @item ar
  12422. alternating frames (right eye first, left eye second)
  12423. @item irl
  12424. interleaved rows (left eye has top row, right eye starts on next row)
  12425. @item irr
  12426. interleaved rows (right eye has top row, left eye starts on next row)
  12427. @item icl
  12428. interleaved columns, left eye first
  12429. @item icr
  12430. interleaved columns, right eye first
  12431. Default value is @samp{sbsl}.
  12432. @end table
  12433. @item out
  12434. Set stereoscopic image format of output.
  12435. @table @samp
  12436. @item sbsl
  12437. side by side parallel (left eye left, right eye right)
  12438. @item sbsr
  12439. side by side crosseye (right eye left, left eye right)
  12440. @item sbs2l
  12441. side by side parallel with half width resolution
  12442. (left eye left, right eye right)
  12443. @item sbs2r
  12444. side by side crosseye with half width resolution
  12445. (right eye left, left eye right)
  12446. @item abl
  12447. above-below (left eye above, right eye below)
  12448. @item abr
  12449. above-below (right eye above, left eye below)
  12450. @item ab2l
  12451. above-below with half height resolution
  12452. (left eye above, right eye below)
  12453. @item ab2r
  12454. above-below with half height resolution
  12455. (right eye above, left eye below)
  12456. @item al
  12457. alternating frames (left eye first, right eye second)
  12458. @item ar
  12459. alternating frames (right eye first, left eye second)
  12460. @item irl
  12461. interleaved rows (left eye has top row, right eye starts on next row)
  12462. @item irr
  12463. interleaved rows (right eye has top row, left eye starts on next row)
  12464. @item arbg
  12465. anaglyph red/blue gray
  12466. (red filter on left eye, blue filter on right eye)
  12467. @item argg
  12468. anaglyph red/green gray
  12469. (red filter on left eye, green filter on right eye)
  12470. @item arcg
  12471. anaglyph red/cyan gray
  12472. (red filter on left eye, cyan filter on right eye)
  12473. @item arch
  12474. anaglyph red/cyan half colored
  12475. (red filter on left eye, cyan filter on right eye)
  12476. @item arcc
  12477. anaglyph red/cyan color
  12478. (red filter on left eye, cyan filter on right eye)
  12479. @item arcd
  12480. anaglyph red/cyan color optimized with the least squares projection of dubois
  12481. (red filter on left eye, cyan filter on right eye)
  12482. @item agmg
  12483. anaglyph green/magenta gray
  12484. (green filter on left eye, magenta filter on right eye)
  12485. @item agmh
  12486. anaglyph green/magenta half colored
  12487. (green filter on left eye, magenta filter on right eye)
  12488. @item agmc
  12489. anaglyph green/magenta colored
  12490. (green filter on left eye, magenta filter on right eye)
  12491. @item agmd
  12492. anaglyph green/magenta color optimized with the least squares projection of dubois
  12493. (green filter on left eye, magenta filter on right eye)
  12494. @item aybg
  12495. anaglyph yellow/blue gray
  12496. (yellow filter on left eye, blue filter on right eye)
  12497. @item aybh
  12498. anaglyph yellow/blue half colored
  12499. (yellow filter on left eye, blue filter on right eye)
  12500. @item aybc
  12501. anaglyph yellow/blue colored
  12502. (yellow filter on left eye, blue filter on right eye)
  12503. @item aybd
  12504. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12505. (yellow filter on left eye, blue filter on right eye)
  12506. @item ml
  12507. mono output (left eye only)
  12508. @item mr
  12509. mono output (right eye only)
  12510. @item chl
  12511. checkerboard, left eye first
  12512. @item chr
  12513. checkerboard, right eye first
  12514. @item icl
  12515. interleaved columns, left eye first
  12516. @item icr
  12517. interleaved columns, right eye first
  12518. @item hdmi
  12519. HDMI frame pack
  12520. @end table
  12521. Default value is @samp{arcd}.
  12522. @end table
  12523. @subsection Examples
  12524. @itemize
  12525. @item
  12526. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12527. @example
  12528. stereo3d=sbsl:aybd
  12529. @end example
  12530. @item
  12531. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12532. @example
  12533. stereo3d=abl:sbsr
  12534. @end example
  12535. @end itemize
  12536. @section streamselect, astreamselect
  12537. Select video or audio streams.
  12538. The filter accepts the following options:
  12539. @table @option
  12540. @item inputs
  12541. Set number of inputs. Default is 2.
  12542. @item map
  12543. Set input indexes to remap to outputs.
  12544. @end table
  12545. @subsection Commands
  12546. The @code{streamselect} and @code{astreamselect} filter supports the following
  12547. commands:
  12548. @table @option
  12549. @item map
  12550. Set input indexes to remap to outputs.
  12551. @end table
  12552. @subsection Examples
  12553. @itemize
  12554. @item
  12555. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12556. @example
  12557. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12558. @end example
  12559. @item
  12560. Same as above, but for audio:
  12561. @example
  12562. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12563. @end example
  12564. @end itemize
  12565. @section sobel
  12566. Apply sobel operator to input video stream.
  12567. The filter accepts the following option:
  12568. @table @option
  12569. @item planes
  12570. Set which planes will be processed, unprocessed planes will be copied.
  12571. By default value 0xf, all planes will be processed.
  12572. @item scale
  12573. Set value which will be multiplied with filtered result.
  12574. @item delta
  12575. Set value which will be added to filtered result.
  12576. @end table
  12577. @anchor{spp}
  12578. @section spp
  12579. Apply a simple postprocessing filter that compresses and decompresses the image
  12580. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12581. and average the results.
  12582. The filter accepts the following options:
  12583. @table @option
  12584. @item quality
  12585. Set quality. This option defines the number of levels for averaging. It accepts
  12586. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12587. effect. A value of @code{6} means the higher quality. For each increment of
  12588. that value the speed drops by a factor of approximately 2. Default value is
  12589. @code{3}.
  12590. @item qp
  12591. Force a constant quantization parameter. If not set, the filter will use the QP
  12592. from the video stream (if available).
  12593. @item mode
  12594. Set thresholding mode. Available modes are:
  12595. @table @samp
  12596. @item hard
  12597. Set hard thresholding (default).
  12598. @item soft
  12599. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12600. @end table
  12601. @item use_bframe_qp
  12602. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12603. option may cause flicker since the B-Frames have often larger QP. Default is
  12604. @code{0} (not enabled).
  12605. @end table
  12606. @section sr
  12607. Scale the input by applying one of the super-resolution methods based on
  12608. convolutional neural networks. Supported models:
  12609. @itemize
  12610. @item
  12611. Super-Resolution Convolutional Neural Network model (SRCNN).
  12612. See @url{https://arxiv.org/abs/1501.00092}.
  12613. @item
  12614. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12615. See @url{https://arxiv.org/abs/1609.05158}.
  12616. @end itemize
  12617. Training scripts as well as scripts for model generation can be found at
  12618. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12619. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12620. The filter accepts the following options:
  12621. @table @option
  12622. @item dnn_backend
  12623. Specify which DNN backend to use for model loading and execution. This option accepts
  12624. the following values:
  12625. @table @samp
  12626. @item native
  12627. Native implementation of DNN loading and execution.
  12628. @item tensorflow
  12629. TensorFlow backend. To enable this backend you
  12630. need to install the TensorFlow for C library (see
  12631. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12632. @code{--enable-libtensorflow}
  12633. @end table
  12634. Default value is @samp{native}.
  12635. @item model
  12636. Set path to model file specifying network architecture and its parameters.
  12637. Note that different backends use different file formats. TensorFlow backend
  12638. can load files for both formats, while native backend can load files for only
  12639. its format.
  12640. @item scale_factor
  12641. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12642. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12643. input upscaled using bicubic upscaling with proper scale factor.
  12644. @end table
  12645. @anchor{subtitles}
  12646. @section subtitles
  12647. Draw subtitles on top of input video using the libass library.
  12648. To enable compilation of this filter you need to configure FFmpeg with
  12649. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12650. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12651. Alpha) subtitles format.
  12652. The filter accepts the following options:
  12653. @table @option
  12654. @item filename, f
  12655. Set the filename of the subtitle file to read. It must be specified.
  12656. @item original_size
  12657. Specify the size of the original video, the video for which the ASS file
  12658. was composed. For the syntax of this option, check the
  12659. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12660. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12661. correctly scale the fonts if the aspect ratio has been changed.
  12662. @item fontsdir
  12663. Set a directory path containing fonts that can be used by the filter.
  12664. These fonts will be used in addition to whatever the font provider uses.
  12665. @item alpha
  12666. Process alpha channel, by default alpha channel is untouched.
  12667. @item charenc
  12668. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12669. useful if not UTF-8.
  12670. @item stream_index, si
  12671. Set subtitles stream index. @code{subtitles} filter only.
  12672. @item force_style
  12673. Override default style or script info parameters of the subtitles. It accepts a
  12674. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12675. @end table
  12676. If the first key is not specified, it is assumed that the first value
  12677. specifies the @option{filename}.
  12678. For example, to render the file @file{sub.srt} on top of the input
  12679. video, use the command:
  12680. @example
  12681. subtitles=sub.srt
  12682. @end example
  12683. which is equivalent to:
  12684. @example
  12685. subtitles=filename=sub.srt
  12686. @end example
  12687. To render the default subtitles stream from file @file{video.mkv}, use:
  12688. @example
  12689. subtitles=video.mkv
  12690. @end example
  12691. To render the second subtitles stream from that file, use:
  12692. @example
  12693. subtitles=video.mkv:si=1
  12694. @end example
  12695. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12696. @code{DejaVu Serif}, use:
  12697. @example
  12698. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12699. @end example
  12700. @section super2xsai
  12701. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12702. Interpolate) pixel art scaling algorithm.
  12703. Useful for enlarging pixel art images without reducing sharpness.
  12704. @section swaprect
  12705. Swap two rectangular objects in video.
  12706. This filter accepts the following options:
  12707. @table @option
  12708. @item w
  12709. Set object width.
  12710. @item h
  12711. Set object height.
  12712. @item x1
  12713. Set 1st rect x coordinate.
  12714. @item y1
  12715. Set 1st rect y coordinate.
  12716. @item x2
  12717. Set 2nd rect x coordinate.
  12718. @item y2
  12719. Set 2nd rect y coordinate.
  12720. All expressions are evaluated once for each frame.
  12721. @end table
  12722. The all options are expressions containing the following constants:
  12723. @table @option
  12724. @item w
  12725. @item h
  12726. The input width and height.
  12727. @item a
  12728. same as @var{w} / @var{h}
  12729. @item sar
  12730. input sample aspect ratio
  12731. @item dar
  12732. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12733. @item n
  12734. The number of the input frame, starting from 0.
  12735. @item t
  12736. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12737. @item pos
  12738. the position in the file of the input frame, NAN if unknown
  12739. @end table
  12740. @section swapuv
  12741. Swap U & V plane.
  12742. @section telecine
  12743. Apply telecine process to the video.
  12744. This filter accepts the following options:
  12745. @table @option
  12746. @item first_field
  12747. @table @samp
  12748. @item top, t
  12749. top field first
  12750. @item bottom, b
  12751. bottom field first
  12752. The default value is @code{top}.
  12753. @end table
  12754. @item pattern
  12755. A string of numbers representing the pulldown pattern you wish to apply.
  12756. The default value is @code{23}.
  12757. @end table
  12758. @example
  12759. Some typical patterns:
  12760. NTSC output (30i):
  12761. 27.5p: 32222
  12762. 24p: 23 (classic)
  12763. 24p: 2332 (preferred)
  12764. 20p: 33
  12765. 18p: 334
  12766. 16p: 3444
  12767. PAL output (25i):
  12768. 27.5p: 12222
  12769. 24p: 222222222223 ("Euro pulldown")
  12770. 16.67p: 33
  12771. 16p: 33333334
  12772. @end example
  12773. @section threshold
  12774. Apply threshold effect to video stream.
  12775. This filter needs four video streams to perform thresholding.
  12776. First stream is stream we are filtering.
  12777. Second stream is holding threshold values, third stream is holding min values,
  12778. and last, fourth stream is holding max values.
  12779. The filter accepts the following option:
  12780. @table @option
  12781. @item planes
  12782. Set which planes will be processed, unprocessed planes will be copied.
  12783. By default value 0xf, all planes will be processed.
  12784. @end table
  12785. For example if first stream pixel's component value is less then threshold value
  12786. of pixel component from 2nd threshold stream, third stream value will picked,
  12787. otherwise fourth stream pixel component value will be picked.
  12788. Using color source filter one can perform various types of thresholding:
  12789. @subsection Examples
  12790. @itemize
  12791. @item
  12792. Binary threshold, using gray color as threshold:
  12793. @example
  12794. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12795. @end example
  12796. @item
  12797. Inverted binary threshold, using gray color as threshold:
  12798. @example
  12799. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12800. @end example
  12801. @item
  12802. Truncate binary threshold, using gray color as threshold:
  12803. @example
  12804. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12805. @end example
  12806. @item
  12807. Threshold to zero, using gray color as threshold:
  12808. @example
  12809. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12810. @end example
  12811. @item
  12812. Inverted threshold to zero, using gray color as threshold:
  12813. @example
  12814. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12815. @end example
  12816. @end itemize
  12817. @section thumbnail
  12818. Select the most representative frame in a given sequence of consecutive frames.
  12819. The filter accepts the following options:
  12820. @table @option
  12821. @item n
  12822. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12823. will pick one of them, and then handle the next batch of @var{n} frames until
  12824. the end. Default is @code{100}.
  12825. @end table
  12826. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12827. value will result in a higher memory usage, so a high value is not recommended.
  12828. @subsection Examples
  12829. @itemize
  12830. @item
  12831. Extract one picture each 50 frames:
  12832. @example
  12833. thumbnail=50
  12834. @end example
  12835. @item
  12836. Complete example of a thumbnail creation with @command{ffmpeg}:
  12837. @example
  12838. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12839. @end example
  12840. @end itemize
  12841. @section tile
  12842. Tile several successive frames together.
  12843. The filter accepts the following options:
  12844. @table @option
  12845. @item layout
  12846. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12847. this option, check the
  12848. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12849. @item nb_frames
  12850. Set the maximum number of frames to render in the given area. It must be less
  12851. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12852. the area will be used.
  12853. @item margin
  12854. Set the outer border margin in pixels.
  12855. @item padding
  12856. Set the inner border thickness (i.e. the number of pixels between frames). For
  12857. more advanced padding options (such as having different values for the edges),
  12858. refer to the pad video filter.
  12859. @item color
  12860. Specify the color of the unused area. For the syntax of this option, check the
  12861. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12862. The default value of @var{color} is "black".
  12863. @item overlap
  12864. Set the number of frames to overlap when tiling several successive frames together.
  12865. The value must be between @code{0} and @var{nb_frames - 1}.
  12866. @item init_padding
  12867. Set the number of frames to initially be empty before displaying first output frame.
  12868. This controls how soon will one get first output frame.
  12869. The value must be between @code{0} and @var{nb_frames - 1}.
  12870. @end table
  12871. @subsection Examples
  12872. @itemize
  12873. @item
  12874. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12875. @example
  12876. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12877. @end example
  12878. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12879. duplicating each output frame to accommodate the originally detected frame
  12880. rate.
  12881. @item
  12882. Display @code{5} pictures in an area of @code{3x2} frames,
  12883. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12884. mixed flat and named options:
  12885. @example
  12886. tile=3x2:nb_frames=5:padding=7:margin=2
  12887. @end example
  12888. @end itemize
  12889. @section tinterlace
  12890. Perform various types of temporal field interlacing.
  12891. Frames are counted starting from 1, so the first input frame is
  12892. considered odd.
  12893. The filter accepts the following options:
  12894. @table @option
  12895. @item mode
  12896. Specify the mode of the interlacing. This option can also be specified
  12897. as a value alone. See below for a list of values for this option.
  12898. Available values are:
  12899. @table @samp
  12900. @item merge, 0
  12901. Move odd frames into the upper field, even into the lower field,
  12902. generating a double height frame at half frame rate.
  12903. @example
  12904. ------> time
  12905. Input:
  12906. Frame 1 Frame 2 Frame 3 Frame 4
  12907. 11111 22222 33333 44444
  12908. 11111 22222 33333 44444
  12909. 11111 22222 33333 44444
  12910. 11111 22222 33333 44444
  12911. Output:
  12912. 11111 33333
  12913. 22222 44444
  12914. 11111 33333
  12915. 22222 44444
  12916. 11111 33333
  12917. 22222 44444
  12918. 11111 33333
  12919. 22222 44444
  12920. @end example
  12921. @item drop_even, 1
  12922. Only output odd frames, even frames are dropped, generating a frame with
  12923. unchanged height at half frame rate.
  12924. @example
  12925. ------> time
  12926. Input:
  12927. Frame 1 Frame 2 Frame 3 Frame 4
  12928. 11111 22222 33333 44444
  12929. 11111 22222 33333 44444
  12930. 11111 22222 33333 44444
  12931. 11111 22222 33333 44444
  12932. Output:
  12933. 11111 33333
  12934. 11111 33333
  12935. 11111 33333
  12936. 11111 33333
  12937. @end example
  12938. @item drop_odd, 2
  12939. Only output even frames, odd frames are dropped, generating a frame with
  12940. unchanged height at half frame rate.
  12941. @example
  12942. ------> time
  12943. Input:
  12944. Frame 1 Frame 2 Frame 3 Frame 4
  12945. 11111 22222 33333 44444
  12946. 11111 22222 33333 44444
  12947. 11111 22222 33333 44444
  12948. 11111 22222 33333 44444
  12949. Output:
  12950. 22222 44444
  12951. 22222 44444
  12952. 22222 44444
  12953. 22222 44444
  12954. @end example
  12955. @item pad, 3
  12956. Expand each frame to full height, but pad alternate lines with black,
  12957. generating a frame with double height at the same input frame rate.
  12958. @example
  12959. ------> time
  12960. Input:
  12961. Frame 1 Frame 2 Frame 3 Frame 4
  12962. 11111 22222 33333 44444
  12963. 11111 22222 33333 44444
  12964. 11111 22222 33333 44444
  12965. 11111 22222 33333 44444
  12966. Output:
  12967. 11111 ..... 33333 .....
  12968. ..... 22222 ..... 44444
  12969. 11111 ..... 33333 .....
  12970. ..... 22222 ..... 44444
  12971. 11111 ..... 33333 .....
  12972. ..... 22222 ..... 44444
  12973. 11111 ..... 33333 .....
  12974. ..... 22222 ..... 44444
  12975. @end example
  12976. @item interleave_top, 4
  12977. Interleave the upper field from odd frames with the lower field from
  12978. even frames, generating a frame with unchanged height at half frame rate.
  12979. @example
  12980. ------> time
  12981. Input:
  12982. Frame 1 Frame 2 Frame 3 Frame 4
  12983. 11111<- 22222 33333<- 44444
  12984. 11111 22222<- 33333 44444<-
  12985. 11111<- 22222 33333<- 44444
  12986. 11111 22222<- 33333 44444<-
  12987. Output:
  12988. 11111 33333
  12989. 22222 44444
  12990. 11111 33333
  12991. 22222 44444
  12992. @end example
  12993. @item interleave_bottom, 5
  12994. Interleave the lower field from odd frames with the upper field from
  12995. even frames, generating a frame with unchanged height at half frame rate.
  12996. @example
  12997. ------> time
  12998. Input:
  12999. Frame 1 Frame 2 Frame 3 Frame 4
  13000. 11111 22222<- 33333 44444<-
  13001. 11111<- 22222 33333<- 44444
  13002. 11111 22222<- 33333 44444<-
  13003. 11111<- 22222 33333<- 44444
  13004. Output:
  13005. 22222 44444
  13006. 11111 33333
  13007. 22222 44444
  13008. 11111 33333
  13009. @end example
  13010. @item interlacex2, 6
  13011. Double frame rate with unchanged height. Frames are inserted each
  13012. containing the second temporal field from the previous input frame and
  13013. the first temporal field from the next input frame. This mode relies on
  13014. the top_field_first flag. Useful for interlaced video displays with no
  13015. field synchronisation.
  13016. @example
  13017. ------> time
  13018. Input:
  13019. Frame 1 Frame 2 Frame 3 Frame 4
  13020. 11111 22222 33333 44444
  13021. 11111 22222 33333 44444
  13022. 11111 22222 33333 44444
  13023. 11111 22222 33333 44444
  13024. Output:
  13025. 11111 22222 22222 33333 33333 44444 44444
  13026. 11111 11111 22222 22222 33333 33333 44444
  13027. 11111 22222 22222 33333 33333 44444 44444
  13028. 11111 11111 22222 22222 33333 33333 44444
  13029. @end example
  13030. @item mergex2, 7
  13031. Move odd frames into the upper field, even into the lower field,
  13032. generating a double height frame at same frame rate.
  13033. @example
  13034. ------> time
  13035. Input:
  13036. Frame 1 Frame 2 Frame 3 Frame 4
  13037. 11111 22222 33333 44444
  13038. 11111 22222 33333 44444
  13039. 11111 22222 33333 44444
  13040. 11111 22222 33333 44444
  13041. Output:
  13042. 11111 33333 33333 55555
  13043. 22222 22222 44444 44444
  13044. 11111 33333 33333 55555
  13045. 22222 22222 44444 44444
  13046. 11111 33333 33333 55555
  13047. 22222 22222 44444 44444
  13048. 11111 33333 33333 55555
  13049. 22222 22222 44444 44444
  13050. @end example
  13051. @end table
  13052. Numeric values are deprecated but are accepted for backward
  13053. compatibility reasons.
  13054. Default mode is @code{merge}.
  13055. @item flags
  13056. Specify flags influencing the filter process.
  13057. Available value for @var{flags} is:
  13058. @table @option
  13059. @item low_pass_filter, vlfp
  13060. Enable linear vertical low-pass filtering in the filter.
  13061. Vertical low-pass filtering is required when creating an interlaced
  13062. destination from a progressive source which contains high-frequency
  13063. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13064. patterning.
  13065. @item complex_filter, cvlfp
  13066. Enable complex vertical low-pass filtering.
  13067. This will slightly less reduce interlace 'twitter' and Moire
  13068. patterning but better retain detail and subjective sharpness impression.
  13069. @end table
  13070. Vertical low-pass filtering can only be enabled for @option{mode}
  13071. @var{interleave_top} and @var{interleave_bottom}.
  13072. @end table
  13073. @section tmix
  13074. Mix successive video frames.
  13075. A description of the accepted options follows.
  13076. @table @option
  13077. @item frames
  13078. The number of successive frames to mix. If unspecified, it defaults to 3.
  13079. @item weights
  13080. Specify weight of each input video frame.
  13081. Each weight is separated by space. If number of weights is smaller than
  13082. number of @var{frames} last specified weight will be used for all remaining
  13083. unset weights.
  13084. @item scale
  13085. Specify scale, if it is set it will be multiplied with sum
  13086. of each weight multiplied with pixel values to give final destination
  13087. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13088. @end table
  13089. @subsection Examples
  13090. @itemize
  13091. @item
  13092. Average 7 successive frames:
  13093. @example
  13094. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13095. @end example
  13096. @item
  13097. Apply simple temporal convolution:
  13098. @example
  13099. tmix=frames=3:weights="-1 3 -1"
  13100. @end example
  13101. @item
  13102. Similar as above but only showing temporal differences:
  13103. @example
  13104. tmix=frames=3:weights="-1 2 -1":scale=1
  13105. @end example
  13106. @end itemize
  13107. @anchor{tonemap}
  13108. @section tonemap
  13109. Tone map colors from different dynamic ranges.
  13110. This filter expects data in single precision floating point, as it needs to
  13111. operate on (and can output) out-of-range values. Another filter, such as
  13112. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13113. The tonemapping algorithms implemented only work on linear light, so input
  13114. data should be linearized beforehand (and possibly correctly tagged).
  13115. @example
  13116. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13117. @end example
  13118. @subsection Options
  13119. The filter accepts the following options.
  13120. @table @option
  13121. @item tonemap
  13122. Set the tone map algorithm to use.
  13123. Possible values are:
  13124. @table @var
  13125. @item none
  13126. Do not apply any tone map, only desaturate overbright pixels.
  13127. @item clip
  13128. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13129. in-range values, while distorting out-of-range values.
  13130. @item linear
  13131. Stretch the entire reference gamut to a linear multiple of the display.
  13132. @item gamma
  13133. Fit a logarithmic transfer between the tone curves.
  13134. @item reinhard
  13135. Preserve overall image brightness with a simple curve, using nonlinear
  13136. contrast, which results in flattening details and degrading color accuracy.
  13137. @item hable
  13138. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13139. of slightly darkening everything. Use it when detail preservation is more
  13140. important than color and brightness accuracy.
  13141. @item mobius
  13142. Smoothly map out-of-range values, while retaining contrast and colors for
  13143. in-range material as much as possible. Use it when color accuracy is more
  13144. important than detail preservation.
  13145. @end table
  13146. Default is none.
  13147. @item param
  13148. Tune the tone mapping algorithm.
  13149. This affects the following algorithms:
  13150. @table @var
  13151. @item none
  13152. Ignored.
  13153. @item linear
  13154. Specifies the scale factor to use while stretching.
  13155. Default to 1.0.
  13156. @item gamma
  13157. Specifies the exponent of the function.
  13158. Default to 1.8.
  13159. @item clip
  13160. Specify an extra linear coefficient to multiply into the signal before clipping.
  13161. Default to 1.0.
  13162. @item reinhard
  13163. Specify the local contrast coefficient at the display peak.
  13164. Default to 0.5, which means that in-gamut values will be about half as bright
  13165. as when clipping.
  13166. @item hable
  13167. Ignored.
  13168. @item mobius
  13169. Specify the transition point from linear to mobius transform. Every value
  13170. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13171. more accurate the result will be, at the cost of losing bright details.
  13172. Default to 0.3, which due to the steep initial slope still preserves in-range
  13173. colors fairly accurately.
  13174. @end table
  13175. @item desat
  13176. Apply desaturation for highlights that exceed this level of brightness. The
  13177. higher the parameter, the more color information will be preserved. This
  13178. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13179. (smoothly) turning into white instead. This makes images feel more natural,
  13180. at the cost of reducing information about out-of-range colors.
  13181. The default of 2.0 is somewhat conservative and will mostly just apply to
  13182. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13183. This option works only if the input frame has a supported color tag.
  13184. @item peak
  13185. Override signal/nominal/reference peak with this value. Useful when the
  13186. embedded peak information in display metadata is not reliable or when tone
  13187. mapping from a lower range to a higher range.
  13188. @end table
  13189. @section tpad
  13190. Temporarily pad video frames.
  13191. The filter accepts the following options:
  13192. @table @option
  13193. @item start
  13194. Specify number of delay frames before input video stream.
  13195. @item stop
  13196. Specify number of padding frames after input video stream.
  13197. Set to -1 to pad indefinitely.
  13198. @item start_mode
  13199. Set kind of frames added to beginning of stream.
  13200. Can be either @var{add} or @var{clone}.
  13201. With @var{add} frames of solid-color are added.
  13202. With @var{clone} frames are clones of first frame.
  13203. @item stop_mode
  13204. Set kind of frames added to end of stream.
  13205. Can be either @var{add} or @var{clone}.
  13206. With @var{add} frames of solid-color are added.
  13207. With @var{clone} frames are clones of last frame.
  13208. @item start_duration, stop_duration
  13209. Specify the duration of the start/stop delay. See
  13210. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13211. for the accepted syntax.
  13212. These options override @var{start} and @var{stop}.
  13213. @item color
  13214. Specify the color of the padded area. For the syntax of this option,
  13215. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13216. manual,ffmpeg-utils}.
  13217. The default value of @var{color} is "black".
  13218. @end table
  13219. @anchor{transpose}
  13220. @section transpose
  13221. Transpose rows with columns in the input video and optionally flip it.
  13222. It accepts the following parameters:
  13223. @table @option
  13224. @item dir
  13225. Specify the transposition direction.
  13226. Can assume the following values:
  13227. @table @samp
  13228. @item 0, 4, cclock_flip
  13229. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13230. @example
  13231. L.R L.l
  13232. . . -> . .
  13233. l.r R.r
  13234. @end example
  13235. @item 1, 5, clock
  13236. Rotate by 90 degrees clockwise, that is:
  13237. @example
  13238. L.R l.L
  13239. . . -> . .
  13240. l.r r.R
  13241. @end example
  13242. @item 2, 6, cclock
  13243. Rotate by 90 degrees counterclockwise, that is:
  13244. @example
  13245. L.R R.r
  13246. . . -> . .
  13247. l.r L.l
  13248. @end example
  13249. @item 3, 7, clock_flip
  13250. Rotate by 90 degrees clockwise and vertically flip, that is:
  13251. @example
  13252. L.R r.R
  13253. . . -> . .
  13254. l.r l.L
  13255. @end example
  13256. @end table
  13257. For values between 4-7, the transposition is only done if the input
  13258. video geometry is portrait and not landscape. These values are
  13259. deprecated, the @code{passthrough} option should be used instead.
  13260. Numerical values are deprecated, and should be dropped in favor of
  13261. symbolic constants.
  13262. @item passthrough
  13263. Do not apply the transposition if the input geometry matches the one
  13264. specified by the specified value. It accepts the following values:
  13265. @table @samp
  13266. @item none
  13267. Always apply transposition.
  13268. @item portrait
  13269. Preserve portrait geometry (when @var{height} >= @var{width}).
  13270. @item landscape
  13271. Preserve landscape geometry (when @var{width} >= @var{height}).
  13272. @end table
  13273. Default value is @code{none}.
  13274. @end table
  13275. For example to rotate by 90 degrees clockwise and preserve portrait
  13276. layout:
  13277. @example
  13278. transpose=dir=1:passthrough=portrait
  13279. @end example
  13280. The command above can also be specified as:
  13281. @example
  13282. transpose=1:portrait
  13283. @end example
  13284. @section transpose_npp
  13285. Transpose rows with columns in the input video and optionally flip it.
  13286. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13287. It accepts the following parameters:
  13288. @table @option
  13289. @item dir
  13290. Specify the transposition direction.
  13291. Can assume the following values:
  13292. @table @samp
  13293. @item cclock_flip
  13294. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13295. @item clock
  13296. Rotate by 90 degrees clockwise.
  13297. @item cclock
  13298. Rotate by 90 degrees counterclockwise.
  13299. @item clock_flip
  13300. Rotate by 90 degrees clockwise and vertically flip.
  13301. @end table
  13302. @item passthrough
  13303. Do not apply the transposition if the input geometry matches the one
  13304. specified by the specified value. It accepts the following values:
  13305. @table @samp
  13306. @item none
  13307. Always apply transposition. (default)
  13308. @item portrait
  13309. Preserve portrait geometry (when @var{height} >= @var{width}).
  13310. @item landscape
  13311. Preserve landscape geometry (when @var{width} >= @var{height}).
  13312. @end table
  13313. @end table
  13314. @section trim
  13315. Trim the input so that the output contains one continuous subpart of the input.
  13316. It accepts the following parameters:
  13317. @table @option
  13318. @item start
  13319. Specify the time of the start of the kept section, i.e. the frame with the
  13320. timestamp @var{start} will be the first frame in the output.
  13321. @item end
  13322. Specify the time of the first frame that will be dropped, i.e. the frame
  13323. immediately preceding the one with the timestamp @var{end} will be the last
  13324. frame in the output.
  13325. @item start_pts
  13326. This is the same as @var{start}, except this option sets the start timestamp
  13327. in timebase units instead of seconds.
  13328. @item end_pts
  13329. This is the same as @var{end}, except this option sets the end timestamp
  13330. in timebase units instead of seconds.
  13331. @item duration
  13332. The maximum duration of the output in seconds.
  13333. @item start_frame
  13334. The number of the first frame that should be passed to the output.
  13335. @item end_frame
  13336. The number of the first frame that should be dropped.
  13337. @end table
  13338. @option{start}, @option{end}, and @option{duration} are expressed as time
  13339. duration specifications; see
  13340. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13341. for the accepted syntax.
  13342. Note that the first two sets of the start/end options and the @option{duration}
  13343. option look at the frame timestamp, while the _frame variants simply count the
  13344. frames that pass through the filter. Also note that this filter does not modify
  13345. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13346. setpts filter after the trim filter.
  13347. If multiple start or end options are set, this filter tries to be greedy and
  13348. keep all the frames that match at least one of the specified constraints. To keep
  13349. only the part that matches all the constraints at once, chain multiple trim
  13350. filters.
  13351. The defaults are such that all the input is kept. So it is possible to set e.g.
  13352. just the end values to keep everything before the specified time.
  13353. Examples:
  13354. @itemize
  13355. @item
  13356. Drop everything except the second minute of input:
  13357. @example
  13358. ffmpeg -i INPUT -vf trim=60:120
  13359. @end example
  13360. @item
  13361. Keep only the first second:
  13362. @example
  13363. ffmpeg -i INPUT -vf trim=duration=1
  13364. @end example
  13365. @end itemize
  13366. @section unpremultiply
  13367. Apply alpha unpremultiply effect to input video stream using first plane
  13368. of second stream as alpha.
  13369. Both streams must have same dimensions and same pixel format.
  13370. The filter accepts the following option:
  13371. @table @option
  13372. @item planes
  13373. Set which planes will be processed, unprocessed planes will be copied.
  13374. By default value 0xf, all planes will be processed.
  13375. If the format has 1 or 2 components, then luma is bit 0.
  13376. If the format has 3 or 4 components:
  13377. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13378. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13379. If present, the alpha channel is always the last bit.
  13380. @item inplace
  13381. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13382. @end table
  13383. @anchor{unsharp}
  13384. @section unsharp
  13385. Sharpen or blur the input video.
  13386. It accepts the following parameters:
  13387. @table @option
  13388. @item luma_msize_x, lx
  13389. Set the luma matrix horizontal size. It must be an odd integer between
  13390. 3 and 23. The default value is 5.
  13391. @item luma_msize_y, ly
  13392. Set the luma matrix vertical size. It must be an odd integer between 3
  13393. and 23. The default value is 5.
  13394. @item luma_amount, la
  13395. Set the luma effect strength. It must be a floating point number, reasonable
  13396. values lay between -1.5 and 1.5.
  13397. Negative values will blur the input video, while positive values will
  13398. sharpen it, a value of zero will disable the effect.
  13399. Default value is 1.0.
  13400. @item chroma_msize_x, cx
  13401. Set the chroma matrix horizontal size. It must be an odd integer
  13402. between 3 and 23. The default value is 5.
  13403. @item chroma_msize_y, cy
  13404. Set the chroma matrix vertical size. It must be an odd integer
  13405. between 3 and 23. The default value is 5.
  13406. @item chroma_amount, ca
  13407. Set the chroma effect strength. It must be a floating point number, reasonable
  13408. values lay between -1.5 and 1.5.
  13409. Negative values will blur the input video, while positive values will
  13410. sharpen it, a value of zero will disable the effect.
  13411. Default value is 0.0.
  13412. @end table
  13413. All parameters are optional and default to the equivalent of the
  13414. string '5:5:1.0:5:5:0.0'.
  13415. @subsection Examples
  13416. @itemize
  13417. @item
  13418. Apply strong luma sharpen effect:
  13419. @example
  13420. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13421. @end example
  13422. @item
  13423. Apply a strong blur of both luma and chroma parameters:
  13424. @example
  13425. unsharp=7:7:-2:7:7:-2
  13426. @end example
  13427. @end itemize
  13428. @section uspp
  13429. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13430. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13431. shifts and average the results.
  13432. The way this differs from the behavior of spp is that uspp actually encodes &
  13433. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13434. DCT similar to MJPEG.
  13435. The filter accepts the following options:
  13436. @table @option
  13437. @item quality
  13438. Set quality. This option defines the number of levels for averaging. It accepts
  13439. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13440. effect. A value of @code{8} means the higher quality. For each increment of
  13441. that value the speed drops by a factor of approximately 2. Default value is
  13442. @code{3}.
  13443. @item qp
  13444. Force a constant quantization parameter. If not set, the filter will use the QP
  13445. from the video stream (if available).
  13446. @end table
  13447. @section vaguedenoiser
  13448. Apply a wavelet based denoiser.
  13449. It transforms each frame from the video input into the wavelet domain,
  13450. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13451. the obtained coefficients. It does an inverse wavelet transform after.
  13452. Due to wavelet properties, it should give a nice smoothed result, and
  13453. reduced noise, without blurring picture features.
  13454. This filter accepts the following options:
  13455. @table @option
  13456. @item threshold
  13457. The filtering strength. The higher, the more filtered the video will be.
  13458. Hard thresholding can use a higher threshold than soft thresholding
  13459. before the video looks overfiltered. Default value is 2.
  13460. @item method
  13461. The filtering method the filter will use.
  13462. It accepts the following values:
  13463. @table @samp
  13464. @item hard
  13465. All values under the threshold will be zeroed.
  13466. @item soft
  13467. All values under the threshold will be zeroed. All values above will be
  13468. reduced by the threshold.
  13469. @item garrote
  13470. Scales or nullifies coefficients - intermediary between (more) soft and
  13471. (less) hard thresholding.
  13472. @end table
  13473. Default is garrote.
  13474. @item nsteps
  13475. Number of times, the wavelet will decompose the picture. Picture can't
  13476. be decomposed beyond a particular point (typically, 8 for a 640x480
  13477. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13478. @item percent
  13479. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13480. @item planes
  13481. A list of the planes to process. By default all planes are processed.
  13482. @end table
  13483. @section vectorscope
  13484. Display 2 color component values in the two dimensional graph (which is called
  13485. a vectorscope).
  13486. This filter accepts the following options:
  13487. @table @option
  13488. @item mode, m
  13489. Set vectorscope mode.
  13490. It accepts the following values:
  13491. @table @samp
  13492. @item gray
  13493. Gray values are displayed on graph, higher brightness means more pixels have
  13494. same component color value on location in graph. This is the default mode.
  13495. @item color
  13496. Gray values are displayed on graph. Surrounding pixels values which are not
  13497. present in video frame are drawn in gradient of 2 color components which are
  13498. set by option @code{x} and @code{y}. The 3rd color component is static.
  13499. @item color2
  13500. Actual color components values present in video frame are displayed on graph.
  13501. @item color3
  13502. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13503. on graph increases value of another color component, which is luminance by
  13504. default values of @code{x} and @code{y}.
  13505. @item color4
  13506. Actual colors present in video frame are displayed on graph. If two different
  13507. colors map to same position on graph then color with higher value of component
  13508. not present in graph is picked.
  13509. @item color5
  13510. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13511. component picked from radial gradient.
  13512. @end table
  13513. @item x
  13514. Set which color component will be represented on X-axis. Default is @code{1}.
  13515. @item y
  13516. Set which color component will be represented on Y-axis. Default is @code{2}.
  13517. @item intensity, i
  13518. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13519. of color component which represents frequency of (X, Y) location in graph.
  13520. @item envelope, e
  13521. @table @samp
  13522. @item none
  13523. No envelope, this is default.
  13524. @item instant
  13525. Instant envelope, even darkest single pixel will be clearly highlighted.
  13526. @item peak
  13527. Hold maximum and minimum values presented in graph over time. This way you
  13528. can still spot out of range values without constantly looking at vectorscope.
  13529. @item peak+instant
  13530. Peak and instant envelope combined together.
  13531. @end table
  13532. @item graticule, g
  13533. Set what kind of graticule to draw.
  13534. @table @samp
  13535. @item none
  13536. @item green
  13537. @item color
  13538. @end table
  13539. @item opacity, o
  13540. Set graticule opacity.
  13541. @item flags, f
  13542. Set graticule flags.
  13543. @table @samp
  13544. @item white
  13545. Draw graticule for white point.
  13546. @item black
  13547. Draw graticule for black point.
  13548. @item name
  13549. Draw color points short names.
  13550. @end table
  13551. @item bgopacity, b
  13552. Set background opacity.
  13553. @item lthreshold, l
  13554. Set low threshold for color component not represented on X or Y axis.
  13555. Values lower than this value will be ignored. Default is 0.
  13556. Note this value is multiplied with actual max possible value one pixel component
  13557. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13558. is 0.1 * 255 = 25.
  13559. @item hthreshold, h
  13560. Set high threshold for color component not represented on X or Y axis.
  13561. Values higher than this value will be ignored. Default is 1.
  13562. Note this value is multiplied with actual max possible value one pixel component
  13563. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13564. is 0.9 * 255 = 230.
  13565. @item colorspace, c
  13566. Set what kind of colorspace to use when drawing graticule.
  13567. @table @samp
  13568. @item auto
  13569. @item 601
  13570. @item 709
  13571. @end table
  13572. Default is auto.
  13573. @end table
  13574. @anchor{vidstabdetect}
  13575. @section vidstabdetect
  13576. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13577. @ref{vidstabtransform} for pass 2.
  13578. This filter generates a file with relative translation and rotation
  13579. transform information about subsequent frames, which is then used by
  13580. the @ref{vidstabtransform} filter.
  13581. To enable compilation of this filter you need to configure FFmpeg with
  13582. @code{--enable-libvidstab}.
  13583. This filter accepts the following options:
  13584. @table @option
  13585. @item result
  13586. Set the path to the file used to write the transforms information.
  13587. Default value is @file{transforms.trf}.
  13588. @item shakiness
  13589. Set how shaky the video is and how quick the camera is. It accepts an
  13590. integer in the range 1-10, a value of 1 means little shakiness, a
  13591. value of 10 means strong shakiness. Default value is 5.
  13592. @item accuracy
  13593. Set the accuracy of the detection process. It must be a value in the
  13594. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13595. accuracy. Default value is 15.
  13596. @item stepsize
  13597. Set stepsize of the search process. The region around minimum is
  13598. scanned with 1 pixel resolution. Default value is 6.
  13599. @item mincontrast
  13600. Set minimum contrast. Below this value a local measurement field is
  13601. discarded. Must be a floating point value in the range 0-1. Default
  13602. value is 0.3.
  13603. @item tripod
  13604. Set reference frame number for tripod mode.
  13605. If enabled, the motion of the frames is compared to a reference frame
  13606. in the filtered stream, identified by the specified number. The idea
  13607. is to compensate all movements in a more-or-less static scene and keep
  13608. the camera view absolutely still.
  13609. If set to 0, it is disabled. The frames are counted starting from 1.
  13610. @item show
  13611. Show fields and transforms in the resulting frames. It accepts an
  13612. integer in the range 0-2. Default value is 0, which disables any
  13613. visualization.
  13614. @end table
  13615. @subsection Examples
  13616. @itemize
  13617. @item
  13618. Use default values:
  13619. @example
  13620. vidstabdetect
  13621. @end example
  13622. @item
  13623. Analyze strongly shaky movie and put the results in file
  13624. @file{mytransforms.trf}:
  13625. @example
  13626. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13627. @end example
  13628. @item
  13629. Visualize the result of internal transformations in the resulting
  13630. video:
  13631. @example
  13632. vidstabdetect=show=1
  13633. @end example
  13634. @item
  13635. Analyze a video with medium shakiness using @command{ffmpeg}:
  13636. @example
  13637. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13638. @end example
  13639. @end itemize
  13640. @anchor{vidstabtransform}
  13641. @section vidstabtransform
  13642. Video stabilization/deshaking: pass 2 of 2,
  13643. see @ref{vidstabdetect} for pass 1.
  13644. Read a file with transform information for each frame and
  13645. apply/compensate them. Together with the @ref{vidstabdetect}
  13646. filter this can be used to deshake videos. See also
  13647. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13648. the @ref{unsharp} filter, see below.
  13649. To enable compilation of this filter you need to configure FFmpeg with
  13650. @code{--enable-libvidstab}.
  13651. @subsection Options
  13652. @table @option
  13653. @item input
  13654. Set path to the file used to read the transforms. Default value is
  13655. @file{transforms.trf}.
  13656. @item smoothing
  13657. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13658. camera movements. Default value is 10.
  13659. For example a number of 10 means that 21 frames are used (10 in the
  13660. past and 10 in the future) to smoothen the motion in the video. A
  13661. larger value leads to a smoother video, but limits the acceleration of
  13662. the camera (pan/tilt movements). 0 is a special case where a static
  13663. camera is simulated.
  13664. @item optalgo
  13665. Set the camera path optimization algorithm.
  13666. Accepted values are:
  13667. @table @samp
  13668. @item gauss
  13669. gaussian kernel low-pass filter on camera motion (default)
  13670. @item avg
  13671. averaging on transformations
  13672. @end table
  13673. @item maxshift
  13674. Set maximal number of pixels to translate frames. Default value is -1,
  13675. meaning no limit.
  13676. @item maxangle
  13677. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13678. value is -1, meaning no limit.
  13679. @item crop
  13680. Specify how to deal with borders that may be visible due to movement
  13681. compensation.
  13682. Available values are:
  13683. @table @samp
  13684. @item keep
  13685. keep image information from previous frame (default)
  13686. @item black
  13687. fill the border black
  13688. @end table
  13689. @item invert
  13690. Invert transforms if set to 1. Default value is 0.
  13691. @item relative
  13692. Consider transforms as relative to previous frame if set to 1,
  13693. absolute if set to 0. Default value is 0.
  13694. @item zoom
  13695. Set percentage to zoom. A positive value will result in a zoom-in
  13696. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13697. zoom).
  13698. @item optzoom
  13699. Set optimal zooming to avoid borders.
  13700. Accepted values are:
  13701. @table @samp
  13702. @item 0
  13703. disabled
  13704. @item 1
  13705. optimal static zoom value is determined (only very strong movements
  13706. will lead to visible borders) (default)
  13707. @item 2
  13708. optimal adaptive zoom value is determined (no borders will be
  13709. visible), see @option{zoomspeed}
  13710. @end table
  13711. Note that the value given at zoom is added to the one calculated here.
  13712. @item zoomspeed
  13713. Set percent to zoom maximally each frame (enabled when
  13714. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13715. 0.25.
  13716. @item interpol
  13717. Specify type of interpolation.
  13718. Available values are:
  13719. @table @samp
  13720. @item no
  13721. no interpolation
  13722. @item linear
  13723. linear only horizontal
  13724. @item bilinear
  13725. linear in both directions (default)
  13726. @item bicubic
  13727. cubic in both directions (slow)
  13728. @end table
  13729. @item tripod
  13730. Enable virtual tripod mode if set to 1, which is equivalent to
  13731. @code{relative=0:smoothing=0}. Default value is 0.
  13732. Use also @code{tripod} option of @ref{vidstabdetect}.
  13733. @item debug
  13734. Increase log verbosity if set to 1. Also the detected global motions
  13735. are written to the temporary file @file{global_motions.trf}. Default
  13736. value is 0.
  13737. @end table
  13738. @subsection Examples
  13739. @itemize
  13740. @item
  13741. Use @command{ffmpeg} for a typical stabilization with default values:
  13742. @example
  13743. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13744. @end example
  13745. Note the use of the @ref{unsharp} filter which is always recommended.
  13746. @item
  13747. Zoom in a bit more and load transform data from a given file:
  13748. @example
  13749. vidstabtransform=zoom=5:input="mytransforms.trf"
  13750. @end example
  13751. @item
  13752. Smoothen the video even more:
  13753. @example
  13754. vidstabtransform=smoothing=30
  13755. @end example
  13756. @end itemize
  13757. @section vflip
  13758. Flip the input video vertically.
  13759. For example, to vertically flip a video with @command{ffmpeg}:
  13760. @example
  13761. ffmpeg -i in.avi -vf "vflip" out.avi
  13762. @end example
  13763. @section vfrdet
  13764. Detect variable frame rate video.
  13765. This filter tries to detect if the input is variable or constant frame rate.
  13766. At end it will output number of frames detected as having variable delta pts,
  13767. and ones with constant delta pts.
  13768. If there was frames with variable delta, than it will also show min and max delta
  13769. encountered.
  13770. @section vibrance
  13771. Boost or alter saturation.
  13772. The filter accepts the following options:
  13773. @table @option
  13774. @item intensity
  13775. Set strength of boost if positive value or strength of alter if negative value.
  13776. Default is 0. Allowed range is from -2 to 2.
  13777. @item rbal
  13778. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13779. @item gbal
  13780. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13781. @item bbal
  13782. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13783. @item rlum
  13784. Set the red luma coefficient.
  13785. @item glum
  13786. Set the green luma coefficient.
  13787. @item blum
  13788. Set the blue luma coefficient.
  13789. @item alternate
  13790. If @code{intensity} is negative and this is set to 1, colors will change,
  13791. otherwise colors will be less saturated, more towards gray.
  13792. @end table
  13793. @anchor{vignette}
  13794. @section vignette
  13795. Make or reverse a natural vignetting effect.
  13796. The filter accepts the following options:
  13797. @table @option
  13798. @item angle, a
  13799. Set lens angle expression as a number of radians.
  13800. The value is clipped in the @code{[0,PI/2]} range.
  13801. Default value: @code{"PI/5"}
  13802. @item x0
  13803. @item y0
  13804. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13805. by default.
  13806. @item mode
  13807. Set forward/backward mode.
  13808. Available modes are:
  13809. @table @samp
  13810. @item forward
  13811. The larger the distance from the central point, the darker the image becomes.
  13812. @item backward
  13813. The larger the distance from the central point, the brighter the image becomes.
  13814. This can be used to reverse a vignette effect, though there is no automatic
  13815. detection to extract the lens @option{angle} and other settings (yet). It can
  13816. also be used to create a burning effect.
  13817. @end table
  13818. Default value is @samp{forward}.
  13819. @item eval
  13820. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13821. It accepts the following values:
  13822. @table @samp
  13823. @item init
  13824. Evaluate expressions only once during the filter initialization.
  13825. @item frame
  13826. Evaluate expressions for each incoming frame. This is way slower than the
  13827. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13828. allows advanced dynamic expressions.
  13829. @end table
  13830. Default value is @samp{init}.
  13831. @item dither
  13832. Set dithering to reduce the circular banding effects. Default is @code{1}
  13833. (enabled).
  13834. @item aspect
  13835. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13836. Setting this value to the SAR of the input will make a rectangular vignetting
  13837. following the dimensions of the video.
  13838. Default is @code{1/1}.
  13839. @end table
  13840. @subsection Expressions
  13841. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13842. following parameters.
  13843. @table @option
  13844. @item w
  13845. @item h
  13846. input width and height
  13847. @item n
  13848. the number of input frame, starting from 0
  13849. @item pts
  13850. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13851. @var{TB} units, NAN if undefined
  13852. @item r
  13853. frame rate of the input video, NAN if the input frame rate is unknown
  13854. @item t
  13855. the PTS (Presentation TimeStamp) of the filtered video frame,
  13856. expressed in seconds, NAN if undefined
  13857. @item tb
  13858. time base of the input video
  13859. @end table
  13860. @subsection Examples
  13861. @itemize
  13862. @item
  13863. Apply simple strong vignetting effect:
  13864. @example
  13865. vignette=PI/4
  13866. @end example
  13867. @item
  13868. Make a flickering vignetting:
  13869. @example
  13870. vignette='PI/4+random(1)*PI/50':eval=frame
  13871. @end example
  13872. @end itemize
  13873. @section vmafmotion
  13874. Obtain the average vmaf motion score of a video.
  13875. It is one of the component filters of VMAF.
  13876. The obtained average motion score is printed through the logging system.
  13877. In the below example the input file @file{ref.mpg} is being processed and score
  13878. is computed.
  13879. @example
  13880. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13881. @end example
  13882. @section vstack
  13883. Stack input videos vertically.
  13884. All streams must be of same pixel format and of same width.
  13885. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13886. to create same output.
  13887. The filter accept the following option:
  13888. @table @option
  13889. @item inputs
  13890. Set number of input streams. Default is 2.
  13891. @item shortest
  13892. If set to 1, force the output to terminate when the shortest input
  13893. terminates. Default value is 0.
  13894. @end table
  13895. @section w3fdif
  13896. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13897. Deinterlacing Filter").
  13898. Based on the process described by Martin Weston for BBC R&D, and
  13899. implemented based on the de-interlace algorithm written by Jim
  13900. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13901. uses filter coefficients calculated by BBC R&D.
  13902. This filter use field-dominance information in frame to decide which
  13903. of each pair of fields to place first in the output.
  13904. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  13905. There are two sets of filter coefficients, so called "simple":
  13906. and "complex". Which set of filter coefficients is used can
  13907. be set by passing an optional parameter:
  13908. @table @option
  13909. @item filter
  13910. Set the interlacing filter coefficients. Accepts one of the following values:
  13911. @table @samp
  13912. @item simple
  13913. Simple filter coefficient set.
  13914. @item complex
  13915. More-complex filter coefficient set.
  13916. @end table
  13917. Default value is @samp{complex}.
  13918. @item deint
  13919. Specify which frames to deinterlace. Accept one of the following values:
  13920. @table @samp
  13921. @item all
  13922. Deinterlace all frames,
  13923. @item interlaced
  13924. Only deinterlace frames marked as interlaced.
  13925. @end table
  13926. Default value is @samp{all}.
  13927. @end table
  13928. @section waveform
  13929. Video waveform monitor.
  13930. The waveform monitor plots color component intensity. By default luminance
  13931. only. Each column of the waveform corresponds to a column of pixels in the
  13932. source video.
  13933. It accepts the following options:
  13934. @table @option
  13935. @item mode, m
  13936. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13937. In row mode, the graph on the left side represents color component value 0 and
  13938. the right side represents value = 255. In column mode, the top side represents
  13939. color component value = 0 and bottom side represents value = 255.
  13940. @item intensity, i
  13941. Set intensity. Smaller values are useful to find out how many values of the same
  13942. luminance are distributed across input rows/columns.
  13943. Default value is @code{0.04}. Allowed range is [0, 1].
  13944. @item mirror, r
  13945. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13946. In mirrored mode, higher values will be represented on the left
  13947. side for @code{row} mode and at the top for @code{column} mode. Default is
  13948. @code{1} (mirrored).
  13949. @item display, d
  13950. Set display mode.
  13951. It accepts the following values:
  13952. @table @samp
  13953. @item overlay
  13954. Presents information identical to that in the @code{parade}, except
  13955. that the graphs representing color components are superimposed directly
  13956. over one another.
  13957. This display mode makes it easier to spot relative differences or similarities
  13958. in overlapping areas of the color components that are supposed to be identical,
  13959. such as neutral whites, grays, or blacks.
  13960. @item stack
  13961. Display separate graph for the color components side by side in
  13962. @code{row} mode or one below the other in @code{column} mode.
  13963. @item parade
  13964. Display separate graph for the color components side by side in
  13965. @code{column} mode or one below the other in @code{row} mode.
  13966. Using this display mode makes it easy to spot color casts in the highlights
  13967. and shadows of an image, by comparing the contours of the top and the bottom
  13968. graphs of each waveform. Since whites, grays, and blacks are characterized
  13969. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13970. should display three waveforms of roughly equal width/height. If not, the
  13971. correction is easy to perform by making level adjustments the three waveforms.
  13972. @end table
  13973. Default is @code{stack}.
  13974. @item components, c
  13975. Set which color components to display. Default is 1, which means only luminance
  13976. or red color component if input is in RGB colorspace. If is set for example to
  13977. 7 it will display all 3 (if) available color components.
  13978. @item envelope, e
  13979. @table @samp
  13980. @item none
  13981. No envelope, this is default.
  13982. @item instant
  13983. Instant envelope, minimum and maximum values presented in graph will be easily
  13984. visible even with small @code{step} value.
  13985. @item peak
  13986. Hold minimum and maximum values presented in graph across time. This way you
  13987. can still spot out of range values without constantly looking at waveforms.
  13988. @item peak+instant
  13989. Peak and instant envelope combined together.
  13990. @end table
  13991. @item filter, f
  13992. @table @samp
  13993. @item lowpass
  13994. No filtering, this is default.
  13995. @item flat
  13996. Luma and chroma combined together.
  13997. @item aflat
  13998. Similar as above, but shows difference between blue and red chroma.
  13999. @item xflat
  14000. Similar as above, but use different colors.
  14001. @item chroma
  14002. Displays only chroma.
  14003. @item color
  14004. Displays actual color value on waveform.
  14005. @item acolor
  14006. Similar as above, but with luma showing frequency of chroma values.
  14007. @end table
  14008. @item graticule, g
  14009. Set which graticule to display.
  14010. @table @samp
  14011. @item none
  14012. Do not display graticule.
  14013. @item green
  14014. Display green graticule showing legal broadcast ranges.
  14015. @item orange
  14016. Display orange graticule showing legal broadcast ranges.
  14017. @end table
  14018. @item opacity, o
  14019. Set graticule opacity.
  14020. @item flags, fl
  14021. Set graticule flags.
  14022. @table @samp
  14023. @item numbers
  14024. Draw numbers above lines. By default enabled.
  14025. @item dots
  14026. Draw dots instead of lines.
  14027. @end table
  14028. @item scale, s
  14029. Set scale used for displaying graticule.
  14030. @table @samp
  14031. @item digital
  14032. @item millivolts
  14033. @item ire
  14034. @end table
  14035. Default is digital.
  14036. @item bgopacity, b
  14037. Set background opacity.
  14038. @end table
  14039. @section weave, doubleweave
  14040. The @code{weave} takes a field-based video input and join
  14041. each two sequential fields into single frame, producing a new double
  14042. height clip with half the frame rate and half the frame count.
  14043. The @code{doubleweave} works same as @code{weave} but without
  14044. halving frame rate and frame count.
  14045. It accepts the following option:
  14046. @table @option
  14047. @item first_field
  14048. Set first field. Available values are:
  14049. @table @samp
  14050. @item top, t
  14051. Set the frame as top-field-first.
  14052. @item bottom, b
  14053. Set the frame as bottom-field-first.
  14054. @end table
  14055. @end table
  14056. @subsection Examples
  14057. @itemize
  14058. @item
  14059. Interlace video using @ref{select} and @ref{separatefields} filter:
  14060. @example
  14061. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14062. @end example
  14063. @end itemize
  14064. @section xbr
  14065. Apply the xBR high-quality magnification filter which is designed for pixel
  14066. art. It follows a set of edge-detection rules, see
  14067. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14068. It accepts the following option:
  14069. @table @option
  14070. @item n
  14071. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14072. @code{3xBR} and @code{4} for @code{4xBR}.
  14073. Default is @code{3}.
  14074. @end table
  14075. @section xmedian
  14076. Pick median pixels from several input videos.
  14077. The filter accept the following options:
  14078. @table @option
  14079. @item inputs
  14080. Set number of inputs.
  14081. Default is 3. Allowed range is from 3 to 255.
  14082. If number of inputs is even number, than result will be mean value between two median values.
  14083. @item planes
  14084. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14085. @end table
  14086. @section xstack
  14087. Stack video inputs into custom layout.
  14088. All streams must be of same pixel format.
  14089. The filter accept the following option:
  14090. @table @option
  14091. @item inputs
  14092. Set number of input streams. Default is 2.
  14093. @item layout
  14094. Specify layout of inputs.
  14095. This option requires the desired layout configuration to be explicitly set by the user.
  14096. This sets position of each video input in output. Each input
  14097. is separated by '|'.
  14098. The first number represents the column, and the second number represents the row.
  14099. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14100. where X is video input from which to take width or height.
  14101. Multiple values can be used when separated by '+'. In such
  14102. case values are summed together.
  14103. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14104. a layout must be set by the user.
  14105. @item shortest
  14106. If set to 1, force the output to terminate when the shortest input
  14107. terminates. Default value is 0.
  14108. @end table
  14109. @subsection Examples
  14110. @itemize
  14111. @item
  14112. Display 4 inputs into 2x2 grid,
  14113. note that if inputs are of different sizes unused gaps might appear,
  14114. as not all of output video is used.
  14115. @example
  14116. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14117. @end example
  14118. @item
  14119. Display 4 inputs into 1x4 grid,
  14120. note that if inputs are of different sizes unused gaps might appear,
  14121. as not all of output video is used.
  14122. @example
  14123. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14124. @end example
  14125. @item
  14126. Display 9 inputs into 3x3 grid,
  14127. note that if inputs are of different sizes unused gaps might appear,
  14128. as not all of output video is used.
  14129. @example
  14130. xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
  14131. @end example
  14132. @end itemize
  14133. @anchor{yadif}
  14134. @section yadif
  14135. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14136. filter").
  14137. It accepts the following parameters:
  14138. @table @option
  14139. @item mode
  14140. The interlacing mode to adopt. It accepts one of the following values:
  14141. @table @option
  14142. @item 0, send_frame
  14143. Output one frame for each frame.
  14144. @item 1, send_field
  14145. Output one frame for each field.
  14146. @item 2, send_frame_nospatial
  14147. Like @code{send_frame}, but it skips the spatial interlacing check.
  14148. @item 3, send_field_nospatial
  14149. Like @code{send_field}, but it skips the spatial interlacing check.
  14150. @end table
  14151. The default value is @code{send_frame}.
  14152. @item parity
  14153. The picture field parity assumed for the input interlaced video. It accepts one
  14154. of the following values:
  14155. @table @option
  14156. @item 0, tff
  14157. Assume the top field is first.
  14158. @item 1, bff
  14159. Assume the bottom field is first.
  14160. @item -1, auto
  14161. Enable automatic detection of field parity.
  14162. @end table
  14163. The default value is @code{auto}.
  14164. If the interlacing is unknown or the decoder does not export this information,
  14165. top field first will be assumed.
  14166. @item deint
  14167. Specify which frames to deinterlace. Accept one of the following
  14168. values:
  14169. @table @option
  14170. @item 0, all
  14171. Deinterlace all frames.
  14172. @item 1, interlaced
  14173. Only deinterlace frames marked as interlaced.
  14174. @end table
  14175. The default value is @code{all}.
  14176. @end table
  14177. @section yadif_cuda
  14178. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14179. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14180. and/or nvenc.
  14181. It accepts the following parameters:
  14182. @table @option
  14183. @item mode
  14184. The interlacing mode to adopt. It accepts one of the following values:
  14185. @table @option
  14186. @item 0, send_frame
  14187. Output one frame for each frame.
  14188. @item 1, send_field
  14189. Output one frame for each field.
  14190. @item 2, send_frame_nospatial
  14191. Like @code{send_frame}, but it skips the spatial interlacing check.
  14192. @item 3, send_field_nospatial
  14193. Like @code{send_field}, but it skips the spatial interlacing check.
  14194. @end table
  14195. The default value is @code{send_frame}.
  14196. @item parity
  14197. The picture field parity assumed for the input interlaced video. It accepts one
  14198. of the following values:
  14199. @table @option
  14200. @item 0, tff
  14201. Assume the top field is first.
  14202. @item 1, bff
  14203. Assume the bottom field is first.
  14204. @item -1, auto
  14205. Enable automatic detection of field parity.
  14206. @end table
  14207. The default value is @code{auto}.
  14208. If the interlacing is unknown or the decoder does not export this information,
  14209. top field first will be assumed.
  14210. @item deint
  14211. Specify which frames to deinterlace. Accept one of the following
  14212. values:
  14213. @table @option
  14214. @item 0, all
  14215. Deinterlace all frames.
  14216. @item 1, interlaced
  14217. Only deinterlace frames marked as interlaced.
  14218. @end table
  14219. The default value is @code{all}.
  14220. @end table
  14221. @section zoompan
  14222. Apply Zoom & Pan effect.
  14223. This filter accepts the following options:
  14224. @table @option
  14225. @item zoom, z
  14226. Set the zoom expression. Range is 1-10. Default is 1.
  14227. @item x
  14228. @item y
  14229. Set the x and y expression. Default is 0.
  14230. @item d
  14231. Set the duration expression in number of frames.
  14232. This sets for how many number of frames effect will last for
  14233. single input image.
  14234. @item s
  14235. Set the output image size, default is 'hd720'.
  14236. @item fps
  14237. Set the output frame rate, default is '25'.
  14238. @end table
  14239. Each expression can contain the following constants:
  14240. @table @option
  14241. @item in_w, iw
  14242. Input width.
  14243. @item in_h, ih
  14244. Input height.
  14245. @item out_w, ow
  14246. Output width.
  14247. @item out_h, oh
  14248. Output height.
  14249. @item in
  14250. Input frame count.
  14251. @item on
  14252. Output frame count.
  14253. @item x
  14254. @item y
  14255. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14256. for current input frame.
  14257. @item px
  14258. @item py
  14259. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14260. not yet such frame (first input frame).
  14261. @item zoom
  14262. Last calculated zoom from 'z' expression for current input frame.
  14263. @item pzoom
  14264. Last calculated zoom of last output frame of previous input frame.
  14265. @item duration
  14266. Number of output frames for current input frame. Calculated from 'd' expression
  14267. for each input frame.
  14268. @item pduration
  14269. number of output frames created for previous input frame
  14270. @item a
  14271. Rational number: input width / input height
  14272. @item sar
  14273. sample aspect ratio
  14274. @item dar
  14275. display aspect ratio
  14276. @end table
  14277. @subsection Examples
  14278. @itemize
  14279. @item
  14280. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14281. @example
  14282. 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
  14283. @end example
  14284. @item
  14285. Zoom-in up to 1.5 and pan always at center of picture:
  14286. @example
  14287. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14288. @end example
  14289. @item
  14290. Same as above but without pausing:
  14291. @example
  14292. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14293. @end example
  14294. @end itemize
  14295. @anchor{zscale}
  14296. @section zscale
  14297. Scale (resize) the input video, using the z.lib library:
  14298. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14299. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14300. The zscale filter forces the output display aspect ratio to be the same
  14301. as the input, by changing the output sample aspect ratio.
  14302. If the input image format is different from the format requested by
  14303. the next filter, the zscale filter will convert the input to the
  14304. requested format.
  14305. @subsection Options
  14306. The filter accepts the following options.
  14307. @table @option
  14308. @item width, w
  14309. @item height, h
  14310. Set the output video dimension expression. Default value is the input
  14311. dimension.
  14312. If the @var{width} or @var{w} value is 0, the input width is used for
  14313. the output. If the @var{height} or @var{h} value is 0, the input height
  14314. is used for the output.
  14315. If one and only one of the values is -n with n >= 1, the zscale filter
  14316. will use a value that maintains the aspect ratio of the input image,
  14317. calculated from the other specified dimension. After that it will,
  14318. however, make sure that the calculated dimension is divisible by n and
  14319. adjust the value if necessary.
  14320. If both values are -n with n >= 1, the behavior will be identical to
  14321. both values being set to 0 as previously detailed.
  14322. See below for the list of accepted constants for use in the dimension
  14323. expression.
  14324. @item size, s
  14325. Set the video size. For the syntax of this option, check the
  14326. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14327. @item dither, d
  14328. Set the dither type.
  14329. Possible values are:
  14330. @table @var
  14331. @item none
  14332. @item ordered
  14333. @item random
  14334. @item error_diffusion
  14335. @end table
  14336. Default is none.
  14337. @item filter, f
  14338. Set the resize filter type.
  14339. Possible values are:
  14340. @table @var
  14341. @item point
  14342. @item bilinear
  14343. @item bicubic
  14344. @item spline16
  14345. @item spline36
  14346. @item lanczos
  14347. @end table
  14348. Default is bilinear.
  14349. @item range, r
  14350. Set the color range.
  14351. Possible values are:
  14352. @table @var
  14353. @item input
  14354. @item limited
  14355. @item full
  14356. @end table
  14357. Default is same as input.
  14358. @item primaries, p
  14359. Set the color primaries.
  14360. Possible values are:
  14361. @table @var
  14362. @item input
  14363. @item 709
  14364. @item unspecified
  14365. @item 170m
  14366. @item 240m
  14367. @item 2020
  14368. @end table
  14369. Default is same as input.
  14370. @item transfer, t
  14371. Set the transfer characteristics.
  14372. Possible values are:
  14373. @table @var
  14374. @item input
  14375. @item 709
  14376. @item unspecified
  14377. @item 601
  14378. @item linear
  14379. @item 2020_10
  14380. @item 2020_12
  14381. @item smpte2084
  14382. @item iec61966-2-1
  14383. @item arib-std-b67
  14384. @end table
  14385. Default is same as input.
  14386. @item matrix, m
  14387. Set the colorspace matrix.
  14388. Possible value are:
  14389. @table @var
  14390. @item input
  14391. @item 709
  14392. @item unspecified
  14393. @item 470bg
  14394. @item 170m
  14395. @item 2020_ncl
  14396. @item 2020_cl
  14397. @end table
  14398. Default is same as input.
  14399. @item rangein, rin
  14400. Set the input color range.
  14401. Possible values are:
  14402. @table @var
  14403. @item input
  14404. @item limited
  14405. @item full
  14406. @end table
  14407. Default is same as input.
  14408. @item primariesin, pin
  14409. Set the input color primaries.
  14410. Possible values are:
  14411. @table @var
  14412. @item input
  14413. @item 709
  14414. @item unspecified
  14415. @item 170m
  14416. @item 240m
  14417. @item 2020
  14418. @end table
  14419. Default is same as input.
  14420. @item transferin, tin
  14421. Set the input transfer characteristics.
  14422. Possible values are:
  14423. @table @var
  14424. @item input
  14425. @item 709
  14426. @item unspecified
  14427. @item 601
  14428. @item linear
  14429. @item 2020_10
  14430. @item 2020_12
  14431. @end table
  14432. Default is same as input.
  14433. @item matrixin, min
  14434. Set the input colorspace matrix.
  14435. Possible value are:
  14436. @table @var
  14437. @item input
  14438. @item 709
  14439. @item unspecified
  14440. @item 470bg
  14441. @item 170m
  14442. @item 2020_ncl
  14443. @item 2020_cl
  14444. @end table
  14445. @item chromal, c
  14446. Set the output chroma location.
  14447. Possible values are:
  14448. @table @var
  14449. @item input
  14450. @item left
  14451. @item center
  14452. @item topleft
  14453. @item top
  14454. @item bottomleft
  14455. @item bottom
  14456. @end table
  14457. @item chromalin, cin
  14458. Set the input chroma location.
  14459. Possible values are:
  14460. @table @var
  14461. @item input
  14462. @item left
  14463. @item center
  14464. @item topleft
  14465. @item top
  14466. @item bottomleft
  14467. @item bottom
  14468. @end table
  14469. @item npl
  14470. Set the nominal peak luminance.
  14471. @end table
  14472. The values of the @option{w} and @option{h} options are expressions
  14473. containing the following constants:
  14474. @table @var
  14475. @item in_w
  14476. @item in_h
  14477. The input width and height
  14478. @item iw
  14479. @item ih
  14480. These are the same as @var{in_w} and @var{in_h}.
  14481. @item out_w
  14482. @item out_h
  14483. The output (scaled) width and height
  14484. @item ow
  14485. @item oh
  14486. These are the same as @var{out_w} and @var{out_h}
  14487. @item a
  14488. The same as @var{iw} / @var{ih}
  14489. @item sar
  14490. input sample aspect ratio
  14491. @item dar
  14492. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14493. @item hsub
  14494. @item vsub
  14495. horizontal and vertical input chroma subsample values. For example for the
  14496. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14497. @item ohsub
  14498. @item ovsub
  14499. horizontal and vertical output chroma subsample values. For example for the
  14500. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14501. @end table
  14502. @table @option
  14503. @end table
  14504. @c man end VIDEO FILTERS
  14505. @chapter OpenCL Video Filters
  14506. @c man begin OPENCL VIDEO FILTERS
  14507. Below is a description of the currently available OpenCL video filters.
  14508. To enable compilation of these filters you need to configure FFmpeg with
  14509. @code{--enable-opencl}.
  14510. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14511. @table @option
  14512. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14513. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14514. given device parameters.
  14515. @item -filter_hw_device @var{name}
  14516. Pass the hardware device called @var{name} to all filters in any filter graph.
  14517. @end table
  14518. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14519. @itemize
  14520. @item
  14521. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14522. @example
  14523. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14524. @end example
  14525. @end itemize
  14526. 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.
  14527. @section avgblur_opencl
  14528. Apply average blur filter.
  14529. The filter accepts the following options:
  14530. @table @option
  14531. @item sizeX
  14532. Set horizontal radius size.
  14533. Range is @code{[1, 1024]} and default value is @code{1}.
  14534. @item planes
  14535. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14536. @item sizeY
  14537. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14538. @end table
  14539. @subsection Example
  14540. @itemize
  14541. @item
  14542. 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.
  14543. @example
  14544. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14545. @end example
  14546. @end itemize
  14547. @section boxblur_opencl
  14548. Apply a boxblur algorithm to the input video.
  14549. It accepts the following parameters:
  14550. @table @option
  14551. @item luma_radius, lr
  14552. @item luma_power, lp
  14553. @item chroma_radius, cr
  14554. @item chroma_power, cp
  14555. @item alpha_radius, ar
  14556. @item alpha_power, ap
  14557. @end table
  14558. A description of the accepted options follows.
  14559. @table @option
  14560. @item luma_radius, lr
  14561. @item chroma_radius, cr
  14562. @item alpha_radius, ar
  14563. Set an expression for the box radius in pixels used for blurring the
  14564. corresponding input plane.
  14565. The radius value must be a non-negative number, and must not be
  14566. greater than the value of the expression @code{min(w,h)/2} for the
  14567. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14568. planes.
  14569. Default value for @option{luma_radius} is "2". If not specified,
  14570. @option{chroma_radius} and @option{alpha_radius} default to the
  14571. corresponding value set for @option{luma_radius}.
  14572. The expressions can contain the following constants:
  14573. @table @option
  14574. @item w
  14575. @item h
  14576. The input width and height in pixels.
  14577. @item cw
  14578. @item ch
  14579. The input chroma image width and height in pixels.
  14580. @item hsub
  14581. @item vsub
  14582. The horizontal and vertical chroma subsample values. For example, for the
  14583. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14584. @end table
  14585. @item luma_power, lp
  14586. @item chroma_power, cp
  14587. @item alpha_power, ap
  14588. Specify how many times the boxblur filter is applied to the
  14589. corresponding plane.
  14590. Default value for @option{luma_power} is 2. If not specified,
  14591. @option{chroma_power} and @option{alpha_power} default to the
  14592. corresponding value set for @option{luma_power}.
  14593. A value of 0 will disable the effect.
  14594. @end table
  14595. @subsection Examples
  14596. 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.
  14597. @itemize
  14598. @item
  14599. Apply a boxblur filter with the luma, chroma, and alpha radius
  14600. 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.
  14601. @example
  14602. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14603. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14604. @end example
  14605. @item
  14606. 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.
  14607. For the luma plane, a 2x2 box radius will be run once.
  14608. For the chroma plane, a 4x4 box radius will be run 5 times.
  14609. For the alpha plane, a 3x3 box radius will be run 7 times.
  14610. @example
  14611. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14612. @end example
  14613. @end itemize
  14614. @section convolution_opencl
  14615. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14616. The filter accepts the following options:
  14617. @table @option
  14618. @item 0m
  14619. @item 1m
  14620. @item 2m
  14621. @item 3m
  14622. Set matrix for each plane.
  14623. Matrix is sequence of 9, 25 or 49 signed numbers.
  14624. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14625. @item 0rdiv
  14626. @item 1rdiv
  14627. @item 2rdiv
  14628. @item 3rdiv
  14629. Set multiplier for calculated value for each plane.
  14630. If unset or 0, it will be sum of all matrix elements.
  14631. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14632. @item 0bias
  14633. @item 1bias
  14634. @item 2bias
  14635. @item 3bias
  14636. Set bias for each plane. This value is added to the result of the multiplication.
  14637. Useful for making the overall image brighter or darker.
  14638. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14639. @end table
  14640. @subsection Examples
  14641. @itemize
  14642. @item
  14643. Apply sharpen:
  14644. @example
  14645. -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
  14646. @end example
  14647. @item
  14648. Apply blur:
  14649. @example
  14650. -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
  14651. @end example
  14652. @item
  14653. Apply edge enhance:
  14654. @example
  14655. -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
  14656. @end example
  14657. @item
  14658. Apply edge detect:
  14659. @example
  14660. -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
  14661. @end example
  14662. @item
  14663. Apply laplacian edge detector which includes diagonals:
  14664. @example
  14665. -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
  14666. @end example
  14667. @item
  14668. Apply emboss:
  14669. @example
  14670. -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
  14671. @end example
  14672. @end itemize
  14673. @section dilation_opencl
  14674. Apply dilation effect to the video.
  14675. This filter replaces the pixel by the local(3x3) maximum.
  14676. It accepts the following options:
  14677. @table @option
  14678. @item threshold0
  14679. @item threshold1
  14680. @item threshold2
  14681. @item threshold3
  14682. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14683. If @code{0}, plane will remain unchanged.
  14684. @item coordinates
  14685. Flag which specifies the pixel to refer to.
  14686. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14687. Flags to local 3x3 coordinates region centered on @code{x}:
  14688. 1 2 3
  14689. 4 x 5
  14690. 6 7 8
  14691. @end table
  14692. @subsection Example
  14693. @itemize
  14694. @item
  14695. 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.
  14696. @example
  14697. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14698. @end example
  14699. @end itemize
  14700. @section erosion_opencl
  14701. Apply erosion effect to the video.
  14702. This filter replaces the pixel by the local(3x3) minimum.
  14703. It accepts the following options:
  14704. @table @option
  14705. @item threshold0
  14706. @item threshold1
  14707. @item threshold2
  14708. @item threshold3
  14709. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14710. If @code{0}, plane will remain unchanged.
  14711. @item coordinates
  14712. Flag which specifies the pixel to refer to.
  14713. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14714. Flags to local 3x3 coordinates region centered on @code{x}:
  14715. 1 2 3
  14716. 4 x 5
  14717. 6 7 8
  14718. @end table
  14719. @subsection Example
  14720. @itemize
  14721. @item
  14722. 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.
  14723. @example
  14724. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14725. @end example
  14726. @end itemize
  14727. @section colorkey_opencl
  14728. RGB colorspace color keying.
  14729. The filter accepts the following options:
  14730. @table @option
  14731. @item color
  14732. The color which will be replaced with transparency.
  14733. @item similarity
  14734. Similarity percentage with the key color.
  14735. 0.01 matches only the exact key color, while 1.0 matches everything.
  14736. @item blend
  14737. Blend percentage.
  14738. 0.0 makes pixels either fully transparent, or not transparent at all.
  14739. Higher values result in semi-transparent pixels, with a higher transparency
  14740. the more similar the pixels color is to the key color.
  14741. @end table
  14742. @subsection Examples
  14743. @itemize
  14744. @item
  14745. Make every semi-green pixel in the input transparent with some slight blending:
  14746. @example
  14747. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  14748. @end example
  14749. @end itemize
  14750. @section nlmeans_opencl
  14751. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  14752. @section overlay_opencl
  14753. Overlay one video on top of another.
  14754. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14755. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14756. The filter accepts the following options:
  14757. @table @option
  14758. @item x
  14759. Set the x coordinate of the overlaid video on the main video.
  14760. Default value is @code{0}.
  14761. @item y
  14762. Set the x coordinate of the overlaid video on the main video.
  14763. Default value is @code{0}.
  14764. @end table
  14765. @subsection Examples
  14766. @itemize
  14767. @item
  14768. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14769. @example
  14770. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14771. @end example
  14772. @item
  14773. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14774. @example
  14775. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14776. @end example
  14777. @end itemize
  14778. @section prewitt_opencl
  14779. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14780. The filter accepts the following option:
  14781. @table @option
  14782. @item planes
  14783. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14784. @item scale
  14785. Set value which will be multiplied with filtered result.
  14786. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14787. @item delta
  14788. Set value which will be added to filtered result.
  14789. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14790. @end table
  14791. @subsection Example
  14792. @itemize
  14793. @item
  14794. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14795. @example
  14796. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14797. @end example
  14798. @end itemize
  14799. @section roberts_opencl
  14800. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14801. The filter accepts the following option:
  14802. @table @option
  14803. @item planes
  14804. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14805. @item scale
  14806. Set value which will be multiplied with filtered result.
  14807. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14808. @item delta
  14809. Set value which will be added to filtered result.
  14810. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14811. @end table
  14812. @subsection Example
  14813. @itemize
  14814. @item
  14815. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14816. @example
  14817. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14818. @end example
  14819. @end itemize
  14820. @section sobel_opencl
  14821. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14822. The filter accepts the following option:
  14823. @table @option
  14824. @item planes
  14825. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14826. @item scale
  14827. Set value which will be multiplied with filtered result.
  14828. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14829. @item delta
  14830. Set value which will be added to filtered result.
  14831. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14832. @end table
  14833. @subsection Example
  14834. @itemize
  14835. @item
  14836. Apply sobel operator with scale set to 2 and delta set to 10
  14837. @example
  14838. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14839. @end example
  14840. @end itemize
  14841. @section tonemap_opencl
  14842. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14843. It accepts the following parameters:
  14844. @table @option
  14845. @item tonemap
  14846. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14847. @item param
  14848. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14849. @item desat
  14850. Apply desaturation for highlights that exceed this level of brightness. The
  14851. higher the parameter, the more color information will be preserved. This
  14852. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14853. (smoothly) turning into white instead. This makes images feel more natural,
  14854. at the cost of reducing information about out-of-range colors.
  14855. The default value is 0.5, and the algorithm here is a little different from
  14856. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14857. @item threshold
  14858. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14859. is used to detect whether the scene has changed or not. If the distance between
  14860. the current frame average brightness and the current running average exceeds
  14861. a threshold value, we would re-calculate scene average and peak brightness.
  14862. The default value is 0.2.
  14863. @item format
  14864. Specify the output pixel format.
  14865. Currently supported formats are:
  14866. @table @var
  14867. @item p010
  14868. @item nv12
  14869. @end table
  14870. @item range, r
  14871. Set the output color range.
  14872. Possible values are:
  14873. @table @var
  14874. @item tv/mpeg
  14875. @item pc/jpeg
  14876. @end table
  14877. Default is same as input.
  14878. @item primaries, p
  14879. Set the output color primaries.
  14880. Possible values are:
  14881. @table @var
  14882. @item bt709
  14883. @item bt2020
  14884. @end table
  14885. Default is same as input.
  14886. @item transfer, t
  14887. Set the output transfer characteristics.
  14888. Possible values are:
  14889. @table @var
  14890. @item bt709
  14891. @item bt2020
  14892. @end table
  14893. Default is bt709.
  14894. @item matrix, m
  14895. Set the output colorspace matrix.
  14896. Possible value are:
  14897. @table @var
  14898. @item bt709
  14899. @item bt2020
  14900. @end table
  14901. Default is same as input.
  14902. @end table
  14903. @subsection Example
  14904. @itemize
  14905. @item
  14906. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14907. @example
  14908. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14909. @end example
  14910. @end itemize
  14911. @section unsharp_opencl
  14912. Sharpen or blur the input video.
  14913. It accepts the following parameters:
  14914. @table @option
  14915. @item luma_msize_x, lx
  14916. Set the luma matrix horizontal size.
  14917. Range is @code{[1, 23]} and default value is @code{5}.
  14918. @item luma_msize_y, ly
  14919. Set the luma matrix vertical size.
  14920. Range is @code{[1, 23]} and default value is @code{5}.
  14921. @item luma_amount, la
  14922. Set the luma effect strength.
  14923. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14924. Negative values will blur the input video, while positive values will
  14925. sharpen it, a value of zero will disable the effect.
  14926. @item chroma_msize_x, cx
  14927. Set the chroma matrix horizontal size.
  14928. Range is @code{[1, 23]} and default value is @code{5}.
  14929. @item chroma_msize_y, cy
  14930. Set the chroma matrix vertical size.
  14931. Range is @code{[1, 23]} and default value is @code{5}.
  14932. @item chroma_amount, ca
  14933. Set the chroma effect strength.
  14934. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14935. Negative values will blur the input video, while positive values will
  14936. sharpen it, a value of zero will disable the effect.
  14937. @end table
  14938. All parameters are optional and default to the equivalent of the
  14939. string '5:5:1.0:5:5:0.0'.
  14940. @subsection Examples
  14941. @itemize
  14942. @item
  14943. Apply strong luma sharpen effect:
  14944. @example
  14945. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14946. @end example
  14947. @item
  14948. Apply a strong blur of both luma and chroma parameters:
  14949. @example
  14950. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14951. @end example
  14952. @end itemize
  14953. @c man end OPENCL VIDEO FILTERS
  14954. @chapter Video Sources
  14955. @c man begin VIDEO SOURCES
  14956. Below is a description of the currently available video sources.
  14957. @section buffer
  14958. Buffer video frames, and make them available to the filter chain.
  14959. This source is mainly intended for a programmatic use, in particular
  14960. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14961. It accepts the following parameters:
  14962. @table @option
  14963. @item video_size
  14964. Specify the size (width and height) of the buffered video frames. For the
  14965. syntax of this option, check the
  14966. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14967. @item width
  14968. The input video width.
  14969. @item height
  14970. The input video height.
  14971. @item pix_fmt
  14972. A string representing the pixel format of the buffered video frames.
  14973. It may be a number corresponding to a pixel format, or a pixel format
  14974. name.
  14975. @item time_base
  14976. Specify the timebase assumed by the timestamps of the buffered frames.
  14977. @item frame_rate
  14978. Specify the frame rate expected for the video stream.
  14979. @item pixel_aspect, sar
  14980. The sample (pixel) aspect ratio of the input video.
  14981. @item sws_param
  14982. Specify the optional parameters to be used for the scale filter which
  14983. is automatically inserted when an input change is detected in the
  14984. input size or format.
  14985. @item hw_frames_ctx
  14986. When using a hardware pixel format, this should be a reference to an
  14987. AVHWFramesContext describing input frames.
  14988. @end table
  14989. For example:
  14990. @example
  14991. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14992. @end example
  14993. will instruct the source to accept video frames with size 320x240 and
  14994. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14995. square pixels (1:1 sample aspect ratio).
  14996. Since the pixel format with name "yuv410p" corresponds to the number 6
  14997. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14998. this example corresponds to:
  14999. @example
  15000. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15001. @end example
  15002. Alternatively, the options can be specified as a flat string, but this
  15003. syntax is deprecated:
  15004. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  15005. @section cellauto
  15006. Create a pattern generated by an elementary cellular automaton.
  15007. The initial state of the cellular automaton can be defined through the
  15008. @option{filename} and @option{pattern} options. If such options are
  15009. not specified an initial state is created randomly.
  15010. At each new frame a new row in the video is filled with the result of
  15011. the cellular automaton next generation. The behavior when the whole
  15012. frame is filled is defined by the @option{scroll} option.
  15013. This source accepts the following options:
  15014. @table @option
  15015. @item filename, f
  15016. Read the initial cellular automaton state, i.e. the starting row, from
  15017. the specified file.
  15018. In the file, each non-whitespace character is considered an alive
  15019. cell, a newline will terminate the row, and further characters in the
  15020. file will be ignored.
  15021. @item pattern, p
  15022. Read the initial cellular automaton state, i.e. the starting row, from
  15023. the specified string.
  15024. Each non-whitespace character in the string is considered an alive
  15025. cell, a newline will terminate the row, and further characters in the
  15026. string will be ignored.
  15027. @item rate, r
  15028. Set the video rate, that is the number of frames generated per second.
  15029. Default is 25.
  15030. @item random_fill_ratio, ratio
  15031. Set the random fill ratio for the initial cellular automaton row. It
  15032. is a floating point number value ranging from 0 to 1, defaults to
  15033. 1/PHI.
  15034. This option is ignored when a file or a pattern is specified.
  15035. @item random_seed, seed
  15036. Set the seed for filling randomly the initial row, must be an integer
  15037. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15038. set to -1, the filter will try to use a good random seed on a best
  15039. effort basis.
  15040. @item rule
  15041. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15042. Default value is 110.
  15043. @item size, s
  15044. Set the size of the output video. For the syntax of this option, check the
  15045. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15046. If @option{filename} or @option{pattern} is specified, the size is set
  15047. by default to the width of the specified initial state row, and the
  15048. height is set to @var{width} * PHI.
  15049. If @option{size} is set, it must contain the width of the specified
  15050. pattern string, and the specified pattern will be centered in the
  15051. larger row.
  15052. If a filename or a pattern string is not specified, the size value
  15053. defaults to "320x518" (used for a randomly generated initial state).
  15054. @item scroll
  15055. If set to 1, scroll the output upward when all the rows in the output
  15056. have been already filled. If set to 0, the new generated row will be
  15057. written over the top row just after the bottom row is filled.
  15058. Defaults to 1.
  15059. @item start_full, full
  15060. If set to 1, completely fill the output with generated rows before
  15061. outputting the first frame.
  15062. This is the default behavior, for disabling set the value to 0.
  15063. @item stitch
  15064. If set to 1, stitch the left and right row edges together.
  15065. This is the default behavior, for disabling set the value to 0.
  15066. @end table
  15067. @subsection Examples
  15068. @itemize
  15069. @item
  15070. Read the initial state from @file{pattern}, and specify an output of
  15071. size 200x400.
  15072. @example
  15073. cellauto=f=pattern:s=200x400
  15074. @end example
  15075. @item
  15076. Generate a random initial row with a width of 200 cells, with a fill
  15077. ratio of 2/3:
  15078. @example
  15079. cellauto=ratio=2/3:s=200x200
  15080. @end example
  15081. @item
  15082. Create a pattern generated by rule 18 starting by a single alive cell
  15083. centered on an initial row with width 100:
  15084. @example
  15085. cellauto=p=@@:s=100x400:full=0:rule=18
  15086. @end example
  15087. @item
  15088. Specify a more elaborated initial pattern:
  15089. @example
  15090. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15091. @end example
  15092. @end itemize
  15093. @anchor{coreimagesrc}
  15094. @section coreimagesrc
  15095. Video source generated on GPU using Apple's CoreImage API on OSX.
  15096. This video source is a specialized version of the @ref{coreimage} video filter.
  15097. Use a core image generator at the beginning of the applied filterchain to
  15098. generate the content.
  15099. The coreimagesrc video source accepts the following options:
  15100. @table @option
  15101. @item list_generators
  15102. List all available generators along with all their respective options as well as
  15103. possible minimum and maximum values along with the default values.
  15104. @example
  15105. list_generators=true
  15106. @end example
  15107. @item size, s
  15108. Specify the size of the sourced video. For the syntax of this option, check the
  15109. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15110. The default value is @code{320x240}.
  15111. @item rate, r
  15112. Specify the frame rate of the sourced video, as the number of frames
  15113. generated per second. It has to be a string in the format
  15114. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15115. number or a valid video frame rate abbreviation. The default value is
  15116. "25".
  15117. @item sar
  15118. Set the sample aspect ratio of the sourced video.
  15119. @item duration, d
  15120. Set the duration of the sourced video. See
  15121. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15122. for the accepted syntax.
  15123. If not specified, or the expressed duration is negative, the video is
  15124. supposed to be generated forever.
  15125. @end table
  15126. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15127. A complete filterchain can be used for further processing of the
  15128. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15129. and examples for details.
  15130. @subsection Examples
  15131. @itemize
  15132. @item
  15133. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15134. given as complete and escaped command-line for Apple's standard bash shell:
  15135. @example
  15136. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15137. @end example
  15138. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15139. need for a nullsrc video source.
  15140. @end itemize
  15141. @section mandelbrot
  15142. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15143. point specified with @var{start_x} and @var{start_y}.
  15144. This source accepts the following options:
  15145. @table @option
  15146. @item end_pts
  15147. Set the terminal pts value. Default value is 400.
  15148. @item end_scale
  15149. Set the terminal scale value.
  15150. Must be a floating point value. Default value is 0.3.
  15151. @item inner
  15152. Set the inner coloring mode, that is the algorithm used to draw the
  15153. Mandelbrot fractal internal region.
  15154. It shall assume one of the following values:
  15155. @table @option
  15156. @item black
  15157. Set black mode.
  15158. @item convergence
  15159. Show time until convergence.
  15160. @item mincol
  15161. Set color based on point closest to the origin of the iterations.
  15162. @item period
  15163. Set period mode.
  15164. @end table
  15165. Default value is @var{mincol}.
  15166. @item bailout
  15167. Set the bailout value. Default value is 10.0.
  15168. @item maxiter
  15169. Set the maximum of iterations performed by the rendering
  15170. algorithm. Default value is 7189.
  15171. @item outer
  15172. Set outer coloring mode.
  15173. It shall assume one of following values:
  15174. @table @option
  15175. @item iteration_count
  15176. Set iteration count mode.
  15177. @item normalized_iteration_count
  15178. set normalized iteration count mode.
  15179. @end table
  15180. Default value is @var{normalized_iteration_count}.
  15181. @item rate, r
  15182. Set frame rate, expressed as number of frames per second. Default
  15183. value is "25".
  15184. @item size, s
  15185. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15186. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15187. @item start_scale
  15188. Set the initial scale value. Default value is 3.0.
  15189. @item start_x
  15190. Set the initial x position. Must be a floating point value between
  15191. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15192. @item start_y
  15193. Set the initial y position. Must be a floating point value between
  15194. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15195. @end table
  15196. @section mptestsrc
  15197. Generate various test patterns, as generated by the MPlayer test filter.
  15198. The size of the generated video is fixed, and is 256x256.
  15199. This source is useful in particular for testing encoding features.
  15200. This source accepts the following options:
  15201. @table @option
  15202. @item rate, r
  15203. Specify the frame rate of the sourced video, as the number of frames
  15204. generated per second. It has to be a string in the format
  15205. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15206. number or a valid video frame rate abbreviation. The default value is
  15207. "25".
  15208. @item duration, d
  15209. Set the duration of the sourced video. See
  15210. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15211. for the accepted syntax.
  15212. If not specified, or the expressed duration is negative, the video is
  15213. supposed to be generated forever.
  15214. @item test, t
  15215. Set the number or the name of the test to perform. Supported tests are:
  15216. @table @option
  15217. @item dc_luma
  15218. @item dc_chroma
  15219. @item freq_luma
  15220. @item freq_chroma
  15221. @item amp_luma
  15222. @item amp_chroma
  15223. @item cbp
  15224. @item mv
  15225. @item ring1
  15226. @item ring2
  15227. @item all
  15228. @end table
  15229. Default value is "all", which will cycle through the list of all tests.
  15230. @end table
  15231. Some examples:
  15232. @example
  15233. mptestsrc=t=dc_luma
  15234. @end example
  15235. will generate a "dc_luma" test pattern.
  15236. @section frei0r_src
  15237. Provide a frei0r source.
  15238. To enable compilation of this filter you need to install the frei0r
  15239. header and configure FFmpeg with @code{--enable-frei0r}.
  15240. This source accepts the following parameters:
  15241. @table @option
  15242. @item size
  15243. The size of the video to generate. For the syntax of this option, check the
  15244. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15245. @item framerate
  15246. The framerate of the generated video. It may be a string of the form
  15247. @var{num}/@var{den} or a frame rate abbreviation.
  15248. @item filter_name
  15249. The name to the frei0r source to load. For more information regarding frei0r and
  15250. how to set the parameters, read the @ref{frei0r} section in the video filters
  15251. documentation.
  15252. @item filter_params
  15253. A '|'-separated list of parameters to pass to the frei0r source.
  15254. @end table
  15255. For example, to generate a frei0r partik0l source with size 200x200
  15256. and frame rate 10 which is overlaid on the overlay filter main input:
  15257. @example
  15258. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15259. @end example
  15260. @section life
  15261. Generate a life pattern.
  15262. This source is based on a generalization of John Conway's life game.
  15263. The sourced input represents a life grid, each pixel represents a cell
  15264. which can be in one of two possible states, alive or dead. Every cell
  15265. interacts with its eight neighbours, which are the cells that are
  15266. horizontally, vertically, or diagonally adjacent.
  15267. At each interaction the grid evolves according to the adopted rule,
  15268. which specifies the number of neighbor alive cells which will make a
  15269. cell stay alive or born. The @option{rule} option allows one to specify
  15270. the rule to adopt.
  15271. This source accepts the following options:
  15272. @table @option
  15273. @item filename, f
  15274. Set the file from which to read the initial grid state. In the file,
  15275. each non-whitespace character is considered an alive cell, and newline
  15276. is used to delimit the end of each row.
  15277. If this option is not specified, the initial grid is generated
  15278. randomly.
  15279. @item rate, r
  15280. Set the video rate, that is the number of frames generated per second.
  15281. Default is 25.
  15282. @item random_fill_ratio, ratio
  15283. Set the random fill ratio for the initial random grid. It is a
  15284. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15285. It is ignored when a file is specified.
  15286. @item random_seed, seed
  15287. Set the seed for filling the initial random grid, must be an integer
  15288. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15289. set to -1, the filter will try to use a good random seed on a best
  15290. effort basis.
  15291. @item rule
  15292. Set the life rule.
  15293. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15294. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15295. @var{NS} specifies the number of alive neighbor cells which make a
  15296. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15297. which make a dead cell to become alive (i.e. to "born").
  15298. "s" and "b" can be used in place of "S" and "B", respectively.
  15299. Alternatively a rule can be specified by an 18-bits integer. The 9
  15300. high order bits are used to encode the next cell state if it is alive
  15301. for each number of neighbor alive cells, the low order bits specify
  15302. the rule for "borning" new cells. Higher order bits encode for an
  15303. higher number of neighbor cells.
  15304. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15305. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15306. Default value is "S23/B3", which is the original Conway's game of life
  15307. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15308. cells, and will born a new cell if there are three alive cells around
  15309. a dead cell.
  15310. @item size, s
  15311. Set the size of the output video. For the syntax of this option, check the
  15312. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15313. If @option{filename} is specified, the size is set by default to the
  15314. same size of the input file. If @option{size} is set, it must contain
  15315. the size specified in the input file, and the initial grid defined in
  15316. that file is centered in the larger resulting area.
  15317. If a filename is not specified, the size value defaults to "320x240"
  15318. (used for a randomly generated initial grid).
  15319. @item stitch
  15320. If set to 1, stitch the left and right grid edges together, and the
  15321. top and bottom edges also. Defaults to 1.
  15322. @item mold
  15323. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15324. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15325. value from 0 to 255.
  15326. @item life_color
  15327. Set the color of living (or new born) cells.
  15328. @item death_color
  15329. Set the color of dead cells. If @option{mold} is set, this is the first color
  15330. used to represent a dead cell.
  15331. @item mold_color
  15332. Set mold color, for definitely dead and moldy cells.
  15333. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15334. ffmpeg-utils manual,ffmpeg-utils}.
  15335. @end table
  15336. @subsection Examples
  15337. @itemize
  15338. @item
  15339. Read a grid from @file{pattern}, and center it on a grid of size
  15340. 300x300 pixels:
  15341. @example
  15342. life=f=pattern:s=300x300
  15343. @end example
  15344. @item
  15345. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15346. @example
  15347. life=ratio=2/3:s=200x200
  15348. @end example
  15349. @item
  15350. Specify a custom rule for evolving a randomly generated grid:
  15351. @example
  15352. life=rule=S14/B34
  15353. @end example
  15354. @item
  15355. Full example with slow death effect (mold) using @command{ffplay}:
  15356. @example
  15357. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15358. @end example
  15359. @end itemize
  15360. @anchor{allrgb}
  15361. @anchor{allyuv}
  15362. @anchor{color}
  15363. @anchor{haldclutsrc}
  15364. @anchor{nullsrc}
  15365. @anchor{pal75bars}
  15366. @anchor{pal100bars}
  15367. @anchor{rgbtestsrc}
  15368. @anchor{smptebars}
  15369. @anchor{smptehdbars}
  15370. @anchor{testsrc}
  15371. @anchor{testsrc2}
  15372. @anchor{yuvtestsrc}
  15373. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15374. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15375. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15376. The @code{color} source provides an uniformly colored input.
  15377. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15378. @ref{haldclut} filter.
  15379. The @code{nullsrc} source returns unprocessed video frames. It is
  15380. mainly useful to be employed in analysis / debugging tools, or as the
  15381. source for filters which ignore the input data.
  15382. The @code{pal75bars} source generates a color bars pattern, based on
  15383. EBU PAL recommendations with 75% color levels.
  15384. The @code{pal100bars} source generates a color bars pattern, based on
  15385. EBU PAL recommendations with 100% color levels.
  15386. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15387. detecting RGB vs BGR issues. You should see a red, green and blue
  15388. stripe from top to bottom.
  15389. The @code{smptebars} source generates a color bars pattern, based on
  15390. the SMPTE Engineering Guideline EG 1-1990.
  15391. The @code{smptehdbars} source generates a color bars pattern, based on
  15392. the SMPTE RP 219-2002.
  15393. The @code{testsrc} source generates a test video pattern, showing a
  15394. color pattern, a scrolling gradient and a timestamp. This is mainly
  15395. intended for testing purposes.
  15396. The @code{testsrc2} source is similar to testsrc, but supports more
  15397. pixel formats instead of just @code{rgb24}. This allows using it as an
  15398. input for other tests without requiring a format conversion.
  15399. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15400. see a y, cb and cr stripe from top to bottom.
  15401. The sources accept the following parameters:
  15402. @table @option
  15403. @item level
  15404. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15405. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15406. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15407. coded on a @code{1/(N*N)} scale.
  15408. @item color, c
  15409. Specify the color of the source, only available in the @code{color}
  15410. source. For the syntax of this option, check the
  15411. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15412. @item size, s
  15413. Specify the size of the sourced video. For the syntax of this option, check the
  15414. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15415. The default value is @code{320x240}.
  15416. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15417. @code{haldclutsrc} filters.
  15418. @item rate, r
  15419. Specify the frame rate of the sourced video, as the number of frames
  15420. generated per second. It has to be a string in the format
  15421. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15422. number or a valid video frame rate abbreviation. The default value is
  15423. "25".
  15424. @item duration, d
  15425. Set the duration of the sourced video. See
  15426. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15427. for the accepted syntax.
  15428. If not specified, or the expressed duration is negative, the video is
  15429. supposed to be generated forever.
  15430. @item sar
  15431. Set the sample aspect ratio of the sourced video.
  15432. @item alpha
  15433. Specify the alpha (opacity) of the background, only available in the
  15434. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15435. 255 (fully opaque, the default).
  15436. @item decimals, n
  15437. Set the number of decimals to show in the timestamp, only available in the
  15438. @code{testsrc} source.
  15439. The displayed timestamp value will correspond to the original
  15440. timestamp value multiplied by the power of 10 of the specified
  15441. value. Default value is 0.
  15442. @end table
  15443. @subsection Examples
  15444. @itemize
  15445. @item
  15446. Generate a video with a duration of 5.3 seconds, with size
  15447. 176x144 and a frame rate of 10 frames per second:
  15448. @example
  15449. testsrc=duration=5.3:size=qcif:rate=10
  15450. @end example
  15451. @item
  15452. The following graph description will generate a red source
  15453. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15454. frames per second:
  15455. @example
  15456. color=c=red@@0.2:s=qcif:r=10
  15457. @end example
  15458. @item
  15459. If the input content is to be ignored, @code{nullsrc} can be used. The
  15460. following command generates noise in the luminance plane by employing
  15461. the @code{geq} filter:
  15462. @example
  15463. nullsrc=s=256x256, geq=random(1)*255:128:128
  15464. @end example
  15465. @end itemize
  15466. @subsection Commands
  15467. The @code{color} source supports the following commands:
  15468. @table @option
  15469. @item c, color
  15470. Set the color of the created image. Accepts the same syntax of the
  15471. corresponding @option{color} option.
  15472. @end table
  15473. @section openclsrc
  15474. Generate video using an OpenCL program.
  15475. @table @option
  15476. @item source
  15477. OpenCL program source file.
  15478. @item kernel
  15479. Kernel name in program.
  15480. @item size, s
  15481. Size of frames to generate. This must be set.
  15482. @item format
  15483. Pixel format to use for the generated frames. This must be set.
  15484. @item rate, r
  15485. Number of frames generated every second. Default value is '25'.
  15486. @end table
  15487. For details of how the program loading works, see the @ref{program_opencl}
  15488. filter.
  15489. Example programs:
  15490. @itemize
  15491. @item
  15492. Generate a colour ramp by setting pixel values from the position of the pixel
  15493. in the output image. (Note that this will work with all pixel formats, but
  15494. the generated output will not be the same.)
  15495. @verbatim
  15496. __kernel void ramp(__write_only image2d_t dst,
  15497. unsigned int index)
  15498. {
  15499. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15500. float4 val;
  15501. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15502. write_imagef(dst, loc, val);
  15503. }
  15504. @end verbatim
  15505. @item
  15506. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15507. @verbatim
  15508. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15509. unsigned int index)
  15510. {
  15511. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15512. float4 value = 0.0f;
  15513. int x = loc.x + index;
  15514. int y = loc.y + index;
  15515. while (x > 0 || y > 0) {
  15516. if (x % 3 == 1 && y % 3 == 1) {
  15517. value = 1.0f;
  15518. break;
  15519. }
  15520. x /= 3;
  15521. y /= 3;
  15522. }
  15523. write_imagef(dst, loc, value);
  15524. }
  15525. @end verbatim
  15526. @end itemize
  15527. @c man end VIDEO SOURCES
  15528. @chapter Video Sinks
  15529. @c man begin VIDEO SINKS
  15530. Below is a description of the currently available video sinks.
  15531. @section buffersink
  15532. Buffer video frames, and make them available to the end of the filter
  15533. graph.
  15534. This sink is mainly intended for programmatic use, in particular
  15535. through the interface defined in @file{libavfilter/buffersink.h}
  15536. or the options system.
  15537. It accepts a pointer to an AVBufferSinkContext structure, which
  15538. defines the incoming buffers' formats, to be passed as the opaque
  15539. parameter to @code{avfilter_init_filter} for initialization.
  15540. @section nullsink
  15541. Null video sink: do absolutely nothing with the input video. It is
  15542. mainly useful as a template and for use in analysis / debugging
  15543. tools.
  15544. @c man end VIDEO SINKS
  15545. @chapter Multimedia Filters
  15546. @c man begin MULTIMEDIA FILTERS
  15547. Below is a description of the currently available multimedia filters.
  15548. @section abitscope
  15549. Convert input audio to a video output, displaying the audio bit scope.
  15550. The filter accepts the following options:
  15551. @table @option
  15552. @item rate, r
  15553. Set frame rate, expressed as number of frames per second. Default
  15554. value is "25".
  15555. @item size, s
  15556. Specify the video size for the output. For the syntax of this option, check the
  15557. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15558. Default value is @code{1024x256}.
  15559. @item colors
  15560. Specify list of colors separated by space or by '|' which will be used to
  15561. draw channels. Unrecognized or missing colors will be replaced
  15562. by white color.
  15563. @end table
  15564. @section ahistogram
  15565. Convert input audio to a video output, displaying the volume histogram.
  15566. The filter accepts the following options:
  15567. @table @option
  15568. @item dmode
  15569. Specify how histogram is calculated.
  15570. It accepts the following values:
  15571. @table @samp
  15572. @item single
  15573. Use single histogram for all channels.
  15574. @item separate
  15575. Use separate histogram for each channel.
  15576. @end table
  15577. Default is @code{single}.
  15578. @item rate, r
  15579. Set frame rate, expressed as number of frames per second. Default
  15580. value is "25".
  15581. @item size, s
  15582. Specify the video size for the output. For the syntax of this option, check the
  15583. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15584. Default value is @code{hd720}.
  15585. @item scale
  15586. Set display scale.
  15587. It accepts the following values:
  15588. @table @samp
  15589. @item log
  15590. logarithmic
  15591. @item sqrt
  15592. square root
  15593. @item cbrt
  15594. cubic root
  15595. @item lin
  15596. linear
  15597. @item rlog
  15598. reverse logarithmic
  15599. @end table
  15600. Default is @code{log}.
  15601. @item ascale
  15602. Set amplitude scale.
  15603. It accepts the following values:
  15604. @table @samp
  15605. @item log
  15606. logarithmic
  15607. @item lin
  15608. linear
  15609. @end table
  15610. Default is @code{log}.
  15611. @item acount
  15612. Set how much frames to accumulate in histogram.
  15613. Default is 1. Setting this to -1 accumulates all frames.
  15614. @item rheight
  15615. Set histogram ratio of window height.
  15616. @item slide
  15617. Set sonogram sliding.
  15618. It accepts the following values:
  15619. @table @samp
  15620. @item replace
  15621. replace old rows with new ones.
  15622. @item scroll
  15623. scroll from top to bottom.
  15624. @end table
  15625. Default is @code{replace}.
  15626. @end table
  15627. @section aphasemeter
  15628. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15629. representing mean phase of current audio frame. A video output can also be produced and is
  15630. enabled by default. The audio is passed through as first output.
  15631. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15632. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15633. and @code{1} means channels are in phase.
  15634. The filter accepts the following options, all related to its video output:
  15635. @table @option
  15636. @item rate, r
  15637. Set the output frame rate. Default value is @code{25}.
  15638. @item size, s
  15639. Set the video size for the output. For the syntax of this option, check the
  15640. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15641. Default value is @code{800x400}.
  15642. @item rc
  15643. @item gc
  15644. @item bc
  15645. Specify the red, green, blue contrast. Default values are @code{2},
  15646. @code{7} and @code{1}.
  15647. Allowed range is @code{[0, 255]}.
  15648. @item mpc
  15649. Set color which will be used for drawing median phase. If color is
  15650. @code{none} which is default, no median phase value will be drawn.
  15651. @item video
  15652. Enable video output. Default is enabled.
  15653. @end table
  15654. @section avectorscope
  15655. Convert input audio to a video output, representing the audio vector
  15656. scope.
  15657. The filter is used to measure the difference between channels of stereo
  15658. audio stream. A monoaural signal, consisting of identical left and right
  15659. signal, results in straight vertical line. Any stereo separation is visible
  15660. as a deviation from this line, creating a Lissajous figure.
  15661. If the straight (or deviation from it) but horizontal line appears this
  15662. indicates that the left and right channels are out of phase.
  15663. The filter accepts the following options:
  15664. @table @option
  15665. @item mode, m
  15666. Set the vectorscope mode.
  15667. Available values are:
  15668. @table @samp
  15669. @item lissajous
  15670. Lissajous rotated by 45 degrees.
  15671. @item lissajous_xy
  15672. Same as above but not rotated.
  15673. @item polar
  15674. Shape resembling half of circle.
  15675. @end table
  15676. Default value is @samp{lissajous}.
  15677. @item size, s
  15678. Set the video size for the output. For the syntax of this option, check the
  15679. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15680. Default value is @code{400x400}.
  15681. @item rate, r
  15682. Set the output frame rate. Default value is @code{25}.
  15683. @item rc
  15684. @item gc
  15685. @item bc
  15686. @item ac
  15687. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15688. @code{160}, @code{80} and @code{255}.
  15689. Allowed range is @code{[0, 255]}.
  15690. @item rf
  15691. @item gf
  15692. @item bf
  15693. @item af
  15694. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15695. @code{10}, @code{5} and @code{5}.
  15696. Allowed range is @code{[0, 255]}.
  15697. @item zoom
  15698. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15699. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15700. @item draw
  15701. Set the vectorscope drawing mode.
  15702. Available values are:
  15703. @table @samp
  15704. @item dot
  15705. Draw dot for each sample.
  15706. @item line
  15707. Draw line between previous and current sample.
  15708. @end table
  15709. Default value is @samp{dot}.
  15710. @item scale
  15711. Specify amplitude scale of audio samples.
  15712. Available values are:
  15713. @table @samp
  15714. @item lin
  15715. Linear.
  15716. @item sqrt
  15717. Square root.
  15718. @item cbrt
  15719. Cubic root.
  15720. @item log
  15721. Logarithmic.
  15722. @end table
  15723. @item swap
  15724. Swap left channel axis with right channel axis.
  15725. @item mirror
  15726. Mirror axis.
  15727. @table @samp
  15728. @item none
  15729. No mirror.
  15730. @item x
  15731. Mirror only x axis.
  15732. @item y
  15733. Mirror only y axis.
  15734. @item xy
  15735. Mirror both axis.
  15736. @end table
  15737. @end table
  15738. @subsection Examples
  15739. @itemize
  15740. @item
  15741. Complete example using @command{ffplay}:
  15742. @example
  15743. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15744. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15745. @end example
  15746. @end itemize
  15747. @section bench, abench
  15748. Benchmark part of a filtergraph.
  15749. The filter accepts the following options:
  15750. @table @option
  15751. @item action
  15752. Start or stop a timer.
  15753. Available values are:
  15754. @table @samp
  15755. @item start
  15756. Get the current time, set it as frame metadata (using the key
  15757. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15758. @item stop
  15759. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15760. the input frame metadata to get the time difference. Time difference, average,
  15761. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15762. @code{min}) are then printed. The timestamps are expressed in seconds.
  15763. @end table
  15764. @end table
  15765. @subsection Examples
  15766. @itemize
  15767. @item
  15768. Benchmark @ref{selectivecolor} filter:
  15769. @example
  15770. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15771. @end example
  15772. @end itemize
  15773. @section concat
  15774. Concatenate audio and video streams, joining them together one after the
  15775. other.
  15776. The filter works on segments of synchronized video and audio streams. All
  15777. segments must have the same number of streams of each type, and that will
  15778. also be the number of streams at output.
  15779. The filter accepts the following options:
  15780. @table @option
  15781. @item n
  15782. Set the number of segments. Default is 2.
  15783. @item v
  15784. Set the number of output video streams, that is also the number of video
  15785. streams in each segment. Default is 1.
  15786. @item a
  15787. Set the number of output audio streams, that is also the number of audio
  15788. streams in each segment. Default is 0.
  15789. @item unsafe
  15790. Activate unsafe mode: do not fail if segments have a different format.
  15791. @end table
  15792. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15793. @var{a} audio outputs.
  15794. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15795. segment, in the same order as the outputs, then the inputs for the second
  15796. segment, etc.
  15797. Related streams do not always have exactly the same duration, for various
  15798. reasons including codec frame size or sloppy authoring. For that reason,
  15799. related synchronized streams (e.g. a video and its audio track) should be
  15800. concatenated at once. The concat filter will use the duration of the longest
  15801. stream in each segment (except the last one), and if necessary pad shorter
  15802. audio streams with silence.
  15803. For this filter to work correctly, all segments must start at timestamp 0.
  15804. All corresponding streams must have the same parameters in all segments; the
  15805. filtering system will automatically select a common pixel format for video
  15806. streams, and a common sample format, sample rate and channel layout for
  15807. audio streams, but other settings, such as resolution, must be converted
  15808. explicitly by the user.
  15809. Different frame rates are acceptable but will result in variable frame rate
  15810. at output; be sure to configure the output file to handle it.
  15811. @subsection Examples
  15812. @itemize
  15813. @item
  15814. Concatenate an opening, an episode and an ending, all in bilingual version
  15815. (video in stream 0, audio in streams 1 and 2):
  15816. @example
  15817. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15818. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15819. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15820. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15821. @end example
  15822. @item
  15823. Concatenate two parts, handling audio and video separately, using the
  15824. (a)movie sources, and adjusting the resolution:
  15825. @example
  15826. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15827. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15828. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15829. @end example
  15830. Note that a desync will happen at the stitch if the audio and video streams
  15831. do not have exactly the same duration in the first file.
  15832. @end itemize
  15833. @subsection Commands
  15834. This filter supports the following commands:
  15835. @table @option
  15836. @item next
  15837. Close the current segment and step to the next one
  15838. @end table
  15839. @section drawgraph, adrawgraph
  15840. Draw a graph using input video or audio metadata.
  15841. It accepts the following parameters:
  15842. @table @option
  15843. @item m1
  15844. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15845. @item fg1
  15846. Set 1st foreground color expression.
  15847. @item m2
  15848. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15849. @item fg2
  15850. Set 2nd foreground color expression.
  15851. @item m3
  15852. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15853. @item fg3
  15854. Set 3rd foreground color expression.
  15855. @item m4
  15856. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15857. @item fg4
  15858. Set 4th foreground color expression.
  15859. @item min
  15860. Set minimal value of metadata value.
  15861. @item max
  15862. Set maximal value of metadata value.
  15863. @item bg
  15864. Set graph background color. Default is white.
  15865. @item mode
  15866. Set graph mode.
  15867. Available values for mode is:
  15868. @table @samp
  15869. @item bar
  15870. @item dot
  15871. @item line
  15872. @end table
  15873. Default is @code{line}.
  15874. @item slide
  15875. Set slide mode.
  15876. Available values for slide is:
  15877. @table @samp
  15878. @item frame
  15879. Draw new frame when right border is reached.
  15880. @item replace
  15881. Replace old columns with new ones.
  15882. @item scroll
  15883. Scroll from right to left.
  15884. @item rscroll
  15885. Scroll from left to right.
  15886. @item picture
  15887. Draw single picture.
  15888. @end table
  15889. Default is @code{frame}.
  15890. @item size
  15891. Set size of graph video. For the syntax of this option, check the
  15892. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15893. The default value is @code{900x256}.
  15894. The foreground color expressions can use the following variables:
  15895. @table @option
  15896. @item MIN
  15897. Minimal value of metadata value.
  15898. @item MAX
  15899. Maximal value of metadata value.
  15900. @item VAL
  15901. Current metadata key value.
  15902. @end table
  15903. The color is defined as 0xAABBGGRR.
  15904. @end table
  15905. Example using metadata from @ref{signalstats} filter:
  15906. @example
  15907. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15908. @end example
  15909. Example using metadata from @ref{ebur128} filter:
  15910. @example
  15911. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15912. @end example
  15913. @anchor{ebur128}
  15914. @section ebur128
  15915. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  15916. level. By default, it logs a message at a frequency of 10Hz with the
  15917. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15918. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15919. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  15920. sample format is double-precision floating point. The input stream will be converted to
  15921. this specification, if needed. Users may need to insert aformat and/or aresample filters
  15922. after this filter to obtain the original parameters.
  15923. The filter also has a video output (see the @var{video} option) with a real
  15924. time graph to observe the loudness evolution. The graphic contains the logged
  15925. message mentioned above, so it is not printed anymore when this option is set,
  15926. unless the verbose logging is set. The main graphing area contains the
  15927. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15928. the momentary loudness (400 milliseconds), but can optionally be configured
  15929. to instead display short-term loudness (see @var{gauge}).
  15930. The green area marks a +/- 1LU target range around the target loudness
  15931. (-23LUFS by default, unless modified through @var{target}).
  15932. More information about the Loudness Recommendation EBU R128 on
  15933. @url{http://tech.ebu.ch/loudness}.
  15934. The filter accepts the following options:
  15935. @table @option
  15936. @item video
  15937. Activate the video output. The audio stream is passed unchanged whether this
  15938. option is set or no. The video stream will be the first output stream if
  15939. activated. Default is @code{0}.
  15940. @item size
  15941. Set the video size. This option is for video only. For the syntax of this
  15942. option, check the
  15943. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15944. Default and minimum resolution is @code{640x480}.
  15945. @item meter
  15946. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15947. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15948. other integer value between this range is allowed.
  15949. @item metadata
  15950. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15951. into 100ms output frames, each of them containing various loudness information
  15952. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15953. Default is @code{0}.
  15954. @item framelog
  15955. Force the frame logging level.
  15956. Available values are:
  15957. @table @samp
  15958. @item info
  15959. information logging level
  15960. @item verbose
  15961. verbose logging level
  15962. @end table
  15963. By default, the logging level is set to @var{info}. If the @option{video} or
  15964. the @option{metadata} options are set, it switches to @var{verbose}.
  15965. @item peak
  15966. Set peak mode(s).
  15967. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15968. values are:
  15969. @table @samp
  15970. @item none
  15971. Disable any peak mode (default).
  15972. @item sample
  15973. Enable sample-peak mode.
  15974. Simple peak mode looking for the higher sample value. It logs a message
  15975. for sample-peak (identified by @code{SPK}).
  15976. @item true
  15977. Enable true-peak mode.
  15978. If enabled, the peak lookup is done on an over-sampled version of the input
  15979. stream for better peak accuracy. It logs a message for true-peak.
  15980. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15981. This mode requires a build with @code{libswresample}.
  15982. @end table
  15983. @item dualmono
  15984. Treat mono input files as "dual mono". If a mono file is intended for playback
  15985. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15986. If set to @code{true}, this option will compensate for this effect.
  15987. Multi-channel input files are not affected by this option.
  15988. @item panlaw
  15989. Set a specific pan law to be used for the measurement of dual mono files.
  15990. This parameter is optional, and has a default value of -3.01dB.
  15991. @item target
  15992. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15993. This parameter is optional and has a default value of -23LUFS as specified
  15994. by EBU R128. However, material published online may prefer a level of -16LUFS
  15995. (e.g. for use with podcasts or video platforms).
  15996. @item gauge
  15997. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15998. @code{shortterm}. By default the momentary value will be used, but in certain
  15999. scenarios it may be more useful to observe the short term value instead (e.g.
  16000. live mixing).
  16001. @item scale
  16002. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16003. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16004. video output, not the summary or continuous log output.
  16005. @end table
  16006. @subsection Examples
  16007. @itemize
  16008. @item
  16009. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16010. @example
  16011. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16012. @end example
  16013. @item
  16014. Run an analysis with @command{ffmpeg}:
  16015. @example
  16016. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16017. @end example
  16018. @end itemize
  16019. @section interleave, ainterleave
  16020. Temporally interleave frames from several inputs.
  16021. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16022. These filters read frames from several inputs and send the oldest
  16023. queued frame to the output.
  16024. Input streams must have well defined, monotonically increasing frame
  16025. timestamp values.
  16026. In order to submit one frame to output, these filters need to enqueue
  16027. at least one frame for each input, so they cannot work in case one
  16028. input is not yet terminated and will not receive incoming frames.
  16029. For example consider the case when one input is a @code{select} filter
  16030. which always drops input frames. The @code{interleave} filter will keep
  16031. reading from that input, but it will never be able to send new frames
  16032. to output until the input sends an end-of-stream signal.
  16033. Also, depending on inputs synchronization, the filters will drop
  16034. frames in case one input receives more frames than the other ones, and
  16035. the queue is already filled.
  16036. These filters accept the following options:
  16037. @table @option
  16038. @item nb_inputs, n
  16039. Set the number of different inputs, it is 2 by default.
  16040. @end table
  16041. @subsection Examples
  16042. @itemize
  16043. @item
  16044. Interleave frames belonging to different streams using @command{ffmpeg}:
  16045. @example
  16046. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16047. @end example
  16048. @item
  16049. Add flickering blur effect:
  16050. @example
  16051. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16052. @end example
  16053. @end itemize
  16054. @section metadata, ametadata
  16055. Manipulate frame metadata.
  16056. This filter accepts the following options:
  16057. @table @option
  16058. @item mode
  16059. Set mode of operation of the filter.
  16060. Can be one of the following:
  16061. @table @samp
  16062. @item select
  16063. If both @code{value} and @code{key} is set, select frames
  16064. which have such metadata. If only @code{key} is set, select
  16065. every frame that has such key in metadata.
  16066. @item add
  16067. Add new metadata @code{key} and @code{value}. If key is already available
  16068. do nothing.
  16069. @item modify
  16070. Modify value of already present key.
  16071. @item delete
  16072. If @code{value} is set, delete only keys that have such value.
  16073. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16074. the frame.
  16075. @item print
  16076. Print key and its value if metadata was found. If @code{key} is not set print all
  16077. metadata values available in frame.
  16078. @end table
  16079. @item key
  16080. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16081. @item value
  16082. Set metadata value which will be used. This option is mandatory for
  16083. @code{modify} and @code{add} mode.
  16084. @item function
  16085. Which function to use when comparing metadata value and @code{value}.
  16086. Can be one of following:
  16087. @table @samp
  16088. @item same_str
  16089. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16090. @item starts_with
  16091. Values are interpreted as strings, returns true if metadata value starts with
  16092. the @code{value} option string.
  16093. @item less
  16094. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16095. @item equal
  16096. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16097. @item greater
  16098. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16099. @item expr
  16100. Values are interpreted as floats, returns true if expression from option @code{expr}
  16101. evaluates to true.
  16102. @end table
  16103. @item expr
  16104. Set expression which is used when @code{function} is set to @code{expr}.
  16105. The expression is evaluated through the eval API and can contain the following
  16106. constants:
  16107. @table @option
  16108. @item VALUE1
  16109. Float representation of @code{value} from metadata key.
  16110. @item VALUE2
  16111. Float representation of @code{value} as supplied by user in @code{value} option.
  16112. @end table
  16113. @item file
  16114. If specified in @code{print} mode, output is written to the named file. Instead of
  16115. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16116. for standard output. If @code{file} option is not set, output is written to the log
  16117. with AV_LOG_INFO loglevel.
  16118. @end table
  16119. @subsection Examples
  16120. @itemize
  16121. @item
  16122. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16123. between 0 and 1.
  16124. @example
  16125. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16126. @end example
  16127. @item
  16128. Print silencedetect output to file @file{metadata.txt}.
  16129. @example
  16130. silencedetect,ametadata=mode=print:file=metadata.txt
  16131. @end example
  16132. @item
  16133. Direct all metadata to a pipe with file descriptor 4.
  16134. @example
  16135. metadata=mode=print:file='pipe\:4'
  16136. @end example
  16137. @end itemize
  16138. @section perms, aperms
  16139. Set read/write permissions for the output frames.
  16140. These filters are mainly aimed at developers to test direct path in the
  16141. following filter in the filtergraph.
  16142. The filters accept the following options:
  16143. @table @option
  16144. @item mode
  16145. Select the permissions mode.
  16146. It accepts the following values:
  16147. @table @samp
  16148. @item none
  16149. Do nothing. This is the default.
  16150. @item ro
  16151. Set all the output frames read-only.
  16152. @item rw
  16153. Set all the output frames directly writable.
  16154. @item toggle
  16155. Make the frame read-only if writable, and writable if read-only.
  16156. @item random
  16157. Set each output frame read-only or writable randomly.
  16158. @end table
  16159. @item seed
  16160. Set the seed for the @var{random} mode, must be an integer included between
  16161. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16162. @code{-1}, the filter will try to use a good random seed on a best effort
  16163. basis.
  16164. @end table
  16165. Note: in case of auto-inserted filter between the permission filter and the
  16166. following one, the permission might not be received as expected in that
  16167. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16168. perms/aperms filter can avoid this problem.
  16169. @section realtime, arealtime
  16170. Slow down filtering to match real time approximately.
  16171. These filters will pause the filtering for a variable amount of time to
  16172. match the output rate with the input timestamps.
  16173. They are similar to the @option{re} option to @code{ffmpeg}.
  16174. They accept the following options:
  16175. @table @option
  16176. @item limit
  16177. Time limit for the pauses. Any pause longer than that will be considered
  16178. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16179. @item speed
  16180. Speed factor for processing. The value must be a float larger than zero.
  16181. Values larger than 1.0 will result in faster than realtime processing,
  16182. smaller will slow processing down. The @var{limit} is automatically adapted
  16183. accordingly. Default is 1.0.
  16184. A processing speed faster than what is possible without these filters cannot
  16185. be achieved.
  16186. @end table
  16187. @anchor{select}
  16188. @section select, aselect
  16189. Select frames to pass in output.
  16190. This filter accepts the following options:
  16191. @table @option
  16192. @item expr, e
  16193. Set expression, which is evaluated for each input frame.
  16194. If the expression is evaluated to zero, the frame is discarded.
  16195. If the evaluation result is negative or NaN, the frame is sent to the
  16196. first output; otherwise it is sent to the output with index
  16197. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16198. For example a value of @code{1.2} corresponds to the output with index
  16199. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16200. @item outputs, n
  16201. Set the number of outputs. The output to which to send the selected
  16202. frame is based on the result of the evaluation. Default value is 1.
  16203. @end table
  16204. The expression can contain the following constants:
  16205. @table @option
  16206. @item n
  16207. The (sequential) number of the filtered frame, starting from 0.
  16208. @item selected_n
  16209. The (sequential) number of the selected frame, starting from 0.
  16210. @item prev_selected_n
  16211. The sequential number of the last selected frame. It's NAN if undefined.
  16212. @item TB
  16213. The timebase of the input timestamps.
  16214. @item pts
  16215. The PTS (Presentation TimeStamp) of the filtered video frame,
  16216. expressed in @var{TB} units. It's NAN if undefined.
  16217. @item t
  16218. The PTS of the filtered video frame,
  16219. expressed in seconds. It's NAN if undefined.
  16220. @item prev_pts
  16221. The PTS of the previously filtered video frame. It's NAN if undefined.
  16222. @item prev_selected_pts
  16223. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16224. @item prev_selected_t
  16225. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16226. @item start_pts
  16227. The PTS of the first video frame in the video. It's NAN if undefined.
  16228. @item start_t
  16229. The time of the first video frame in the video. It's NAN if undefined.
  16230. @item pict_type @emph{(video only)}
  16231. The type of the filtered frame. It can assume one of the following
  16232. values:
  16233. @table @option
  16234. @item I
  16235. @item P
  16236. @item B
  16237. @item S
  16238. @item SI
  16239. @item SP
  16240. @item BI
  16241. @end table
  16242. @item interlace_type @emph{(video only)}
  16243. The frame interlace type. It can assume one of the following values:
  16244. @table @option
  16245. @item PROGRESSIVE
  16246. The frame is progressive (not interlaced).
  16247. @item TOPFIRST
  16248. The frame is top-field-first.
  16249. @item BOTTOMFIRST
  16250. The frame is bottom-field-first.
  16251. @end table
  16252. @item consumed_sample_n @emph{(audio only)}
  16253. the number of selected samples before the current frame
  16254. @item samples_n @emph{(audio only)}
  16255. the number of samples in the current frame
  16256. @item sample_rate @emph{(audio only)}
  16257. the input sample rate
  16258. @item key
  16259. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16260. @item pos
  16261. the position in the file of the filtered frame, -1 if the information
  16262. is not available (e.g. for synthetic video)
  16263. @item scene @emph{(video only)}
  16264. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16265. probability for the current frame to introduce a new scene, while a higher
  16266. value means the current frame is more likely to be one (see the example below)
  16267. @item concatdec_select
  16268. The concat demuxer can select only part of a concat input file by setting an
  16269. inpoint and an outpoint, but the output packets may not be entirely contained
  16270. in the selected interval. By using this variable, it is possible to skip frames
  16271. generated by the concat demuxer which are not exactly contained in the selected
  16272. interval.
  16273. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16274. and the @var{lavf.concat.duration} packet metadata values which are also
  16275. present in the decoded frames.
  16276. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16277. start_time and either the duration metadata is missing or the frame pts is less
  16278. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16279. missing.
  16280. That basically means that an input frame is selected if its pts is within the
  16281. interval set by the concat demuxer.
  16282. @end table
  16283. The default value of the select expression is "1".
  16284. @subsection Examples
  16285. @itemize
  16286. @item
  16287. Select all frames in input:
  16288. @example
  16289. select
  16290. @end example
  16291. The example above is the same as:
  16292. @example
  16293. select=1
  16294. @end example
  16295. @item
  16296. Skip all frames:
  16297. @example
  16298. select=0
  16299. @end example
  16300. @item
  16301. Select only I-frames:
  16302. @example
  16303. select='eq(pict_type\,I)'
  16304. @end example
  16305. @item
  16306. Select one frame every 100:
  16307. @example
  16308. select='not(mod(n\,100))'
  16309. @end example
  16310. @item
  16311. Select only frames contained in the 10-20 time interval:
  16312. @example
  16313. select=between(t\,10\,20)
  16314. @end example
  16315. @item
  16316. Select only I-frames contained in the 10-20 time interval:
  16317. @example
  16318. select=between(t\,10\,20)*eq(pict_type\,I)
  16319. @end example
  16320. @item
  16321. Select frames with a minimum distance of 10 seconds:
  16322. @example
  16323. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16324. @end example
  16325. @item
  16326. Use aselect to select only audio frames with samples number > 100:
  16327. @example
  16328. aselect='gt(samples_n\,100)'
  16329. @end example
  16330. @item
  16331. Create a mosaic of the first scenes:
  16332. @example
  16333. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16334. @end example
  16335. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16336. choice.
  16337. @item
  16338. Send even and odd frames to separate outputs, and compose them:
  16339. @example
  16340. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16341. @end example
  16342. @item
  16343. Select useful frames from an ffconcat file which is using inpoints and
  16344. outpoints but where the source files are not intra frame only.
  16345. @example
  16346. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16347. @end example
  16348. @end itemize
  16349. @section sendcmd, asendcmd
  16350. Send commands to filters in the filtergraph.
  16351. These filters read commands to be sent to other filters in the
  16352. filtergraph.
  16353. @code{sendcmd} must be inserted between two video filters,
  16354. @code{asendcmd} must be inserted between two audio filters, but apart
  16355. from that they act the same way.
  16356. The specification of commands can be provided in the filter arguments
  16357. with the @var{commands} option, or in a file specified by the
  16358. @var{filename} option.
  16359. These filters accept the following options:
  16360. @table @option
  16361. @item commands, c
  16362. Set the commands to be read and sent to the other filters.
  16363. @item filename, f
  16364. Set the filename of the commands to be read and sent to the other
  16365. filters.
  16366. @end table
  16367. @subsection Commands syntax
  16368. A commands description consists of a sequence of interval
  16369. specifications, comprising a list of commands to be executed when a
  16370. particular event related to that interval occurs. The occurring event
  16371. is typically the current frame time entering or leaving a given time
  16372. interval.
  16373. An interval is specified by the following syntax:
  16374. @example
  16375. @var{START}[-@var{END}] @var{COMMANDS};
  16376. @end example
  16377. The time interval is specified by the @var{START} and @var{END} times.
  16378. @var{END} is optional and defaults to the maximum time.
  16379. The current frame time is considered within the specified interval if
  16380. it is included in the interval [@var{START}, @var{END}), that is when
  16381. the time is greater or equal to @var{START} and is lesser than
  16382. @var{END}.
  16383. @var{COMMANDS} consists of a sequence of one or more command
  16384. specifications, separated by ",", relating to that interval. The
  16385. syntax of a command specification is given by:
  16386. @example
  16387. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16388. @end example
  16389. @var{FLAGS} is optional and specifies the type of events relating to
  16390. the time interval which enable sending the specified command, and must
  16391. be a non-null sequence of identifier flags separated by "+" or "|" and
  16392. enclosed between "[" and "]".
  16393. The following flags are recognized:
  16394. @table @option
  16395. @item enter
  16396. The command is sent when the current frame timestamp enters the
  16397. specified interval. In other words, the command is sent when the
  16398. previous frame timestamp was not in the given interval, and the
  16399. current is.
  16400. @item leave
  16401. The command is sent when the current frame timestamp leaves the
  16402. specified interval. In other words, the command is sent when the
  16403. previous frame timestamp was in the given interval, and the
  16404. current is not.
  16405. @end table
  16406. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16407. assumed.
  16408. @var{TARGET} specifies the target of the command, usually the name of
  16409. the filter class or a specific filter instance name.
  16410. @var{COMMAND} specifies the name of the command for the target filter.
  16411. @var{ARG} is optional and specifies the optional list of argument for
  16412. the given @var{COMMAND}.
  16413. Between one interval specification and another, whitespaces, or
  16414. sequences of characters starting with @code{#} until the end of line,
  16415. are ignored and can be used to annotate comments.
  16416. A simplified BNF description of the commands specification syntax
  16417. follows:
  16418. @example
  16419. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16420. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16421. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16422. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16423. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16424. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16425. @end example
  16426. @subsection Examples
  16427. @itemize
  16428. @item
  16429. Specify audio tempo change at second 4:
  16430. @example
  16431. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16432. @end example
  16433. @item
  16434. Target a specific filter instance:
  16435. @example
  16436. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16437. @end example
  16438. @item
  16439. Specify a list of drawtext and hue commands in a file.
  16440. @example
  16441. # show text in the interval 5-10
  16442. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16443. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16444. # desaturate the image in the interval 15-20
  16445. 15.0-20.0 [enter] hue s 0,
  16446. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16447. [leave] hue s 1,
  16448. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16449. # apply an exponential saturation fade-out effect, starting from time 25
  16450. 25 [enter] hue s exp(25-t)
  16451. @end example
  16452. A filtergraph allowing to read and process the above command list
  16453. stored in a file @file{test.cmd}, can be specified with:
  16454. @example
  16455. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16456. @end example
  16457. @end itemize
  16458. @anchor{setpts}
  16459. @section setpts, asetpts
  16460. Change the PTS (presentation timestamp) of the input frames.
  16461. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16462. This filter accepts the following options:
  16463. @table @option
  16464. @item expr
  16465. The expression which is evaluated for each frame to construct its timestamp.
  16466. @end table
  16467. The expression is evaluated through the eval API and can contain the following
  16468. constants:
  16469. @table @option
  16470. @item FRAME_RATE, FR
  16471. frame rate, only defined for constant frame-rate video
  16472. @item PTS
  16473. The presentation timestamp in input
  16474. @item N
  16475. The count of the input frame for video or the number of consumed samples,
  16476. not including the current frame for audio, starting from 0.
  16477. @item NB_CONSUMED_SAMPLES
  16478. The number of consumed samples, not including the current frame (only
  16479. audio)
  16480. @item NB_SAMPLES, S
  16481. The number of samples in the current frame (only audio)
  16482. @item SAMPLE_RATE, SR
  16483. The audio sample rate.
  16484. @item STARTPTS
  16485. The PTS of the first frame.
  16486. @item STARTT
  16487. the time in seconds of the first frame
  16488. @item INTERLACED
  16489. State whether the current frame is interlaced.
  16490. @item T
  16491. the time in seconds of the current frame
  16492. @item POS
  16493. original position in the file of the frame, or undefined if undefined
  16494. for the current frame
  16495. @item PREV_INPTS
  16496. The previous input PTS.
  16497. @item PREV_INT
  16498. previous input time in seconds
  16499. @item PREV_OUTPTS
  16500. The previous output PTS.
  16501. @item PREV_OUTT
  16502. previous output time in seconds
  16503. @item RTCTIME
  16504. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16505. instead.
  16506. @item RTCSTART
  16507. The wallclock (RTC) time at the start of the movie in microseconds.
  16508. @item TB
  16509. The timebase of the input timestamps.
  16510. @end table
  16511. @subsection Examples
  16512. @itemize
  16513. @item
  16514. Start counting PTS from zero
  16515. @example
  16516. setpts=PTS-STARTPTS
  16517. @end example
  16518. @item
  16519. Apply fast motion effect:
  16520. @example
  16521. setpts=0.5*PTS
  16522. @end example
  16523. @item
  16524. Apply slow motion effect:
  16525. @example
  16526. setpts=2.0*PTS
  16527. @end example
  16528. @item
  16529. Set fixed rate of 25 frames per second:
  16530. @example
  16531. setpts=N/(25*TB)
  16532. @end example
  16533. @item
  16534. Set fixed rate 25 fps with some jitter:
  16535. @example
  16536. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16537. @end example
  16538. @item
  16539. Apply an offset of 10 seconds to the input PTS:
  16540. @example
  16541. setpts=PTS+10/TB
  16542. @end example
  16543. @item
  16544. Generate timestamps from a "live source" and rebase onto the current timebase:
  16545. @example
  16546. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16547. @end example
  16548. @item
  16549. Generate timestamps by counting samples:
  16550. @example
  16551. asetpts=N/SR/TB
  16552. @end example
  16553. @end itemize
  16554. @section setrange
  16555. Force color range for the output video frame.
  16556. The @code{setrange} filter marks the color range property for the
  16557. output frames. It does not change the input frame, but only sets the
  16558. corresponding property, which affects how the frame is treated by
  16559. following filters.
  16560. The filter accepts the following options:
  16561. @table @option
  16562. @item range
  16563. Available values are:
  16564. @table @samp
  16565. @item auto
  16566. Keep the same color range property.
  16567. @item unspecified, unknown
  16568. Set the color range as unspecified.
  16569. @item limited, tv, mpeg
  16570. Set the color range as limited.
  16571. @item full, pc, jpeg
  16572. Set the color range as full.
  16573. @end table
  16574. @end table
  16575. @section settb, asettb
  16576. Set the timebase to use for the output frames timestamps.
  16577. It is mainly useful for testing timebase configuration.
  16578. It accepts the following parameters:
  16579. @table @option
  16580. @item expr, tb
  16581. The expression which is evaluated into the output timebase.
  16582. @end table
  16583. The value for @option{tb} is an arithmetic expression representing a
  16584. rational. The expression can contain the constants "AVTB" (the default
  16585. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16586. audio only). Default value is "intb".
  16587. @subsection Examples
  16588. @itemize
  16589. @item
  16590. Set the timebase to 1/25:
  16591. @example
  16592. settb=expr=1/25
  16593. @end example
  16594. @item
  16595. Set the timebase to 1/10:
  16596. @example
  16597. settb=expr=0.1
  16598. @end example
  16599. @item
  16600. Set the timebase to 1001/1000:
  16601. @example
  16602. settb=1+0.001
  16603. @end example
  16604. @item
  16605. Set the timebase to 2*intb:
  16606. @example
  16607. settb=2*intb
  16608. @end example
  16609. @item
  16610. Set the default timebase value:
  16611. @example
  16612. settb=AVTB
  16613. @end example
  16614. @end itemize
  16615. @section showcqt
  16616. Convert input audio to a video output representing frequency spectrum
  16617. logarithmically using Brown-Puckette constant Q transform algorithm with
  16618. direct frequency domain coefficient calculation (but the transform itself
  16619. is not really constant Q, instead the Q factor is actually variable/clamped),
  16620. with musical tone scale, from E0 to D#10.
  16621. The filter accepts the following options:
  16622. @table @option
  16623. @item size, s
  16624. Specify the video size for the output. It must be even. For the syntax of this option,
  16625. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16626. Default value is @code{1920x1080}.
  16627. @item fps, rate, r
  16628. Set the output frame rate. Default value is @code{25}.
  16629. @item bar_h
  16630. Set the bargraph height. It must be even. Default value is @code{-1} which
  16631. computes the bargraph height automatically.
  16632. @item axis_h
  16633. Set the axis height. It must be even. Default value is @code{-1} which computes
  16634. the axis height automatically.
  16635. @item sono_h
  16636. Set the sonogram height. It must be even. Default value is @code{-1} which
  16637. computes the sonogram height automatically.
  16638. @item fullhd
  16639. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16640. instead. Default value is @code{1}.
  16641. @item sono_v, volume
  16642. Specify the sonogram volume expression. It can contain variables:
  16643. @table @option
  16644. @item bar_v
  16645. the @var{bar_v} evaluated expression
  16646. @item frequency, freq, f
  16647. the frequency where it is evaluated
  16648. @item timeclamp, tc
  16649. the value of @var{timeclamp} option
  16650. @end table
  16651. and functions:
  16652. @table @option
  16653. @item a_weighting(f)
  16654. A-weighting of equal loudness
  16655. @item b_weighting(f)
  16656. B-weighting of equal loudness
  16657. @item c_weighting(f)
  16658. C-weighting of equal loudness.
  16659. @end table
  16660. Default value is @code{16}.
  16661. @item bar_v, volume2
  16662. Specify the bargraph volume expression. It can contain variables:
  16663. @table @option
  16664. @item sono_v
  16665. the @var{sono_v} evaluated expression
  16666. @item frequency, freq, f
  16667. the frequency where it is evaluated
  16668. @item timeclamp, tc
  16669. the value of @var{timeclamp} option
  16670. @end table
  16671. and functions:
  16672. @table @option
  16673. @item a_weighting(f)
  16674. A-weighting of equal loudness
  16675. @item b_weighting(f)
  16676. B-weighting of equal loudness
  16677. @item c_weighting(f)
  16678. C-weighting of equal loudness.
  16679. @end table
  16680. Default value is @code{sono_v}.
  16681. @item sono_g, gamma
  16682. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16683. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16684. Acceptable range is @code{[1, 7]}.
  16685. @item bar_g, gamma2
  16686. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16687. @code{[1, 7]}.
  16688. @item bar_t
  16689. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16690. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16691. @item timeclamp, tc
  16692. Specify the transform timeclamp. At low frequency, there is trade-off between
  16693. accuracy in time domain and frequency domain. If timeclamp is lower,
  16694. event in time domain is represented more accurately (such as fast bass drum),
  16695. otherwise event in frequency domain is represented more accurately
  16696. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16697. @item attack
  16698. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16699. limits future samples by applying asymmetric windowing in time domain, useful
  16700. when low latency is required. Accepted range is @code{[0, 1]}.
  16701. @item basefreq
  16702. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16703. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16704. @item endfreq
  16705. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16706. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16707. @item coeffclamp
  16708. This option is deprecated and ignored.
  16709. @item tlength
  16710. Specify the transform length in time domain. Use this option to control accuracy
  16711. trade-off between time domain and frequency domain at every frequency sample.
  16712. It can contain variables:
  16713. @table @option
  16714. @item frequency, freq, f
  16715. the frequency where it is evaluated
  16716. @item timeclamp, tc
  16717. the value of @var{timeclamp} option.
  16718. @end table
  16719. Default value is @code{384*tc/(384+tc*f)}.
  16720. @item count
  16721. Specify the transform count for every video frame. Default value is @code{6}.
  16722. Acceptable range is @code{[1, 30]}.
  16723. @item fcount
  16724. Specify the transform count for every single pixel. Default value is @code{0},
  16725. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16726. @item fontfile
  16727. Specify font file for use with freetype to draw the axis. If not specified,
  16728. use embedded font. Note that drawing with font file or embedded font is not
  16729. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16730. option instead.
  16731. @item font
  16732. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16733. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16734. @item fontcolor
  16735. Specify font color expression. This is arithmetic expression that should return
  16736. integer value 0xRRGGBB. It can contain variables:
  16737. @table @option
  16738. @item frequency, freq, f
  16739. the frequency where it is evaluated
  16740. @item timeclamp, tc
  16741. the value of @var{timeclamp} option
  16742. @end table
  16743. and functions:
  16744. @table @option
  16745. @item midi(f)
  16746. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16747. @item r(x), g(x), b(x)
  16748. red, green, and blue value of intensity x.
  16749. @end table
  16750. Default value is @code{st(0, (midi(f)-59.5)/12);
  16751. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16752. r(1-ld(1)) + b(ld(1))}.
  16753. @item axisfile
  16754. Specify image file to draw the axis. This option override @var{fontfile} and
  16755. @var{fontcolor} option.
  16756. @item axis, text
  16757. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16758. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16759. Default value is @code{1}.
  16760. @item csp
  16761. Set colorspace. The accepted values are:
  16762. @table @samp
  16763. @item unspecified
  16764. Unspecified (default)
  16765. @item bt709
  16766. BT.709
  16767. @item fcc
  16768. FCC
  16769. @item bt470bg
  16770. BT.470BG or BT.601-6 625
  16771. @item smpte170m
  16772. SMPTE-170M or BT.601-6 525
  16773. @item smpte240m
  16774. SMPTE-240M
  16775. @item bt2020ncl
  16776. BT.2020 with non-constant luminance
  16777. @end table
  16778. @item cscheme
  16779. Set spectrogram color scheme. This is list of floating point values with format
  16780. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16781. The default is @code{1|0.5|0|0|0.5|1}.
  16782. @end table
  16783. @subsection Examples
  16784. @itemize
  16785. @item
  16786. Playing audio while showing the spectrum:
  16787. @example
  16788. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16789. @end example
  16790. @item
  16791. Same as above, but with frame rate 30 fps:
  16792. @example
  16793. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16794. @end example
  16795. @item
  16796. Playing at 1280x720:
  16797. @example
  16798. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16799. @end example
  16800. @item
  16801. Disable sonogram display:
  16802. @example
  16803. sono_h=0
  16804. @end example
  16805. @item
  16806. A1 and its harmonics: A1, A2, (near)E3, A3:
  16807. @example
  16808. 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),
  16809. asplit[a][out1]; [a] showcqt [out0]'
  16810. @end example
  16811. @item
  16812. Same as above, but with more accuracy in frequency domain:
  16813. @example
  16814. 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),
  16815. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16816. @end example
  16817. @item
  16818. Custom volume:
  16819. @example
  16820. bar_v=10:sono_v=bar_v*a_weighting(f)
  16821. @end example
  16822. @item
  16823. Custom gamma, now spectrum is linear to the amplitude.
  16824. @example
  16825. bar_g=2:sono_g=2
  16826. @end example
  16827. @item
  16828. Custom tlength equation:
  16829. @example
  16830. 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)))'
  16831. @end example
  16832. @item
  16833. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16834. @example
  16835. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16836. @end example
  16837. @item
  16838. Custom font using fontconfig:
  16839. @example
  16840. font='Courier New,Monospace,mono|bold'
  16841. @end example
  16842. @item
  16843. Custom frequency range with custom axis using image file:
  16844. @example
  16845. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16846. @end example
  16847. @end itemize
  16848. @section showfreqs
  16849. Convert input audio to video output representing the audio power spectrum.
  16850. Audio amplitude is on Y-axis while frequency is on X-axis.
  16851. The filter accepts the following options:
  16852. @table @option
  16853. @item size, s
  16854. Specify size of video. For the syntax of this option, check the
  16855. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16856. Default is @code{1024x512}.
  16857. @item mode
  16858. Set display mode.
  16859. This set how each frequency bin will be represented.
  16860. It accepts the following values:
  16861. @table @samp
  16862. @item line
  16863. @item bar
  16864. @item dot
  16865. @end table
  16866. Default is @code{bar}.
  16867. @item ascale
  16868. Set amplitude scale.
  16869. It accepts the following values:
  16870. @table @samp
  16871. @item lin
  16872. Linear scale.
  16873. @item sqrt
  16874. Square root scale.
  16875. @item cbrt
  16876. Cubic root scale.
  16877. @item log
  16878. Logarithmic scale.
  16879. @end table
  16880. Default is @code{log}.
  16881. @item fscale
  16882. Set frequency scale.
  16883. It accepts the following values:
  16884. @table @samp
  16885. @item lin
  16886. Linear scale.
  16887. @item log
  16888. Logarithmic scale.
  16889. @item rlog
  16890. Reverse logarithmic scale.
  16891. @end table
  16892. Default is @code{lin}.
  16893. @item win_size
  16894. Set window size.
  16895. It accepts the following values:
  16896. @table @samp
  16897. @item w16
  16898. @item w32
  16899. @item w64
  16900. @item w128
  16901. @item w256
  16902. @item w512
  16903. @item w1024
  16904. @item w2048
  16905. @item w4096
  16906. @item w8192
  16907. @item w16384
  16908. @item w32768
  16909. @item w65536
  16910. @end table
  16911. Default is @code{w2048}
  16912. @item win_func
  16913. Set windowing function.
  16914. It accepts the following values:
  16915. @table @samp
  16916. @item rect
  16917. @item bartlett
  16918. @item hanning
  16919. @item hamming
  16920. @item blackman
  16921. @item welch
  16922. @item flattop
  16923. @item bharris
  16924. @item bnuttall
  16925. @item bhann
  16926. @item sine
  16927. @item nuttall
  16928. @item lanczos
  16929. @item gauss
  16930. @item tukey
  16931. @item dolph
  16932. @item cauchy
  16933. @item parzen
  16934. @item poisson
  16935. @item bohman
  16936. @end table
  16937. Default is @code{hanning}.
  16938. @item overlap
  16939. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16940. which means optimal overlap for selected window function will be picked.
  16941. @item averaging
  16942. Set time averaging. Setting this to 0 will display current maximal peaks.
  16943. Default is @code{1}, which means time averaging is disabled.
  16944. @item colors
  16945. Specify list of colors separated by space or by '|' which will be used to
  16946. draw channel frequencies. Unrecognized or missing colors will be replaced
  16947. by white color.
  16948. @item cmode
  16949. Set channel display mode.
  16950. It accepts the following values:
  16951. @table @samp
  16952. @item combined
  16953. @item separate
  16954. @end table
  16955. Default is @code{combined}.
  16956. @item minamp
  16957. Set minimum amplitude used in @code{log} amplitude scaler.
  16958. @end table
  16959. @section showspatial
  16960. Convert stereo input audio to a video output, representing the spatial relationship
  16961. between two channels.
  16962. The filter accepts the following options:
  16963. @table @option
  16964. @item size, s
  16965. Specify the video size for the output. For the syntax of this option, check the
  16966. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16967. Default value is @code{512x512}.
  16968. @item win_size
  16969. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  16970. @item win_func
  16971. Set window function.
  16972. It accepts the following values:
  16973. @table @samp
  16974. @item rect
  16975. @item bartlett
  16976. @item hann
  16977. @item hanning
  16978. @item hamming
  16979. @item blackman
  16980. @item welch
  16981. @item flattop
  16982. @item bharris
  16983. @item bnuttall
  16984. @item bhann
  16985. @item sine
  16986. @item nuttall
  16987. @item lanczos
  16988. @item gauss
  16989. @item tukey
  16990. @item dolph
  16991. @item cauchy
  16992. @item parzen
  16993. @item poisson
  16994. @item bohman
  16995. @end table
  16996. Default value is @code{hann}.
  16997. @item overlap
  16998. Set ratio of overlap window. Default value is @code{0.5}.
  16999. When value is @code{1} overlap is set to recommended size for specific
  17000. window function currently used.
  17001. @end table
  17002. @anchor{showspectrum}
  17003. @section showspectrum
  17004. Convert input audio to a video output, representing the audio frequency
  17005. spectrum.
  17006. The filter accepts the following options:
  17007. @table @option
  17008. @item size, s
  17009. Specify the video size for the output. For the syntax of this option, check the
  17010. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17011. Default value is @code{640x512}.
  17012. @item slide
  17013. Specify how the spectrum should slide along the window.
  17014. It accepts the following values:
  17015. @table @samp
  17016. @item replace
  17017. the samples start again on the left when they reach the right
  17018. @item scroll
  17019. the samples scroll from right to left
  17020. @item fullframe
  17021. frames are only produced when the samples reach the right
  17022. @item rscroll
  17023. the samples scroll from left to right
  17024. @end table
  17025. Default value is @code{replace}.
  17026. @item mode
  17027. Specify display mode.
  17028. It accepts the following values:
  17029. @table @samp
  17030. @item combined
  17031. all channels are displayed in the same row
  17032. @item separate
  17033. all channels are displayed in separate rows
  17034. @end table
  17035. Default value is @samp{combined}.
  17036. @item color
  17037. Specify display color mode.
  17038. It accepts the following values:
  17039. @table @samp
  17040. @item channel
  17041. each channel is displayed in a separate color
  17042. @item intensity
  17043. each channel is displayed using the same color scheme
  17044. @item rainbow
  17045. each channel is displayed using the rainbow color scheme
  17046. @item moreland
  17047. each channel is displayed using the moreland color scheme
  17048. @item nebulae
  17049. each channel is displayed using the nebulae color scheme
  17050. @item fire
  17051. each channel is displayed using the fire color scheme
  17052. @item fiery
  17053. each channel is displayed using the fiery color scheme
  17054. @item fruit
  17055. each channel is displayed using the fruit color scheme
  17056. @item cool
  17057. each channel is displayed using the cool color scheme
  17058. @item magma
  17059. each channel is displayed using the magma color scheme
  17060. @item green
  17061. each channel is displayed using the green color scheme
  17062. @item viridis
  17063. each channel is displayed using the viridis color scheme
  17064. @item plasma
  17065. each channel is displayed using the plasma color scheme
  17066. @item cividis
  17067. each channel is displayed using the cividis color scheme
  17068. @item terrain
  17069. each channel is displayed using the terrain color scheme
  17070. @end table
  17071. Default value is @samp{channel}.
  17072. @item scale
  17073. Specify scale used for calculating intensity color values.
  17074. It accepts the following values:
  17075. @table @samp
  17076. @item lin
  17077. linear
  17078. @item sqrt
  17079. square root, default
  17080. @item cbrt
  17081. cubic root
  17082. @item log
  17083. logarithmic
  17084. @item 4thrt
  17085. 4th root
  17086. @item 5thrt
  17087. 5th root
  17088. @end table
  17089. Default value is @samp{sqrt}.
  17090. @item fscale
  17091. Specify frequency scale.
  17092. It accepts the following values:
  17093. @table @samp
  17094. @item lin
  17095. linear
  17096. @item log
  17097. logarithmic
  17098. @end table
  17099. Default value is @samp{lin}.
  17100. @item saturation
  17101. Set saturation modifier for displayed colors. Negative values provide
  17102. alternative color scheme. @code{0} is no saturation at all.
  17103. Saturation must be in [-10.0, 10.0] range.
  17104. Default value is @code{1}.
  17105. @item win_func
  17106. Set window function.
  17107. It accepts the following values:
  17108. @table @samp
  17109. @item rect
  17110. @item bartlett
  17111. @item hann
  17112. @item hanning
  17113. @item hamming
  17114. @item blackman
  17115. @item welch
  17116. @item flattop
  17117. @item bharris
  17118. @item bnuttall
  17119. @item bhann
  17120. @item sine
  17121. @item nuttall
  17122. @item lanczos
  17123. @item gauss
  17124. @item tukey
  17125. @item dolph
  17126. @item cauchy
  17127. @item parzen
  17128. @item poisson
  17129. @item bohman
  17130. @end table
  17131. Default value is @code{hann}.
  17132. @item orientation
  17133. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17134. @code{horizontal}. Default is @code{vertical}.
  17135. @item overlap
  17136. Set ratio of overlap window. Default value is @code{0}.
  17137. When value is @code{1} overlap is set to recommended size for specific
  17138. window function currently used.
  17139. @item gain
  17140. Set scale gain for calculating intensity color values.
  17141. Default value is @code{1}.
  17142. @item data
  17143. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17144. @item rotation
  17145. Set color rotation, must be in [-1.0, 1.0] range.
  17146. Default value is @code{0}.
  17147. @item start
  17148. Set start frequency from which to display spectrogram. Default is @code{0}.
  17149. @item stop
  17150. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17151. @item fps
  17152. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17153. @item legend
  17154. Draw time and frequency axes and legends. Default is disabled.
  17155. @end table
  17156. The usage is very similar to the showwaves filter; see the examples in that
  17157. section.
  17158. @subsection Examples
  17159. @itemize
  17160. @item
  17161. Large window with logarithmic color scaling:
  17162. @example
  17163. showspectrum=s=1280x480:scale=log
  17164. @end example
  17165. @item
  17166. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17167. @example
  17168. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17169. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17170. @end example
  17171. @end itemize
  17172. @section showspectrumpic
  17173. Convert input audio to a single video frame, representing the audio frequency
  17174. spectrum.
  17175. The filter accepts the following options:
  17176. @table @option
  17177. @item size, s
  17178. Specify the video size for the output. For the syntax of this option, check the
  17179. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17180. Default value is @code{4096x2048}.
  17181. @item mode
  17182. Specify display mode.
  17183. It accepts the following values:
  17184. @table @samp
  17185. @item combined
  17186. all channels are displayed in the same row
  17187. @item separate
  17188. all channels are displayed in separate rows
  17189. @end table
  17190. Default value is @samp{combined}.
  17191. @item color
  17192. Specify display color mode.
  17193. It accepts the following values:
  17194. @table @samp
  17195. @item channel
  17196. each channel is displayed in a separate color
  17197. @item intensity
  17198. each channel is displayed using the same color scheme
  17199. @item rainbow
  17200. each channel is displayed using the rainbow color scheme
  17201. @item moreland
  17202. each channel is displayed using the moreland color scheme
  17203. @item nebulae
  17204. each channel is displayed using the nebulae color scheme
  17205. @item fire
  17206. each channel is displayed using the fire color scheme
  17207. @item fiery
  17208. each channel is displayed using the fiery color scheme
  17209. @item fruit
  17210. each channel is displayed using the fruit color scheme
  17211. @item cool
  17212. each channel is displayed using the cool color scheme
  17213. @item magma
  17214. each channel is displayed using the magma color scheme
  17215. @item green
  17216. each channel is displayed using the green color scheme
  17217. @item viridis
  17218. each channel is displayed using the viridis color scheme
  17219. @item plasma
  17220. each channel is displayed using the plasma color scheme
  17221. @item cividis
  17222. each channel is displayed using the cividis color scheme
  17223. @item terrain
  17224. each channel is displayed using the terrain color scheme
  17225. @end table
  17226. Default value is @samp{intensity}.
  17227. @item scale
  17228. Specify scale used for calculating intensity color values.
  17229. It accepts the following values:
  17230. @table @samp
  17231. @item lin
  17232. linear
  17233. @item sqrt
  17234. square root, default
  17235. @item cbrt
  17236. cubic root
  17237. @item log
  17238. logarithmic
  17239. @item 4thrt
  17240. 4th root
  17241. @item 5thrt
  17242. 5th root
  17243. @end table
  17244. Default value is @samp{log}.
  17245. @item fscale
  17246. Specify frequency scale.
  17247. It accepts the following values:
  17248. @table @samp
  17249. @item lin
  17250. linear
  17251. @item log
  17252. logarithmic
  17253. @end table
  17254. Default value is @samp{lin}.
  17255. @item saturation
  17256. Set saturation modifier for displayed colors. Negative values provide
  17257. alternative color scheme. @code{0} is no saturation at all.
  17258. Saturation must be in [-10.0, 10.0] range.
  17259. Default value is @code{1}.
  17260. @item win_func
  17261. Set window function.
  17262. It accepts the following values:
  17263. @table @samp
  17264. @item rect
  17265. @item bartlett
  17266. @item hann
  17267. @item hanning
  17268. @item hamming
  17269. @item blackman
  17270. @item welch
  17271. @item flattop
  17272. @item bharris
  17273. @item bnuttall
  17274. @item bhann
  17275. @item sine
  17276. @item nuttall
  17277. @item lanczos
  17278. @item gauss
  17279. @item tukey
  17280. @item dolph
  17281. @item cauchy
  17282. @item parzen
  17283. @item poisson
  17284. @item bohman
  17285. @end table
  17286. Default value is @code{hann}.
  17287. @item orientation
  17288. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17289. @code{horizontal}. Default is @code{vertical}.
  17290. @item gain
  17291. Set scale gain for calculating intensity color values.
  17292. Default value is @code{1}.
  17293. @item legend
  17294. Draw time and frequency axes and legends. Default is enabled.
  17295. @item rotation
  17296. Set color rotation, must be in [-1.0, 1.0] range.
  17297. Default value is @code{0}.
  17298. @item start
  17299. Set start frequency from which to display spectrogram. Default is @code{0}.
  17300. @item stop
  17301. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17302. @end table
  17303. @subsection Examples
  17304. @itemize
  17305. @item
  17306. Extract an audio spectrogram of a whole audio track
  17307. in a 1024x1024 picture using @command{ffmpeg}:
  17308. @example
  17309. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17310. @end example
  17311. @end itemize
  17312. @section showvolume
  17313. Convert input audio volume to a video output.
  17314. The filter accepts the following options:
  17315. @table @option
  17316. @item rate, r
  17317. Set video rate.
  17318. @item b
  17319. Set border width, allowed range is [0, 5]. Default is 1.
  17320. @item w
  17321. Set channel width, allowed range is [80, 8192]. Default is 400.
  17322. @item h
  17323. Set channel height, allowed range is [1, 900]. Default is 20.
  17324. @item f
  17325. Set fade, allowed range is [0, 1]. Default is 0.95.
  17326. @item c
  17327. Set volume color expression.
  17328. The expression can use the following variables:
  17329. @table @option
  17330. @item VOLUME
  17331. Current max volume of channel in dB.
  17332. @item PEAK
  17333. Current peak.
  17334. @item CHANNEL
  17335. Current channel number, starting from 0.
  17336. @end table
  17337. @item t
  17338. If set, displays channel names. Default is enabled.
  17339. @item v
  17340. If set, displays volume values. Default is enabled.
  17341. @item o
  17342. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17343. default is @code{h}.
  17344. @item s
  17345. Set step size, allowed range is [0, 5]. Default is 0, which means
  17346. step is disabled.
  17347. @item p
  17348. Set background opacity, allowed range is [0, 1]. Default is 0.
  17349. @item m
  17350. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17351. default is @code{p}.
  17352. @item ds
  17353. Set display scale, can be linear: @code{lin} or log: @code{log},
  17354. default is @code{lin}.
  17355. @item dm
  17356. In second.
  17357. If set to > 0., display a line for the max level
  17358. in the previous seconds.
  17359. default is disabled: @code{0.}
  17360. @item dmc
  17361. The color of the max line. Use when @code{dm} option is set to > 0.
  17362. default is: @code{orange}
  17363. @end table
  17364. @section showwaves
  17365. Convert input audio to a video output, representing the samples waves.
  17366. The filter accepts the following options:
  17367. @table @option
  17368. @item size, s
  17369. Specify the video size for the output. For the syntax of this option, check the
  17370. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17371. Default value is @code{600x240}.
  17372. @item mode
  17373. Set display mode.
  17374. Available values are:
  17375. @table @samp
  17376. @item point
  17377. Draw a point for each sample.
  17378. @item line
  17379. Draw a vertical line for each sample.
  17380. @item p2p
  17381. Draw a point for each sample and a line between them.
  17382. @item cline
  17383. Draw a centered vertical line for each sample.
  17384. @end table
  17385. Default value is @code{point}.
  17386. @item n
  17387. Set the number of samples which are printed on the same column. A
  17388. larger value will decrease the frame rate. Must be a positive
  17389. integer. This option can be set only if the value for @var{rate}
  17390. is not explicitly specified.
  17391. @item rate, r
  17392. Set the (approximate) output frame rate. This is done by setting the
  17393. option @var{n}. Default value is "25".
  17394. @item split_channels
  17395. Set if channels should be drawn separately or overlap. Default value is 0.
  17396. @item colors
  17397. Set colors separated by '|' which are going to be used for drawing of each channel.
  17398. @item scale
  17399. Set amplitude scale.
  17400. Available values are:
  17401. @table @samp
  17402. @item lin
  17403. Linear.
  17404. @item log
  17405. Logarithmic.
  17406. @item sqrt
  17407. Square root.
  17408. @item cbrt
  17409. Cubic root.
  17410. @end table
  17411. Default is linear.
  17412. @item draw
  17413. Set the draw mode. This is mostly useful to set for high @var{n}.
  17414. Available values are:
  17415. @table @samp
  17416. @item scale
  17417. Scale pixel values for each drawn sample.
  17418. @item full
  17419. Draw every sample directly.
  17420. @end table
  17421. Default value is @code{scale}.
  17422. @end table
  17423. @subsection Examples
  17424. @itemize
  17425. @item
  17426. Output the input file audio and the corresponding video representation
  17427. at the same time:
  17428. @example
  17429. amovie=a.mp3,asplit[out0],showwaves[out1]
  17430. @end example
  17431. @item
  17432. Create a synthetic signal and show it with showwaves, forcing a
  17433. frame rate of 30 frames per second:
  17434. @example
  17435. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17436. @end example
  17437. @end itemize
  17438. @section showwavespic
  17439. Convert input audio to a single video frame, representing the samples waves.
  17440. The filter accepts the following options:
  17441. @table @option
  17442. @item size, s
  17443. Specify the video size for the output. For the syntax of this option, check the
  17444. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17445. Default value is @code{600x240}.
  17446. @item split_channels
  17447. Set if channels should be drawn separately or overlap. Default value is 0.
  17448. @item colors
  17449. Set colors separated by '|' which are going to be used for drawing of each channel.
  17450. @item scale
  17451. Set amplitude scale.
  17452. Available values are:
  17453. @table @samp
  17454. @item lin
  17455. Linear.
  17456. @item log
  17457. Logarithmic.
  17458. @item sqrt
  17459. Square root.
  17460. @item cbrt
  17461. Cubic root.
  17462. @end table
  17463. Default is linear.
  17464. @item draw
  17465. Set the draw mode.
  17466. Available values are:
  17467. @table @samp
  17468. @item scale
  17469. Scale pixel values for each drawn sample.
  17470. @item full
  17471. Draw every sample directly.
  17472. @end table
  17473. Default value is @code{scale}.
  17474. @end table
  17475. @subsection Examples
  17476. @itemize
  17477. @item
  17478. Extract a channel split representation of the wave form of a whole audio track
  17479. in a 1024x800 picture using @command{ffmpeg}:
  17480. @example
  17481. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17482. @end example
  17483. @end itemize
  17484. @section sidedata, asidedata
  17485. Delete frame side data, or select frames based on it.
  17486. This filter accepts the following options:
  17487. @table @option
  17488. @item mode
  17489. Set mode of operation of the filter.
  17490. Can be one of the following:
  17491. @table @samp
  17492. @item select
  17493. Select every frame with side data of @code{type}.
  17494. @item delete
  17495. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17496. data in the frame.
  17497. @end table
  17498. @item type
  17499. Set side data type used with all modes. Must be set for @code{select} mode. For
  17500. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17501. in @file{libavutil/frame.h}. For example, to choose
  17502. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17503. @end table
  17504. @section spectrumsynth
  17505. Sythesize audio from 2 input video spectrums, first input stream represents
  17506. magnitude across time and second represents phase across time.
  17507. The filter will transform from frequency domain as displayed in videos back
  17508. to time domain as presented in audio output.
  17509. This filter is primarily created for reversing processed @ref{showspectrum}
  17510. filter outputs, but can synthesize sound from other spectrograms too.
  17511. But in such case results are going to be poor if the phase data is not
  17512. available, because in such cases phase data need to be recreated, usually
  17513. it's just recreated from random noise.
  17514. For best results use gray only output (@code{channel} color mode in
  17515. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17516. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17517. @code{data} option. Inputs videos should generally use @code{fullframe}
  17518. slide mode as that saves resources needed for decoding video.
  17519. The filter accepts the following options:
  17520. @table @option
  17521. @item sample_rate
  17522. Specify sample rate of output audio, the sample rate of audio from which
  17523. spectrum was generated may differ.
  17524. @item channels
  17525. Set number of channels represented in input video spectrums.
  17526. @item scale
  17527. Set scale which was used when generating magnitude input spectrum.
  17528. Can be @code{lin} or @code{log}. Default is @code{log}.
  17529. @item slide
  17530. Set slide which was used when generating inputs spectrums.
  17531. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17532. Default is @code{fullframe}.
  17533. @item win_func
  17534. Set window function used for resynthesis.
  17535. @item overlap
  17536. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17537. which means optimal overlap for selected window function will be picked.
  17538. @item orientation
  17539. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17540. Default is @code{vertical}.
  17541. @end table
  17542. @subsection Examples
  17543. @itemize
  17544. @item
  17545. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17546. then resynthesize videos back to audio with spectrumsynth:
  17547. @example
  17548. 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
  17549. 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
  17550. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17551. @end example
  17552. @end itemize
  17553. @section split, asplit
  17554. Split input into several identical outputs.
  17555. @code{asplit} works with audio input, @code{split} with video.
  17556. The filter accepts a single parameter which specifies the number of outputs. If
  17557. unspecified, it defaults to 2.
  17558. @subsection Examples
  17559. @itemize
  17560. @item
  17561. Create two separate outputs from the same input:
  17562. @example
  17563. [in] split [out0][out1]
  17564. @end example
  17565. @item
  17566. To create 3 or more outputs, you need to specify the number of
  17567. outputs, like in:
  17568. @example
  17569. [in] asplit=3 [out0][out1][out2]
  17570. @end example
  17571. @item
  17572. Create two separate outputs from the same input, one cropped and
  17573. one padded:
  17574. @example
  17575. [in] split [splitout1][splitout2];
  17576. [splitout1] crop=100:100:0:0 [cropout];
  17577. [splitout2] pad=200:200:100:100 [padout];
  17578. @end example
  17579. @item
  17580. Create 5 copies of the input audio with @command{ffmpeg}:
  17581. @example
  17582. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17583. @end example
  17584. @end itemize
  17585. @section zmq, azmq
  17586. Receive commands sent through a libzmq client, and forward them to
  17587. filters in the filtergraph.
  17588. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17589. must be inserted between two video filters, @code{azmq} between two
  17590. audio filters. Both are capable to send messages to any filter type.
  17591. To enable these filters you need to install the libzmq library and
  17592. headers and configure FFmpeg with @code{--enable-libzmq}.
  17593. For more information about libzmq see:
  17594. @url{http://www.zeromq.org/}
  17595. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17596. receives messages sent through a network interface defined by the
  17597. @option{bind_address} (or the abbreviation "@option{b}") option.
  17598. Default value of this option is @file{tcp://localhost:5555}. You may
  17599. want to alter this value to your needs, but do not forget to escape any
  17600. ':' signs (see @ref{filtergraph escaping}).
  17601. The received message must be in the form:
  17602. @example
  17603. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17604. @end example
  17605. @var{TARGET} specifies the target of the command, usually the name of
  17606. the filter class or a specific filter instance name. The default
  17607. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17608. but you can override this by using the @samp{filter_name@@id} syntax
  17609. (see @ref{Filtergraph syntax}).
  17610. @var{COMMAND} specifies the name of the command for the target filter.
  17611. @var{ARG} is optional and specifies the optional argument list for the
  17612. given @var{COMMAND}.
  17613. Upon reception, the message is processed and the corresponding command
  17614. is injected into the filtergraph. Depending on the result, the filter
  17615. will send a reply to the client, adopting the format:
  17616. @example
  17617. @var{ERROR_CODE} @var{ERROR_REASON}
  17618. @var{MESSAGE}
  17619. @end example
  17620. @var{MESSAGE} is optional.
  17621. @subsection Examples
  17622. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17623. be used to send commands processed by these filters.
  17624. Consider the following filtergraph generated by @command{ffplay}.
  17625. In this example the last overlay filter has an instance name. All other
  17626. filters will have default instance names.
  17627. @example
  17628. ffplay -dumpgraph 1 -f lavfi "
  17629. color=s=100x100:c=red [l];
  17630. color=s=100x100:c=blue [r];
  17631. nullsrc=s=200x100, zmq [bg];
  17632. [bg][l] overlay [bg+l];
  17633. [bg+l][r] overlay@@my=x=100 "
  17634. @end example
  17635. To change the color of the left side of the video, the following
  17636. command can be used:
  17637. @example
  17638. echo Parsed_color_0 c yellow | tools/zmqsend
  17639. @end example
  17640. To change the right side:
  17641. @example
  17642. echo Parsed_color_1 c pink | tools/zmqsend
  17643. @end example
  17644. To change the position of the right side:
  17645. @example
  17646. echo overlay@@my x 150 | tools/zmqsend
  17647. @end example
  17648. @c man end MULTIMEDIA FILTERS
  17649. @chapter Multimedia Sources
  17650. @c man begin MULTIMEDIA SOURCES
  17651. Below is a description of the currently available multimedia sources.
  17652. @section amovie
  17653. This is the same as @ref{movie} source, except it selects an audio
  17654. stream by default.
  17655. @anchor{movie}
  17656. @section movie
  17657. Read audio and/or video stream(s) from a movie container.
  17658. It accepts the following parameters:
  17659. @table @option
  17660. @item filename
  17661. The name of the resource to read (not necessarily a file; it can also be a
  17662. device or a stream accessed through some protocol).
  17663. @item format_name, f
  17664. Specifies the format assumed for the movie to read, and can be either
  17665. the name of a container or an input device. If not specified, the
  17666. format is guessed from @var{movie_name} or by probing.
  17667. @item seek_point, sp
  17668. Specifies the seek point in seconds. The frames will be output
  17669. starting from this seek point. The parameter is evaluated with
  17670. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17671. postfix. The default value is "0".
  17672. @item streams, s
  17673. Specifies the streams to read. Several streams can be specified,
  17674. separated by "+". The source will then have as many outputs, in the
  17675. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17676. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17677. respectively the default (best suited) video and audio stream. Default
  17678. is "dv", or "da" if the filter is called as "amovie".
  17679. @item stream_index, si
  17680. Specifies the index of the video stream to read. If the value is -1,
  17681. the most suitable video stream will be automatically selected. The default
  17682. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17683. audio instead of video.
  17684. @item loop
  17685. Specifies how many times to read the stream in sequence.
  17686. If the value is 0, the stream will be looped infinitely.
  17687. Default value is "1".
  17688. Note that when the movie is looped the source timestamps are not
  17689. changed, so it will generate non monotonically increasing timestamps.
  17690. @item discontinuity
  17691. Specifies the time difference between frames above which the point is
  17692. considered a timestamp discontinuity which is removed by adjusting the later
  17693. timestamps.
  17694. @end table
  17695. It allows overlaying a second video on top of the main input of
  17696. a filtergraph, as shown in this graph:
  17697. @example
  17698. input -----------> deltapts0 --> overlay --> output
  17699. ^
  17700. |
  17701. movie --> scale--> deltapts1 -------+
  17702. @end example
  17703. @subsection Examples
  17704. @itemize
  17705. @item
  17706. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17707. on top of the input labelled "in":
  17708. @example
  17709. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17710. [in] setpts=PTS-STARTPTS [main];
  17711. [main][over] overlay=16:16 [out]
  17712. @end example
  17713. @item
  17714. Read from a video4linux2 device, and overlay it on top of the input
  17715. labelled "in":
  17716. @example
  17717. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17718. [in] setpts=PTS-STARTPTS [main];
  17719. [main][over] overlay=16:16 [out]
  17720. @end example
  17721. @item
  17722. Read the first video stream and the audio stream with id 0x81 from
  17723. dvd.vob; the video is connected to the pad named "video" and the audio is
  17724. connected to the pad named "audio":
  17725. @example
  17726. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17727. @end example
  17728. @end itemize
  17729. @subsection Commands
  17730. Both movie and amovie support the following commands:
  17731. @table @option
  17732. @item seek
  17733. Perform seek using "av_seek_frame".
  17734. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17735. @itemize
  17736. @item
  17737. @var{stream_index}: If stream_index is -1, a default
  17738. stream is selected, and @var{timestamp} is automatically converted
  17739. from AV_TIME_BASE units to the stream specific time_base.
  17740. @item
  17741. @var{timestamp}: Timestamp in AVStream.time_base units
  17742. or, if no stream is specified, in AV_TIME_BASE units.
  17743. @item
  17744. @var{flags}: Flags which select direction and seeking mode.
  17745. @end itemize
  17746. @item get_duration
  17747. Get movie duration in AV_TIME_BASE units.
  17748. @end table
  17749. @c man end MULTIMEDIA SOURCES