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.

23202 lines
618KB

  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. @end table
  1384. @section anull
  1385. Pass the audio source unchanged to the output.
  1386. @section apad
  1387. Pad the end of an audio stream with silence.
  1388. This can be used together with @command{ffmpeg} @option{-shortest} to
  1389. extend audio streams to the same length as the video stream.
  1390. A description of the accepted options follows.
  1391. @table @option
  1392. @item packet_size
  1393. Set silence packet size. Default value is 4096.
  1394. @item pad_len
  1395. Set the number of samples of silence to add to the end. After the
  1396. value is reached, the stream is terminated. This option is mutually
  1397. exclusive with @option{whole_len}.
  1398. @item whole_len
  1399. Set the minimum total number of samples in the output audio stream. If
  1400. the value is longer than the input audio length, silence is added to
  1401. the end, until the value is reached. This option is mutually exclusive
  1402. with @option{pad_len}.
  1403. @item pad_dur
  1404. Specify the duration of samples of silence to add. See
  1405. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1406. for the accepted syntax. Used only if set to non-zero value.
  1407. @item whole_dur
  1408. Specify the minimum total duration in the output audio stream. See
  1409. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1410. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1411. the input audio length, silence is added to the end, until the value is reached.
  1412. This option is mutually exclusive with @option{pad_dur}
  1413. @end table
  1414. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1415. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1416. the input stream indefinitely.
  1417. @subsection Examples
  1418. @itemize
  1419. @item
  1420. Add 1024 samples of silence to the end of the input:
  1421. @example
  1422. apad=pad_len=1024
  1423. @end example
  1424. @item
  1425. Make sure the audio output will contain at least 10000 samples, pad
  1426. the input with silence if required:
  1427. @example
  1428. apad=whole_len=10000
  1429. @end example
  1430. @item
  1431. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1432. video stream will always result the shortest and will be converted
  1433. until the end in the output file when using the @option{shortest}
  1434. option:
  1435. @example
  1436. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1437. @end example
  1438. @end itemize
  1439. @section aphaser
  1440. Add a phasing effect to the input audio.
  1441. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1442. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1443. A description of the accepted parameters follows.
  1444. @table @option
  1445. @item in_gain
  1446. Set input gain. Default is 0.4.
  1447. @item out_gain
  1448. Set output gain. Default is 0.74
  1449. @item delay
  1450. Set delay in milliseconds. Default is 3.0.
  1451. @item decay
  1452. Set decay. Default is 0.4.
  1453. @item speed
  1454. Set modulation speed in Hz. Default is 0.5.
  1455. @item type
  1456. Set modulation type. Default is triangular.
  1457. It accepts the following values:
  1458. @table @samp
  1459. @item triangular, t
  1460. @item sinusoidal, s
  1461. @end table
  1462. @end table
  1463. @section apulsator
  1464. Audio pulsator is something between an autopanner and a tremolo.
  1465. But it can produce funny stereo effects as well. Pulsator changes the volume
  1466. of the left and right channel based on a LFO (low frequency oscillator) with
  1467. different waveforms and shifted phases.
  1468. This filter have the ability to define an offset between left and right
  1469. channel. An offset of 0 means that both LFO shapes match each other.
  1470. The left and right channel are altered equally - a conventional tremolo.
  1471. An offset of 50% means that the shape of the right channel is exactly shifted
  1472. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1473. an autopanner. At 1 both curves match again. Every setting in between moves the
  1474. phase shift gapless between all stages and produces some "bypassing" sounds with
  1475. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1476. the 0.5) the faster the signal passes from the left to the right speaker.
  1477. The filter accepts the following options:
  1478. @table @option
  1479. @item level_in
  1480. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1481. @item level_out
  1482. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1483. @item mode
  1484. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1485. sawup or sawdown. Default is sine.
  1486. @item amount
  1487. Set modulation. Define how much of original signal is affected by the LFO.
  1488. @item offset_l
  1489. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1490. @item offset_r
  1491. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1492. @item width
  1493. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1494. @item timing
  1495. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1496. @item bpm
  1497. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1498. is set to bpm.
  1499. @item ms
  1500. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1501. is set to ms.
  1502. @item hz
  1503. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1504. if timing is set to hz.
  1505. @end table
  1506. @anchor{aresample}
  1507. @section aresample
  1508. Resample the input audio to the specified parameters, using the
  1509. libswresample library. If none are specified then the filter will
  1510. automatically convert between its input and output.
  1511. This filter is also able to stretch/squeeze the audio data to make it match
  1512. the timestamps or to inject silence / cut out audio to make it match the
  1513. timestamps, do a combination of both or do neither.
  1514. The filter accepts the syntax
  1515. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1516. expresses a sample rate and @var{resampler_options} is a list of
  1517. @var{key}=@var{value} pairs, separated by ":". See the
  1518. @ref{Resampler Options,,"Resampler Options" section in the
  1519. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1520. for the complete list of supported options.
  1521. @subsection Examples
  1522. @itemize
  1523. @item
  1524. Resample the input audio to 44100Hz:
  1525. @example
  1526. aresample=44100
  1527. @end example
  1528. @item
  1529. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1530. samples per second compensation:
  1531. @example
  1532. aresample=async=1000
  1533. @end example
  1534. @end itemize
  1535. @section areverse
  1536. Reverse an audio clip.
  1537. Warning: This filter requires memory to buffer the entire clip, so trimming
  1538. is suggested.
  1539. @subsection Examples
  1540. @itemize
  1541. @item
  1542. Take the first 5 seconds of a clip, and reverse it.
  1543. @example
  1544. atrim=end=5,areverse
  1545. @end example
  1546. @end itemize
  1547. @section asetnsamples
  1548. Set the number of samples per each output audio frame.
  1549. The last output packet may contain a different number of samples, as
  1550. the filter will flush all the remaining samples when the input audio
  1551. signals its end.
  1552. The filter accepts the following options:
  1553. @table @option
  1554. @item nb_out_samples, n
  1555. Set the number of frames per each output audio frame. The number is
  1556. intended as the number of samples @emph{per each channel}.
  1557. Default value is 1024.
  1558. @item pad, p
  1559. If set to 1, the filter will pad the last audio frame with zeroes, so
  1560. that the last frame will contain the same number of samples as the
  1561. previous ones. Default value is 1.
  1562. @end table
  1563. For example, to set the number of per-frame samples to 1234 and
  1564. disable padding for the last frame, use:
  1565. @example
  1566. asetnsamples=n=1234:p=0
  1567. @end example
  1568. @section asetrate
  1569. Set the sample rate without altering the PCM data.
  1570. This will result in a change of speed and pitch.
  1571. The filter accepts the following options:
  1572. @table @option
  1573. @item sample_rate, r
  1574. Set the output sample rate. Default is 44100 Hz.
  1575. @end table
  1576. @section ashowinfo
  1577. Show a line containing various information for each input audio frame.
  1578. The input audio is not modified.
  1579. The shown line contains a sequence of key/value pairs of the form
  1580. @var{key}:@var{value}.
  1581. The following values are shown in the output:
  1582. @table @option
  1583. @item n
  1584. The (sequential) number of the input frame, starting from 0.
  1585. @item pts
  1586. The presentation timestamp of the input frame, in time base units; the time base
  1587. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1588. @item pts_time
  1589. The presentation timestamp of the input frame in seconds.
  1590. @item pos
  1591. position of the frame in the input stream, -1 if this information in
  1592. unavailable and/or meaningless (for example in case of synthetic audio)
  1593. @item fmt
  1594. The sample format.
  1595. @item chlayout
  1596. The channel layout.
  1597. @item rate
  1598. The sample rate for the audio frame.
  1599. @item nb_samples
  1600. The number of samples (per channel) in the frame.
  1601. @item checksum
  1602. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1603. audio, the data is treated as if all the planes were concatenated.
  1604. @item plane_checksums
  1605. A list of Adler-32 checksums for each data plane.
  1606. @end table
  1607. @section asoftclip
  1608. Apply audio soft clipping.
  1609. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1610. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1611. This filter accepts the following options:
  1612. @table @option
  1613. @item type
  1614. Set type of soft-clipping.
  1615. It accepts the following values:
  1616. @table @option
  1617. @item tanh
  1618. @item atan
  1619. @item cubic
  1620. @item exp
  1621. @item alg
  1622. @item quintic
  1623. @item sin
  1624. @end table
  1625. @item param
  1626. Set additional parameter which controls sigmoid function.
  1627. @end table
  1628. @section asr
  1629. Automatic Speech Recognition
  1630. This filter uses PocketSphinx for speech recognition. To enable
  1631. compilation of this filter, you need to configure FFmpeg with
  1632. @code{--enable-pocketsphinx}.
  1633. It accepts the following options:
  1634. @table @option
  1635. @item rate
  1636. Set sampling rate of input audio. Defaults is @code{16000}.
  1637. This need to match speech models, otherwise one will get poor results.
  1638. @item hmm
  1639. Set dictionary containing acoustic model files.
  1640. @item dict
  1641. Set pronunciation dictionary.
  1642. @item lm
  1643. Set language model file.
  1644. @item lmctl
  1645. Set language model set.
  1646. @item lmname
  1647. Set which language model to use.
  1648. @item logfn
  1649. Set output for log messages.
  1650. @end table
  1651. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1652. @anchor{astats}
  1653. @section astats
  1654. Display time domain statistical information about the audio channels.
  1655. Statistics are calculated and displayed for each audio channel and,
  1656. where applicable, an overall figure is also given.
  1657. It accepts the following option:
  1658. @table @option
  1659. @item length
  1660. Short window length in seconds, used for peak and trough RMS measurement.
  1661. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1662. @item metadata
  1663. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1664. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1665. disabled.
  1666. Available keys for each channel are:
  1667. DC_offset
  1668. Min_level
  1669. Max_level
  1670. Min_difference
  1671. Max_difference
  1672. Mean_difference
  1673. RMS_difference
  1674. Peak_level
  1675. RMS_peak
  1676. RMS_trough
  1677. Crest_factor
  1678. Flat_factor
  1679. Peak_count
  1680. Bit_depth
  1681. Dynamic_range
  1682. Zero_crossings
  1683. Zero_crossings_rate
  1684. Number_of_NaNs
  1685. Number_of_Infs
  1686. Number_of_denormals
  1687. and for Overall:
  1688. DC_offset
  1689. Min_level
  1690. Max_level
  1691. Min_difference
  1692. Max_difference
  1693. Mean_difference
  1694. RMS_difference
  1695. Peak_level
  1696. RMS_level
  1697. RMS_peak
  1698. RMS_trough
  1699. Flat_factor
  1700. Peak_count
  1701. Bit_depth
  1702. Number_of_samples
  1703. Number_of_NaNs
  1704. Number_of_Infs
  1705. Number_of_denormals
  1706. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1707. this @code{lavfi.astats.Overall.Peak_count}.
  1708. For description what each key means read below.
  1709. @item reset
  1710. Set number of frame after which stats are going to be recalculated.
  1711. Default is disabled.
  1712. @item measure_perchannel
  1713. Select the entries which need to be measured per channel. The metadata keys can
  1714. be used as flags, default is @option{all} which measures everything.
  1715. @option{none} disables all per channel measurement.
  1716. @item measure_overall
  1717. Select the entries which need to be measured overall. The metadata keys can
  1718. be used as flags, default is @option{all} which measures everything.
  1719. @option{none} disables all overall measurement.
  1720. @end table
  1721. A description of each shown parameter follows:
  1722. @table @option
  1723. @item DC offset
  1724. Mean amplitude displacement from zero.
  1725. @item Min level
  1726. Minimal sample level.
  1727. @item Max level
  1728. Maximal sample level.
  1729. @item Min difference
  1730. Minimal difference between two consecutive samples.
  1731. @item Max difference
  1732. Maximal difference between two consecutive samples.
  1733. @item Mean difference
  1734. Mean difference between two consecutive samples.
  1735. The average of each difference between two consecutive samples.
  1736. @item RMS difference
  1737. Root Mean Square difference between two consecutive samples.
  1738. @item Peak level dB
  1739. @item RMS level dB
  1740. Standard peak and RMS level measured in dBFS.
  1741. @item RMS peak dB
  1742. @item RMS trough dB
  1743. Peak and trough values for RMS level measured over a short window.
  1744. @item Crest factor
  1745. Standard ratio of peak to RMS level (note: not in dB).
  1746. @item Flat factor
  1747. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1748. (i.e. either @var{Min level} or @var{Max level}).
  1749. @item Peak count
  1750. Number of occasions (not the number of samples) that the signal attained either
  1751. @var{Min level} or @var{Max level}.
  1752. @item Bit depth
  1753. Overall bit depth of audio. Number of bits used for each sample.
  1754. @item Dynamic range
  1755. Measured dynamic range of audio in dB.
  1756. @item Zero crossings
  1757. Number of points where the waveform crosses the zero level axis.
  1758. @item Zero crossings rate
  1759. Rate of Zero crossings and number of audio samples.
  1760. @end table
  1761. @section atempo
  1762. Adjust audio tempo.
  1763. The filter accepts exactly one parameter, the audio tempo. If not
  1764. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1765. be in the [0.5, 100.0] range.
  1766. Note that tempo greater than 2 will skip some samples rather than
  1767. blend them in. If for any reason this is a concern it is always
  1768. possible to daisy-chain several instances of atempo to achieve the
  1769. desired product tempo.
  1770. @subsection Examples
  1771. @itemize
  1772. @item
  1773. Slow down audio to 80% tempo:
  1774. @example
  1775. atempo=0.8
  1776. @end example
  1777. @item
  1778. To speed up audio to 300% tempo:
  1779. @example
  1780. atempo=3
  1781. @end example
  1782. @item
  1783. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1784. @example
  1785. atempo=sqrt(3),atempo=sqrt(3)
  1786. @end example
  1787. @end itemize
  1788. @section atrim
  1789. Trim the input so that the output contains one continuous subpart of the input.
  1790. It accepts the following parameters:
  1791. @table @option
  1792. @item start
  1793. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1794. sample with the timestamp @var{start} will be the first sample in the output.
  1795. @item end
  1796. Specify time of the first audio sample that will be dropped, i.e. the
  1797. audio sample immediately preceding the one with the timestamp @var{end} will be
  1798. the last sample in the output.
  1799. @item start_pts
  1800. Same as @var{start}, except this option sets the start timestamp in samples
  1801. instead of seconds.
  1802. @item end_pts
  1803. Same as @var{end}, except this option sets the end timestamp in samples instead
  1804. of seconds.
  1805. @item duration
  1806. The maximum duration of the output in seconds.
  1807. @item start_sample
  1808. The number of the first sample that should be output.
  1809. @item end_sample
  1810. The number of the first sample that should be dropped.
  1811. @end table
  1812. @option{start}, @option{end}, and @option{duration} are expressed as time
  1813. duration specifications; see
  1814. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1815. Note that the first two sets of the start/end options and the @option{duration}
  1816. option look at the frame timestamp, while the _sample options simply count the
  1817. samples that pass through the filter. So start/end_pts and start/end_sample will
  1818. give different results when the timestamps are wrong, inexact or do not start at
  1819. zero. Also note that this filter does not modify the timestamps. If you wish
  1820. to have the output timestamps start at zero, insert the asetpts filter after the
  1821. atrim filter.
  1822. If multiple start or end options are set, this filter tries to be greedy and
  1823. keep all samples that match at least one of the specified constraints. To keep
  1824. only the part that matches all the constraints at once, chain multiple atrim
  1825. filters.
  1826. The defaults are such that all the input is kept. So it is possible to set e.g.
  1827. just the end values to keep everything before the specified time.
  1828. Examples:
  1829. @itemize
  1830. @item
  1831. Drop everything except the second minute of input:
  1832. @example
  1833. ffmpeg -i INPUT -af atrim=60:120
  1834. @end example
  1835. @item
  1836. Keep only the first 1000 samples:
  1837. @example
  1838. ffmpeg -i INPUT -af atrim=end_sample=1000
  1839. @end example
  1840. @end itemize
  1841. @section bandpass
  1842. Apply a two-pole Butterworth band-pass filter with central
  1843. frequency @var{frequency}, and (3dB-point) band-width width.
  1844. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1845. instead of the default: constant 0dB peak gain.
  1846. The filter roll off at 6dB per octave (20dB per decade).
  1847. The filter accepts the following options:
  1848. @table @option
  1849. @item frequency, f
  1850. Set the filter's central frequency. Default is @code{3000}.
  1851. @item csg
  1852. Constant skirt gain if set to 1. Defaults to 0.
  1853. @item width_type, t
  1854. Set method to specify band-width of filter.
  1855. @table @option
  1856. @item h
  1857. Hz
  1858. @item q
  1859. Q-Factor
  1860. @item o
  1861. octave
  1862. @item s
  1863. slope
  1864. @item k
  1865. kHz
  1866. @end table
  1867. @item width, w
  1868. Specify the band-width of a filter in width_type units.
  1869. @item channels, c
  1870. Specify which channels to filter, by default all available are filtered.
  1871. @end table
  1872. @subsection Commands
  1873. This filter supports the following commands:
  1874. @table @option
  1875. @item frequency, f
  1876. Change bandpass frequency.
  1877. Syntax for the command is : "@var{frequency}"
  1878. @item width_type, t
  1879. Change bandpass width_type.
  1880. Syntax for the command is : "@var{width_type}"
  1881. @item width, w
  1882. Change bandpass width.
  1883. Syntax for the command is : "@var{width}"
  1884. @end table
  1885. @section bandreject
  1886. Apply a two-pole Butterworth band-reject filter with central
  1887. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1888. The filter roll off at 6dB per octave (20dB per decade).
  1889. The filter accepts the following options:
  1890. @table @option
  1891. @item frequency, f
  1892. Set the filter's central frequency. Default is @code{3000}.
  1893. @item width_type, t
  1894. Set method to specify band-width of filter.
  1895. @table @option
  1896. @item h
  1897. Hz
  1898. @item q
  1899. Q-Factor
  1900. @item o
  1901. octave
  1902. @item s
  1903. slope
  1904. @item k
  1905. kHz
  1906. @end table
  1907. @item width, w
  1908. Specify the band-width of a filter in width_type units.
  1909. @item channels, c
  1910. Specify which channels to filter, by default all available are filtered.
  1911. @end table
  1912. @subsection Commands
  1913. This filter supports the following commands:
  1914. @table @option
  1915. @item frequency, f
  1916. Change bandreject frequency.
  1917. Syntax for the command is : "@var{frequency}"
  1918. @item width_type, t
  1919. Change bandreject width_type.
  1920. Syntax for the command is : "@var{width_type}"
  1921. @item width, w
  1922. Change bandreject width.
  1923. Syntax for the command is : "@var{width}"
  1924. @end table
  1925. @section bass, lowshelf
  1926. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1927. shelving filter with a response similar to that of a standard
  1928. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1929. The filter accepts the following options:
  1930. @table @option
  1931. @item gain, g
  1932. Give the gain at 0 Hz. Its useful range is about -20
  1933. (for a large cut) to +20 (for a large boost).
  1934. Beware of clipping when using a positive gain.
  1935. @item frequency, f
  1936. Set the filter's central frequency and so can be used
  1937. to extend or reduce the frequency range to be boosted or cut.
  1938. The default value is @code{100} Hz.
  1939. @item width_type, t
  1940. Set method to specify band-width of filter.
  1941. @table @option
  1942. @item h
  1943. Hz
  1944. @item q
  1945. Q-Factor
  1946. @item o
  1947. octave
  1948. @item s
  1949. slope
  1950. @item k
  1951. kHz
  1952. @end table
  1953. @item width, w
  1954. Determine how steep is the filter's shelf transition.
  1955. @item channels, c
  1956. Specify which channels to filter, by default all available are filtered.
  1957. @end table
  1958. @subsection Commands
  1959. This filter supports the following commands:
  1960. @table @option
  1961. @item frequency, f
  1962. Change bass frequency.
  1963. Syntax for the command is : "@var{frequency}"
  1964. @item width_type, t
  1965. Change bass width_type.
  1966. Syntax for the command is : "@var{width_type}"
  1967. @item width, w
  1968. Change bass width.
  1969. Syntax for the command is : "@var{width}"
  1970. @item gain, g
  1971. Change bass gain.
  1972. Syntax for the command is : "@var{gain}"
  1973. @end table
  1974. @section biquad
  1975. Apply a biquad IIR filter with the given coefficients.
  1976. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1977. are the numerator and denominator coefficients respectively.
  1978. and @var{channels}, @var{c} specify which channels to filter, by default all
  1979. available are filtered.
  1980. @subsection Commands
  1981. This filter supports the following commands:
  1982. @table @option
  1983. @item a0
  1984. @item a1
  1985. @item a2
  1986. @item b0
  1987. @item b1
  1988. @item b2
  1989. Change biquad parameter.
  1990. Syntax for the command is : "@var{value}"
  1991. @end table
  1992. @section bs2b
  1993. Bauer stereo to binaural transformation, which improves headphone listening of
  1994. stereo audio records.
  1995. To enable compilation of this filter you need to configure FFmpeg with
  1996. @code{--enable-libbs2b}.
  1997. It accepts the following parameters:
  1998. @table @option
  1999. @item profile
  2000. Pre-defined crossfeed level.
  2001. @table @option
  2002. @item default
  2003. Default level (fcut=700, feed=50).
  2004. @item cmoy
  2005. Chu Moy circuit (fcut=700, feed=60).
  2006. @item jmeier
  2007. Jan Meier circuit (fcut=650, feed=95).
  2008. @end table
  2009. @item fcut
  2010. Cut frequency (in Hz).
  2011. @item feed
  2012. Feed level (in Hz).
  2013. @end table
  2014. @section channelmap
  2015. Remap input channels to new locations.
  2016. It accepts the following parameters:
  2017. @table @option
  2018. @item map
  2019. Map channels from input to output. The argument is a '|'-separated list of
  2020. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2021. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2022. channel (e.g. FL for front left) or its index in the input channel layout.
  2023. @var{out_channel} is the name of the output channel or its index in the output
  2024. channel layout. If @var{out_channel} is not given then it is implicitly an
  2025. index, starting with zero and increasing by one for each mapping.
  2026. @item channel_layout
  2027. The channel layout of the output stream.
  2028. @end table
  2029. If no mapping is present, the filter will implicitly map input channels to
  2030. output channels, preserving indices.
  2031. @subsection Examples
  2032. @itemize
  2033. @item
  2034. For example, assuming a 5.1+downmix input MOV file,
  2035. @example
  2036. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2037. @end example
  2038. will create an output WAV file tagged as stereo from the downmix channels of
  2039. the input.
  2040. @item
  2041. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2042. @example
  2043. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2044. @end example
  2045. @end itemize
  2046. @section channelsplit
  2047. Split each channel from an input audio stream into a separate output stream.
  2048. It accepts the following parameters:
  2049. @table @option
  2050. @item channel_layout
  2051. The channel layout of the input stream. The default is "stereo".
  2052. @item channels
  2053. A channel layout describing the channels to be extracted as separate output streams
  2054. or "all" to extract each input channel as a separate stream. The default is "all".
  2055. Choosing channels not present in channel layout in the input will result in an error.
  2056. @end table
  2057. @subsection Examples
  2058. @itemize
  2059. @item
  2060. For example, assuming a stereo input MP3 file,
  2061. @example
  2062. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2063. @end example
  2064. will create an output Matroska file with two audio streams, one containing only
  2065. the left channel and the other the right channel.
  2066. @item
  2067. Split a 5.1 WAV file into per-channel files:
  2068. @example
  2069. ffmpeg -i in.wav -filter_complex
  2070. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2071. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2072. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2073. side_right.wav
  2074. @end example
  2075. @item
  2076. Extract only LFE from a 5.1 WAV file:
  2077. @example
  2078. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2079. -map '[LFE]' lfe.wav
  2080. @end example
  2081. @end itemize
  2082. @section chorus
  2083. Add a chorus effect to the audio.
  2084. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2085. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2086. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2087. The modulation depth defines the range the modulated delay is played before or after
  2088. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2089. sound tuned around the original one, like in a chorus where some vocals are slightly
  2090. off key.
  2091. It accepts the following parameters:
  2092. @table @option
  2093. @item in_gain
  2094. Set input gain. Default is 0.4.
  2095. @item out_gain
  2096. Set output gain. Default is 0.4.
  2097. @item delays
  2098. Set delays. A typical delay is around 40ms to 60ms.
  2099. @item decays
  2100. Set decays.
  2101. @item speeds
  2102. Set speeds.
  2103. @item depths
  2104. Set depths.
  2105. @end table
  2106. @subsection Examples
  2107. @itemize
  2108. @item
  2109. A single delay:
  2110. @example
  2111. chorus=0.7:0.9:55:0.4:0.25:2
  2112. @end example
  2113. @item
  2114. Two delays:
  2115. @example
  2116. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2117. @end example
  2118. @item
  2119. Fuller sounding chorus with three delays:
  2120. @example
  2121. 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
  2122. @end example
  2123. @end itemize
  2124. @section compand
  2125. Compress or expand the audio's dynamic range.
  2126. It accepts the following parameters:
  2127. @table @option
  2128. @item attacks
  2129. @item decays
  2130. A list of times in seconds for each channel over which the instantaneous level
  2131. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2132. increase of volume and @var{decays} refers to decrease of volume. For most
  2133. situations, the attack time (response to the audio getting louder) should be
  2134. shorter than the decay time, because the human ear is more sensitive to sudden
  2135. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2136. a typical value for decay is 0.8 seconds.
  2137. If specified number of attacks & decays is lower than number of channels, the last
  2138. set attack/decay will be used for all remaining channels.
  2139. @item points
  2140. A list of points for the transfer function, specified in dB relative to the
  2141. maximum possible signal amplitude. Each key points list must be defined using
  2142. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2143. @code{x0/y0 x1/y1 x2/y2 ....}
  2144. The input values must be in strictly increasing order but the transfer function
  2145. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2146. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2147. function are @code{-70/-70|-60/-20|1/0}.
  2148. @item soft-knee
  2149. Set the curve radius in dB for all joints. It defaults to 0.01.
  2150. @item gain
  2151. Set the additional gain in dB to be applied at all points on the transfer
  2152. function. This allows for easy adjustment of the overall gain.
  2153. It defaults to 0.
  2154. @item volume
  2155. Set an initial volume, in dB, to be assumed for each channel when filtering
  2156. starts. This permits the user to supply a nominal level initially, so that, for
  2157. example, a very large gain is not applied to initial signal levels before the
  2158. companding has begun to operate. A typical value for audio which is initially
  2159. quiet is -90 dB. It defaults to 0.
  2160. @item delay
  2161. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2162. delayed before being fed to the volume adjuster. Specifying a delay
  2163. approximately equal to the attack/decay times allows the filter to effectively
  2164. operate in predictive rather than reactive mode. It defaults to 0.
  2165. @end table
  2166. @subsection Examples
  2167. @itemize
  2168. @item
  2169. Make music with both quiet and loud passages suitable for listening to in a
  2170. noisy environment:
  2171. @example
  2172. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2173. @end example
  2174. Another example for audio with whisper and explosion parts:
  2175. @example
  2176. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2177. @end example
  2178. @item
  2179. A noise gate for when the noise is at a lower level than the signal:
  2180. @example
  2181. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2182. @end example
  2183. @item
  2184. Here is another noise gate, this time for when the noise is at a higher level
  2185. than the signal (making it, in some ways, similar to squelch):
  2186. @example
  2187. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2188. @end example
  2189. @item
  2190. 2:1 compression starting at -6dB:
  2191. @example
  2192. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2193. @end example
  2194. @item
  2195. 2:1 compression starting at -9dB:
  2196. @example
  2197. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2198. @end example
  2199. @item
  2200. 2:1 compression starting at -12dB:
  2201. @example
  2202. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2203. @end example
  2204. @item
  2205. 2:1 compression starting at -18dB:
  2206. @example
  2207. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2208. @end example
  2209. @item
  2210. 3:1 compression starting at -15dB:
  2211. @example
  2212. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2213. @end example
  2214. @item
  2215. Compressor/Gate:
  2216. @example
  2217. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2218. @end example
  2219. @item
  2220. Expander:
  2221. @example
  2222. 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
  2223. @end example
  2224. @item
  2225. Hard limiter at -6dB:
  2226. @example
  2227. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2228. @end example
  2229. @item
  2230. Hard limiter at -12dB:
  2231. @example
  2232. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2233. @end example
  2234. @item
  2235. Hard noise gate at -35 dB:
  2236. @example
  2237. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2238. @end example
  2239. @item
  2240. Soft limiter:
  2241. @example
  2242. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2243. @end example
  2244. @end itemize
  2245. @section compensationdelay
  2246. Compensation Delay Line is a metric based delay to compensate differing
  2247. positions of microphones or speakers.
  2248. For example, you have recorded guitar with two microphones placed in
  2249. different location. Because the front of sound wave has fixed speed in
  2250. normal conditions, the phasing of microphones can vary and depends on
  2251. their location and interposition. The best sound mix can be achieved when
  2252. these microphones are in phase (synchronized). Note that distance of
  2253. ~30 cm between microphones makes one microphone to capture signal in
  2254. antiphase to another microphone. That makes the final mix sounding moody.
  2255. This filter helps to solve phasing problems by adding different delays
  2256. to each microphone track and make them synchronized.
  2257. The best result can be reached when you take one track as base and
  2258. synchronize other tracks one by one with it.
  2259. Remember that synchronization/delay tolerance depends on sample rate, too.
  2260. Higher sample rates will give more tolerance.
  2261. It accepts the following parameters:
  2262. @table @option
  2263. @item mm
  2264. Set millimeters distance. This is compensation distance for fine tuning.
  2265. Default is 0.
  2266. @item cm
  2267. Set cm distance. This is compensation distance for tightening distance setup.
  2268. Default is 0.
  2269. @item m
  2270. Set meters distance. This is compensation distance for hard distance setup.
  2271. Default is 0.
  2272. @item dry
  2273. Set dry amount. Amount of unprocessed (dry) signal.
  2274. Default is 0.
  2275. @item wet
  2276. Set wet amount. Amount of processed (wet) signal.
  2277. Default is 1.
  2278. @item temp
  2279. Set temperature degree in Celsius. This is the temperature of the environment.
  2280. Default is 20.
  2281. @end table
  2282. @section crossfeed
  2283. Apply headphone crossfeed filter.
  2284. Crossfeed is the process of blending the left and right channels of stereo
  2285. audio recording.
  2286. It is mainly used to reduce extreme stereo separation of low frequencies.
  2287. The intent is to produce more speaker like sound to the listener.
  2288. The filter accepts the following options:
  2289. @table @option
  2290. @item strength
  2291. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2292. This sets gain of low shelf filter for side part of stereo image.
  2293. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2294. @item range
  2295. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2296. This sets cut off frequency of low shelf filter. Default is cut off near
  2297. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2298. @item level_in
  2299. Set input gain. Default is 0.9.
  2300. @item level_out
  2301. Set output gain. Default is 1.
  2302. @end table
  2303. @section crystalizer
  2304. Simple algorithm to expand audio dynamic range.
  2305. The filter accepts the following options:
  2306. @table @option
  2307. @item i
  2308. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2309. (unchanged sound) to 10.0 (maximum effect).
  2310. @item c
  2311. Enable clipping. By default is enabled.
  2312. @end table
  2313. @section dcshift
  2314. Apply a DC shift to the audio.
  2315. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2316. in the recording chain) from the audio. The effect of a DC offset is reduced
  2317. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2318. a signal has a DC offset.
  2319. @table @option
  2320. @item shift
  2321. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2322. the audio.
  2323. @item limitergain
  2324. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2325. used to prevent clipping.
  2326. @end table
  2327. @section drmeter
  2328. Measure audio dynamic range.
  2329. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2330. is found in transition material. And anything less that 8 have very poor dynamics
  2331. and is very compressed.
  2332. The filter accepts the following options:
  2333. @table @option
  2334. @item length
  2335. Set window length in seconds used to split audio into segments of equal length.
  2336. Default is 3 seconds.
  2337. @end table
  2338. @section dynaudnorm
  2339. Dynamic Audio Normalizer.
  2340. This filter applies a certain amount of gain to the input audio in order
  2341. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2342. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2343. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2344. This allows for applying extra gain to the "quiet" sections of the audio
  2345. while avoiding distortions or clipping the "loud" sections. In other words:
  2346. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2347. sections, in the sense that the volume of each section is brought to the
  2348. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2349. this goal *without* applying "dynamic range compressing". It will retain 100%
  2350. of the dynamic range *within* each section of the audio file.
  2351. @table @option
  2352. @item f
  2353. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2354. Default is 500 milliseconds.
  2355. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2356. referred to as frames. This is required, because a peak magnitude has no
  2357. meaning for just a single sample value. Instead, we need to determine the
  2358. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2359. normalizer would simply use the peak magnitude of the complete file, the
  2360. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2361. frame. The length of a frame is specified in milliseconds. By default, the
  2362. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2363. been found to give good results with most files.
  2364. Note that the exact frame length, in number of samples, will be determined
  2365. automatically, based on the sampling rate of the individual input audio file.
  2366. @item g
  2367. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2368. number. Default is 31.
  2369. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2370. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2371. is specified in frames, centered around the current frame. For the sake of
  2372. simplicity, this must be an odd number. Consequently, the default value of 31
  2373. takes into account the current frame, as well as the 15 preceding frames and
  2374. the 15 subsequent frames. Using a larger window results in a stronger
  2375. smoothing effect and thus in less gain variation, i.e. slower gain
  2376. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2377. effect and thus in more gain variation, i.e. faster gain adaptation.
  2378. In other words, the more you increase this value, the more the Dynamic Audio
  2379. Normalizer will behave like a "traditional" normalization filter. On the
  2380. contrary, the more you decrease this value, the more the Dynamic Audio
  2381. Normalizer will behave like a dynamic range compressor.
  2382. @item p
  2383. Set the target peak value. This specifies the highest permissible magnitude
  2384. level for the normalized audio input. This filter will try to approach the
  2385. target peak magnitude as closely as possible, but at the same time it also
  2386. makes sure that the normalized signal will never exceed the peak magnitude.
  2387. A frame's maximum local gain factor is imposed directly by the target peak
  2388. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2389. It is not recommended to go above this value.
  2390. @item m
  2391. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2392. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2393. factor for each input frame, i.e. the maximum gain factor that does not
  2394. result in clipping or distortion. The maximum gain factor is determined by
  2395. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2396. additionally bounds the frame's maximum gain factor by a predetermined
  2397. (global) maximum gain factor. This is done in order to avoid excessive gain
  2398. factors in "silent" or almost silent frames. By default, the maximum gain
  2399. factor is 10.0, For most inputs the default value should be sufficient and
  2400. it usually is not recommended to increase this value. Though, for input
  2401. with an extremely low overall volume level, it may be necessary to allow even
  2402. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2403. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2404. Instead, a "sigmoid" threshold function will be applied. This way, the
  2405. gain factors will smoothly approach the threshold value, but never exceed that
  2406. value.
  2407. @item r
  2408. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2409. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2410. This means that the maximum local gain factor for each frame is defined
  2411. (only) by the frame's highest magnitude sample. This way, the samples can
  2412. be amplified as much as possible without exceeding the maximum signal
  2413. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2414. Normalizer can also take into account the frame's root mean square,
  2415. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2416. determine the power of a time-varying signal. It is therefore considered
  2417. that the RMS is a better approximation of the "perceived loudness" than
  2418. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2419. frames to a constant RMS value, a uniform "perceived loudness" can be
  2420. established. If a target RMS value has been specified, a frame's local gain
  2421. factor is defined as the factor that would result in exactly that RMS value.
  2422. Note, however, that the maximum local gain factor is still restricted by the
  2423. frame's highest magnitude sample, in order to prevent clipping.
  2424. @item n
  2425. Enable channels coupling. By default is enabled.
  2426. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2427. amount. This means the same gain factor will be applied to all channels, i.e.
  2428. the maximum possible gain factor is determined by the "loudest" channel.
  2429. However, in some recordings, it may happen that the volume of the different
  2430. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2431. In this case, this option can be used to disable the channel coupling. This way,
  2432. the gain factor will be determined independently for each channel, depending
  2433. only on the individual channel's highest magnitude sample. This allows for
  2434. harmonizing the volume of the different channels.
  2435. @item c
  2436. Enable DC bias correction. By default is disabled.
  2437. An audio signal (in the time domain) is a sequence of sample values.
  2438. In the Dynamic Audio Normalizer these sample values are represented in the
  2439. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2440. audio signal, or "waveform", should be centered around the zero point.
  2441. That means if we calculate the mean value of all samples in a file, or in a
  2442. single frame, then the result should be 0.0 or at least very close to that
  2443. value. If, however, there is a significant deviation of the mean value from
  2444. 0.0, in either positive or negative direction, this is referred to as a
  2445. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2446. Audio Normalizer provides optional DC bias correction.
  2447. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2448. the mean value, or "DC correction" offset, of each input frame and subtract
  2449. that value from all of the frame's sample values which ensures those samples
  2450. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2451. boundaries, the DC correction offset values will be interpolated smoothly
  2452. between neighbouring frames.
  2453. @item b
  2454. Enable alternative boundary mode. By default is disabled.
  2455. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2456. around each frame. This includes the preceding frames as well as the
  2457. subsequent frames. However, for the "boundary" frames, located at the very
  2458. beginning and at the very end of the audio file, not all neighbouring
  2459. frames are available. In particular, for the first few frames in the audio
  2460. file, the preceding frames are not known. And, similarly, for the last few
  2461. frames in the audio file, the subsequent frames are not known. Thus, the
  2462. question arises which gain factors should be assumed for the missing frames
  2463. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2464. to deal with this situation. The default boundary mode assumes a gain factor
  2465. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2466. "fade out" at the beginning and at the end of the input, respectively.
  2467. @item s
  2468. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2469. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2470. compression. This means that signal peaks will not be pruned and thus the
  2471. full dynamic range will be retained within each local neighbourhood. However,
  2472. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2473. normalization algorithm with a more "traditional" compression.
  2474. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2475. (thresholding) function. If (and only if) the compression feature is enabled,
  2476. all input frames will be processed by a soft knee thresholding function prior
  2477. to the actual normalization process. Put simply, the thresholding function is
  2478. going to prune all samples whose magnitude exceeds a certain threshold value.
  2479. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2480. value. Instead, the threshold value will be adjusted for each individual
  2481. frame.
  2482. In general, smaller parameters result in stronger compression, and vice versa.
  2483. Values below 3.0 are not recommended, because audible distortion may appear.
  2484. @end table
  2485. @section earwax
  2486. Make audio easier to listen to on headphones.
  2487. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2488. so that when listened to on headphones the stereo image is moved from
  2489. inside your head (standard for headphones) to outside and in front of
  2490. the listener (standard for speakers).
  2491. Ported from SoX.
  2492. @section equalizer
  2493. Apply a two-pole peaking equalisation (EQ) filter. With this
  2494. filter, the signal-level at and around a selected frequency can
  2495. be increased or decreased, whilst (unlike bandpass and bandreject
  2496. filters) that at all other frequencies is unchanged.
  2497. In order to produce complex equalisation curves, this filter can
  2498. be given several times, each with a different central frequency.
  2499. The filter accepts the following options:
  2500. @table @option
  2501. @item frequency, f
  2502. Set the filter's central frequency in Hz.
  2503. @item width_type, t
  2504. Set method to specify band-width of filter.
  2505. @table @option
  2506. @item h
  2507. Hz
  2508. @item q
  2509. Q-Factor
  2510. @item o
  2511. octave
  2512. @item s
  2513. slope
  2514. @item k
  2515. kHz
  2516. @end table
  2517. @item width, w
  2518. Specify the band-width of a filter in width_type units.
  2519. @item gain, g
  2520. Set the required gain or attenuation in dB.
  2521. Beware of clipping when using a positive gain.
  2522. @item channels, c
  2523. Specify which channels to filter, by default all available are filtered.
  2524. @end table
  2525. @subsection Examples
  2526. @itemize
  2527. @item
  2528. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2529. @example
  2530. equalizer=f=1000:t=h:width=200:g=-10
  2531. @end example
  2532. @item
  2533. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2534. @example
  2535. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2536. @end example
  2537. @end itemize
  2538. @subsection Commands
  2539. This filter supports the following commands:
  2540. @table @option
  2541. @item frequency, f
  2542. Change equalizer frequency.
  2543. Syntax for the command is : "@var{frequency}"
  2544. @item width_type, t
  2545. Change equalizer width_type.
  2546. Syntax for the command is : "@var{width_type}"
  2547. @item width, w
  2548. Change equalizer width.
  2549. Syntax for the command is : "@var{width}"
  2550. @item gain, g
  2551. Change equalizer gain.
  2552. Syntax for the command is : "@var{gain}"
  2553. @end table
  2554. @section extrastereo
  2555. Linearly increases the difference between left and right channels which
  2556. adds some sort of "live" effect to playback.
  2557. The filter accepts the following options:
  2558. @table @option
  2559. @item m
  2560. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2561. (average of both channels), with 1.0 sound will be unchanged, with
  2562. -1.0 left and right channels will be swapped.
  2563. @item c
  2564. Enable clipping. By default is enabled.
  2565. @end table
  2566. @section firequalizer
  2567. Apply FIR Equalization using arbitrary frequency response.
  2568. The filter accepts the following option:
  2569. @table @option
  2570. @item gain
  2571. Set gain curve equation (in dB). The expression can contain variables:
  2572. @table @option
  2573. @item f
  2574. the evaluated frequency
  2575. @item sr
  2576. sample rate
  2577. @item ch
  2578. channel number, set to 0 when multichannels evaluation is disabled
  2579. @item chid
  2580. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2581. multichannels evaluation is disabled
  2582. @item chs
  2583. number of channels
  2584. @item chlayout
  2585. channel_layout, see libavutil/channel_layout.h
  2586. @end table
  2587. and functions:
  2588. @table @option
  2589. @item gain_interpolate(f)
  2590. interpolate gain on frequency f based on gain_entry
  2591. @item cubic_interpolate(f)
  2592. same as gain_interpolate, but smoother
  2593. @end table
  2594. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2595. @item gain_entry
  2596. Set gain entry for gain_interpolate function. The expression can
  2597. contain functions:
  2598. @table @option
  2599. @item entry(f, g)
  2600. store gain entry at frequency f with value g
  2601. @end table
  2602. This option is also available as command.
  2603. @item delay
  2604. Set filter delay in seconds. Higher value means more accurate.
  2605. Default is @code{0.01}.
  2606. @item accuracy
  2607. Set filter accuracy in Hz. Lower value means more accurate.
  2608. Default is @code{5}.
  2609. @item wfunc
  2610. Set window function. Acceptable values are:
  2611. @table @option
  2612. @item rectangular
  2613. rectangular window, useful when gain curve is already smooth
  2614. @item hann
  2615. hann window (default)
  2616. @item hamming
  2617. hamming window
  2618. @item blackman
  2619. blackman window
  2620. @item nuttall3
  2621. 3-terms continuous 1st derivative nuttall window
  2622. @item mnuttall3
  2623. minimum 3-terms discontinuous nuttall window
  2624. @item nuttall
  2625. 4-terms continuous 1st derivative nuttall window
  2626. @item bnuttall
  2627. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2628. @item bharris
  2629. blackman-harris window
  2630. @item tukey
  2631. tukey window
  2632. @end table
  2633. @item fixed
  2634. If enabled, use fixed number of audio samples. This improves speed when
  2635. filtering with large delay. Default is disabled.
  2636. @item multi
  2637. Enable multichannels evaluation on gain. Default is disabled.
  2638. @item zero_phase
  2639. Enable zero phase mode by subtracting timestamp to compensate delay.
  2640. Default is disabled.
  2641. @item scale
  2642. Set scale used by gain. Acceptable values are:
  2643. @table @option
  2644. @item linlin
  2645. linear frequency, linear gain
  2646. @item linlog
  2647. linear frequency, logarithmic (in dB) gain (default)
  2648. @item loglin
  2649. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2650. @item loglog
  2651. logarithmic frequency, logarithmic gain
  2652. @end table
  2653. @item dumpfile
  2654. Set file for dumping, suitable for gnuplot.
  2655. @item dumpscale
  2656. Set scale for dumpfile. Acceptable values are same with scale option.
  2657. Default is linlog.
  2658. @item fft2
  2659. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2660. Default is disabled.
  2661. @item min_phase
  2662. Enable minimum phase impulse response. Default is disabled.
  2663. @end table
  2664. @subsection Examples
  2665. @itemize
  2666. @item
  2667. lowpass at 1000 Hz:
  2668. @example
  2669. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2670. @end example
  2671. @item
  2672. lowpass at 1000 Hz with gain_entry:
  2673. @example
  2674. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2675. @end example
  2676. @item
  2677. custom equalization:
  2678. @example
  2679. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2680. @end example
  2681. @item
  2682. higher delay with zero phase to compensate delay:
  2683. @example
  2684. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2685. @end example
  2686. @item
  2687. lowpass on left channel, highpass on right channel:
  2688. @example
  2689. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2690. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2691. @end example
  2692. @end itemize
  2693. @section flanger
  2694. Apply a flanging effect to the audio.
  2695. The filter accepts the following options:
  2696. @table @option
  2697. @item delay
  2698. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2699. @item depth
  2700. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2701. @item regen
  2702. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2703. Default value is 0.
  2704. @item width
  2705. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2706. Default value is 71.
  2707. @item speed
  2708. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2709. @item shape
  2710. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2711. Default value is @var{sinusoidal}.
  2712. @item phase
  2713. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2714. Default value is 25.
  2715. @item interp
  2716. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2717. Default is @var{linear}.
  2718. @end table
  2719. @section haas
  2720. Apply Haas effect to audio.
  2721. Note that this makes most sense to apply on mono signals.
  2722. With this filter applied to mono signals it give some directionality and
  2723. stretches its stereo image.
  2724. The filter accepts the following options:
  2725. @table @option
  2726. @item level_in
  2727. Set input level. By default is @var{1}, or 0dB
  2728. @item level_out
  2729. Set output level. By default is @var{1}, or 0dB.
  2730. @item side_gain
  2731. Set gain applied to side part of signal. By default is @var{1}.
  2732. @item middle_source
  2733. Set kind of middle source. Can be one of the following:
  2734. @table @samp
  2735. @item left
  2736. Pick left channel.
  2737. @item right
  2738. Pick right channel.
  2739. @item mid
  2740. Pick middle part signal of stereo image.
  2741. @item side
  2742. Pick side part signal of stereo image.
  2743. @end table
  2744. @item middle_phase
  2745. Change middle phase. By default is disabled.
  2746. @item left_delay
  2747. Set left channel delay. By default is @var{2.05} milliseconds.
  2748. @item left_balance
  2749. Set left channel balance. By default is @var{-1}.
  2750. @item left_gain
  2751. Set left channel gain. By default is @var{1}.
  2752. @item left_phase
  2753. Change left phase. By default is disabled.
  2754. @item right_delay
  2755. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2756. @item right_balance
  2757. Set right channel balance. By default is @var{1}.
  2758. @item right_gain
  2759. Set right channel gain. By default is @var{1}.
  2760. @item right_phase
  2761. Change right phase. By default is enabled.
  2762. @end table
  2763. @section hdcd
  2764. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2765. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2766. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2767. of HDCD, and detects the Transient Filter flag.
  2768. @example
  2769. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2770. @end example
  2771. When using the filter with wav, note the default encoding for wav is 16-bit,
  2772. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2773. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2774. @example
  2775. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2776. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2777. @end example
  2778. The filter accepts the following options:
  2779. @table @option
  2780. @item disable_autoconvert
  2781. Disable any automatic format conversion or resampling in the filter graph.
  2782. @item process_stereo
  2783. Process the stereo channels together. If target_gain does not match between
  2784. channels, consider it invalid and use the last valid target_gain.
  2785. @item cdt_ms
  2786. Set the code detect timer period in ms.
  2787. @item force_pe
  2788. Always extend peaks above -3dBFS even if PE isn't signaled.
  2789. @item analyze_mode
  2790. Replace audio with a solid tone and adjust the amplitude to signal some
  2791. specific aspect of the decoding process. The output file can be loaded in
  2792. an audio editor alongside the original to aid analysis.
  2793. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2794. Modes are:
  2795. @table @samp
  2796. @item 0, off
  2797. Disabled
  2798. @item 1, lle
  2799. Gain adjustment level at each sample
  2800. @item 2, pe
  2801. Samples where peak extend occurs
  2802. @item 3, cdt
  2803. Samples where the code detect timer is active
  2804. @item 4, tgm
  2805. Samples where the target gain does not match between channels
  2806. @end table
  2807. @end table
  2808. @section headphone
  2809. Apply head-related transfer functions (HRTFs) to create virtual
  2810. loudspeakers around the user for binaural listening via headphones.
  2811. The HRIRs are provided via additional streams, for each channel
  2812. one stereo input stream is needed.
  2813. The filter accepts the following options:
  2814. @table @option
  2815. @item map
  2816. Set mapping of input streams for convolution.
  2817. The argument is a '|'-separated list of channel names in order as they
  2818. are given as additional stream inputs for filter.
  2819. This also specify number of input streams. Number of input streams
  2820. must be not less than number of channels in first stream plus one.
  2821. @item gain
  2822. Set gain applied to audio. Value is in dB. Default is 0.
  2823. @item type
  2824. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2825. processing audio in time domain which is slow.
  2826. @var{freq} is processing audio in frequency domain which is fast.
  2827. Default is @var{freq}.
  2828. @item lfe
  2829. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2830. @item size
  2831. Set size of frame in number of samples which will be processed at once.
  2832. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2833. @item hrir
  2834. Set format of hrir stream.
  2835. Default value is @var{stereo}. Alternative value is @var{multich}.
  2836. If value is set to @var{stereo}, number of additional streams should
  2837. be greater or equal to number of input channels in first input stream.
  2838. Also each additional stream should have stereo number of channels.
  2839. If value is set to @var{multich}, number of additional streams should
  2840. be exactly one. Also number of input channels of additional stream
  2841. should be equal or greater than twice number of channels of first input
  2842. stream.
  2843. @end table
  2844. @subsection Examples
  2845. @itemize
  2846. @item
  2847. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2848. each amovie filter use stereo file with IR coefficients as input.
  2849. The files give coefficients for each position of virtual loudspeaker:
  2850. @example
  2851. ffmpeg -i input.wav
  2852. -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"
  2853. output.wav
  2854. @end example
  2855. @item
  2856. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2857. but now in @var{multich} @var{hrir} format.
  2858. @example
  2859. 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"
  2860. output.wav
  2861. @end example
  2862. @end itemize
  2863. @section highpass
  2864. Apply a high-pass filter with 3dB point frequency.
  2865. The filter can be either single-pole, or double-pole (the default).
  2866. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2867. The filter accepts the following options:
  2868. @table @option
  2869. @item frequency, f
  2870. Set frequency in Hz. Default is 3000.
  2871. @item poles, p
  2872. Set number of poles. Default is 2.
  2873. @item width_type, t
  2874. Set method to specify band-width of filter.
  2875. @table @option
  2876. @item h
  2877. Hz
  2878. @item q
  2879. Q-Factor
  2880. @item o
  2881. octave
  2882. @item s
  2883. slope
  2884. @item k
  2885. kHz
  2886. @end table
  2887. @item width, w
  2888. Specify the band-width of a filter in width_type units.
  2889. Applies only to double-pole filter.
  2890. The default is 0.707q and gives a Butterworth response.
  2891. @item channels, c
  2892. Specify which channels to filter, by default all available are filtered.
  2893. @end table
  2894. @subsection Commands
  2895. This filter supports the following commands:
  2896. @table @option
  2897. @item frequency, f
  2898. Change highpass frequency.
  2899. Syntax for the command is : "@var{frequency}"
  2900. @item width_type, t
  2901. Change highpass width_type.
  2902. Syntax for the command is : "@var{width_type}"
  2903. @item width, w
  2904. Change highpass width.
  2905. Syntax for the command is : "@var{width}"
  2906. @end table
  2907. @section join
  2908. Join multiple input streams into one multi-channel stream.
  2909. It accepts the following parameters:
  2910. @table @option
  2911. @item inputs
  2912. The number of input streams. It defaults to 2.
  2913. @item channel_layout
  2914. The desired output channel layout. It defaults to stereo.
  2915. @item map
  2916. Map channels from inputs to output. The argument is a '|'-separated list of
  2917. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2918. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2919. can be either the name of the input channel (e.g. FL for front left) or its
  2920. index in the specified input stream. @var{out_channel} is the name of the output
  2921. channel.
  2922. @end table
  2923. The filter will attempt to guess the mappings when they are not specified
  2924. explicitly. It does so by first trying to find an unused matching input channel
  2925. and if that fails it picks the first unused input channel.
  2926. Join 3 inputs (with properly set channel layouts):
  2927. @example
  2928. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2929. @end example
  2930. Build a 5.1 output from 6 single-channel streams:
  2931. @example
  2932. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2933. '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'
  2934. out
  2935. @end example
  2936. @section ladspa
  2937. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2938. To enable compilation of this filter you need to configure FFmpeg with
  2939. @code{--enable-ladspa}.
  2940. @table @option
  2941. @item file, f
  2942. Specifies the name of LADSPA plugin library to load. If the environment
  2943. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2944. each one of the directories specified by the colon separated list in
  2945. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2946. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2947. @file{/usr/lib/ladspa/}.
  2948. @item plugin, p
  2949. Specifies the plugin within the library. Some libraries contain only
  2950. one plugin, but others contain many of them. If this is not set filter
  2951. will list all available plugins within the specified library.
  2952. @item controls, c
  2953. Set the '|' separated list of controls which are zero or more floating point
  2954. values that determine the behavior of the loaded plugin (for example delay,
  2955. threshold or gain).
  2956. Controls need to be defined using the following syntax:
  2957. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2958. @var{valuei} is the value set on the @var{i}-th control.
  2959. Alternatively they can be also defined using the following syntax:
  2960. @var{value0}|@var{value1}|@var{value2}|..., where
  2961. @var{valuei} is the value set on the @var{i}-th control.
  2962. If @option{controls} is set to @code{help}, all available controls and
  2963. their valid ranges are printed.
  2964. @item sample_rate, s
  2965. Specify the sample rate, default to 44100. Only used if plugin have
  2966. zero inputs.
  2967. @item nb_samples, n
  2968. Set the number of samples per channel per each output frame, default
  2969. is 1024. Only used if plugin have zero inputs.
  2970. @item duration, d
  2971. Set the minimum duration of the sourced audio. See
  2972. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2973. for the accepted syntax.
  2974. Note that the resulting duration may be greater than the specified duration,
  2975. as the generated audio is always cut at the end of a complete frame.
  2976. If not specified, or the expressed duration is negative, the audio is
  2977. supposed to be generated forever.
  2978. Only used if plugin have zero inputs.
  2979. @end table
  2980. @subsection Examples
  2981. @itemize
  2982. @item
  2983. List all available plugins within amp (LADSPA example plugin) library:
  2984. @example
  2985. ladspa=file=amp
  2986. @end example
  2987. @item
  2988. List all available controls and their valid ranges for @code{vcf_notch}
  2989. plugin from @code{VCF} library:
  2990. @example
  2991. ladspa=f=vcf:p=vcf_notch:c=help
  2992. @end example
  2993. @item
  2994. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2995. plugin library:
  2996. @example
  2997. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2998. @end example
  2999. @item
  3000. Add reverberation to the audio using TAP-plugins
  3001. (Tom's Audio Processing plugins):
  3002. @example
  3003. ladspa=file=tap_reverb:tap_reverb
  3004. @end example
  3005. @item
  3006. Generate white noise, with 0.2 amplitude:
  3007. @example
  3008. ladspa=file=cmt:noise_source_white:c=c0=.2
  3009. @end example
  3010. @item
  3011. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3012. @code{C* Audio Plugin Suite} (CAPS) library:
  3013. @example
  3014. ladspa=file=caps:Click:c=c1=20'
  3015. @end example
  3016. @item
  3017. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3018. @example
  3019. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3020. @end example
  3021. @item
  3022. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3023. @code{SWH Plugins} collection:
  3024. @example
  3025. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3026. @end example
  3027. @item
  3028. Attenuate low frequencies using Multiband EQ from Steve Harris
  3029. @code{SWH Plugins} collection:
  3030. @example
  3031. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3032. @end example
  3033. @item
  3034. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3035. (CAPS) library:
  3036. @example
  3037. ladspa=caps:Narrower
  3038. @end example
  3039. @item
  3040. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3041. @example
  3042. ladspa=caps:White:.2
  3043. @end example
  3044. @item
  3045. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3046. @example
  3047. ladspa=caps:Fractal:c=c1=1
  3048. @end example
  3049. @item
  3050. Dynamic volume normalization using @code{VLevel} plugin:
  3051. @example
  3052. ladspa=vlevel-ladspa:vlevel_mono
  3053. @end example
  3054. @end itemize
  3055. @subsection Commands
  3056. This filter supports the following commands:
  3057. @table @option
  3058. @item cN
  3059. Modify the @var{N}-th control value.
  3060. If the specified value is not valid, it is ignored and prior one is kept.
  3061. @end table
  3062. @section loudnorm
  3063. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3064. Support for both single pass (livestreams, files) and double pass (files) modes.
  3065. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3066. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3067. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3068. The filter accepts the following options:
  3069. @table @option
  3070. @item I, i
  3071. Set integrated loudness target.
  3072. Range is -70.0 - -5.0. Default value is -24.0.
  3073. @item LRA, lra
  3074. Set loudness range target.
  3075. Range is 1.0 - 20.0. Default value is 7.0.
  3076. @item TP, tp
  3077. Set maximum true peak.
  3078. Range is -9.0 - +0.0. Default value is -2.0.
  3079. @item measured_I, measured_i
  3080. Measured IL of input file.
  3081. Range is -99.0 - +0.0.
  3082. @item measured_LRA, measured_lra
  3083. Measured LRA of input file.
  3084. Range is 0.0 - 99.0.
  3085. @item measured_TP, measured_tp
  3086. Measured true peak of input file.
  3087. Range is -99.0 - +99.0.
  3088. @item measured_thresh
  3089. Measured threshold of input file.
  3090. Range is -99.0 - +0.0.
  3091. @item offset
  3092. Set offset gain. Gain is applied before the true-peak limiter.
  3093. Range is -99.0 - +99.0. Default is +0.0.
  3094. @item linear
  3095. Normalize linearly if possible.
  3096. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3097. to be specified in order to use this mode.
  3098. Options are true or false. Default is true.
  3099. @item dual_mono
  3100. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3101. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3102. If set to @code{true}, this option will compensate for this effect.
  3103. Multi-channel input files are not affected by this option.
  3104. Options are true or false. Default is false.
  3105. @item print_format
  3106. Set print format for stats. Options are summary, json, or none.
  3107. Default value is none.
  3108. @end table
  3109. @section lowpass
  3110. Apply a low-pass filter with 3dB point frequency.
  3111. The filter can be either single-pole or double-pole (the default).
  3112. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3113. The filter accepts the following options:
  3114. @table @option
  3115. @item frequency, f
  3116. Set frequency in Hz. Default is 500.
  3117. @item poles, p
  3118. Set number of poles. Default is 2.
  3119. @item width_type, t
  3120. Set method to specify band-width of filter.
  3121. @table @option
  3122. @item h
  3123. Hz
  3124. @item q
  3125. Q-Factor
  3126. @item o
  3127. octave
  3128. @item s
  3129. slope
  3130. @item k
  3131. kHz
  3132. @end table
  3133. @item width, w
  3134. Specify the band-width of a filter in width_type units.
  3135. Applies only to double-pole filter.
  3136. The default is 0.707q and gives a Butterworth response.
  3137. @item channels, c
  3138. Specify which channels to filter, by default all available are filtered.
  3139. @end table
  3140. @subsection Examples
  3141. @itemize
  3142. @item
  3143. Lowpass only LFE channel, it LFE is not present it does nothing:
  3144. @example
  3145. lowpass=c=LFE
  3146. @end example
  3147. @end itemize
  3148. @subsection Commands
  3149. This filter supports the following commands:
  3150. @table @option
  3151. @item frequency, f
  3152. Change lowpass frequency.
  3153. Syntax for the command is : "@var{frequency}"
  3154. @item width_type, t
  3155. Change lowpass width_type.
  3156. Syntax for the command is : "@var{width_type}"
  3157. @item width, w
  3158. Change lowpass width.
  3159. Syntax for the command is : "@var{width}"
  3160. @end table
  3161. @section lv2
  3162. Load a LV2 (LADSPA Version 2) plugin.
  3163. To enable compilation of this filter you need to configure FFmpeg with
  3164. @code{--enable-lv2}.
  3165. @table @option
  3166. @item plugin, p
  3167. Specifies the plugin URI. You may need to escape ':'.
  3168. @item controls, c
  3169. Set the '|' separated list of controls which are zero or more floating point
  3170. values that determine the behavior of the loaded plugin (for example delay,
  3171. threshold or gain).
  3172. If @option{controls} is set to @code{help}, all available controls and
  3173. their valid ranges are printed.
  3174. @item sample_rate, s
  3175. Specify the sample rate, default to 44100. Only used if plugin have
  3176. zero inputs.
  3177. @item nb_samples, n
  3178. Set the number of samples per channel per each output frame, default
  3179. is 1024. Only used if plugin have zero inputs.
  3180. @item duration, d
  3181. Set the minimum duration of the sourced audio. See
  3182. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3183. for the accepted syntax.
  3184. Note that the resulting duration may be greater than the specified duration,
  3185. as the generated audio is always cut at the end of a complete frame.
  3186. If not specified, or the expressed duration is negative, the audio is
  3187. supposed to be generated forever.
  3188. Only used if plugin have zero inputs.
  3189. @end table
  3190. @subsection Examples
  3191. @itemize
  3192. @item
  3193. Apply bass enhancer plugin from Calf:
  3194. @example
  3195. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3196. @end example
  3197. @item
  3198. Apply vinyl plugin from Calf:
  3199. @example
  3200. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3201. @end example
  3202. @item
  3203. Apply bit crusher plugin from ArtyFX:
  3204. @example
  3205. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3206. @end example
  3207. @end itemize
  3208. @section mcompand
  3209. Multiband Compress or expand the audio's dynamic range.
  3210. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3211. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3212. response when absent compander action.
  3213. It accepts the following parameters:
  3214. @table @option
  3215. @item args
  3216. This option syntax is:
  3217. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3218. For explanation of each item refer to compand filter documentation.
  3219. @end table
  3220. @anchor{pan}
  3221. @section pan
  3222. Mix channels with specific gain levels. The filter accepts the output
  3223. channel layout followed by a set of channels definitions.
  3224. This filter is also designed to efficiently remap the channels of an audio
  3225. stream.
  3226. The filter accepts parameters of the form:
  3227. "@var{l}|@var{outdef}|@var{outdef}|..."
  3228. @table @option
  3229. @item l
  3230. output channel layout or number of channels
  3231. @item outdef
  3232. output channel specification, of the form:
  3233. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3234. @item out_name
  3235. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3236. number (c0, c1, etc.)
  3237. @item gain
  3238. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3239. @item in_name
  3240. input channel to use, see out_name for details; it is not possible to mix
  3241. named and numbered input channels
  3242. @end table
  3243. If the `=' in a channel specification is replaced by `<', then the gains for
  3244. that specification will be renormalized so that the total is 1, thus
  3245. avoiding clipping noise.
  3246. @subsection Mixing examples
  3247. For example, if you want to down-mix from stereo to mono, but with a bigger
  3248. factor for the left channel:
  3249. @example
  3250. pan=1c|c0=0.9*c0+0.1*c1
  3251. @end example
  3252. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3253. 7-channels surround:
  3254. @example
  3255. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3256. @end example
  3257. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3258. that should be preferred (see "-ac" option) unless you have very specific
  3259. needs.
  3260. @subsection Remapping examples
  3261. The channel remapping will be effective if, and only if:
  3262. @itemize
  3263. @item gain coefficients are zeroes or ones,
  3264. @item only one input per channel output,
  3265. @end itemize
  3266. If all these conditions are satisfied, the filter will notify the user ("Pure
  3267. channel mapping detected"), and use an optimized and lossless method to do the
  3268. remapping.
  3269. For example, if you have a 5.1 source and want a stereo audio stream by
  3270. dropping the extra channels:
  3271. @example
  3272. pan="stereo| c0=FL | c1=FR"
  3273. @end example
  3274. Given the same source, you can also switch front left and front right channels
  3275. and keep the input channel layout:
  3276. @example
  3277. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3278. @end example
  3279. If the input is a stereo audio stream, you can mute the front left channel (and
  3280. still keep the stereo channel layout) with:
  3281. @example
  3282. pan="stereo|c1=c1"
  3283. @end example
  3284. Still with a stereo audio stream input, you can copy the right channel in both
  3285. front left and right:
  3286. @example
  3287. pan="stereo| c0=FR | c1=FR"
  3288. @end example
  3289. @section replaygain
  3290. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3291. outputs it unchanged.
  3292. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3293. @section resample
  3294. Convert the audio sample format, sample rate and channel layout. It is
  3295. not meant to be used directly.
  3296. @section rubberband
  3297. Apply time-stretching and pitch-shifting with librubberband.
  3298. To enable compilation of this filter, you need to configure FFmpeg with
  3299. @code{--enable-librubberband}.
  3300. The filter accepts the following options:
  3301. @table @option
  3302. @item tempo
  3303. Set tempo scale factor.
  3304. @item pitch
  3305. Set pitch scale factor.
  3306. @item transients
  3307. Set transients detector.
  3308. Possible values are:
  3309. @table @var
  3310. @item crisp
  3311. @item mixed
  3312. @item smooth
  3313. @end table
  3314. @item detector
  3315. Set detector.
  3316. Possible values are:
  3317. @table @var
  3318. @item compound
  3319. @item percussive
  3320. @item soft
  3321. @end table
  3322. @item phase
  3323. Set phase.
  3324. Possible values are:
  3325. @table @var
  3326. @item laminar
  3327. @item independent
  3328. @end table
  3329. @item window
  3330. Set processing window size.
  3331. Possible values are:
  3332. @table @var
  3333. @item standard
  3334. @item short
  3335. @item long
  3336. @end table
  3337. @item smoothing
  3338. Set smoothing.
  3339. Possible values are:
  3340. @table @var
  3341. @item off
  3342. @item on
  3343. @end table
  3344. @item formant
  3345. Enable formant preservation when shift pitching.
  3346. Possible values are:
  3347. @table @var
  3348. @item shifted
  3349. @item preserved
  3350. @end table
  3351. @item pitchq
  3352. Set pitch quality.
  3353. Possible values are:
  3354. @table @var
  3355. @item quality
  3356. @item speed
  3357. @item consistency
  3358. @end table
  3359. @item channels
  3360. Set channels.
  3361. Possible values are:
  3362. @table @var
  3363. @item apart
  3364. @item together
  3365. @end table
  3366. @end table
  3367. @section sidechaincompress
  3368. This filter acts like normal compressor but has the ability to compress
  3369. detected signal using second input signal.
  3370. It needs two input streams and returns one output stream.
  3371. First input stream will be processed depending on second stream signal.
  3372. The filtered signal then can be filtered with other filters in later stages of
  3373. processing. See @ref{pan} and @ref{amerge} filter.
  3374. The filter accepts the following options:
  3375. @table @option
  3376. @item level_in
  3377. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3378. @item mode
  3379. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3380. Default is @code{downward}.
  3381. @item threshold
  3382. If a signal of second stream raises above this level it will affect the gain
  3383. reduction of first stream.
  3384. By default is 0.125. Range is between 0.00097563 and 1.
  3385. @item ratio
  3386. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3387. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3388. Default is 2. Range is between 1 and 20.
  3389. @item attack
  3390. Amount of milliseconds the signal has to rise above the threshold before gain
  3391. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3392. @item release
  3393. Amount of milliseconds the signal has to fall below the threshold before
  3394. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3395. @item makeup
  3396. Set the amount by how much signal will be amplified after processing.
  3397. Default is 1. Range is from 1 to 64.
  3398. @item knee
  3399. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3400. Default is 2.82843. Range is between 1 and 8.
  3401. @item link
  3402. Choose if the @code{average} level between all channels of side-chain stream
  3403. or the louder(@code{maximum}) channel of side-chain stream affects the
  3404. reduction. Default is @code{average}.
  3405. @item detection
  3406. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3407. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3408. @item level_sc
  3409. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3410. @item mix
  3411. How much to use compressed signal in output. Default is 1.
  3412. Range is between 0 and 1.
  3413. @end table
  3414. @subsection Examples
  3415. @itemize
  3416. @item
  3417. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3418. depending on the signal of 2nd input and later compressed signal to be
  3419. merged with 2nd input:
  3420. @example
  3421. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3422. @end example
  3423. @end itemize
  3424. @section sidechaingate
  3425. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3426. filter the detected signal before sending it to the gain reduction stage.
  3427. Normally a gate uses the full range signal to detect a level above the
  3428. threshold.
  3429. For example: If you cut all lower frequencies from your sidechain signal
  3430. the gate will decrease the volume of your track only if not enough highs
  3431. appear. With this technique you are able to reduce the resonation of a
  3432. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3433. guitar.
  3434. It needs two input streams and returns one output stream.
  3435. First input stream will be processed depending on second stream signal.
  3436. The filter accepts the following options:
  3437. @table @option
  3438. @item level_in
  3439. Set input level before filtering.
  3440. Default is 1. Allowed range is from 0.015625 to 64.
  3441. @item mode
  3442. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3443. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3444. will be amplified, expanding dynamic range in upward direction.
  3445. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3446. @item range
  3447. Set the level of gain reduction when the signal is below the threshold.
  3448. Default is 0.06125. Allowed range is from 0 to 1.
  3449. Setting this to 0 disables reduction and then filter behaves like expander.
  3450. @item threshold
  3451. If a signal rises above this level the gain reduction is released.
  3452. Default is 0.125. Allowed range is from 0 to 1.
  3453. @item ratio
  3454. Set a ratio about which the signal is reduced.
  3455. Default is 2. Allowed range is from 1 to 9000.
  3456. @item attack
  3457. Amount of milliseconds the signal has to rise above the threshold before gain
  3458. reduction stops.
  3459. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3460. @item release
  3461. Amount of milliseconds the signal has to fall below the threshold before the
  3462. reduction is increased again. Default is 250 milliseconds.
  3463. Allowed range is from 0.01 to 9000.
  3464. @item makeup
  3465. Set amount of amplification of signal after processing.
  3466. Default is 1. Allowed range is from 1 to 64.
  3467. @item knee
  3468. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3469. Default is 2.828427125. Allowed range is from 1 to 8.
  3470. @item detection
  3471. Choose if exact signal should be taken for detection or an RMS like one.
  3472. Default is rms. Can be peak or rms.
  3473. @item link
  3474. Choose if the average level between all channels or the louder channel affects
  3475. the reduction.
  3476. Default is average. Can be average or maximum.
  3477. @item level_sc
  3478. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3479. @end table
  3480. @section silencedetect
  3481. Detect silence in an audio stream.
  3482. This filter logs a message when it detects that the input audio volume is less
  3483. or equal to a noise tolerance value for a duration greater or equal to the
  3484. minimum detected noise duration.
  3485. The printed times and duration are expressed in seconds.
  3486. The filter accepts the following options:
  3487. @table @option
  3488. @item noise, n
  3489. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3490. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3491. @item duration, d
  3492. Set silence duration until notification (default is 2 seconds).
  3493. @item mono, m
  3494. Process each channel separately, instead of combined. By default is disabled.
  3495. @end table
  3496. @subsection Examples
  3497. @itemize
  3498. @item
  3499. Detect 5 seconds of silence with -50dB noise tolerance:
  3500. @example
  3501. silencedetect=n=-50dB:d=5
  3502. @end example
  3503. @item
  3504. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3505. tolerance in @file{silence.mp3}:
  3506. @example
  3507. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3508. @end example
  3509. @end itemize
  3510. @section silenceremove
  3511. Remove silence from the beginning, middle or end of the audio.
  3512. The filter accepts the following options:
  3513. @table @option
  3514. @item start_periods
  3515. This value is used to indicate if audio should be trimmed at beginning of
  3516. the audio. A value of zero indicates no silence should be trimmed from the
  3517. beginning. When specifying a non-zero value, it trims audio up until it
  3518. finds non-silence. Normally, when trimming silence from beginning of audio
  3519. the @var{start_periods} will be @code{1} but it can be increased to higher
  3520. values to trim all audio up to specific count of non-silence periods.
  3521. Default value is @code{0}.
  3522. @item start_duration
  3523. Specify the amount of time that non-silence must be detected before it stops
  3524. trimming audio. By increasing the duration, bursts of noises can be treated
  3525. as silence and trimmed off. Default value is @code{0}.
  3526. @item start_threshold
  3527. This indicates what sample value should be treated as silence. For digital
  3528. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3529. you may wish to increase the value to account for background noise.
  3530. Can be specified in dB (in case "dB" is appended to the specified value)
  3531. or amplitude ratio. Default value is @code{0}.
  3532. @item start_silence
  3533. Specify max duration of silence at beginning that will be kept after
  3534. trimming. Default is 0, which is equal to trimming all samples detected
  3535. as silence.
  3536. @item start_mode
  3537. Specify mode of detection of silence end in start of multi-channel audio.
  3538. Can be @var{any} or @var{all}. Default is @var{any}.
  3539. With @var{any}, any sample that is detected as non-silence will cause
  3540. stopped trimming of silence.
  3541. With @var{all}, only if all channels are detected as non-silence will cause
  3542. stopped trimming of silence.
  3543. @item stop_periods
  3544. Set the count for trimming silence from the end of audio.
  3545. To remove silence from the middle of a file, specify a @var{stop_periods}
  3546. that is negative. This value is then treated as a positive value and is
  3547. used to indicate the effect should restart processing as specified by
  3548. @var{start_periods}, making it suitable for removing periods of silence
  3549. in the middle of the audio.
  3550. Default value is @code{0}.
  3551. @item stop_duration
  3552. Specify a duration of silence that must exist before audio is not copied any
  3553. more. By specifying a higher duration, silence that is wanted can be left in
  3554. the audio.
  3555. Default value is @code{0}.
  3556. @item stop_threshold
  3557. This is the same as @option{start_threshold} but for trimming silence from
  3558. the end of audio.
  3559. Can be specified in dB (in case "dB" is appended to the specified value)
  3560. or amplitude ratio. Default value is @code{0}.
  3561. @item stop_silence
  3562. Specify max duration of silence at end that will be kept after
  3563. trimming. Default is 0, which is equal to trimming all samples detected
  3564. as silence.
  3565. @item stop_mode
  3566. Specify mode of detection of silence start in end of multi-channel audio.
  3567. Can be @var{any} or @var{all}. Default is @var{any}.
  3568. With @var{any}, any sample that is detected as non-silence will cause
  3569. stopped trimming of silence.
  3570. With @var{all}, only if all channels are detected as non-silence will cause
  3571. stopped trimming of silence.
  3572. @item detection
  3573. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3574. and works better with digital silence which is exactly 0.
  3575. Default value is @code{rms}.
  3576. @item window
  3577. Set duration in number of seconds used to calculate size of window in number
  3578. of samples for detecting silence.
  3579. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3580. @end table
  3581. @subsection Examples
  3582. @itemize
  3583. @item
  3584. The following example shows how this filter can be used to start a recording
  3585. that does not contain the delay at the start which usually occurs between
  3586. pressing the record button and the start of the performance:
  3587. @example
  3588. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3589. @end example
  3590. @item
  3591. Trim all silence encountered from beginning to end where there is more than 1
  3592. second of silence in audio:
  3593. @example
  3594. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3595. @end example
  3596. @end itemize
  3597. @section sofalizer
  3598. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3599. loudspeakers around the user for binaural listening via headphones (audio
  3600. formats up to 9 channels supported).
  3601. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3602. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3603. Austrian Academy of Sciences.
  3604. To enable compilation of this filter you need to configure FFmpeg with
  3605. @code{--enable-libmysofa}.
  3606. The filter accepts the following options:
  3607. @table @option
  3608. @item sofa
  3609. Set the SOFA file used for rendering.
  3610. @item gain
  3611. Set gain applied to audio. Value is in dB. Default is 0.
  3612. @item rotation
  3613. Set rotation of virtual loudspeakers in deg. Default is 0.
  3614. @item elevation
  3615. Set elevation of virtual speakers in deg. Default is 0.
  3616. @item radius
  3617. Set distance in meters between loudspeakers and the listener with near-field
  3618. HRTFs. Default is 1.
  3619. @item type
  3620. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3621. processing audio in time domain which is slow.
  3622. @var{freq} is processing audio in frequency domain which is fast.
  3623. Default is @var{freq}.
  3624. @item speakers
  3625. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3626. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3627. Each virtual loudspeaker is described with short channel name following with
  3628. azimuth and elevation in degrees.
  3629. Each virtual loudspeaker description is separated by '|'.
  3630. For example to override front left and front right channel positions use:
  3631. 'speakers=FL 45 15|FR 345 15'.
  3632. Descriptions with unrecognised channel names are ignored.
  3633. @item lfegain
  3634. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3635. @item framesize
  3636. Set custom frame size in number of samples. Default is 1024.
  3637. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3638. is set to @var{freq}.
  3639. @item normalize
  3640. Should all IRs be normalized upon importing SOFA file.
  3641. By default is enabled.
  3642. @item interpolate
  3643. Should nearest IRs be interpolated with neighbor IRs if exact position
  3644. does not match. By default is disabled.
  3645. @item minphase
  3646. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3647. @item anglestep
  3648. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3649. @item radstep
  3650. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3651. @end table
  3652. @subsection Examples
  3653. @itemize
  3654. @item
  3655. Using ClubFritz6 sofa file:
  3656. @example
  3657. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3658. @end example
  3659. @item
  3660. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3661. @example
  3662. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3663. @end example
  3664. @item
  3665. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3666. and also with custom gain:
  3667. @example
  3668. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3669. @end example
  3670. @end itemize
  3671. @section stereotools
  3672. This filter has some handy utilities to manage stereo signals, for converting
  3673. M/S stereo recordings to L/R signal while having control over the parameters
  3674. or spreading the stereo image of master track.
  3675. The filter accepts the following options:
  3676. @table @option
  3677. @item level_in
  3678. Set input level before filtering for both channels. Defaults is 1.
  3679. Allowed range is from 0.015625 to 64.
  3680. @item level_out
  3681. Set output level after filtering for both channels. Defaults is 1.
  3682. Allowed range is from 0.015625 to 64.
  3683. @item balance_in
  3684. Set input balance between both channels. Default is 0.
  3685. Allowed range is from -1 to 1.
  3686. @item balance_out
  3687. Set output balance between both channels. Default is 0.
  3688. Allowed range is from -1 to 1.
  3689. @item softclip
  3690. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3691. clipping. Disabled by default.
  3692. @item mutel
  3693. Mute the left channel. Disabled by default.
  3694. @item muter
  3695. Mute the right channel. Disabled by default.
  3696. @item phasel
  3697. Change the phase of the left channel. Disabled by default.
  3698. @item phaser
  3699. Change the phase of the right channel. Disabled by default.
  3700. @item mode
  3701. Set stereo mode. Available values are:
  3702. @table @samp
  3703. @item lr>lr
  3704. Left/Right to Left/Right, this is default.
  3705. @item lr>ms
  3706. Left/Right to Mid/Side.
  3707. @item ms>lr
  3708. Mid/Side to Left/Right.
  3709. @item lr>ll
  3710. Left/Right to Left/Left.
  3711. @item lr>rr
  3712. Left/Right to Right/Right.
  3713. @item lr>l+r
  3714. Left/Right to Left + Right.
  3715. @item lr>rl
  3716. Left/Right to Right/Left.
  3717. @item ms>ll
  3718. Mid/Side to Left/Left.
  3719. @item ms>rr
  3720. Mid/Side to Right/Right.
  3721. @end table
  3722. @item slev
  3723. Set level of side signal. Default is 1.
  3724. Allowed range is from 0.015625 to 64.
  3725. @item sbal
  3726. Set balance of side signal. Default is 0.
  3727. Allowed range is from -1 to 1.
  3728. @item mlev
  3729. Set level of the middle signal. Default is 1.
  3730. Allowed range is from 0.015625 to 64.
  3731. @item mpan
  3732. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3733. @item base
  3734. Set stereo base between mono and inversed channels. Default is 0.
  3735. Allowed range is from -1 to 1.
  3736. @item delay
  3737. Set delay in milliseconds how much to delay left from right channel and
  3738. vice versa. Default is 0. Allowed range is from -20 to 20.
  3739. @item sclevel
  3740. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3741. @item phase
  3742. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3743. @item bmode_in, bmode_out
  3744. Set balance mode for balance_in/balance_out option.
  3745. Can be one of the following:
  3746. @table @samp
  3747. @item balance
  3748. Classic balance mode. Attenuate one channel at time.
  3749. Gain is raised up to 1.
  3750. @item amplitude
  3751. Similar as classic mode above but gain is raised up to 2.
  3752. @item power
  3753. Equal power distribution, from -6dB to +6dB range.
  3754. @end table
  3755. @end table
  3756. @subsection Examples
  3757. @itemize
  3758. @item
  3759. Apply karaoke like effect:
  3760. @example
  3761. stereotools=mlev=0.015625
  3762. @end example
  3763. @item
  3764. Convert M/S signal to L/R:
  3765. @example
  3766. "stereotools=mode=ms>lr"
  3767. @end example
  3768. @end itemize
  3769. @section stereowiden
  3770. This filter enhance the stereo effect by suppressing signal common to both
  3771. channels and by delaying the signal of left into right and vice versa,
  3772. thereby widening the stereo effect.
  3773. The filter accepts the following options:
  3774. @table @option
  3775. @item delay
  3776. Time in milliseconds of the delay of left signal into right and vice versa.
  3777. Default is 20 milliseconds.
  3778. @item feedback
  3779. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3780. effect of left signal in right output and vice versa which gives widening
  3781. effect. Default is 0.3.
  3782. @item crossfeed
  3783. Cross feed of left into right with inverted phase. This helps in suppressing
  3784. the mono. If the value is 1 it will cancel all the signal common to both
  3785. channels. Default is 0.3.
  3786. @item drymix
  3787. Set level of input signal of original channel. Default is 0.8.
  3788. @end table
  3789. @section superequalizer
  3790. Apply 18 band equalizer.
  3791. The filter accepts the following options:
  3792. @table @option
  3793. @item 1b
  3794. Set 65Hz band gain.
  3795. @item 2b
  3796. Set 92Hz band gain.
  3797. @item 3b
  3798. Set 131Hz band gain.
  3799. @item 4b
  3800. Set 185Hz band gain.
  3801. @item 5b
  3802. Set 262Hz band gain.
  3803. @item 6b
  3804. Set 370Hz band gain.
  3805. @item 7b
  3806. Set 523Hz band gain.
  3807. @item 8b
  3808. Set 740Hz band gain.
  3809. @item 9b
  3810. Set 1047Hz band gain.
  3811. @item 10b
  3812. Set 1480Hz band gain.
  3813. @item 11b
  3814. Set 2093Hz band gain.
  3815. @item 12b
  3816. Set 2960Hz band gain.
  3817. @item 13b
  3818. Set 4186Hz band gain.
  3819. @item 14b
  3820. Set 5920Hz band gain.
  3821. @item 15b
  3822. Set 8372Hz band gain.
  3823. @item 16b
  3824. Set 11840Hz band gain.
  3825. @item 17b
  3826. Set 16744Hz band gain.
  3827. @item 18b
  3828. Set 20000Hz band gain.
  3829. @end table
  3830. @section surround
  3831. Apply audio surround upmix filter.
  3832. This filter allows to produce multichannel output from audio stream.
  3833. The filter accepts the following options:
  3834. @table @option
  3835. @item chl_out
  3836. Set output channel layout. By default, this is @var{5.1}.
  3837. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3838. for the required syntax.
  3839. @item chl_in
  3840. Set input channel layout. By default, this is @var{stereo}.
  3841. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3842. for the required syntax.
  3843. @item level_in
  3844. Set input volume level. By default, this is @var{1}.
  3845. @item level_out
  3846. Set output volume level. By default, this is @var{1}.
  3847. @item lfe
  3848. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3849. @item lfe_low
  3850. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3851. @item lfe_high
  3852. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3853. @item lfe_mode
  3854. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3855. In @var{add} mode, LFE channel is created from input audio and added to output.
  3856. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3857. also all non-LFE output channels are subtracted with output LFE channel.
  3858. @item angle
  3859. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3860. Default is @var{90}.
  3861. @item fc_in
  3862. Set front center input volume. By default, this is @var{1}.
  3863. @item fc_out
  3864. Set front center output volume. By default, this is @var{1}.
  3865. @item fl_in
  3866. Set front left input volume. By default, this is @var{1}.
  3867. @item fl_out
  3868. Set front left output volume. By default, this is @var{1}.
  3869. @item fr_in
  3870. Set front right input volume. By default, this is @var{1}.
  3871. @item fr_out
  3872. Set front right output volume. By default, this is @var{1}.
  3873. @item sl_in
  3874. Set side left input volume. By default, this is @var{1}.
  3875. @item sl_out
  3876. Set side left output volume. By default, this is @var{1}.
  3877. @item sr_in
  3878. Set side right input volume. By default, this is @var{1}.
  3879. @item sr_out
  3880. Set side right output volume. By default, this is @var{1}.
  3881. @item bl_in
  3882. Set back left input volume. By default, this is @var{1}.
  3883. @item bl_out
  3884. Set back left output volume. By default, this is @var{1}.
  3885. @item br_in
  3886. Set back right input volume. By default, this is @var{1}.
  3887. @item br_out
  3888. Set back right output volume. By default, this is @var{1}.
  3889. @item bc_in
  3890. Set back center input volume. By default, this is @var{1}.
  3891. @item bc_out
  3892. Set back center output volume. By default, this is @var{1}.
  3893. @item lfe_in
  3894. Set LFE input volume. By default, this is @var{1}.
  3895. @item lfe_out
  3896. Set LFE output volume. By default, this is @var{1}.
  3897. @item allx
  3898. Set spread usage of stereo image across X axis for all channels.
  3899. @item ally
  3900. Set spread usage of stereo image across Y axis for all channels.
  3901. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3902. Set spread usage of stereo image across X axis for each channel.
  3903. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3904. Set spread usage of stereo image across Y axis for each channel.
  3905. @item win_size
  3906. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3907. @item win_func
  3908. Set window function.
  3909. It accepts the following values:
  3910. @table @samp
  3911. @item rect
  3912. @item bartlett
  3913. @item hann, hanning
  3914. @item hamming
  3915. @item blackman
  3916. @item welch
  3917. @item flattop
  3918. @item bharris
  3919. @item bnuttall
  3920. @item bhann
  3921. @item sine
  3922. @item nuttall
  3923. @item lanczos
  3924. @item gauss
  3925. @item tukey
  3926. @item dolph
  3927. @item cauchy
  3928. @item parzen
  3929. @item poisson
  3930. @item bohman
  3931. @end table
  3932. Default is @code{hann}.
  3933. @item overlap
  3934. Set window overlap. If set to 1, the recommended overlap for selected
  3935. window function will be picked. Default is @code{0.5}.
  3936. @end table
  3937. @section treble, highshelf
  3938. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3939. shelving filter with a response similar to that of a standard
  3940. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3941. The filter accepts the following options:
  3942. @table @option
  3943. @item gain, g
  3944. Give the gain at whichever is the lower of ~22 kHz and the
  3945. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3946. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3947. @item frequency, f
  3948. Set the filter's central frequency and so can be used
  3949. to extend or reduce the frequency range to be boosted or cut.
  3950. The default value is @code{3000} Hz.
  3951. @item width_type, t
  3952. Set method to specify band-width of filter.
  3953. @table @option
  3954. @item h
  3955. Hz
  3956. @item q
  3957. Q-Factor
  3958. @item o
  3959. octave
  3960. @item s
  3961. slope
  3962. @item k
  3963. kHz
  3964. @end table
  3965. @item width, w
  3966. Determine how steep is the filter's shelf transition.
  3967. @item channels, c
  3968. Specify which channels to filter, by default all available are filtered.
  3969. @end table
  3970. @subsection Commands
  3971. This filter supports the following commands:
  3972. @table @option
  3973. @item frequency, f
  3974. Change treble frequency.
  3975. Syntax for the command is : "@var{frequency}"
  3976. @item width_type, t
  3977. Change treble width_type.
  3978. Syntax for the command is : "@var{width_type}"
  3979. @item width, w
  3980. Change treble width.
  3981. Syntax for the command is : "@var{width}"
  3982. @item gain, g
  3983. Change treble gain.
  3984. Syntax for the command is : "@var{gain}"
  3985. @end table
  3986. @section tremolo
  3987. Sinusoidal amplitude modulation.
  3988. The filter accepts the following options:
  3989. @table @option
  3990. @item f
  3991. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3992. (20 Hz or lower) will result in a tremolo effect.
  3993. This filter may also be used as a ring modulator by specifying
  3994. a modulation frequency higher than 20 Hz.
  3995. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3996. @item d
  3997. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3998. Default value is 0.5.
  3999. @end table
  4000. @section vibrato
  4001. Sinusoidal phase modulation.
  4002. The filter accepts the following options:
  4003. @table @option
  4004. @item f
  4005. Modulation frequency in Hertz.
  4006. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4007. @item d
  4008. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4009. Default value is 0.5.
  4010. @end table
  4011. @section volume
  4012. Adjust the input audio volume.
  4013. It accepts the following parameters:
  4014. @table @option
  4015. @item volume
  4016. Set audio volume expression.
  4017. Output values are clipped to the maximum value.
  4018. The output audio volume is given by the relation:
  4019. @example
  4020. @var{output_volume} = @var{volume} * @var{input_volume}
  4021. @end example
  4022. The default value for @var{volume} is "1.0".
  4023. @item precision
  4024. This parameter represents the mathematical precision.
  4025. It determines which input sample formats will be allowed, which affects the
  4026. precision of the volume scaling.
  4027. @table @option
  4028. @item fixed
  4029. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4030. @item float
  4031. 32-bit floating-point; this limits input sample format to FLT. (default)
  4032. @item double
  4033. 64-bit floating-point; this limits input sample format to DBL.
  4034. @end table
  4035. @item replaygain
  4036. Choose the behaviour on encountering ReplayGain side data in input frames.
  4037. @table @option
  4038. @item drop
  4039. Remove ReplayGain side data, ignoring its contents (the default).
  4040. @item ignore
  4041. Ignore ReplayGain side data, but leave it in the frame.
  4042. @item track
  4043. Prefer the track gain, if present.
  4044. @item album
  4045. Prefer the album gain, if present.
  4046. @end table
  4047. @item replaygain_preamp
  4048. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4049. Default value for @var{replaygain_preamp} is 0.0.
  4050. @item eval
  4051. Set when the volume expression is evaluated.
  4052. It accepts the following values:
  4053. @table @samp
  4054. @item once
  4055. only evaluate expression once during the filter initialization, or
  4056. when the @samp{volume} command is sent
  4057. @item frame
  4058. evaluate expression for each incoming frame
  4059. @end table
  4060. Default value is @samp{once}.
  4061. @end table
  4062. The volume expression can contain the following parameters.
  4063. @table @option
  4064. @item n
  4065. frame number (starting at zero)
  4066. @item nb_channels
  4067. number of channels
  4068. @item nb_consumed_samples
  4069. number of samples consumed by the filter
  4070. @item nb_samples
  4071. number of samples in the current frame
  4072. @item pos
  4073. original frame position in the file
  4074. @item pts
  4075. frame PTS
  4076. @item sample_rate
  4077. sample rate
  4078. @item startpts
  4079. PTS at start of stream
  4080. @item startt
  4081. time at start of stream
  4082. @item t
  4083. frame time
  4084. @item tb
  4085. timestamp timebase
  4086. @item volume
  4087. last set volume value
  4088. @end table
  4089. Note that when @option{eval} is set to @samp{once} only the
  4090. @var{sample_rate} and @var{tb} variables are available, all other
  4091. variables will evaluate to NAN.
  4092. @subsection Commands
  4093. This filter supports the following commands:
  4094. @table @option
  4095. @item volume
  4096. Modify the volume expression.
  4097. The command accepts the same syntax of the corresponding option.
  4098. If the specified expression is not valid, it is kept at its current
  4099. value.
  4100. @item replaygain_noclip
  4101. Prevent clipping by limiting the gain applied.
  4102. Default value for @var{replaygain_noclip} is 1.
  4103. @end table
  4104. @subsection Examples
  4105. @itemize
  4106. @item
  4107. Halve the input audio volume:
  4108. @example
  4109. volume=volume=0.5
  4110. volume=volume=1/2
  4111. volume=volume=-6.0206dB
  4112. @end example
  4113. In all the above example the named key for @option{volume} can be
  4114. omitted, for example like in:
  4115. @example
  4116. volume=0.5
  4117. @end example
  4118. @item
  4119. Increase input audio power by 6 decibels using fixed-point precision:
  4120. @example
  4121. volume=volume=6dB:precision=fixed
  4122. @end example
  4123. @item
  4124. Fade volume after time 10 with an annihilation period of 5 seconds:
  4125. @example
  4126. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4127. @end example
  4128. @end itemize
  4129. @section volumedetect
  4130. Detect the volume of the input video.
  4131. The filter has no parameters. The input is not modified. Statistics about
  4132. the volume will be printed in the log when the input stream end is reached.
  4133. In particular it will show the mean volume (root mean square), maximum
  4134. volume (on a per-sample basis), and the beginning of a histogram of the
  4135. registered volume values (from the maximum value to a cumulated 1/1000 of
  4136. the samples).
  4137. All volumes are in decibels relative to the maximum PCM value.
  4138. @subsection Examples
  4139. Here is an excerpt of the output:
  4140. @example
  4141. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4142. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4143. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4144. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4145. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4146. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4147. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4148. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4149. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4150. @end example
  4151. It means that:
  4152. @itemize
  4153. @item
  4154. The mean square energy is approximately -27 dB, or 10^-2.7.
  4155. @item
  4156. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4157. @item
  4158. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4159. @end itemize
  4160. In other words, raising the volume by +4 dB does not cause any clipping,
  4161. raising it by +5 dB causes clipping for 6 samples, etc.
  4162. @c man end AUDIO FILTERS
  4163. @chapter Audio Sources
  4164. @c man begin AUDIO SOURCES
  4165. Below is a description of the currently available audio sources.
  4166. @section abuffer
  4167. Buffer audio frames, and make them available to the filter chain.
  4168. This source is mainly intended for a programmatic use, in particular
  4169. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4170. It accepts the following parameters:
  4171. @table @option
  4172. @item time_base
  4173. The timebase which will be used for timestamps of submitted frames. It must be
  4174. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4175. @item sample_rate
  4176. The sample rate of the incoming audio buffers.
  4177. @item sample_fmt
  4178. The sample format of the incoming audio buffers.
  4179. Either a sample format name or its corresponding integer representation from
  4180. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4181. @item channel_layout
  4182. The channel layout of the incoming audio buffers.
  4183. Either a channel layout name from channel_layout_map in
  4184. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4185. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4186. @item channels
  4187. The number of channels of the incoming audio buffers.
  4188. If both @var{channels} and @var{channel_layout} are specified, then they
  4189. must be consistent.
  4190. @end table
  4191. @subsection Examples
  4192. @example
  4193. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4194. @end example
  4195. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4196. Since the sample format with name "s16p" corresponds to the number
  4197. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4198. equivalent to:
  4199. @example
  4200. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4201. @end example
  4202. @section aevalsrc
  4203. Generate an audio signal specified by an expression.
  4204. This source accepts in input one or more expressions (one for each
  4205. channel), which are evaluated and used to generate a corresponding
  4206. audio signal.
  4207. This source accepts the following options:
  4208. @table @option
  4209. @item exprs
  4210. Set the '|'-separated expressions list for each separate channel. In case the
  4211. @option{channel_layout} option is not specified, the selected channel layout
  4212. depends on the number of provided expressions. Otherwise the last
  4213. specified expression is applied to the remaining output channels.
  4214. @item channel_layout, c
  4215. Set the channel layout. The number of channels in the specified layout
  4216. must be equal to the number of specified expressions.
  4217. @item duration, d
  4218. Set the minimum duration of the sourced audio. See
  4219. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4220. for the accepted syntax.
  4221. Note that the resulting duration may be greater than the specified
  4222. duration, as the generated audio is always cut at the end of a
  4223. complete frame.
  4224. If not specified, or the expressed duration is negative, the audio is
  4225. supposed to be generated forever.
  4226. @item nb_samples, n
  4227. Set the number of samples per channel per each output frame,
  4228. default to 1024.
  4229. @item sample_rate, s
  4230. Specify the sample rate, default to 44100.
  4231. @end table
  4232. Each expression in @var{exprs} can contain the following constants:
  4233. @table @option
  4234. @item n
  4235. number of the evaluated sample, starting from 0
  4236. @item t
  4237. time of the evaluated sample expressed in seconds, starting from 0
  4238. @item s
  4239. sample rate
  4240. @end table
  4241. @subsection Examples
  4242. @itemize
  4243. @item
  4244. Generate silence:
  4245. @example
  4246. aevalsrc=0
  4247. @end example
  4248. @item
  4249. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4250. 8000 Hz:
  4251. @example
  4252. aevalsrc="sin(440*2*PI*t):s=8000"
  4253. @end example
  4254. @item
  4255. Generate a two channels signal, specify the channel layout (Front
  4256. Center + Back Center) explicitly:
  4257. @example
  4258. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4259. @end example
  4260. @item
  4261. Generate white noise:
  4262. @example
  4263. aevalsrc="-2+random(0)"
  4264. @end example
  4265. @item
  4266. Generate an amplitude modulated signal:
  4267. @example
  4268. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4269. @end example
  4270. @item
  4271. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4272. @example
  4273. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4274. @end example
  4275. @end itemize
  4276. @section anullsrc
  4277. The null audio source, return unprocessed audio frames. It is mainly useful
  4278. as a template and to be employed in analysis / debugging tools, or as
  4279. the source for filters which ignore the input data (for example the sox
  4280. synth filter).
  4281. This source accepts the following options:
  4282. @table @option
  4283. @item channel_layout, cl
  4284. Specifies the channel layout, and can be either an integer or a string
  4285. representing a channel layout. The default value of @var{channel_layout}
  4286. is "stereo".
  4287. Check the channel_layout_map definition in
  4288. @file{libavutil/channel_layout.c} for the mapping between strings and
  4289. channel layout values.
  4290. @item sample_rate, r
  4291. Specifies the sample rate, and defaults to 44100.
  4292. @item nb_samples, n
  4293. Set the number of samples per requested frames.
  4294. @end table
  4295. @subsection Examples
  4296. @itemize
  4297. @item
  4298. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4299. @example
  4300. anullsrc=r=48000:cl=4
  4301. @end example
  4302. @item
  4303. Do the same operation with a more obvious syntax:
  4304. @example
  4305. anullsrc=r=48000:cl=mono
  4306. @end example
  4307. @end itemize
  4308. All the parameters need to be explicitly defined.
  4309. @section flite
  4310. Synthesize a voice utterance using the libflite library.
  4311. To enable compilation of this filter you need to configure FFmpeg with
  4312. @code{--enable-libflite}.
  4313. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4314. The filter accepts the following options:
  4315. @table @option
  4316. @item list_voices
  4317. If set to 1, list the names of the available voices and exit
  4318. immediately. Default value is 0.
  4319. @item nb_samples, n
  4320. Set the maximum number of samples per frame. Default value is 512.
  4321. @item textfile
  4322. Set the filename containing the text to speak.
  4323. @item text
  4324. Set the text to speak.
  4325. @item voice, v
  4326. Set the voice to use for the speech synthesis. Default value is
  4327. @code{kal}. See also the @var{list_voices} option.
  4328. @end table
  4329. @subsection Examples
  4330. @itemize
  4331. @item
  4332. Read from file @file{speech.txt}, and synthesize the text using the
  4333. standard flite voice:
  4334. @example
  4335. flite=textfile=speech.txt
  4336. @end example
  4337. @item
  4338. Read the specified text selecting the @code{slt} voice:
  4339. @example
  4340. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4341. @end example
  4342. @item
  4343. Input text to ffmpeg:
  4344. @example
  4345. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4346. @end example
  4347. @item
  4348. Make @file{ffplay} speak the specified text, using @code{flite} and
  4349. the @code{lavfi} device:
  4350. @example
  4351. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4352. @end example
  4353. @end itemize
  4354. For more information about libflite, check:
  4355. @url{http://www.festvox.org/flite/}
  4356. @section anoisesrc
  4357. Generate a noise audio signal.
  4358. The filter accepts the following options:
  4359. @table @option
  4360. @item sample_rate, r
  4361. Specify the sample rate. Default value is 48000 Hz.
  4362. @item amplitude, a
  4363. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4364. is 1.0.
  4365. @item duration, d
  4366. Specify the duration of the generated audio stream. Not specifying this option
  4367. results in noise with an infinite length.
  4368. @item color, colour, c
  4369. Specify the color of noise. Available noise colors are white, pink, brown,
  4370. blue and violet. Default color is white.
  4371. @item seed, s
  4372. Specify a value used to seed the PRNG.
  4373. @item nb_samples, n
  4374. Set the number of samples per each output frame, default is 1024.
  4375. @end table
  4376. @subsection Examples
  4377. @itemize
  4378. @item
  4379. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4380. @example
  4381. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4382. @end example
  4383. @end itemize
  4384. @section hilbert
  4385. Generate odd-tap Hilbert transform FIR coefficients.
  4386. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4387. the signal by 90 degrees.
  4388. This is used in many matrix coding schemes and for analytic signal generation.
  4389. The process is often written as a multiplication by i (or j), the imaginary unit.
  4390. The filter accepts the following options:
  4391. @table @option
  4392. @item sample_rate, s
  4393. Set sample rate, default is 44100.
  4394. @item taps, t
  4395. Set length of FIR filter, default is 22051.
  4396. @item nb_samples, n
  4397. Set number of samples per each frame.
  4398. @item win_func, w
  4399. Set window function to be used when generating FIR coefficients.
  4400. @end table
  4401. @section sinc
  4402. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4403. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4404. The filter accepts the following options:
  4405. @table @option
  4406. @item sample_rate, r
  4407. Set sample rate, default is 44100.
  4408. @item nb_samples, n
  4409. Set number of samples per each frame. Default is 1024.
  4410. @item hp
  4411. Set high-pass frequency. Default is 0.
  4412. @item lp
  4413. Set low-pass frequency. Default is 0.
  4414. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4415. is higher than 0 then filter will create band-pass filter coefficients,
  4416. otherwise band-reject filter coefficients.
  4417. @item phase
  4418. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4419. @item beta
  4420. Set Kaiser window beta.
  4421. @item att
  4422. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4423. @item round
  4424. Enable rounding, by default is disabled.
  4425. @item hptaps
  4426. Set number of taps for high-pass filter.
  4427. @item lptaps
  4428. Set number of taps for low-pass filter.
  4429. @end table
  4430. @section sine
  4431. Generate an audio signal made of a sine wave with amplitude 1/8.
  4432. The audio signal is bit-exact.
  4433. The filter accepts the following options:
  4434. @table @option
  4435. @item frequency, f
  4436. Set the carrier frequency. Default is 440 Hz.
  4437. @item beep_factor, b
  4438. Enable a periodic beep every second with frequency @var{beep_factor} times
  4439. the carrier frequency. Default is 0, meaning the beep is disabled.
  4440. @item sample_rate, r
  4441. Specify the sample rate, default is 44100.
  4442. @item duration, d
  4443. Specify the duration of the generated audio stream.
  4444. @item samples_per_frame
  4445. Set the number of samples per output frame.
  4446. The expression can contain the following constants:
  4447. @table @option
  4448. @item n
  4449. The (sequential) number of the output audio frame, starting from 0.
  4450. @item pts
  4451. The PTS (Presentation TimeStamp) of the output audio frame,
  4452. expressed in @var{TB} units.
  4453. @item t
  4454. The PTS of the output audio frame, expressed in seconds.
  4455. @item TB
  4456. The timebase of the output audio frames.
  4457. @end table
  4458. Default is @code{1024}.
  4459. @end table
  4460. @subsection Examples
  4461. @itemize
  4462. @item
  4463. Generate a simple 440 Hz sine wave:
  4464. @example
  4465. sine
  4466. @end example
  4467. @item
  4468. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4469. @example
  4470. sine=220:4:d=5
  4471. sine=f=220:b=4:d=5
  4472. sine=frequency=220:beep_factor=4:duration=5
  4473. @end example
  4474. @item
  4475. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4476. pattern:
  4477. @example
  4478. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4479. @end example
  4480. @end itemize
  4481. @c man end AUDIO SOURCES
  4482. @chapter Audio Sinks
  4483. @c man begin AUDIO SINKS
  4484. Below is a description of the currently available audio sinks.
  4485. @section abuffersink
  4486. Buffer audio frames, and make them available to the end of filter chain.
  4487. This sink is mainly intended for programmatic use, in particular
  4488. through the interface defined in @file{libavfilter/buffersink.h}
  4489. or the options system.
  4490. It accepts a pointer to an AVABufferSinkContext structure, which
  4491. defines the incoming buffers' formats, to be passed as the opaque
  4492. parameter to @code{avfilter_init_filter} for initialization.
  4493. @section anullsink
  4494. Null audio sink; do absolutely nothing with the input audio. It is
  4495. mainly useful as a template and for use in analysis / debugging
  4496. tools.
  4497. @c man end AUDIO SINKS
  4498. @chapter Video Filters
  4499. @c man begin VIDEO FILTERS
  4500. When you configure your FFmpeg build, you can disable any of the
  4501. existing filters using @code{--disable-filters}.
  4502. The configure output will show the video filters included in your
  4503. build.
  4504. Below is a description of the currently available video filters.
  4505. @section alphaextract
  4506. Extract the alpha component from the input as a grayscale video. This
  4507. is especially useful with the @var{alphamerge} filter.
  4508. @section alphamerge
  4509. Add or replace the alpha component of the primary input with the
  4510. grayscale value of a second input. This is intended for use with
  4511. @var{alphaextract} to allow the transmission or storage of frame
  4512. sequences that have alpha in a format that doesn't support an alpha
  4513. channel.
  4514. For example, to reconstruct full frames from a normal YUV-encoded video
  4515. and a separate video created with @var{alphaextract}, you might use:
  4516. @example
  4517. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4518. @end example
  4519. Since this filter is designed for reconstruction, it operates on frame
  4520. sequences without considering timestamps, and terminates when either
  4521. input reaches end of stream. This will cause problems if your encoding
  4522. pipeline drops frames. If you're trying to apply an image as an
  4523. overlay to a video stream, consider the @var{overlay} filter instead.
  4524. @section amplify
  4525. Amplify differences between current pixel and pixels of adjacent frames in
  4526. same pixel location.
  4527. This filter accepts the following options:
  4528. @table @option
  4529. @item radius
  4530. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4531. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4532. @item factor
  4533. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4534. @item threshold
  4535. Set threshold for difference amplification. Any difference greater or equal to
  4536. this value will not alter source pixel. Default is 10.
  4537. Allowed range is from 0 to 65535.
  4538. @item tolerance
  4539. Set tolerance for difference amplification. Any difference lower to
  4540. this value will not alter source pixel. Default is 0.
  4541. Allowed range is from 0 to 65535.
  4542. @item low
  4543. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4544. This option controls maximum possible value that will decrease source pixel value.
  4545. @item high
  4546. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4547. This option controls maximum possible value that will increase source pixel value.
  4548. @item planes
  4549. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4550. @end table
  4551. @section ass
  4552. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4553. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4554. Substation Alpha) subtitles files.
  4555. This filter accepts the following option in addition to the common options from
  4556. the @ref{subtitles} filter:
  4557. @table @option
  4558. @item shaping
  4559. Set the shaping engine
  4560. Available values are:
  4561. @table @samp
  4562. @item auto
  4563. The default libass shaping engine, which is the best available.
  4564. @item simple
  4565. Fast, font-agnostic shaper that can do only substitutions
  4566. @item complex
  4567. Slower shaper using OpenType for substitutions and positioning
  4568. @end table
  4569. The default is @code{auto}.
  4570. @end table
  4571. @section atadenoise
  4572. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4573. The filter accepts the following options:
  4574. @table @option
  4575. @item 0a
  4576. Set threshold A for 1st plane. Default is 0.02.
  4577. Valid range is 0 to 0.3.
  4578. @item 0b
  4579. Set threshold B for 1st plane. Default is 0.04.
  4580. Valid range is 0 to 5.
  4581. @item 1a
  4582. Set threshold A for 2nd plane. Default is 0.02.
  4583. Valid range is 0 to 0.3.
  4584. @item 1b
  4585. Set threshold B for 2nd plane. Default is 0.04.
  4586. Valid range is 0 to 5.
  4587. @item 2a
  4588. Set threshold A for 3rd plane. Default is 0.02.
  4589. Valid range is 0 to 0.3.
  4590. @item 2b
  4591. Set threshold B for 3rd plane. Default is 0.04.
  4592. Valid range is 0 to 5.
  4593. Threshold A is designed to react on abrupt changes in the input signal and
  4594. threshold B is designed to react on continuous changes in the input signal.
  4595. @item s
  4596. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4597. number in range [5, 129].
  4598. @item p
  4599. Set what planes of frame filter will use for averaging. Default is all.
  4600. @end table
  4601. @section avgblur
  4602. Apply average blur filter.
  4603. The filter accepts the following options:
  4604. @table @option
  4605. @item sizeX
  4606. Set horizontal radius size.
  4607. @item planes
  4608. Set which planes to filter. By default all planes are filtered.
  4609. @item sizeY
  4610. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4611. Default is @code{0}.
  4612. @end table
  4613. @section bbox
  4614. Compute the bounding box for the non-black pixels in the input frame
  4615. luminance plane.
  4616. This filter computes the bounding box containing all the pixels with a
  4617. luminance value greater than the minimum allowed value.
  4618. The parameters describing the bounding box are printed on the filter
  4619. log.
  4620. The filter accepts the following option:
  4621. @table @option
  4622. @item min_val
  4623. Set the minimal luminance value. Default is @code{16}.
  4624. @end table
  4625. @section bitplanenoise
  4626. Show and measure bit plane noise.
  4627. The filter accepts the following options:
  4628. @table @option
  4629. @item bitplane
  4630. Set which plane to analyze. Default is @code{1}.
  4631. @item filter
  4632. Filter out noisy pixels from @code{bitplane} set above.
  4633. Default is disabled.
  4634. @end table
  4635. @section blackdetect
  4636. Detect video intervals that are (almost) completely black. Can be
  4637. useful to detect chapter transitions, commercials, or invalid
  4638. recordings. Output lines contains the time for the start, end and
  4639. duration of the detected black interval expressed in seconds.
  4640. In order to display the output lines, you need to set the loglevel at
  4641. least to the AV_LOG_INFO value.
  4642. The filter accepts the following options:
  4643. @table @option
  4644. @item black_min_duration, d
  4645. Set the minimum detected black duration expressed in seconds. It must
  4646. be a non-negative floating point number.
  4647. Default value is 2.0.
  4648. @item picture_black_ratio_th, pic_th
  4649. Set the threshold for considering a picture "black".
  4650. Express the minimum value for the ratio:
  4651. @example
  4652. @var{nb_black_pixels} / @var{nb_pixels}
  4653. @end example
  4654. for which a picture is considered black.
  4655. Default value is 0.98.
  4656. @item pixel_black_th, pix_th
  4657. Set the threshold for considering a pixel "black".
  4658. The threshold expresses the maximum pixel luminance value for which a
  4659. pixel is considered "black". The provided value is scaled according to
  4660. the following equation:
  4661. @example
  4662. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4663. @end example
  4664. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4665. the input video format, the range is [0-255] for YUV full-range
  4666. formats and [16-235] for YUV non full-range formats.
  4667. Default value is 0.10.
  4668. @end table
  4669. The following example sets the maximum pixel threshold to the minimum
  4670. value, and detects only black intervals of 2 or more seconds:
  4671. @example
  4672. blackdetect=d=2:pix_th=0.00
  4673. @end example
  4674. @section blackframe
  4675. Detect frames that are (almost) completely black. Can be useful to
  4676. detect chapter transitions or commercials. Output lines consist of
  4677. the frame number of the detected frame, the percentage of blackness,
  4678. the position in the file if known or -1 and the timestamp in seconds.
  4679. In order to display the output lines, you need to set the loglevel at
  4680. least to the AV_LOG_INFO value.
  4681. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4682. The value represents the percentage of pixels in the picture that
  4683. are below the threshold value.
  4684. It accepts the following parameters:
  4685. @table @option
  4686. @item amount
  4687. The percentage of the pixels that have to be below the threshold; it defaults to
  4688. @code{98}.
  4689. @item threshold, thresh
  4690. The threshold below which a pixel value is considered black; it defaults to
  4691. @code{32}.
  4692. @end table
  4693. @section blend, tblend
  4694. Blend two video frames into each other.
  4695. The @code{blend} filter takes two input streams and outputs one
  4696. stream, the first input is the "top" layer and second input is
  4697. "bottom" layer. By default, the output terminates when the longest input terminates.
  4698. The @code{tblend} (time blend) filter takes two consecutive frames
  4699. from one single stream, and outputs the result obtained by blending
  4700. the new frame on top of the old frame.
  4701. A description of the accepted options follows.
  4702. @table @option
  4703. @item c0_mode
  4704. @item c1_mode
  4705. @item c2_mode
  4706. @item c3_mode
  4707. @item all_mode
  4708. Set blend mode for specific pixel component or all pixel components in case
  4709. of @var{all_mode}. Default value is @code{normal}.
  4710. Available values for component modes are:
  4711. @table @samp
  4712. @item addition
  4713. @item grainmerge
  4714. @item and
  4715. @item average
  4716. @item burn
  4717. @item darken
  4718. @item difference
  4719. @item grainextract
  4720. @item divide
  4721. @item dodge
  4722. @item freeze
  4723. @item exclusion
  4724. @item extremity
  4725. @item glow
  4726. @item hardlight
  4727. @item hardmix
  4728. @item heat
  4729. @item lighten
  4730. @item linearlight
  4731. @item multiply
  4732. @item multiply128
  4733. @item negation
  4734. @item normal
  4735. @item or
  4736. @item overlay
  4737. @item phoenix
  4738. @item pinlight
  4739. @item reflect
  4740. @item screen
  4741. @item softlight
  4742. @item subtract
  4743. @item vividlight
  4744. @item xor
  4745. @end table
  4746. @item c0_opacity
  4747. @item c1_opacity
  4748. @item c2_opacity
  4749. @item c3_opacity
  4750. @item all_opacity
  4751. Set blend opacity for specific pixel component or all pixel components in case
  4752. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4753. @item c0_expr
  4754. @item c1_expr
  4755. @item c2_expr
  4756. @item c3_expr
  4757. @item all_expr
  4758. Set blend expression for specific pixel component or all pixel components in case
  4759. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4760. The expressions can use the following variables:
  4761. @table @option
  4762. @item N
  4763. The sequential number of the filtered frame, starting from @code{0}.
  4764. @item X
  4765. @item Y
  4766. the coordinates of the current sample
  4767. @item W
  4768. @item H
  4769. the width and height of currently filtered plane
  4770. @item SW
  4771. @item SH
  4772. Width and height scale for the plane being filtered. It is the
  4773. ratio between the dimensions of the current plane to the luma plane,
  4774. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4775. the luma plane and @code{0.5,0.5} for the chroma planes.
  4776. @item T
  4777. Time of the current frame, expressed in seconds.
  4778. @item TOP, A
  4779. Value of pixel component at current location for first video frame (top layer).
  4780. @item BOTTOM, B
  4781. Value of pixel component at current location for second video frame (bottom layer).
  4782. @end table
  4783. @end table
  4784. The @code{blend} filter also supports the @ref{framesync} options.
  4785. @subsection Examples
  4786. @itemize
  4787. @item
  4788. Apply transition from bottom layer to top layer in first 10 seconds:
  4789. @example
  4790. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4791. @end example
  4792. @item
  4793. Apply linear horizontal transition from top layer to bottom layer:
  4794. @example
  4795. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4796. @end example
  4797. @item
  4798. Apply 1x1 checkerboard effect:
  4799. @example
  4800. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4801. @end example
  4802. @item
  4803. Apply uncover left effect:
  4804. @example
  4805. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4806. @end example
  4807. @item
  4808. Apply uncover down effect:
  4809. @example
  4810. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4811. @end example
  4812. @item
  4813. Apply uncover up-left effect:
  4814. @example
  4815. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4816. @end example
  4817. @item
  4818. Split diagonally video and shows top and bottom layer on each side:
  4819. @example
  4820. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4821. @end example
  4822. @item
  4823. Display differences between the current and the previous frame:
  4824. @example
  4825. tblend=all_mode=grainextract
  4826. @end example
  4827. @end itemize
  4828. @section bm3d
  4829. Denoise frames using Block-Matching 3D algorithm.
  4830. The filter accepts the following options.
  4831. @table @option
  4832. @item sigma
  4833. Set denoising strength. Default value is 1.
  4834. Allowed range is from 0 to 999.9.
  4835. The denoising algorithm is very sensitive to sigma, so adjust it
  4836. according to the source.
  4837. @item block
  4838. Set local patch size. This sets dimensions in 2D.
  4839. @item bstep
  4840. Set sliding step for processing blocks. Default value is 4.
  4841. Allowed range is from 1 to 64.
  4842. Smaller values allows processing more reference blocks and is slower.
  4843. @item group
  4844. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4845. When set to 1, no block matching is done. Larger values allows more blocks
  4846. in single group.
  4847. Allowed range is from 1 to 256.
  4848. @item range
  4849. Set radius for search block matching. Default is 9.
  4850. Allowed range is from 1 to INT32_MAX.
  4851. @item mstep
  4852. Set step between two search locations for block matching. Default is 1.
  4853. Allowed range is from 1 to 64. Smaller is slower.
  4854. @item thmse
  4855. Set threshold of mean square error for block matching. Valid range is 0 to
  4856. INT32_MAX.
  4857. @item hdthr
  4858. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4859. Larger values results in stronger hard-thresholding filtering in frequency
  4860. domain.
  4861. @item estim
  4862. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4863. Default is @code{basic}.
  4864. @item ref
  4865. If enabled, filter will use 2nd stream for block matching.
  4866. Default is disabled for @code{basic} value of @var{estim} option,
  4867. and always enabled if value of @var{estim} is @code{final}.
  4868. @item planes
  4869. Set planes to filter. Default is all available except alpha.
  4870. @end table
  4871. @subsection Examples
  4872. @itemize
  4873. @item
  4874. Basic filtering with bm3d:
  4875. @example
  4876. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4877. @end example
  4878. @item
  4879. Same as above, but filtering only luma:
  4880. @example
  4881. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4882. @end example
  4883. @item
  4884. Same as above, but with both estimation modes:
  4885. @example
  4886. 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
  4887. @end example
  4888. @item
  4889. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4890. @example
  4891. 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
  4892. @end example
  4893. @end itemize
  4894. @section boxblur
  4895. Apply a boxblur algorithm to the input video.
  4896. It accepts the following parameters:
  4897. @table @option
  4898. @item luma_radius, lr
  4899. @item luma_power, lp
  4900. @item chroma_radius, cr
  4901. @item chroma_power, cp
  4902. @item alpha_radius, ar
  4903. @item alpha_power, ap
  4904. @end table
  4905. A description of the accepted options follows.
  4906. @table @option
  4907. @item luma_radius, lr
  4908. @item chroma_radius, cr
  4909. @item alpha_radius, ar
  4910. Set an expression for the box radius in pixels used for blurring the
  4911. corresponding input plane.
  4912. The radius value must be a non-negative number, and must not be
  4913. greater than the value of the expression @code{min(w,h)/2} for the
  4914. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4915. planes.
  4916. Default value for @option{luma_radius} is "2". If not specified,
  4917. @option{chroma_radius} and @option{alpha_radius} default to the
  4918. corresponding value set for @option{luma_radius}.
  4919. The expressions can contain the following constants:
  4920. @table @option
  4921. @item w
  4922. @item h
  4923. The input width and height in pixels.
  4924. @item cw
  4925. @item ch
  4926. The input chroma image width and height in pixels.
  4927. @item hsub
  4928. @item vsub
  4929. The horizontal and vertical chroma subsample values. For example, for the
  4930. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4931. @end table
  4932. @item luma_power, lp
  4933. @item chroma_power, cp
  4934. @item alpha_power, ap
  4935. Specify how many times the boxblur filter is applied to the
  4936. corresponding plane.
  4937. Default value for @option{luma_power} is 2. If not specified,
  4938. @option{chroma_power} and @option{alpha_power} default to the
  4939. corresponding value set for @option{luma_power}.
  4940. A value of 0 will disable the effect.
  4941. @end table
  4942. @subsection Examples
  4943. @itemize
  4944. @item
  4945. Apply a boxblur filter with the luma, chroma, and alpha radii
  4946. set to 2:
  4947. @example
  4948. boxblur=luma_radius=2:luma_power=1
  4949. boxblur=2:1
  4950. @end example
  4951. @item
  4952. Set the luma radius to 2, and alpha and chroma radius to 0:
  4953. @example
  4954. boxblur=2:1:cr=0:ar=0
  4955. @end example
  4956. @item
  4957. Set the luma and chroma radii to a fraction of the video dimension:
  4958. @example
  4959. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4960. @end example
  4961. @end itemize
  4962. @section bwdif
  4963. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4964. Deinterlacing Filter").
  4965. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4966. interpolation algorithms.
  4967. It accepts the following parameters:
  4968. @table @option
  4969. @item mode
  4970. The interlacing mode to adopt. It accepts one of the following values:
  4971. @table @option
  4972. @item 0, send_frame
  4973. Output one frame for each frame.
  4974. @item 1, send_field
  4975. Output one frame for each field.
  4976. @end table
  4977. The default value is @code{send_field}.
  4978. @item parity
  4979. The picture field parity assumed for the input interlaced video. It accepts one
  4980. of the following values:
  4981. @table @option
  4982. @item 0, tff
  4983. Assume the top field is first.
  4984. @item 1, bff
  4985. Assume the bottom field is first.
  4986. @item -1, auto
  4987. Enable automatic detection of field parity.
  4988. @end table
  4989. The default value is @code{auto}.
  4990. If the interlacing is unknown or the decoder does not export this information,
  4991. top field first will be assumed.
  4992. @item deint
  4993. Specify which frames to deinterlace. Accept one of the following
  4994. values:
  4995. @table @option
  4996. @item 0, all
  4997. Deinterlace all frames.
  4998. @item 1, interlaced
  4999. Only deinterlace frames marked as interlaced.
  5000. @end table
  5001. The default value is @code{all}.
  5002. @end table
  5003. @section chromahold
  5004. Remove all color information for all colors except for certain one.
  5005. The filter accepts the following options:
  5006. @table @option
  5007. @item color
  5008. The color which will not be replaced with neutral chroma.
  5009. @item similarity
  5010. Similarity percentage with the above color.
  5011. 0.01 matches only the exact key color, while 1.0 matches everything.
  5012. @item blend
  5013. Blend percentage.
  5014. 0.0 makes pixels either fully gray, or not gray at all.
  5015. Higher values result in more preserved color.
  5016. @item yuv
  5017. Signals that the color passed is already in YUV instead of RGB.
  5018. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5019. This can be used to pass exact YUV values as hexadecimal numbers.
  5020. @end table
  5021. @section chromakey
  5022. YUV colorspace color/chroma keying.
  5023. The filter accepts the following options:
  5024. @table @option
  5025. @item color
  5026. The color which will be replaced with transparency.
  5027. @item similarity
  5028. Similarity percentage with the key color.
  5029. 0.01 matches only the exact key color, while 1.0 matches everything.
  5030. @item blend
  5031. Blend percentage.
  5032. 0.0 makes pixels either fully transparent, or not transparent at all.
  5033. Higher values result in semi-transparent pixels, with a higher transparency
  5034. the more similar the pixels color is to the key color.
  5035. @item yuv
  5036. Signals that the color passed is already in YUV instead of RGB.
  5037. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5038. This can be used to pass exact YUV values as hexadecimal numbers.
  5039. @end table
  5040. @subsection Examples
  5041. @itemize
  5042. @item
  5043. Make every green pixel in the input image transparent:
  5044. @example
  5045. ffmpeg -i input.png -vf chromakey=green out.png
  5046. @end example
  5047. @item
  5048. Overlay a greenscreen-video on top of a static black background.
  5049. @example
  5050. 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
  5051. @end example
  5052. @end itemize
  5053. @section chromashift
  5054. Shift chroma pixels horizontally and/or vertically.
  5055. The filter accepts the following options:
  5056. @table @option
  5057. @item cbh
  5058. Set amount to shift chroma-blue horizontally.
  5059. @item cbv
  5060. Set amount to shift chroma-blue vertically.
  5061. @item crh
  5062. Set amount to shift chroma-red horizontally.
  5063. @item crv
  5064. Set amount to shift chroma-red vertically.
  5065. @item edge
  5066. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5067. @end table
  5068. @section ciescope
  5069. Display CIE color diagram with pixels overlaid onto it.
  5070. The filter accepts the following options:
  5071. @table @option
  5072. @item system
  5073. Set color system.
  5074. @table @samp
  5075. @item ntsc, 470m
  5076. @item ebu, 470bg
  5077. @item smpte
  5078. @item 240m
  5079. @item apple
  5080. @item widergb
  5081. @item cie1931
  5082. @item rec709, hdtv
  5083. @item uhdtv, rec2020
  5084. @end table
  5085. @item cie
  5086. Set CIE system.
  5087. @table @samp
  5088. @item xyy
  5089. @item ucs
  5090. @item luv
  5091. @end table
  5092. @item gamuts
  5093. Set what gamuts to draw.
  5094. See @code{system} option for available values.
  5095. @item size, s
  5096. Set ciescope size, by default set to 512.
  5097. @item intensity, i
  5098. Set intensity used to map input pixel values to CIE diagram.
  5099. @item contrast
  5100. Set contrast used to draw tongue colors that are out of active color system gamut.
  5101. @item corrgamma
  5102. Correct gamma displayed on scope, by default enabled.
  5103. @item showwhite
  5104. Show white point on CIE diagram, by default disabled.
  5105. @item gamma
  5106. Set input gamma. Used only with XYZ input color space.
  5107. @end table
  5108. @section codecview
  5109. Visualize information exported by some codecs.
  5110. Some codecs can export information through frames using side-data or other
  5111. means. For example, some MPEG based codecs export motion vectors through the
  5112. @var{export_mvs} flag in the codec @option{flags2} option.
  5113. The filter accepts the following option:
  5114. @table @option
  5115. @item mv
  5116. Set motion vectors to visualize.
  5117. Available flags for @var{mv} are:
  5118. @table @samp
  5119. @item pf
  5120. forward predicted MVs of P-frames
  5121. @item bf
  5122. forward predicted MVs of B-frames
  5123. @item bb
  5124. backward predicted MVs of B-frames
  5125. @end table
  5126. @item qp
  5127. Display quantization parameters using the chroma planes.
  5128. @item mv_type, mvt
  5129. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5130. Available flags for @var{mv_type} are:
  5131. @table @samp
  5132. @item fp
  5133. forward predicted MVs
  5134. @item bp
  5135. backward predicted MVs
  5136. @end table
  5137. @item frame_type, ft
  5138. Set frame type to visualize motion vectors of.
  5139. Available flags for @var{frame_type} are:
  5140. @table @samp
  5141. @item if
  5142. intra-coded frames (I-frames)
  5143. @item pf
  5144. predicted frames (P-frames)
  5145. @item bf
  5146. bi-directionally predicted frames (B-frames)
  5147. @end table
  5148. @end table
  5149. @subsection Examples
  5150. @itemize
  5151. @item
  5152. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5153. @example
  5154. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5155. @end example
  5156. @item
  5157. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5158. @example
  5159. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5160. @end example
  5161. @end itemize
  5162. @section colorbalance
  5163. Modify intensity of primary colors (red, green and blue) of input frames.
  5164. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5165. regions for the red-cyan, green-magenta or blue-yellow balance.
  5166. A positive adjustment value shifts the balance towards the primary color, a negative
  5167. value towards the complementary color.
  5168. The filter accepts the following options:
  5169. @table @option
  5170. @item rs
  5171. @item gs
  5172. @item bs
  5173. Adjust red, green and blue shadows (darkest pixels).
  5174. @item rm
  5175. @item gm
  5176. @item bm
  5177. Adjust red, green and blue midtones (medium pixels).
  5178. @item rh
  5179. @item gh
  5180. @item bh
  5181. Adjust red, green and blue highlights (brightest pixels).
  5182. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5183. @end table
  5184. @subsection Examples
  5185. @itemize
  5186. @item
  5187. Add red color cast to shadows:
  5188. @example
  5189. colorbalance=rs=.3
  5190. @end example
  5191. @end itemize
  5192. @section colorkey
  5193. RGB colorspace color keying.
  5194. The filter accepts the following options:
  5195. @table @option
  5196. @item color
  5197. The color which will be replaced with transparency.
  5198. @item similarity
  5199. Similarity percentage with the key color.
  5200. 0.01 matches only the exact key color, while 1.0 matches everything.
  5201. @item blend
  5202. Blend percentage.
  5203. 0.0 makes pixels either fully transparent, or not transparent at all.
  5204. Higher values result in semi-transparent pixels, with a higher transparency
  5205. the more similar the pixels color is to the key color.
  5206. @end table
  5207. @subsection Examples
  5208. @itemize
  5209. @item
  5210. Make every green pixel in the input image transparent:
  5211. @example
  5212. ffmpeg -i input.png -vf colorkey=green out.png
  5213. @end example
  5214. @item
  5215. Overlay a greenscreen-video on top of a static background image.
  5216. @example
  5217. 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
  5218. @end example
  5219. @end itemize
  5220. @section colorhold
  5221. Remove all color information for all RGB colors except for certain one.
  5222. The filter accepts the following options:
  5223. @table @option
  5224. @item color
  5225. The color which will not be replaced with neutral gray.
  5226. @item similarity
  5227. Similarity percentage with the above color.
  5228. 0.01 matches only the exact key color, while 1.0 matches everything.
  5229. @item blend
  5230. Blend percentage. 0.0 makes pixels fully gray.
  5231. Higher values result in more preserved color.
  5232. @end table
  5233. @section colorlevels
  5234. Adjust video input frames using levels.
  5235. The filter accepts the following options:
  5236. @table @option
  5237. @item rimin
  5238. @item gimin
  5239. @item bimin
  5240. @item aimin
  5241. Adjust red, green, blue and alpha input black point.
  5242. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5243. @item rimax
  5244. @item gimax
  5245. @item bimax
  5246. @item aimax
  5247. Adjust red, green, blue and alpha input white point.
  5248. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5249. Input levels are used to lighten highlights (bright tones), darken shadows
  5250. (dark tones), change the balance of bright and dark tones.
  5251. @item romin
  5252. @item gomin
  5253. @item bomin
  5254. @item aomin
  5255. Adjust red, green, blue and alpha output black point.
  5256. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5257. @item romax
  5258. @item gomax
  5259. @item bomax
  5260. @item aomax
  5261. Adjust red, green, blue and alpha output white point.
  5262. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5263. Output levels allows manual selection of a constrained output level range.
  5264. @end table
  5265. @subsection Examples
  5266. @itemize
  5267. @item
  5268. Make video output darker:
  5269. @example
  5270. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5271. @end example
  5272. @item
  5273. Increase contrast:
  5274. @example
  5275. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5276. @end example
  5277. @item
  5278. Make video output lighter:
  5279. @example
  5280. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5281. @end example
  5282. @item
  5283. Increase brightness:
  5284. @example
  5285. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5286. @end example
  5287. @end itemize
  5288. @section colorchannelmixer
  5289. Adjust video input frames by re-mixing color channels.
  5290. This filter modifies a color channel by adding the values associated to
  5291. the other channels of the same pixels. For example if the value to
  5292. modify is red, the output value will be:
  5293. @example
  5294. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5295. @end example
  5296. The filter accepts the following options:
  5297. @table @option
  5298. @item rr
  5299. @item rg
  5300. @item rb
  5301. @item ra
  5302. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5303. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5304. @item gr
  5305. @item gg
  5306. @item gb
  5307. @item ga
  5308. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5309. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5310. @item br
  5311. @item bg
  5312. @item bb
  5313. @item ba
  5314. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5315. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5316. @item ar
  5317. @item ag
  5318. @item ab
  5319. @item aa
  5320. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5321. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5322. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5323. @end table
  5324. @subsection Examples
  5325. @itemize
  5326. @item
  5327. Convert source to grayscale:
  5328. @example
  5329. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5330. @end example
  5331. @item
  5332. Simulate sepia tones:
  5333. @example
  5334. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5335. @end example
  5336. @end itemize
  5337. @section colormatrix
  5338. Convert color matrix.
  5339. The filter accepts the following options:
  5340. @table @option
  5341. @item src
  5342. @item dst
  5343. Specify the source and destination color matrix. Both values must be
  5344. specified.
  5345. The accepted values are:
  5346. @table @samp
  5347. @item bt709
  5348. BT.709
  5349. @item fcc
  5350. FCC
  5351. @item bt601
  5352. BT.601
  5353. @item bt470
  5354. BT.470
  5355. @item bt470bg
  5356. BT.470BG
  5357. @item smpte170m
  5358. SMPTE-170M
  5359. @item smpte240m
  5360. SMPTE-240M
  5361. @item bt2020
  5362. BT.2020
  5363. @end table
  5364. @end table
  5365. For example to convert from BT.601 to SMPTE-240M, use the command:
  5366. @example
  5367. colormatrix=bt601:smpte240m
  5368. @end example
  5369. @section colorspace
  5370. Convert colorspace, transfer characteristics or color primaries.
  5371. Input video needs to have an even size.
  5372. The filter accepts the following options:
  5373. @table @option
  5374. @anchor{all}
  5375. @item all
  5376. Specify all color properties at once.
  5377. The accepted values are:
  5378. @table @samp
  5379. @item bt470m
  5380. BT.470M
  5381. @item bt470bg
  5382. BT.470BG
  5383. @item bt601-6-525
  5384. BT.601-6 525
  5385. @item bt601-6-625
  5386. BT.601-6 625
  5387. @item bt709
  5388. BT.709
  5389. @item smpte170m
  5390. SMPTE-170M
  5391. @item smpte240m
  5392. SMPTE-240M
  5393. @item bt2020
  5394. BT.2020
  5395. @end table
  5396. @anchor{space}
  5397. @item space
  5398. Specify output colorspace.
  5399. The accepted values are:
  5400. @table @samp
  5401. @item bt709
  5402. BT.709
  5403. @item fcc
  5404. FCC
  5405. @item bt470bg
  5406. BT.470BG or BT.601-6 625
  5407. @item smpte170m
  5408. SMPTE-170M or BT.601-6 525
  5409. @item smpte240m
  5410. SMPTE-240M
  5411. @item ycgco
  5412. YCgCo
  5413. @item bt2020ncl
  5414. BT.2020 with non-constant luminance
  5415. @end table
  5416. @anchor{trc}
  5417. @item trc
  5418. Specify output transfer characteristics.
  5419. The accepted values are:
  5420. @table @samp
  5421. @item bt709
  5422. BT.709
  5423. @item bt470m
  5424. BT.470M
  5425. @item bt470bg
  5426. BT.470BG
  5427. @item gamma22
  5428. Constant gamma of 2.2
  5429. @item gamma28
  5430. Constant gamma of 2.8
  5431. @item smpte170m
  5432. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5433. @item smpte240m
  5434. SMPTE-240M
  5435. @item srgb
  5436. SRGB
  5437. @item iec61966-2-1
  5438. iec61966-2-1
  5439. @item iec61966-2-4
  5440. iec61966-2-4
  5441. @item xvycc
  5442. xvycc
  5443. @item bt2020-10
  5444. BT.2020 for 10-bits content
  5445. @item bt2020-12
  5446. BT.2020 for 12-bits content
  5447. @end table
  5448. @anchor{primaries}
  5449. @item primaries
  5450. Specify output color primaries.
  5451. The accepted values are:
  5452. @table @samp
  5453. @item bt709
  5454. BT.709
  5455. @item bt470m
  5456. BT.470M
  5457. @item bt470bg
  5458. BT.470BG or BT.601-6 625
  5459. @item smpte170m
  5460. SMPTE-170M or BT.601-6 525
  5461. @item smpte240m
  5462. SMPTE-240M
  5463. @item film
  5464. film
  5465. @item smpte431
  5466. SMPTE-431
  5467. @item smpte432
  5468. SMPTE-432
  5469. @item bt2020
  5470. BT.2020
  5471. @item jedec-p22
  5472. JEDEC P22 phosphors
  5473. @end table
  5474. @anchor{range}
  5475. @item range
  5476. Specify output color range.
  5477. The accepted values are:
  5478. @table @samp
  5479. @item tv
  5480. TV (restricted) range
  5481. @item mpeg
  5482. MPEG (restricted) range
  5483. @item pc
  5484. PC (full) range
  5485. @item jpeg
  5486. JPEG (full) range
  5487. @end table
  5488. @item format
  5489. Specify output color format.
  5490. The accepted values are:
  5491. @table @samp
  5492. @item yuv420p
  5493. YUV 4:2:0 planar 8-bits
  5494. @item yuv420p10
  5495. YUV 4:2:0 planar 10-bits
  5496. @item yuv420p12
  5497. YUV 4:2:0 planar 12-bits
  5498. @item yuv422p
  5499. YUV 4:2:2 planar 8-bits
  5500. @item yuv422p10
  5501. YUV 4:2:2 planar 10-bits
  5502. @item yuv422p12
  5503. YUV 4:2:2 planar 12-bits
  5504. @item yuv444p
  5505. YUV 4:4:4 planar 8-bits
  5506. @item yuv444p10
  5507. YUV 4:4:4 planar 10-bits
  5508. @item yuv444p12
  5509. YUV 4:4:4 planar 12-bits
  5510. @end table
  5511. @item fast
  5512. Do a fast conversion, which skips gamma/primary correction. This will take
  5513. significantly less CPU, but will be mathematically incorrect. To get output
  5514. compatible with that produced by the colormatrix filter, use fast=1.
  5515. @item dither
  5516. Specify dithering mode.
  5517. The accepted values are:
  5518. @table @samp
  5519. @item none
  5520. No dithering
  5521. @item fsb
  5522. Floyd-Steinberg dithering
  5523. @end table
  5524. @item wpadapt
  5525. Whitepoint adaptation mode.
  5526. The accepted values are:
  5527. @table @samp
  5528. @item bradford
  5529. Bradford whitepoint adaptation
  5530. @item vonkries
  5531. von Kries whitepoint adaptation
  5532. @item identity
  5533. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5534. @end table
  5535. @item iall
  5536. Override all input properties at once. Same accepted values as @ref{all}.
  5537. @item ispace
  5538. Override input colorspace. Same accepted values as @ref{space}.
  5539. @item iprimaries
  5540. Override input color primaries. Same accepted values as @ref{primaries}.
  5541. @item itrc
  5542. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5543. @item irange
  5544. Override input color range. Same accepted values as @ref{range}.
  5545. @end table
  5546. The filter converts the transfer characteristics, color space and color
  5547. primaries to the specified user values. The output value, if not specified,
  5548. is set to a default value based on the "all" property. If that property is
  5549. also not specified, the filter will log an error. The output color range and
  5550. format default to the same value as the input color range and format. The
  5551. input transfer characteristics, color space, color primaries and color range
  5552. should be set on the input data. If any of these are missing, the filter will
  5553. log an error and no conversion will take place.
  5554. For example to convert the input to SMPTE-240M, use the command:
  5555. @example
  5556. colorspace=smpte240m
  5557. @end example
  5558. @section convolution
  5559. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5560. The filter accepts the following options:
  5561. @table @option
  5562. @item 0m
  5563. @item 1m
  5564. @item 2m
  5565. @item 3m
  5566. Set matrix for each plane.
  5567. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5568. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5569. @item 0rdiv
  5570. @item 1rdiv
  5571. @item 2rdiv
  5572. @item 3rdiv
  5573. Set multiplier for calculated value for each plane.
  5574. If unset or 0, it will be sum of all matrix elements.
  5575. @item 0bias
  5576. @item 1bias
  5577. @item 2bias
  5578. @item 3bias
  5579. Set bias for each plane. This value is added to the result of the multiplication.
  5580. Useful for making the overall image brighter or darker. Default is 0.0.
  5581. @item 0mode
  5582. @item 1mode
  5583. @item 2mode
  5584. @item 3mode
  5585. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5586. Default is @var{square}.
  5587. @end table
  5588. @subsection Examples
  5589. @itemize
  5590. @item
  5591. Apply sharpen:
  5592. @example
  5593. 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"
  5594. @end example
  5595. @item
  5596. Apply blur:
  5597. @example
  5598. 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"
  5599. @end example
  5600. @item
  5601. Apply edge enhance:
  5602. @example
  5603. 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"
  5604. @end example
  5605. @item
  5606. Apply edge detect:
  5607. @example
  5608. 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"
  5609. @end example
  5610. @item
  5611. Apply laplacian edge detector which includes diagonals:
  5612. @example
  5613. 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"
  5614. @end example
  5615. @item
  5616. Apply emboss:
  5617. @example
  5618. 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"
  5619. @end example
  5620. @end itemize
  5621. @section convolve
  5622. Apply 2D convolution of video stream in frequency domain using second stream
  5623. as impulse.
  5624. The filter accepts the following options:
  5625. @table @option
  5626. @item planes
  5627. Set which planes to process.
  5628. @item impulse
  5629. Set which impulse video frames will be processed, can be @var{first}
  5630. or @var{all}. Default is @var{all}.
  5631. @end table
  5632. The @code{convolve} filter also supports the @ref{framesync} options.
  5633. @section copy
  5634. Copy the input video source unchanged to the output. This is mainly useful for
  5635. testing purposes.
  5636. @anchor{coreimage}
  5637. @section coreimage
  5638. Video filtering on GPU using Apple's CoreImage API on OSX.
  5639. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5640. processed by video hardware. However, software-based OpenGL implementations
  5641. exist which means there is no guarantee for hardware processing. It depends on
  5642. the respective OSX.
  5643. There are many filters and image generators provided by Apple that come with a
  5644. large variety of options. The filter has to be referenced by its name along
  5645. with its options.
  5646. The coreimage filter accepts the following options:
  5647. @table @option
  5648. @item list_filters
  5649. List all available filters and generators along with all their respective
  5650. options as well as possible minimum and maximum values along with the default
  5651. values.
  5652. @example
  5653. list_filters=true
  5654. @end example
  5655. @item filter
  5656. Specify all filters by their respective name and options.
  5657. Use @var{list_filters} to determine all valid filter names and options.
  5658. Numerical options are specified by a float value and are automatically clamped
  5659. to their respective value range. Vector and color options have to be specified
  5660. by a list of space separated float values. Character escaping has to be done.
  5661. A special option name @code{default} is available to use default options for a
  5662. filter.
  5663. It is required to specify either @code{default} or at least one of the filter options.
  5664. All omitted options are used with their default values.
  5665. The syntax of the filter string is as follows:
  5666. @example
  5667. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5668. @end example
  5669. @item output_rect
  5670. Specify a rectangle where the output of the filter chain is copied into the
  5671. input image. It is given by a list of space separated float values:
  5672. @example
  5673. output_rect=x\ y\ width\ height
  5674. @end example
  5675. If not given, the output rectangle equals the dimensions of the input image.
  5676. The output rectangle is automatically cropped at the borders of the input
  5677. image. Negative values are valid for each component.
  5678. @example
  5679. output_rect=25\ 25\ 100\ 100
  5680. @end example
  5681. @end table
  5682. Several filters can be chained for successive processing without GPU-HOST
  5683. transfers allowing for fast processing of complex filter chains.
  5684. Currently, only filters with zero (generators) or exactly one (filters) input
  5685. image and one output image are supported. Also, transition filters are not yet
  5686. usable as intended.
  5687. Some filters generate output images with additional padding depending on the
  5688. respective filter kernel. The padding is automatically removed to ensure the
  5689. filter output has the same size as the input image.
  5690. For image generators, the size of the output image is determined by the
  5691. previous output image of the filter chain or the input image of the whole
  5692. filterchain, respectively. The generators do not use the pixel information of
  5693. this image to generate their output. However, the generated output is
  5694. blended onto this image, resulting in partial or complete coverage of the
  5695. output image.
  5696. The @ref{coreimagesrc} video source can be used for generating input images
  5697. which are directly fed into the filter chain. By using it, providing input
  5698. images by another video source or an input video is not required.
  5699. @subsection Examples
  5700. @itemize
  5701. @item
  5702. List all filters available:
  5703. @example
  5704. coreimage=list_filters=true
  5705. @end example
  5706. @item
  5707. Use the CIBoxBlur filter with default options to blur an image:
  5708. @example
  5709. coreimage=filter=CIBoxBlur@@default
  5710. @end example
  5711. @item
  5712. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5713. its center at 100x100 and a radius of 50 pixels:
  5714. @example
  5715. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5716. @end example
  5717. @item
  5718. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5719. given as complete and escaped command-line for Apple's standard bash shell:
  5720. @example
  5721. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5722. @end example
  5723. @end itemize
  5724. @section crop
  5725. Crop the input video to given dimensions.
  5726. It accepts the following parameters:
  5727. @table @option
  5728. @item w, out_w
  5729. The width of the output video. It defaults to @code{iw}.
  5730. This expression is evaluated only once during the filter
  5731. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5732. @item h, out_h
  5733. The height of the output video. It defaults to @code{ih}.
  5734. This expression is evaluated only once during the filter
  5735. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5736. @item x
  5737. The horizontal position, in the input video, of the left edge of the output
  5738. video. It defaults to @code{(in_w-out_w)/2}.
  5739. This expression is evaluated per-frame.
  5740. @item y
  5741. The vertical position, in the input video, of the top edge of the output video.
  5742. It defaults to @code{(in_h-out_h)/2}.
  5743. This expression is evaluated per-frame.
  5744. @item keep_aspect
  5745. If set to 1 will force the output display aspect ratio
  5746. to be the same of the input, by changing the output sample aspect
  5747. ratio. It defaults to 0.
  5748. @item exact
  5749. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5750. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5751. It defaults to 0.
  5752. @end table
  5753. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5754. expressions containing the following constants:
  5755. @table @option
  5756. @item x
  5757. @item y
  5758. The computed values for @var{x} and @var{y}. They are evaluated for
  5759. each new frame.
  5760. @item in_w
  5761. @item in_h
  5762. The input width and height.
  5763. @item iw
  5764. @item ih
  5765. These are the same as @var{in_w} and @var{in_h}.
  5766. @item out_w
  5767. @item out_h
  5768. The output (cropped) width and height.
  5769. @item ow
  5770. @item oh
  5771. These are the same as @var{out_w} and @var{out_h}.
  5772. @item a
  5773. same as @var{iw} / @var{ih}
  5774. @item sar
  5775. input sample aspect ratio
  5776. @item dar
  5777. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5778. @item hsub
  5779. @item vsub
  5780. horizontal and vertical chroma subsample values. For example for the
  5781. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5782. @item n
  5783. The number of the input frame, starting from 0.
  5784. @item pos
  5785. the position in the file of the input frame, NAN if unknown
  5786. @item t
  5787. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5788. @end table
  5789. The expression for @var{out_w} may depend on the value of @var{out_h},
  5790. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5791. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5792. evaluated after @var{out_w} and @var{out_h}.
  5793. The @var{x} and @var{y} parameters specify the expressions for the
  5794. position of the top-left corner of the output (non-cropped) area. They
  5795. are evaluated for each frame. If the evaluated value is not valid, it
  5796. is approximated to the nearest valid value.
  5797. The expression for @var{x} may depend on @var{y}, and the expression
  5798. for @var{y} may depend on @var{x}.
  5799. @subsection Examples
  5800. @itemize
  5801. @item
  5802. Crop area with size 100x100 at position (12,34).
  5803. @example
  5804. crop=100:100:12:34
  5805. @end example
  5806. Using named options, the example above becomes:
  5807. @example
  5808. crop=w=100:h=100:x=12:y=34
  5809. @end example
  5810. @item
  5811. Crop the central input area with size 100x100:
  5812. @example
  5813. crop=100:100
  5814. @end example
  5815. @item
  5816. Crop the central input area with size 2/3 of the input video:
  5817. @example
  5818. crop=2/3*in_w:2/3*in_h
  5819. @end example
  5820. @item
  5821. Crop the input video central square:
  5822. @example
  5823. crop=out_w=in_h
  5824. crop=in_h
  5825. @end example
  5826. @item
  5827. Delimit the rectangle with the top-left corner placed at position
  5828. 100:100 and the right-bottom corner corresponding to the right-bottom
  5829. corner of the input image.
  5830. @example
  5831. crop=in_w-100:in_h-100:100:100
  5832. @end example
  5833. @item
  5834. Crop 10 pixels from the left and right borders, and 20 pixels from
  5835. the top and bottom borders
  5836. @example
  5837. crop=in_w-2*10:in_h-2*20
  5838. @end example
  5839. @item
  5840. Keep only the bottom right quarter of the input image:
  5841. @example
  5842. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5843. @end example
  5844. @item
  5845. Crop height for getting Greek harmony:
  5846. @example
  5847. crop=in_w:1/PHI*in_w
  5848. @end example
  5849. @item
  5850. Apply trembling effect:
  5851. @example
  5852. 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)
  5853. @end example
  5854. @item
  5855. Apply erratic camera effect depending on timestamp:
  5856. @example
  5857. 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)"
  5858. @end example
  5859. @item
  5860. Set x depending on the value of y:
  5861. @example
  5862. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5863. @end example
  5864. @end itemize
  5865. @subsection Commands
  5866. This filter supports the following commands:
  5867. @table @option
  5868. @item w, out_w
  5869. @item h, out_h
  5870. @item x
  5871. @item y
  5872. Set width/height of the output video and the horizontal/vertical position
  5873. in the input video.
  5874. The command accepts the same syntax of the corresponding option.
  5875. If the specified expression is not valid, it is kept at its current
  5876. value.
  5877. @end table
  5878. @section cropdetect
  5879. Auto-detect the crop size.
  5880. It calculates the necessary cropping parameters and prints the
  5881. recommended parameters via the logging system. The detected dimensions
  5882. correspond to the non-black area of the input video.
  5883. It accepts the following parameters:
  5884. @table @option
  5885. @item limit
  5886. Set higher black value threshold, which can be optionally specified
  5887. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5888. value greater to the set value is considered non-black. It defaults to 24.
  5889. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5890. on the bitdepth of the pixel format.
  5891. @item round
  5892. The value which the width/height should be divisible by. It defaults to
  5893. 16. The offset is automatically adjusted to center the video. Use 2 to
  5894. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5895. encoding to most video codecs.
  5896. @item reset_count, reset
  5897. Set the counter that determines after how many frames cropdetect will
  5898. reset the previously detected largest video area and start over to
  5899. detect the current optimal crop area. Default value is 0.
  5900. This can be useful when channel logos distort the video area. 0
  5901. indicates 'never reset', and returns the largest area encountered during
  5902. playback.
  5903. @end table
  5904. @anchor{cue}
  5905. @section cue
  5906. Delay video filtering until a given wallclock timestamp. The filter first
  5907. passes on @option{preroll} amount of frames, then it buffers at most
  5908. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5909. it forwards the buffered frames and also any subsequent frames coming in its
  5910. input.
  5911. The filter can be used synchronize the output of multiple ffmpeg processes for
  5912. realtime output devices like decklink. By putting the delay in the filtering
  5913. chain and pre-buffering frames the process can pass on data to output almost
  5914. immediately after the target wallclock timestamp is reached.
  5915. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5916. some use cases.
  5917. @table @option
  5918. @item cue
  5919. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5920. @item preroll
  5921. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5922. @item buffer
  5923. The maximum duration of content to buffer before waiting for the cue expressed
  5924. in seconds. Default is 0.
  5925. @end table
  5926. @anchor{curves}
  5927. @section curves
  5928. Apply color adjustments using curves.
  5929. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5930. component (red, green and blue) has its values defined by @var{N} key points
  5931. tied from each other using a smooth curve. The x-axis represents the pixel
  5932. values from the input frame, and the y-axis the new pixel values to be set for
  5933. the output frame.
  5934. By default, a component curve is defined by the two points @var{(0;0)} and
  5935. @var{(1;1)}. This creates a straight line where each original pixel value is
  5936. "adjusted" to its own value, which means no change to the image.
  5937. The filter allows you to redefine these two points and add some more. A new
  5938. curve (using a natural cubic spline interpolation) will be define to pass
  5939. smoothly through all these new coordinates. The new defined points needs to be
  5940. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5941. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5942. the vector spaces, the values will be clipped accordingly.
  5943. The filter accepts the following options:
  5944. @table @option
  5945. @item preset
  5946. Select one of the available color presets. This option can be used in addition
  5947. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5948. options takes priority on the preset values.
  5949. Available presets are:
  5950. @table @samp
  5951. @item none
  5952. @item color_negative
  5953. @item cross_process
  5954. @item darker
  5955. @item increase_contrast
  5956. @item lighter
  5957. @item linear_contrast
  5958. @item medium_contrast
  5959. @item negative
  5960. @item strong_contrast
  5961. @item vintage
  5962. @end table
  5963. Default is @code{none}.
  5964. @item master, m
  5965. Set the master key points. These points will define a second pass mapping. It
  5966. is sometimes called a "luminance" or "value" mapping. It can be used with
  5967. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5968. post-processing LUT.
  5969. @item red, r
  5970. Set the key points for the red component.
  5971. @item green, g
  5972. Set the key points for the green component.
  5973. @item blue, b
  5974. Set the key points for the blue component.
  5975. @item all
  5976. Set the key points for all components (not including master).
  5977. Can be used in addition to the other key points component
  5978. options. In this case, the unset component(s) will fallback on this
  5979. @option{all} setting.
  5980. @item psfile
  5981. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5982. @item plot
  5983. Save Gnuplot script of the curves in specified file.
  5984. @end table
  5985. To avoid some filtergraph syntax conflicts, each key points list need to be
  5986. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5987. @subsection Examples
  5988. @itemize
  5989. @item
  5990. Increase slightly the middle level of blue:
  5991. @example
  5992. curves=blue='0/0 0.5/0.58 1/1'
  5993. @end example
  5994. @item
  5995. Vintage effect:
  5996. @example
  5997. 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'
  5998. @end example
  5999. Here we obtain the following coordinates for each components:
  6000. @table @var
  6001. @item red
  6002. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6003. @item green
  6004. @code{(0;0) (0.50;0.48) (1;1)}
  6005. @item blue
  6006. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6007. @end table
  6008. @item
  6009. The previous example can also be achieved with the associated built-in preset:
  6010. @example
  6011. curves=preset=vintage
  6012. @end example
  6013. @item
  6014. Or simply:
  6015. @example
  6016. curves=vintage
  6017. @end example
  6018. @item
  6019. Use a Photoshop preset and redefine the points of the green component:
  6020. @example
  6021. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6022. @end example
  6023. @item
  6024. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6025. and @command{gnuplot}:
  6026. @example
  6027. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6028. gnuplot -p /tmp/curves.plt
  6029. @end example
  6030. @end itemize
  6031. @section datascope
  6032. Video data analysis filter.
  6033. This filter shows hexadecimal pixel values of part of video.
  6034. The filter accepts the following options:
  6035. @table @option
  6036. @item size, s
  6037. Set output video size.
  6038. @item x
  6039. Set x offset from where to pick pixels.
  6040. @item y
  6041. Set y offset from where to pick pixels.
  6042. @item mode
  6043. Set scope mode, can be one of the following:
  6044. @table @samp
  6045. @item mono
  6046. Draw hexadecimal pixel values with white color on black background.
  6047. @item color
  6048. Draw hexadecimal pixel values with input video pixel color on black
  6049. background.
  6050. @item color2
  6051. Draw hexadecimal pixel values on color background picked from input video,
  6052. the text color is picked in such way so its always visible.
  6053. @end table
  6054. @item axis
  6055. Draw rows and columns numbers on left and top of video.
  6056. @item opacity
  6057. Set background opacity.
  6058. @end table
  6059. @section dctdnoiz
  6060. Denoise frames using 2D DCT (frequency domain filtering).
  6061. This filter is not designed for real time.
  6062. The filter accepts the following options:
  6063. @table @option
  6064. @item sigma, s
  6065. Set the noise sigma constant.
  6066. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6067. coefficient (absolute value) below this threshold with be dropped.
  6068. If you need a more advanced filtering, see @option{expr}.
  6069. Default is @code{0}.
  6070. @item overlap
  6071. Set number overlapping pixels for each block. Since the filter can be slow, you
  6072. may want to reduce this value, at the cost of a less effective filter and the
  6073. risk of various artefacts.
  6074. If the overlapping value doesn't permit processing the whole input width or
  6075. height, a warning will be displayed and according borders won't be denoised.
  6076. Default value is @var{blocksize}-1, which is the best possible setting.
  6077. @item expr, e
  6078. Set the coefficient factor expression.
  6079. For each coefficient of a DCT block, this expression will be evaluated as a
  6080. multiplier value for the coefficient.
  6081. If this is option is set, the @option{sigma} option will be ignored.
  6082. The absolute value of the coefficient can be accessed through the @var{c}
  6083. variable.
  6084. @item n
  6085. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6086. @var{blocksize}, which is the width and height of the processed blocks.
  6087. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6088. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6089. on the speed processing. Also, a larger block size does not necessarily means a
  6090. better de-noising.
  6091. @end table
  6092. @subsection Examples
  6093. Apply a denoise with a @option{sigma} of @code{4.5}:
  6094. @example
  6095. dctdnoiz=4.5
  6096. @end example
  6097. The same operation can be achieved using the expression system:
  6098. @example
  6099. dctdnoiz=e='gte(c, 4.5*3)'
  6100. @end example
  6101. Violent denoise using a block size of @code{16x16}:
  6102. @example
  6103. dctdnoiz=15:n=4
  6104. @end example
  6105. @section deband
  6106. Remove banding artifacts from input video.
  6107. It works by replacing banded pixels with average value of referenced pixels.
  6108. The filter accepts the following options:
  6109. @table @option
  6110. @item 1thr
  6111. @item 2thr
  6112. @item 3thr
  6113. @item 4thr
  6114. Set banding detection threshold for each plane. Default is 0.02.
  6115. Valid range is 0.00003 to 0.5.
  6116. If difference between current pixel and reference pixel is less than threshold,
  6117. it will be considered as banded.
  6118. @item range, r
  6119. Banding detection range in pixels. Default is 16. If positive, random number
  6120. in range 0 to set value will be used. If negative, exact absolute value
  6121. will be used.
  6122. The range defines square of four pixels around current pixel.
  6123. @item direction, d
  6124. Set direction in radians from which four pixel will be compared. If positive,
  6125. random direction from 0 to set direction will be picked. If negative, exact of
  6126. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6127. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6128. column.
  6129. @item blur, b
  6130. If enabled, current pixel is compared with average value of all four
  6131. surrounding pixels. The default is enabled. If disabled current pixel is
  6132. compared with all four surrounding pixels. The pixel is considered banded
  6133. if only all four differences with surrounding pixels are less than threshold.
  6134. @item coupling, c
  6135. If enabled, current pixel is changed if and only if all pixel components are banded,
  6136. e.g. banding detection threshold is triggered for all color components.
  6137. The default is disabled.
  6138. @end table
  6139. @section deblock
  6140. Remove blocking artifacts from input video.
  6141. The filter accepts the following options:
  6142. @table @option
  6143. @item filter
  6144. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6145. This controls what kind of deblocking is applied.
  6146. @item block
  6147. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6148. @item alpha
  6149. @item beta
  6150. @item gamma
  6151. @item delta
  6152. Set blocking detection thresholds. Allowed range is 0 to 1.
  6153. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6154. Using higher threshold gives more deblocking strength.
  6155. Setting @var{alpha} controls threshold detection at exact edge of block.
  6156. Remaining options controls threshold detection near the edge. Each one for
  6157. below/above or left/right. Setting any of those to @var{0} disables
  6158. deblocking.
  6159. @item planes
  6160. Set planes to filter. Default is to filter all available planes.
  6161. @end table
  6162. @subsection Examples
  6163. @itemize
  6164. @item
  6165. Deblock using weak filter and block size of 4 pixels.
  6166. @example
  6167. deblock=filter=weak:block=4
  6168. @end example
  6169. @item
  6170. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6171. deblocking more edges.
  6172. @example
  6173. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6174. @end example
  6175. @item
  6176. Similar as above, but filter only first plane.
  6177. @example
  6178. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6179. @end example
  6180. @item
  6181. Similar as above, but filter only second and third plane.
  6182. @example
  6183. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6184. @end example
  6185. @end itemize
  6186. @anchor{decimate}
  6187. @section decimate
  6188. Drop duplicated frames at regular intervals.
  6189. The filter accepts the following options:
  6190. @table @option
  6191. @item cycle
  6192. Set the number of frames from which one will be dropped. Setting this to
  6193. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6194. Default is @code{5}.
  6195. @item dupthresh
  6196. Set the threshold for duplicate detection. If the difference metric for a frame
  6197. is less than or equal to this value, then it is declared as duplicate. Default
  6198. is @code{1.1}
  6199. @item scthresh
  6200. Set scene change threshold. Default is @code{15}.
  6201. @item blockx
  6202. @item blocky
  6203. Set the size of the x and y-axis blocks used during metric calculations.
  6204. Larger blocks give better noise suppression, but also give worse detection of
  6205. small movements. Must be a power of two. Default is @code{32}.
  6206. @item ppsrc
  6207. Mark main input as a pre-processed input and activate clean source input
  6208. stream. This allows the input to be pre-processed with various filters to help
  6209. the metrics calculation while keeping the frame selection lossless. When set to
  6210. @code{1}, the first stream is for the pre-processed input, and the second
  6211. stream is the clean source from where the kept frames are chosen. Default is
  6212. @code{0}.
  6213. @item chroma
  6214. Set whether or not chroma is considered in the metric calculations. Default is
  6215. @code{1}.
  6216. @end table
  6217. @section deconvolve
  6218. Apply 2D deconvolution of video stream in frequency domain using second stream
  6219. as impulse.
  6220. The filter accepts the following options:
  6221. @table @option
  6222. @item planes
  6223. Set which planes to process.
  6224. @item impulse
  6225. Set which impulse video frames will be processed, can be @var{first}
  6226. or @var{all}. Default is @var{all}.
  6227. @item noise
  6228. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6229. and height are not same and not power of 2 or if stream prior to convolving
  6230. had noise.
  6231. @end table
  6232. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6233. @section dedot
  6234. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6235. It accepts the following options:
  6236. @table @option
  6237. @item m
  6238. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6239. @var{rainbows} for cross-color reduction.
  6240. @item lt
  6241. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6242. @item tl
  6243. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6244. @item tc
  6245. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6246. @item ct
  6247. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6248. @end table
  6249. @section deflate
  6250. Apply deflate effect to the video.
  6251. This filter replaces the pixel by the local(3x3) average by taking into account
  6252. only values lower than the pixel.
  6253. It accepts the following options:
  6254. @table @option
  6255. @item threshold0
  6256. @item threshold1
  6257. @item threshold2
  6258. @item threshold3
  6259. Limit the maximum change for each plane, default is 65535.
  6260. If 0, plane will remain unchanged.
  6261. @end table
  6262. @section deflicker
  6263. Remove temporal frame luminance variations.
  6264. It accepts the following options:
  6265. @table @option
  6266. @item size, s
  6267. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6268. @item mode, m
  6269. Set averaging mode to smooth temporal luminance variations.
  6270. Available values are:
  6271. @table @samp
  6272. @item am
  6273. Arithmetic mean
  6274. @item gm
  6275. Geometric mean
  6276. @item hm
  6277. Harmonic mean
  6278. @item qm
  6279. Quadratic mean
  6280. @item cm
  6281. Cubic mean
  6282. @item pm
  6283. Power mean
  6284. @item median
  6285. Median
  6286. @end table
  6287. @item bypass
  6288. Do not actually modify frame. Useful when one only wants metadata.
  6289. @end table
  6290. @section dejudder
  6291. Remove judder produced by partially interlaced telecined content.
  6292. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6293. source was partially telecined content then the output of @code{pullup,dejudder}
  6294. will have a variable frame rate. May change the recorded frame rate of the
  6295. container. Aside from that change, this filter will not affect constant frame
  6296. rate video.
  6297. The option available in this filter is:
  6298. @table @option
  6299. @item cycle
  6300. Specify the length of the window over which the judder repeats.
  6301. Accepts any integer greater than 1. Useful values are:
  6302. @table @samp
  6303. @item 4
  6304. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6305. @item 5
  6306. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6307. @item 20
  6308. If a mixture of the two.
  6309. @end table
  6310. The default is @samp{4}.
  6311. @end table
  6312. @section delogo
  6313. Suppress a TV station logo by a simple interpolation of the surrounding
  6314. pixels. Just set a rectangle covering the logo and watch it disappear
  6315. (and sometimes something even uglier appear - your mileage may vary).
  6316. It accepts the following parameters:
  6317. @table @option
  6318. @item x
  6319. @item y
  6320. Specify the top left corner coordinates of the logo. They must be
  6321. specified.
  6322. @item w
  6323. @item h
  6324. Specify the width and height of the logo to clear. They must be
  6325. specified.
  6326. @item band, t
  6327. Specify the thickness of the fuzzy edge of the rectangle (added to
  6328. @var{w} and @var{h}). The default value is 1. This option is
  6329. deprecated, setting higher values should no longer be necessary and
  6330. is not recommended.
  6331. @item show
  6332. When set to 1, a green rectangle is drawn on the screen to simplify
  6333. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6334. The default value is 0.
  6335. The rectangle is drawn on the outermost pixels which will be (partly)
  6336. replaced with interpolated values. The values of the next pixels
  6337. immediately outside this rectangle in each direction will be used to
  6338. compute the interpolated pixel values inside the rectangle.
  6339. @end table
  6340. @subsection Examples
  6341. @itemize
  6342. @item
  6343. Set a rectangle covering the area with top left corner coordinates 0,0
  6344. and size 100x77, and a band of size 10:
  6345. @example
  6346. delogo=x=0:y=0:w=100:h=77:band=10
  6347. @end example
  6348. @end itemize
  6349. @section deshake
  6350. Attempt to fix small changes in horizontal and/or vertical shift. This
  6351. filter helps remove camera shake from hand-holding a camera, bumping a
  6352. tripod, moving on a vehicle, etc.
  6353. The filter accepts the following options:
  6354. @table @option
  6355. @item x
  6356. @item y
  6357. @item w
  6358. @item h
  6359. Specify a rectangular area where to limit the search for motion
  6360. vectors.
  6361. If desired the search for motion vectors can be limited to a
  6362. rectangular area of the frame defined by its top left corner, width
  6363. and height. These parameters have the same meaning as the drawbox
  6364. filter which can be used to visualise the position of the bounding
  6365. box.
  6366. This is useful when simultaneous movement of subjects within the frame
  6367. might be confused for camera motion by the motion vector search.
  6368. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6369. then the full frame is used. This allows later options to be set
  6370. without specifying the bounding box for the motion vector search.
  6371. Default - search the whole frame.
  6372. @item rx
  6373. @item ry
  6374. Specify the maximum extent of movement in x and y directions in the
  6375. range 0-64 pixels. Default 16.
  6376. @item edge
  6377. Specify how to generate pixels to fill blanks at the edge of the
  6378. frame. Available values are:
  6379. @table @samp
  6380. @item blank, 0
  6381. Fill zeroes at blank locations
  6382. @item original, 1
  6383. Original image at blank locations
  6384. @item clamp, 2
  6385. Extruded edge value at blank locations
  6386. @item mirror, 3
  6387. Mirrored edge at blank locations
  6388. @end table
  6389. Default value is @samp{mirror}.
  6390. @item blocksize
  6391. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6392. default 8.
  6393. @item contrast
  6394. Specify the contrast threshold for blocks. Only blocks with more than
  6395. the specified contrast (difference between darkest and lightest
  6396. pixels) will be considered. Range 1-255, default 125.
  6397. @item search
  6398. Specify the search strategy. Available values are:
  6399. @table @samp
  6400. @item exhaustive, 0
  6401. Set exhaustive search
  6402. @item less, 1
  6403. Set less exhaustive search.
  6404. @end table
  6405. Default value is @samp{exhaustive}.
  6406. @item filename
  6407. If set then a detailed log of the motion search is written to the
  6408. specified file.
  6409. @end table
  6410. @section despill
  6411. Remove unwanted contamination of foreground colors, caused by reflected color of
  6412. greenscreen or bluescreen.
  6413. This filter accepts the following options:
  6414. @table @option
  6415. @item type
  6416. Set what type of despill to use.
  6417. @item mix
  6418. Set how spillmap will be generated.
  6419. @item expand
  6420. Set how much to get rid of still remaining spill.
  6421. @item red
  6422. Controls amount of red in spill area.
  6423. @item green
  6424. Controls amount of green in spill area.
  6425. Should be -1 for greenscreen.
  6426. @item blue
  6427. Controls amount of blue in spill area.
  6428. Should be -1 for bluescreen.
  6429. @item brightness
  6430. Controls brightness of spill area, preserving colors.
  6431. @item alpha
  6432. Modify alpha from generated spillmap.
  6433. @end table
  6434. @section detelecine
  6435. Apply an exact inverse of the telecine operation. It requires a predefined
  6436. pattern specified using the pattern option which must be the same as that passed
  6437. to the telecine filter.
  6438. This filter accepts the following options:
  6439. @table @option
  6440. @item first_field
  6441. @table @samp
  6442. @item top, t
  6443. top field first
  6444. @item bottom, b
  6445. bottom field first
  6446. The default value is @code{top}.
  6447. @end table
  6448. @item pattern
  6449. A string of numbers representing the pulldown pattern you wish to apply.
  6450. The default value is @code{23}.
  6451. @item start_frame
  6452. A number representing position of the first frame with respect to the telecine
  6453. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6454. @end table
  6455. @section dilation
  6456. Apply dilation effect to the video.
  6457. This filter replaces the pixel by the local(3x3) maximum.
  6458. It accepts the following options:
  6459. @table @option
  6460. @item threshold0
  6461. @item threshold1
  6462. @item threshold2
  6463. @item threshold3
  6464. Limit the maximum change for each plane, default is 65535.
  6465. If 0, plane will remain unchanged.
  6466. @item coordinates
  6467. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6468. pixels are used.
  6469. Flags to local 3x3 coordinates maps like this:
  6470. 1 2 3
  6471. 4 5
  6472. 6 7 8
  6473. @end table
  6474. @section displace
  6475. Displace pixels as indicated by second and third input stream.
  6476. It takes three input streams and outputs one stream, the first input is the
  6477. source, and second and third input are displacement maps.
  6478. The second input specifies how much to displace pixels along the
  6479. x-axis, while the third input specifies how much to displace pixels
  6480. along the y-axis.
  6481. If one of displacement map streams terminates, last frame from that
  6482. displacement map will be used.
  6483. Note that once generated, displacements maps can be reused over and over again.
  6484. A description of the accepted options follows.
  6485. @table @option
  6486. @item edge
  6487. Set displace behavior for pixels that are out of range.
  6488. Available values are:
  6489. @table @samp
  6490. @item blank
  6491. Missing pixels are replaced by black pixels.
  6492. @item smear
  6493. Adjacent pixels will spread out to replace missing pixels.
  6494. @item wrap
  6495. Out of range pixels are wrapped so they point to pixels of other side.
  6496. @item mirror
  6497. Out of range pixels will be replaced with mirrored pixels.
  6498. @end table
  6499. Default is @samp{smear}.
  6500. @end table
  6501. @subsection Examples
  6502. @itemize
  6503. @item
  6504. Add ripple effect to rgb input of video size hd720:
  6505. @example
  6506. 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
  6507. @end example
  6508. @item
  6509. Add wave effect to rgb input of video size hd720:
  6510. @example
  6511. 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
  6512. @end example
  6513. @end itemize
  6514. @section drawbox
  6515. Draw a colored box on the input image.
  6516. It accepts the following parameters:
  6517. @table @option
  6518. @item x
  6519. @item y
  6520. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6521. @item width, w
  6522. @item height, h
  6523. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6524. the input width and height. It defaults to 0.
  6525. @item color, c
  6526. Specify the color of the box to write. For the general syntax of this option,
  6527. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6528. value @code{invert} is used, the box edge color is the same as the
  6529. video with inverted luma.
  6530. @item thickness, t
  6531. The expression which sets the thickness of the box edge.
  6532. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6533. See below for the list of accepted constants.
  6534. @item replace
  6535. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6536. will overwrite the video's color and alpha pixels.
  6537. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6538. @end table
  6539. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6540. following constants:
  6541. @table @option
  6542. @item dar
  6543. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6544. @item hsub
  6545. @item vsub
  6546. horizontal and vertical chroma subsample values. For example for the
  6547. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6548. @item in_h, ih
  6549. @item in_w, iw
  6550. The input width and height.
  6551. @item sar
  6552. The input sample aspect ratio.
  6553. @item x
  6554. @item y
  6555. The x and y offset coordinates where the box is drawn.
  6556. @item w
  6557. @item h
  6558. The width and height of the drawn box.
  6559. @item t
  6560. The thickness of the drawn box.
  6561. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6562. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6563. @end table
  6564. @subsection Examples
  6565. @itemize
  6566. @item
  6567. Draw a black box around the edge of the input image:
  6568. @example
  6569. drawbox
  6570. @end example
  6571. @item
  6572. Draw a box with color red and an opacity of 50%:
  6573. @example
  6574. drawbox=10:20:200:60:red@@0.5
  6575. @end example
  6576. The previous example can be specified as:
  6577. @example
  6578. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6579. @end example
  6580. @item
  6581. Fill the box with pink color:
  6582. @example
  6583. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6584. @end example
  6585. @item
  6586. Draw a 2-pixel red 2.40:1 mask:
  6587. @example
  6588. 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
  6589. @end example
  6590. @end itemize
  6591. @section drawgrid
  6592. Draw a grid on the input image.
  6593. It accepts the following parameters:
  6594. @table @option
  6595. @item x
  6596. @item y
  6597. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6598. @item width, w
  6599. @item height, h
  6600. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6601. input width and height, respectively, minus @code{thickness}, so image gets
  6602. framed. Default to 0.
  6603. @item color, c
  6604. Specify the color of the grid. For the general syntax of this option,
  6605. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6606. value @code{invert} is used, the grid color is the same as the
  6607. video with inverted luma.
  6608. @item thickness, t
  6609. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6610. See below for the list of accepted constants.
  6611. @item replace
  6612. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6613. will overwrite the video's color and alpha pixels.
  6614. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6615. @end table
  6616. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6617. following constants:
  6618. @table @option
  6619. @item dar
  6620. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6621. @item hsub
  6622. @item vsub
  6623. horizontal and vertical chroma subsample values. For example for the
  6624. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6625. @item in_h, ih
  6626. @item in_w, iw
  6627. The input grid cell width and height.
  6628. @item sar
  6629. The input sample aspect ratio.
  6630. @item x
  6631. @item y
  6632. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6633. @item w
  6634. @item h
  6635. The width and height of the drawn cell.
  6636. @item t
  6637. The thickness of the drawn cell.
  6638. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6639. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6640. @end table
  6641. @subsection Examples
  6642. @itemize
  6643. @item
  6644. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6645. @example
  6646. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6647. @end example
  6648. @item
  6649. Draw a white 3x3 grid with an opacity of 50%:
  6650. @example
  6651. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6652. @end example
  6653. @end itemize
  6654. @anchor{drawtext}
  6655. @section drawtext
  6656. Draw a text string or text from a specified file on top of a video, using the
  6657. libfreetype library.
  6658. To enable compilation of this filter, you need to configure FFmpeg with
  6659. @code{--enable-libfreetype}.
  6660. To enable default font fallback and the @var{font} option you need to
  6661. configure FFmpeg with @code{--enable-libfontconfig}.
  6662. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6663. @code{--enable-libfribidi}.
  6664. @subsection Syntax
  6665. It accepts the following parameters:
  6666. @table @option
  6667. @item box
  6668. Used to draw a box around text using the background color.
  6669. The value must be either 1 (enable) or 0 (disable).
  6670. The default value of @var{box} is 0.
  6671. @item boxborderw
  6672. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6673. The default value of @var{boxborderw} is 0.
  6674. @item boxcolor
  6675. The color to be used for drawing box around text. For the syntax of this
  6676. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6677. The default value of @var{boxcolor} is "white".
  6678. @item line_spacing
  6679. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6680. The default value of @var{line_spacing} is 0.
  6681. @item borderw
  6682. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6683. The default value of @var{borderw} is 0.
  6684. @item bordercolor
  6685. Set the color to be used for drawing border around text. For the syntax of this
  6686. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6687. The default value of @var{bordercolor} is "black".
  6688. @item expansion
  6689. Select how the @var{text} is expanded. Can be either @code{none},
  6690. @code{strftime} (deprecated) or
  6691. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6692. below for details.
  6693. @item basetime
  6694. Set a start time for the count. Value is in microseconds. Only applied
  6695. in the deprecated strftime expansion mode. To emulate in normal expansion
  6696. mode use the @code{pts} function, supplying the start time (in seconds)
  6697. as the second argument.
  6698. @item fix_bounds
  6699. If true, check and fix text coords to avoid clipping.
  6700. @item fontcolor
  6701. The color to be used for drawing fonts. For the syntax of this option, check
  6702. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6703. The default value of @var{fontcolor} is "black".
  6704. @item fontcolor_expr
  6705. String which is expanded the same way as @var{text} to obtain dynamic
  6706. @var{fontcolor} value. By default this option has empty value and is not
  6707. processed. When this option is set, it overrides @var{fontcolor} option.
  6708. @item font
  6709. The font family to be used for drawing text. By default Sans.
  6710. @item fontfile
  6711. The font file to be used for drawing text. The path must be included.
  6712. This parameter is mandatory if the fontconfig support is disabled.
  6713. @item alpha
  6714. Draw the text applying alpha blending. The value can
  6715. be a number between 0.0 and 1.0.
  6716. The expression accepts the same variables @var{x, y} as well.
  6717. The default value is 1.
  6718. Please see @var{fontcolor_expr}.
  6719. @item fontsize
  6720. The font size to be used for drawing text.
  6721. The default value of @var{fontsize} is 16.
  6722. @item text_shaping
  6723. If set to 1, attempt to shape the text (for example, reverse the order of
  6724. right-to-left text and join Arabic characters) before drawing it.
  6725. Otherwise, just draw the text exactly as given.
  6726. By default 1 (if supported).
  6727. @item ft_load_flags
  6728. The flags to be used for loading the fonts.
  6729. The flags map the corresponding flags supported by libfreetype, and are
  6730. a combination of the following values:
  6731. @table @var
  6732. @item default
  6733. @item no_scale
  6734. @item no_hinting
  6735. @item render
  6736. @item no_bitmap
  6737. @item vertical_layout
  6738. @item force_autohint
  6739. @item crop_bitmap
  6740. @item pedantic
  6741. @item ignore_global_advance_width
  6742. @item no_recurse
  6743. @item ignore_transform
  6744. @item monochrome
  6745. @item linear_design
  6746. @item no_autohint
  6747. @end table
  6748. Default value is "default".
  6749. For more information consult the documentation for the FT_LOAD_*
  6750. libfreetype flags.
  6751. @item shadowcolor
  6752. The color to be used for drawing a shadow behind the drawn text. For the
  6753. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6754. ffmpeg-utils manual,ffmpeg-utils}.
  6755. The default value of @var{shadowcolor} is "black".
  6756. @item shadowx
  6757. @item shadowy
  6758. The x and y offsets for the text shadow position with respect to the
  6759. position of the text. They can be either positive or negative
  6760. values. The default value for both is "0".
  6761. @item start_number
  6762. The starting frame number for the n/frame_num variable. The default value
  6763. is "0".
  6764. @item tabsize
  6765. The size in number of spaces to use for rendering the tab.
  6766. Default value is 4.
  6767. @item timecode
  6768. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6769. format. It can be used with or without text parameter. @var{timecode_rate}
  6770. option must be specified.
  6771. @item timecode_rate, rate, r
  6772. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6773. integer. Minimum value is "1".
  6774. Drop-frame timecode is supported for frame rates 30 & 60.
  6775. @item tc24hmax
  6776. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6777. Default is 0 (disabled).
  6778. @item text
  6779. The text string to be drawn. The text must be a sequence of UTF-8
  6780. encoded characters.
  6781. This parameter is mandatory if no file is specified with the parameter
  6782. @var{textfile}.
  6783. @item textfile
  6784. A text file containing text to be drawn. The text must be a sequence
  6785. of UTF-8 encoded characters.
  6786. This parameter is mandatory if no text string is specified with the
  6787. parameter @var{text}.
  6788. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6789. @item reload
  6790. If set to 1, the @var{textfile} will be reloaded before each frame.
  6791. Be sure to update it atomically, or it may be read partially, or even fail.
  6792. @item x
  6793. @item y
  6794. The expressions which specify the offsets where text will be drawn
  6795. within the video frame. They are relative to the top/left border of the
  6796. output image.
  6797. The default value of @var{x} and @var{y} is "0".
  6798. See below for the list of accepted constants and functions.
  6799. @end table
  6800. The parameters for @var{x} and @var{y} are expressions containing the
  6801. following constants and functions:
  6802. @table @option
  6803. @item dar
  6804. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6805. @item hsub
  6806. @item vsub
  6807. horizontal and vertical chroma subsample values. For example for the
  6808. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6809. @item line_h, lh
  6810. the height of each text line
  6811. @item main_h, h, H
  6812. the input height
  6813. @item main_w, w, W
  6814. the input width
  6815. @item max_glyph_a, ascent
  6816. the maximum distance from the baseline to the highest/upper grid
  6817. coordinate used to place a glyph outline point, for all the rendered
  6818. glyphs.
  6819. It is a positive value, due to the grid's orientation with the Y axis
  6820. upwards.
  6821. @item max_glyph_d, descent
  6822. the maximum distance from the baseline to the lowest grid coordinate
  6823. used to place a glyph outline point, for all the rendered glyphs.
  6824. This is a negative value, due to the grid's orientation, with the Y axis
  6825. upwards.
  6826. @item max_glyph_h
  6827. maximum glyph height, that is the maximum height for all the glyphs
  6828. contained in the rendered text, it is equivalent to @var{ascent} -
  6829. @var{descent}.
  6830. @item max_glyph_w
  6831. maximum glyph width, that is the maximum width for all the glyphs
  6832. contained in the rendered text
  6833. @item n
  6834. the number of input frame, starting from 0
  6835. @item rand(min, max)
  6836. return a random number included between @var{min} and @var{max}
  6837. @item sar
  6838. The input sample aspect ratio.
  6839. @item t
  6840. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6841. @item text_h, th
  6842. the height of the rendered text
  6843. @item text_w, tw
  6844. the width of the rendered text
  6845. @item x
  6846. @item y
  6847. the x and y offset coordinates where the text is drawn.
  6848. These parameters allow the @var{x} and @var{y} expressions to refer
  6849. each other, so you can for example specify @code{y=x/dar}.
  6850. @end table
  6851. @anchor{drawtext_expansion}
  6852. @subsection Text expansion
  6853. If @option{expansion} is set to @code{strftime},
  6854. the filter recognizes strftime() sequences in the provided text and
  6855. expands them accordingly. Check the documentation of strftime(). This
  6856. feature is deprecated.
  6857. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6858. If @option{expansion} is set to @code{normal} (which is the default),
  6859. the following expansion mechanism is used.
  6860. The backslash character @samp{\}, followed by any character, always expands to
  6861. the second character.
  6862. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6863. braces is a function name, possibly followed by arguments separated by ':'.
  6864. If the arguments contain special characters or delimiters (':' or '@}'),
  6865. they should be escaped.
  6866. Note that they probably must also be escaped as the value for the
  6867. @option{text} option in the filter argument string and as the filter
  6868. argument in the filtergraph description, and possibly also for the shell,
  6869. that makes up to four levels of escaping; using a text file avoids these
  6870. problems.
  6871. The following functions are available:
  6872. @table @command
  6873. @item expr, e
  6874. The expression evaluation result.
  6875. It must take one argument specifying the expression to be evaluated,
  6876. which accepts the same constants and functions as the @var{x} and
  6877. @var{y} values. Note that not all constants should be used, for
  6878. example the text size is not known when evaluating the expression, so
  6879. the constants @var{text_w} and @var{text_h} will have an undefined
  6880. value.
  6881. @item expr_int_format, eif
  6882. Evaluate the expression's value and output as formatted integer.
  6883. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6884. The second argument specifies the output format. Allowed values are @samp{x},
  6885. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6886. @code{printf} function.
  6887. The third parameter is optional and sets the number of positions taken by the output.
  6888. It can be used to add padding with zeros from the left.
  6889. @item gmtime
  6890. The time at which the filter is running, expressed in UTC.
  6891. It can accept an argument: a strftime() format string.
  6892. @item localtime
  6893. The time at which the filter is running, expressed in the local time zone.
  6894. It can accept an argument: a strftime() format string.
  6895. @item metadata
  6896. Frame metadata. Takes one or two arguments.
  6897. The first argument is mandatory and specifies the metadata key.
  6898. The second argument is optional and specifies a default value, used when the
  6899. metadata key is not found or empty.
  6900. @item n, frame_num
  6901. The frame number, starting from 0.
  6902. @item pict_type
  6903. A 1 character description of the current picture type.
  6904. @item pts
  6905. The timestamp of the current frame.
  6906. It can take up to three arguments.
  6907. The first argument is the format of the timestamp; it defaults to @code{flt}
  6908. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6909. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6910. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6911. @code{localtime} stands for the timestamp of the frame formatted as
  6912. local time zone time.
  6913. The second argument is an offset added to the timestamp.
  6914. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6915. supplied to present the hour part of the formatted timestamp in 24h format
  6916. (00-23).
  6917. If the format is set to @code{localtime} or @code{gmtime},
  6918. a third argument may be supplied: a strftime() format string.
  6919. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6920. @end table
  6921. @subsection Commands
  6922. This filter supports altering parameters via commands:
  6923. @table @option
  6924. @item reinit
  6925. Alter existing filter parameters.
  6926. Syntax for the argument is the same as for filter invocation, e.g.
  6927. @example
  6928. fontsize=56:fontcolor=green:text='Hello World'
  6929. @end example
  6930. Full filter invocation with sendcmd would look like this:
  6931. @example
  6932. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  6933. @end example
  6934. @end table
  6935. If the entire argument can't be parsed or applied as valid values then the filter will
  6936. continue with its existing parameters.
  6937. @subsection Examples
  6938. @itemize
  6939. @item
  6940. Draw "Test Text" with font FreeSerif, using the default values for the
  6941. optional parameters.
  6942. @example
  6943. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6944. @end example
  6945. @item
  6946. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6947. and y=50 (counting from the top-left corner of the screen), text is
  6948. yellow with a red box around it. Both the text and the box have an
  6949. opacity of 20%.
  6950. @example
  6951. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6952. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6953. @end example
  6954. Note that the double quotes are not necessary if spaces are not used
  6955. within the parameter list.
  6956. @item
  6957. Show the text at the center of the video frame:
  6958. @example
  6959. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6960. @end example
  6961. @item
  6962. Show the text at a random position, switching to a new position every 30 seconds:
  6963. @example
  6964. 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)"
  6965. @end example
  6966. @item
  6967. Show a text line sliding from right to left in the last row of the video
  6968. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6969. with no newlines.
  6970. @example
  6971. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6972. @end example
  6973. @item
  6974. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6975. @example
  6976. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6977. @end example
  6978. @item
  6979. Draw a single green letter "g", at the center of the input video.
  6980. The glyph baseline is placed at half screen height.
  6981. @example
  6982. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6983. @end example
  6984. @item
  6985. Show text for 1 second every 3 seconds:
  6986. @example
  6987. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6988. @end example
  6989. @item
  6990. Use fontconfig to set the font. Note that the colons need to be escaped.
  6991. @example
  6992. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6993. @end example
  6994. @item
  6995. Print the date of a real-time encoding (see strftime(3)):
  6996. @example
  6997. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6998. @end example
  6999. @item
  7000. Show text fading in and out (appearing/disappearing):
  7001. @example
  7002. #!/bin/sh
  7003. DS=1.0 # display start
  7004. DE=10.0 # display end
  7005. FID=1.5 # fade in duration
  7006. FOD=5 # fade out duration
  7007. 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 @}"
  7008. @end example
  7009. @item
  7010. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7011. and the @option{fontsize} value are included in the @option{y} offset.
  7012. @example
  7013. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7014. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7015. @end example
  7016. @end itemize
  7017. For more information about libfreetype, check:
  7018. @url{http://www.freetype.org/}.
  7019. For more information about fontconfig, check:
  7020. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7021. For more information about libfribidi, check:
  7022. @url{http://fribidi.org/}.
  7023. @section edgedetect
  7024. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7025. The filter accepts the following options:
  7026. @table @option
  7027. @item low
  7028. @item high
  7029. Set low and high threshold values used by the Canny thresholding
  7030. algorithm.
  7031. The high threshold selects the "strong" edge pixels, which are then
  7032. connected through 8-connectivity with the "weak" edge pixels selected
  7033. by the low threshold.
  7034. @var{low} and @var{high} threshold values must be chosen in the range
  7035. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7036. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7037. is @code{50/255}.
  7038. @item mode
  7039. Define the drawing mode.
  7040. @table @samp
  7041. @item wires
  7042. Draw white/gray wires on black background.
  7043. @item colormix
  7044. Mix the colors to create a paint/cartoon effect.
  7045. @item canny
  7046. Apply Canny edge detector on all selected planes.
  7047. @end table
  7048. Default value is @var{wires}.
  7049. @item planes
  7050. Select planes for filtering. By default all available planes are filtered.
  7051. @end table
  7052. @subsection Examples
  7053. @itemize
  7054. @item
  7055. Standard edge detection with custom values for the hysteresis thresholding:
  7056. @example
  7057. edgedetect=low=0.1:high=0.4
  7058. @end example
  7059. @item
  7060. Painting effect without thresholding:
  7061. @example
  7062. edgedetect=mode=colormix:high=0
  7063. @end example
  7064. @end itemize
  7065. @section eq
  7066. Set brightness, contrast, saturation and approximate gamma adjustment.
  7067. The filter accepts the following options:
  7068. @table @option
  7069. @item contrast
  7070. Set the contrast expression. The value must be a float value in range
  7071. @code{-2.0} to @code{2.0}. The default value is "1".
  7072. @item brightness
  7073. Set the brightness expression. The value must be a float value in
  7074. range @code{-1.0} to @code{1.0}. The default value is "0".
  7075. @item saturation
  7076. Set the saturation expression. The value must be a float in
  7077. range @code{0.0} to @code{3.0}. The default value is "1".
  7078. @item gamma
  7079. Set the gamma expression. The value must be a float in range
  7080. @code{0.1} to @code{10.0}. The default value is "1".
  7081. @item gamma_r
  7082. Set the gamma expression for red. The value must be a float in
  7083. range @code{0.1} to @code{10.0}. The default value is "1".
  7084. @item gamma_g
  7085. Set the gamma expression for green. The value must be a float in range
  7086. @code{0.1} to @code{10.0}. The default value is "1".
  7087. @item gamma_b
  7088. Set the gamma expression for blue. The value must be a float in range
  7089. @code{0.1} to @code{10.0}. The default value is "1".
  7090. @item gamma_weight
  7091. Set the gamma weight expression. It can be used to reduce the effect
  7092. of a high gamma value on bright image areas, e.g. keep them from
  7093. getting overamplified and just plain white. The value must be a float
  7094. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7095. gamma correction all the way down while @code{1.0} leaves it at its
  7096. full strength. Default is "1".
  7097. @item eval
  7098. Set when the expressions for brightness, contrast, saturation and
  7099. gamma expressions are evaluated.
  7100. It accepts the following values:
  7101. @table @samp
  7102. @item init
  7103. only evaluate expressions once during the filter initialization or
  7104. when a command is processed
  7105. @item frame
  7106. evaluate expressions for each incoming frame
  7107. @end table
  7108. Default value is @samp{init}.
  7109. @end table
  7110. The expressions accept the following parameters:
  7111. @table @option
  7112. @item n
  7113. frame count of the input frame starting from 0
  7114. @item pos
  7115. byte position of the corresponding packet in the input file, NAN if
  7116. unspecified
  7117. @item r
  7118. frame rate of the input video, NAN if the input frame rate is unknown
  7119. @item t
  7120. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7121. @end table
  7122. @subsection Commands
  7123. The filter supports the following commands:
  7124. @table @option
  7125. @item contrast
  7126. Set the contrast expression.
  7127. @item brightness
  7128. Set the brightness expression.
  7129. @item saturation
  7130. Set the saturation expression.
  7131. @item gamma
  7132. Set the gamma expression.
  7133. @item gamma_r
  7134. Set the gamma_r expression.
  7135. @item gamma_g
  7136. Set gamma_g expression.
  7137. @item gamma_b
  7138. Set gamma_b expression.
  7139. @item gamma_weight
  7140. Set gamma_weight expression.
  7141. The command accepts the same syntax of the corresponding option.
  7142. If the specified expression is not valid, it is kept at its current
  7143. value.
  7144. @end table
  7145. @section erosion
  7146. Apply erosion effect to the video.
  7147. This filter replaces the pixel by the local(3x3) minimum.
  7148. It accepts the following options:
  7149. @table @option
  7150. @item threshold0
  7151. @item threshold1
  7152. @item threshold2
  7153. @item threshold3
  7154. Limit the maximum change for each plane, default is 65535.
  7155. If 0, plane will remain unchanged.
  7156. @item coordinates
  7157. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7158. pixels are used.
  7159. Flags to local 3x3 coordinates maps like this:
  7160. 1 2 3
  7161. 4 5
  7162. 6 7 8
  7163. @end table
  7164. @section extractplanes
  7165. Extract color channel components from input video stream into
  7166. separate grayscale video streams.
  7167. The filter accepts the following option:
  7168. @table @option
  7169. @item planes
  7170. Set plane(s) to extract.
  7171. Available values for planes are:
  7172. @table @samp
  7173. @item y
  7174. @item u
  7175. @item v
  7176. @item a
  7177. @item r
  7178. @item g
  7179. @item b
  7180. @end table
  7181. Choosing planes not available in the input will result in an error.
  7182. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7183. with @code{y}, @code{u}, @code{v} planes at same time.
  7184. @end table
  7185. @subsection Examples
  7186. @itemize
  7187. @item
  7188. Extract luma, u and v color channel component from input video frame
  7189. into 3 grayscale outputs:
  7190. @example
  7191. 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
  7192. @end example
  7193. @end itemize
  7194. @section elbg
  7195. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7196. For each input image, the filter will compute the optimal mapping from
  7197. the input to the output given the codebook length, that is the number
  7198. of distinct output colors.
  7199. This filter accepts the following options.
  7200. @table @option
  7201. @item codebook_length, l
  7202. Set codebook length. The value must be a positive integer, and
  7203. represents the number of distinct output colors. Default value is 256.
  7204. @item nb_steps, n
  7205. Set the maximum number of iterations to apply for computing the optimal
  7206. mapping. The higher the value the better the result and the higher the
  7207. computation time. Default value is 1.
  7208. @item seed, s
  7209. Set a random seed, must be an integer included between 0 and
  7210. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7211. will try to use a good random seed on a best effort basis.
  7212. @item pal8
  7213. Set pal8 output pixel format. This option does not work with codebook
  7214. length greater than 256.
  7215. @end table
  7216. @section entropy
  7217. Measure graylevel entropy in histogram of color channels of video frames.
  7218. It accepts the following parameters:
  7219. @table @option
  7220. @item mode
  7221. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7222. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7223. between neighbour histogram values.
  7224. @end table
  7225. @section fade
  7226. Apply a fade-in/out effect to the input video.
  7227. It accepts the following parameters:
  7228. @table @option
  7229. @item type, t
  7230. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7231. effect.
  7232. Default is @code{in}.
  7233. @item start_frame, s
  7234. Specify the number of the frame to start applying the fade
  7235. effect at. Default is 0.
  7236. @item nb_frames, n
  7237. The number of frames that the fade effect lasts. At the end of the
  7238. fade-in effect, the output video will have the same intensity as the input video.
  7239. At the end of the fade-out transition, the output video will be filled with the
  7240. selected @option{color}.
  7241. Default is 25.
  7242. @item alpha
  7243. If set to 1, fade only alpha channel, if one exists on the input.
  7244. Default value is 0.
  7245. @item start_time, st
  7246. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7247. effect. If both start_frame and start_time are specified, the fade will start at
  7248. whichever comes last. Default is 0.
  7249. @item duration, d
  7250. The number of seconds for which the fade effect has to last. At the end of the
  7251. fade-in effect the output video will have the same intensity as the input video,
  7252. at the end of the fade-out transition the output video will be filled with the
  7253. selected @option{color}.
  7254. If both duration and nb_frames are specified, duration is used. Default is 0
  7255. (nb_frames is used by default).
  7256. @item color, c
  7257. Specify the color of the fade. Default is "black".
  7258. @end table
  7259. @subsection Examples
  7260. @itemize
  7261. @item
  7262. Fade in the first 30 frames of video:
  7263. @example
  7264. fade=in:0:30
  7265. @end example
  7266. The command above is equivalent to:
  7267. @example
  7268. fade=t=in:s=0:n=30
  7269. @end example
  7270. @item
  7271. Fade out the last 45 frames of a 200-frame video:
  7272. @example
  7273. fade=out:155:45
  7274. fade=type=out:start_frame=155:nb_frames=45
  7275. @end example
  7276. @item
  7277. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7278. @example
  7279. fade=in:0:25, fade=out:975:25
  7280. @end example
  7281. @item
  7282. Make the first 5 frames yellow, then fade in from frame 5-24:
  7283. @example
  7284. fade=in:5:20:color=yellow
  7285. @end example
  7286. @item
  7287. Fade in alpha over first 25 frames of video:
  7288. @example
  7289. fade=in:0:25:alpha=1
  7290. @end example
  7291. @item
  7292. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7293. @example
  7294. fade=t=in:st=5.5:d=0.5
  7295. @end example
  7296. @end itemize
  7297. @section fftfilt
  7298. Apply arbitrary expressions to samples in frequency domain
  7299. @table @option
  7300. @item dc_Y
  7301. Adjust the dc value (gain) of the luma plane of the image. The filter
  7302. accepts an integer value in range @code{0} to @code{1000}. The default
  7303. value is set to @code{0}.
  7304. @item dc_U
  7305. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7306. filter accepts an integer value in range @code{0} to @code{1000}. The
  7307. default value is set to @code{0}.
  7308. @item dc_V
  7309. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7310. filter accepts an integer value in range @code{0} to @code{1000}. The
  7311. default value is set to @code{0}.
  7312. @item weight_Y
  7313. Set the frequency domain weight expression for the luma plane.
  7314. @item weight_U
  7315. Set the frequency domain weight expression for the 1st chroma plane.
  7316. @item weight_V
  7317. Set the frequency domain weight expression for the 2nd chroma plane.
  7318. @item eval
  7319. Set when the expressions are evaluated.
  7320. It accepts the following values:
  7321. @table @samp
  7322. @item init
  7323. Only evaluate expressions once during the filter initialization.
  7324. @item frame
  7325. Evaluate expressions for each incoming frame.
  7326. @end table
  7327. Default value is @samp{init}.
  7328. The filter accepts the following variables:
  7329. @item X
  7330. @item Y
  7331. The coordinates of the current sample.
  7332. @item W
  7333. @item H
  7334. The width and height of the image.
  7335. @item N
  7336. The number of input frame, starting from 0.
  7337. @end table
  7338. @subsection Examples
  7339. @itemize
  7340. @item
  7341. High-pass:
  7342. @example
  7343. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7344. @end example
  7345. @item
  7346. Low-pass:
  7347. @example
  7348. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7349. @end example
  7350. @item
  7351. Sharpen:
  7352. @example
  7353. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7354. @end example
  7355. @item
  7356. Blur:
  7357. @example
  7358. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7359. @end example
  7360. @end itemize
  7361. @section fftdnoiz
  7362. Denoise frames using 3D FFT (frequency domain filtering).
  7363. The filter accepts the following options:
  7364. @table @option
  7365. @item sigma
  7366. Set the noise sigma constant. This sets denoising strength.
  7367. Default value is 1. Allowed range is from 0 to 30.
  7368. Using very high sigma with low overlap may give blocking artifacts.
  7369. @item amount
  7370. Set amount of denoising. By default all detected noise is reduced.
  7371. Default value is 1. Allowed range is from 0 to 1.
  7372. @item block
  7373. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7374. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7375. block size in pixels is 2^4 which is 16.
  7376. @item overlap
  7377. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7378. @item prev
  7379. Set number of previous frames to use for denoising. By default is set to 0.
  7380. @item next
  7381. Set number of next frames to to use for denoising. By default is set to 0.
  7382. @item planes
  7383. Set planes which will be filtered, by default are all available filtered
  7384. except alpha.
  7385. @end table
  7386. @section field
  7387. Extract a single field from an interlaced image using stride
  7388. arithmetic to avoid wasting CPU time. The output frames are marked as
  7389. non-interlaced.
  7390. The filter accepts the following options:
  7391. @table @option
  7392. @item type
  7393. Specify whether to extract the top (if the value is @code{0} or
  7394. @code{top}) or the bottom field (if the value is @code{1} or
  7395. @code{bottom}).
  7396. @end table
  7397. @section fieldhint
  7398. Create new frames by copying the top and bottom fields from surrounding frames
  7399. supplied as numbers by the hint file.
  7400. @table @option
  7401. @item hint
  7402. Set file containing hints: absolute/relative frame numbers.
  7403. There must be one line for each frame in a clip. Each line must contain two
  7404. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7405. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7406. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7407. for @code{relative} mode. First number tells from which frame to pick up top
  7408. field and second number tells from which frame to pick up bottom field.
  7409. If optionally followed by @code{+} output frame will be marked as interlaced,
  7410. else if followed by @code{-} output frame will be marked as progressive, else
  7411. it will be marked same as input frame.
  7412. If line starts with @code{#} or @code{;} that line is skipped.
  7413. @item mode
  7414. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7415. @end table
  7416. Example of first several lines of @code{hint} file for @code{relative} mode:
  7417. @example
  7418. 0,0 - # first frame
  7419. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7420. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7421. 1,0 -
  7422. 0,0 -
  7423. 0,0 -
  7424. 1,0 -
  7425. 1,0 -
  7426. 1,0 -
  7427. 0,0 -
  7428. 0,0 -
  7429. 1,0 -
  7430. 1,0 -
  7431. 1,0 -
  7432. 0,0 -
  7433. @end example
  7434. @section fieldmatch
  7435. Field matching filter for inverse telecine. It is meant to reconstruct the
  7436. progressive frames from a telecined stream. The filter does not drop duplicated
  7437. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7438. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7439. The separation of the field matching and the decimation is notably motivated by
  7440. the possibility of inserting a de-interlacing filter fallback between the two.
  7441. If the source has mixed telecined and real interlaced content,
  7442. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7443. But these remaining combed frames will be marked as interlaced, and thus can be
  7444. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7445. In addition to the various configuration options, @code{fieldmatch} can take an
  7446. optional second stream, activated through the @option{ppsrc} option. If
  7447. enabled, the frames reconstruction will be based on the fields and frames from
  7448. this second stream. This allows the first input to be pre-processed in order to
  7449. help the various algorithms of the filter, while keeping the output lossless
  7450. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7451. or brightness/contrast adjustments can help.
  7452. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7453. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7454. which @code{fieldmatch} is based on. While the semantic and usage are very
  7455. close, some behaviour and options names can differ.
  7456. The @ref{decimate} filter currently only works for constant frame rate input.
  7457. If your input has mixed telecined (30fps) and progressive content with a lower
  7458. framerate like 24fps use the following filterchain to produce the necessary cfr
  7459. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7460. The filter accepts the following options:
  7461. @table @option
  7462. @item order
  7463. Specify the assumed field order of the input stream. Available values are:
  7464. @table @samp
  7465. @item auto
  7466. Auto detect parity (use FFmpeg's internal parity value).
  7467. @item bff
  7468. Assume bottom field first.
  7469. @item tff
  7470. Assume top field first.
  7471. @end table
  7472. Note that it is sometimes recommended not to trust the parity announced by the
  7473. stream.
  7474. Default value is @var{auto}.
  7475. @item mode
  7476. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7477. sense that it won't risk creating jerkiness due to duplicate frames when
  7478. possible, but if there are bad edits or blended fields it will end up
  7479. outputting combed frames when a good match might actually exist. On the other
  7480. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7481. but will almost always find a good frame if there is one. The other values are
  7482. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7483. jerkiness and creating duplicate frames versus finding good matches in sections
  7484. with bad edits, orphaned fields, blended fields, etc.
  7485. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7486. Available values are:
  7487. @table @samp
  7488. @item pc
  7489. 2-way matching (p/c)
  7490. @item pc_n
  7491. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7492. @item pc_u
  7493. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7494. @item pc_n_ub
  7495. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7496. still combed (p/c + n + u/b)
  7497. @item pcn
  7498. 3-way matching (p/c/n)
  7499. @item pcn_ub
  7500. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7501. detected as combed (p/c/n + u/b)
  7502. @end table
  7503. The parenthesis at the end indicate the matches that would be used for that
  7504. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7505. @var{top}).
  7506. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7507. the slowest.
  7508. Default value is @var{pc_n}.
  7509. @item ppsrc
  7510. Mark the main input stream as a pre-processed input, and enable the secondary
  7511. input stream as the clean source to pick the fields from. See the filter
  7512. introduction for more details. It is similar to the @option{clip2} feature from
  7513. VFM/TFM.
  7514. Default value is @code{0} (disabled).
  7515. @item field
  7516. Set the field to match from. It is recommended to set this to the same value as
  7517. @option{order} unless you experience matching failures with that setting. In
  7518. certain circumstances changing the field that is used to match from can have a
  7519. large impact on matching performance. Available values are:
  7520. @table @samp
  7521. @item auto
  7522. Automatic (same value as @option{order}).
  7523. @item bottom
  7524. Match from the bottom field.
  7525. @item top
  7526. Match from the top field.
  7527. @end table
  7528. Default value is @var{auto}.
  7529. @item mchroma
  7530. Set whether or not chroma is included during the match comparisons. In most
  7531. cases it is recommended to leave this enabled. You should set this to @code{0}
  7532. only if your clip has bad chroma problems such as heavy rainbowing or other
  7533. artifacts. Setting this to @code{0} could also be used to speed things up at
  7534. the cost of some accuracy.
  7535. Default value is @code{1}.
  7536. @item y0
  7537. @item y1
  7538. These define an exclusion band which excludes the lines between @option{y0} and
  7539. @option{y1} from being included in the field matching decision. An exclusion
  7540. band can be used to ignore subtitles, a logo, or other things that may
  7541. interfere with the matching. @option{y0} sets the starting scan line and
  7542. @option{y1} sets the ending line; all lines in between @option{y0} and
  7543. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7544. @option{y0} and @option{y1} to the same value will disable the feature.
  7545. @option{y0} and @option{y1} defaults to @code{0}.
  7546. @item scthresh
  7547. Set the scene change detection threshold as a percentage of maximum change on
  7548. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7549. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7550. @option{scthresh} is @code{[0.0, 100.0]}.
  7551. Default value is @code{12.0}.
  7552. @item combmatch
  7553. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7554. account the combed scores of matches when deciding what match to use as the
  7555. final match. Available values are:
  7556. @table @samp
  7557. @item none
  7558. No final matching based on combed scores.
  7559. @item sc
  7560. Combed scores are only used when a scene change is detected.
  7561. @item full
  7562. Use combed scores all the time.
  7563. @end table
  7564. Default is @var{sc}.
  7565. @item combdbg
  7566. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7567. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7568. Available values are:
  7569. @table @samp
  7570. @item none
  7571. No forced calculation.
  7572. @item pcn
  7573. Force p/c/n calculations.
  7574. @item pcnub
  7575. Force p/c/n/u/b calculations.
  7576. @end table
  7577. Default value is @var{none}.
  7578. @item cthresh
  7579. This is the area combing threshold used for combed frame detection. This
  7580. essentially controls how "strong" or "visible" combing must be to be detected.
  7581. Larger values mean combing must be more visible and smaller values mean combing
  7582. can be less visible or strong and still be detected. Valid settings are from
  7583. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7584. be detected as combed). This is basically a pixel difference value. A good
  7585. range is @code{[8, 12]}.
  7586. Default value is @code{9}.
  7587. @item chroma
  7588. Sets whether or not chroma is considered in the combed frame decision. Only
  7589. disable this if your source has chroma problems (rainbowing, etc.) that are
  7590. causing problems for the combed frame detection with chroma enabled. Actually,
  7591. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7592. where there is chroma only combing in the source.
  7593. Default value is @code{0}.
  7594. @item blockx
  7595. @item blocky
  7596. Respectively set the x-axis and y-axis size of the window used during combed
  7597. frame detection. This has to do with the size of the area in which
  7598. @option{combpel} pixels are required to be detected as combed for a frame to be
  7599. declared combed. See the @option{combpel} parameter description for more info.
  7600. Possible values are any number that is a power of 2 starting at 4 and going up
  7601. to 512.
  7602. Default value is @code{16}.
  7603. @item combpel
  7604. The number of combed pixels inside any of the @option{blocky} by
  7605. @option{blockx} size blocks on the frame for the frame to be detected as
  7606. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7607. setting controls "how much" combing there must be in any localized area (a
  7608. window defined by the @option{blockx} and @option{blocky} settings) on the
  7609. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7610. which point no frames will ever be detected as combed). This setting is known
  7611. as @option{MI} in TFM/VFM vocabulary.
  7612. Default value is @code{80}.
  7613. @end table
  7614. @anchor{p/c/n/u/b meaning}
  7615. @subsection p/c/n/u/b meaning
  7616. @subsubsection p/c/n
  7617. We assume the following telecined stream:
  7618. @example
  7619. Top fields: 1 2 2 3 4
  7620. Bottom fields: 1 2 3 4 4
  7621. @end example
  7622. The numbers correspond to the progressive frame the fields relate to. Here, the
  7623. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7624. When @code{fieldmatch} is configured to run a matching from bottom
  7625. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7626. @example
  7627. Input stream:
  7628. T 1 2 2 3 4
  7629. B 1 2 3 4 4 <-- matching reference
  7630. Matches: c c n n c
  7631. Output stream:
  7632. T 1 2 3 4 4
  7633. B 1 2 3 4 4
  7634. @end example
  7635. As a result of the field matching, we can see that some frames get duplicated.
  7636. To perform a complete inverse telecine, you need to rely on a decimation filter
  7637. after this operation. See for instance the @ref{decimate} filter.
  7638. The same operation now matching from top fields (@option{field}=@var{top})
  7639. looks like this:
  7640. @example
  7641. Input stream:
  7642. T 1 2 2 3 4 <-- matching reference
  7643. B 1 2 3 4 4
  7644. Matches: c c p p c
  7645. Output stream:
  7646. T 1 2 2 3 4
  7647. B 1 2 2 3 4
  7648. @end example
  7649. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7650. basically, they refer to the frame and field of the opposite parity:
  7651. @itemize
  7652. @item @var{p} matches the field of the opposite parity in the previous frame
  7653. @item @var{c} matches the field of the opposite parity in the current frame
  7654. @item @var{n} matches the field of the opposite parity in the next frame
  7655. @end itemize
  7656. @subsubsection u/b
  7657. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7658. from the opposite parity flag. In the following examples, we assume that we are
  7659. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7660. 'x' is placed above and below each matched fields.
  7661. With bottom matching (@option{field}=@var{bottom}):
  7662. @example
  7663. Match: c p n b u
  7664. x x x x x
  7665. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7666. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7667. x x x x x
  7668. Output frames:
  7669. 2 1 2 2 2
  7670. 2 2 2 1 3
  7671. @end example
  7672. With top matching (@option{field}=@var{top}):
  7673. @example
  7674. Match: c p n b u
  7675. x x x x x
  7676. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7677. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7678. x x x x x
  7679. Output frames:
  7680. 2 2 2 1 2
  7681. 2 1 3 2 2
  7682. @end example
  7683. @subsection Examples
  7684. Simple IVTC of a top field first telecined stream:
  7685. @example
  7686. fieldmatch=order=tff:combmatch=none, decimate
  7687. @end example
  7688. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7689. @example
  7690. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7691. @end example
  7692. @section fieldorder
  7693. Transform the field order of the input video.
  7694. It accepts the following parameters:
  7695. @table @option
  7696. @item order
  7697. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7698. for bottom field first.
  7699. @end table
  7700. The default value is @samp{tff}.
  7701. The transformation is done by shifting the picture content up or down
  7702. by one line, and filling the remaining line with appropriate picture content.
  7703. This method is consistent with most broadcast field order converters.
  7704. If the input video is not flagged as being interlaced, or it is already
  7705. flagged as being of the required output field order, then this filter does
  7706. not alter the incoming video.
  7707. It is very useful when converting to or from PAL DV material,
  7708. which is bottom field first.
  7709. For example:
  7710. @example
  7711. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7712. @end example
  7713. @section fifo, afifo
  7714. Buffer input images and send them when they are requested.
  7715. It is mainly useful when auto-inserted by the libavfilter
  7716. framework.
  7717. It does not take parameters.
  7718. @section fillborders
  7719. Fill borders of the input video, without changing video stream dimensions.
  7720. Sometimes video can have garbage at the four edges and you may not want to
  7721. crop video input to keep size multiple of some number.
  7722. This filter accepts the following options:
  7723. @table @option
  7724. @item left
  7725. Number of pixels to fill from left border.
  7726. @item right
  7727. Number of pixels to fill from right border.
  7728. @item top
  7729. Number of pixels to fill from top border.
  7730. @item bottom
  7731. Number of pixels to fill from bottom border.
  7732. @item mode
  7733. Set fill mode.
  7734. It accepts the following values:
  7735. @table @samp
  7736. @item smear
  7737. fill pixels using outermost pixels
  7738. @item mirror
  7739. fill pixels using mirroring
  7740. @item fixed
  7741. fill pixels with constant value
  7742. @end table
  7743. Default is @var{smear}.
  7744. @item color
  7745. Set color for pixels in fixed mode. Default is @var{black}.
  7746. @end table
  7747. @section find_rect
  7748. Find a rectangular object
  7749. It accepts the following options:
  7750. @table @option
  7751. @item object
  7752. Filepath of the object image, needs to be in gray8.
  7753. @item threshold
  7754. Detection threshold, default is 0.5.
  7755. @item mipmaps
  7756. Number of mipmaps, default is 3.
  7757. @item xmin, ymin, xmax, ymax
  7758. Specifies the rectangle in which to search.
  7759. @end table
  7760. @subsection Examples
  7761. @itemize
  7762. @item
  7763. Generate a representative palette of a given video using @command{ffmpeg}:
  7764. @example
  7765. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7766. @end example
  7767. @end itemize
  7768. @section cover_rect
  7769. Cover a rectangular object
  7770. It accepts the following options:
  7771. @table @option
  7772. @item cover
  7773. Filepath of the optional cover image, needs to be in yuv420.
  7774. @item mode
  7775. Set covering mode.
  7776. It accepts the following values:
  7777. @table @samp
  7778. @item cover
  7779. cover it by the supplied image
  7780. @item blur
  7781. cover it by interpolating the surrounding pixels
  7782. @end table
  7783. Default value is @var{blur}.
  7784. @end table
  7785. @subsection Examples
  7786. @itemize
  7787. @item
  7788. Generate a representative palette of a given video using @command{ffmpeg}:
  7789. @example
  7790. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7791. @end example
  7792. @end itemize
  7793. @section floodfill
  7794. Flood area with values of same pixel components with another values.
  7795. It accepts the following options:
  7796. @table @option
  7797. @item x
  7798. Set pixel x coordinate.
  7799. @item y
  7800. Set pixel y coordinate.
  7801. @item s0
  7802. Set source #0 component value.
  7803. @item s1
  7804. Set source #1 component value.
  7805. @item s2
  7806. Set source #2 component value.
  7807. @item s3
  7808. Set source #3 component value.
  7809. @item d0
  7810. Set destination #0 component value.
  7811. @item d1
  7812. Set destination #1 component value.
  7813. @item d2
  7814. Set destination #2 component value.
  7815. @item d3
  7816. Set destination #3 component value.
  7817. @end table
  7818. @anchor{format}
  7819. @section format
  7820. Convert the input video to one of the specified pixel formats.
  7821. Libavfilter will try to pick one that is suitable as input to
  7822. the next filter.
  7823. It accepts the following parameters:
  7824. @table @option
  7825. @item pix_fmts
  7826. A '|'-separated list of pixel format names, such as
  7827. "pix_fmts=yuv420p|monow|rgb24".
  7828. @end table
  7829. @subsection Examples
  7830. @itemize
  7831. @item
  7832. Convert the input video to the @var{yuv420p} format
  7833. @example
  7834. format=pix_fmts=yuv420p
  7835. @end example
  7836. Convert the input video to any of the formats in the list
  7837. @example
  7838. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7839. @end example
  7840. @end itemize
  7841. @anchor{fps}
  7842. @section fps
  7843. Convert the video to specified constant frame rate by duplicating or dropping
  7844. frames as necessary.
  7845. It accepts the following parameters:
  7846. @table @option
  7847. @item fps
  7848. The desired output frame rate. The default is @code{25}.
  7849. @item start_time
  7850. Assume the first PTS should be the given value, in seconds. This allows for
  7851. padding/trimming at the start of stream. By default, no assumption is made
  7852. about the first frame's expected PTS, so no padding or trimming is done.
  7853. For example, this could be set to 0 to pad the beginning with duplicates of
  7854. the first frame if a video stream starts after the audio stream or to trim any
  7855. frames with a negative PTS.
  7856. @item round
  7857. Timestamp (PTS) rounding method.
  7858. Possible values are:
  7859. @table @option
  7860. @item zero
  7861. round towards 0
  7862. @item inf
  7863. round away from 0
  7864. @item down
  7865. round towards -infinity
  7866. @item up
  7867. round towards +infinity
  7868. @item near
  7869. round to nearest
  7870. @end table
  7871. The default is @code{near}.
  7872. @item eof_action
  7873. Action performed when reading the last frame.
  7874. Possible values are:
  7875. @table @option
  7876. @item round
  7877. Use same timestamp rounding method as used for other frames.
  7878. @item pass
  7879. Pass through last frame if input duration has not been reached yet.
  7880. @end table
  7881. The default is @code{round}.
  7882. @end table
  7883. Alternatively, the options can be specified as a flat string:
  7884. @var{fps}[:@var{start_time}[:@var{round}]].
  7885. See also the @ref{setpts} filter.
  7886. @subsection Examples
  7887. @itemize
  7888. @item
  7889. A typical usage in order to set the fps to 25:
  7890. @example
  7891. fps=fps=25
  7892. @end example
  7893. @item
  7894. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7895. @example
  7896. fps=fps=film:round=near
  7897. @end example
  7898. @end itemize
  7899. @section framepack
  7900. Pack two different video streams into a stereoscopic video, setting proper
  7901. metadata on supported codecs. The two views should have the same size and
  7902. framerate and processing will stop when the shorter video ends. Please note
  7903. that you may conveniently adjust view properties with the @ref{scale} and
  7904. @ref{fps} filters.
  7905. It accepts the following parameters:
  7906. @table @option
  7907. @item format
  7908. The desired packing format. Supported values are:
  7909. @table @option
  7910. @item sbs
  7911. The views are next to each other (default).
  7912. @item tab
  7913. The views are on top of each other.
  7914. @item lines
  7915. The views are packed by line.
  7916. @item columns
  7917. The views are packed by column.
  7918. @item frameseq
  7919. The views are temporally interleaved.
  7920. @end table
  7921. @end table
  7922. Some examples:
  7923. @example
  7924. # Convert left and right views into a frame-sequential video
  7925. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7926. # Convert views into a side-by-side video with the same output resolution as the input
  7927. 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
  7928. @end example
  7929. @section framerate
  7930. Change the frame rate by interpolating new video output frames from the source
  7931. frames.
  7932. This filter is not designed to function correctly with interlaced media. If
  7933. you wish to change the frame rate of interlaced media then you are required
  7934. to deinterlace before this filter and re-interlace after this filter.
  7935. A description of the accepted options follows.
  7936. @table @option
  7937. @item fps
  7938. Specify the output frames per second. This option can also be specified
  7939. as a value alone. The default is @code{50}.
  7940. @item interp_start
  7941. Specify the start of a range where the output frame will be created as a
  7942. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7943. the default is @code{15}.
  7944. @item interp_end
  7945. Specify the end of a range where the output frame will be created as a
  7946. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7947. the default is @code{240}.
  7948. @item scene
  7949. Specify the level at which a scene change is detected as a value between
  7950. 0 and 100 to indicate a new scene; a low value reflects a low
  7951. probability for the current frame to introduce a new scene, while a higher
  7952. value means the current frame is more likely to be one.
  7953. The default is @code{8.2}.
  7954. @item flags
  7955. Specify flags influencing the filter process.
  7956. Available value for @var{flags} is:
  7957. @table @option
  7958. @item scene_change_detect, scd
  7959. Enable scene change detection using the value of the option @var{scene}.
  7960. This flag is enabled by default.
  7961. @end table
  7962. @end table
  7963. @section framestep
  7964. Select one frame every N-th frame.
  7965. This filter accepts the following option:
  7966. @table @option
  7967. @item step
  7968. Select frame after every @code{step} frames.
  7969. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7970. @end table
  7971. @section freezedetect
  7972. Detect frozen video.
  7973. This filter logs a message and sets frame metadata when it detects that the
  7974. input video has no significant change in content during a specified duration.
  7975. Video freeze detection calculates the mean average absolute difference of all
  7976. the components of video frames and compares it to a noise floor.
  7977. The printed times and duration are expressed in seconds. The
  7978. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  7979. whose timestamp equals or exceeds the detection duration and it contains the
  7980. timestamp of the first frame of the freeze. The
  7981. @code{lavfi.freezedetect.freeze_duration} and
  7982. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  7983. after the freeze.
  7984. The filter accepts the following options:
  7985. @table @option
  7986. @item noise, n
  7987. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  7988. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  7989. 0.001.
  7990. @item duration, d
  7991. Set freeze duration until notification (default is 2 seconds).
  7992. @end table
  7993. @anchor{frei0r}
  7994. @section frei0r
  7995. Apply a frei0r effect to the input video.
  7996. To enable the compilation of this filter, you need to install the frei0r
  7997. header and configure FFmpeg with @code{--enable-frei0r}.
  7998. It accepts the following parameters:
  7999. @table @option
  8000. @item filter_name
  8001. The name of the frei0r effect to load. If the environment variable
  8002. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8003. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8004. Otherwise, the standard frei0r paths are searched, in this order:
  8005. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8006. @file{/usr/lib/frei0r-1/}.
  8007. @item filter_params
  8008. A '|'-separated list of parameters to pass to the frei0r effect.
  8009. @end table
  8010. A frei0r effect parameter can be a boolean (its value is either
  8011. "y" or "n"), a double, a color (specified as
  8012. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8013. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8014. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8015. a position (specified as @var{X}/@var{Y}, where
  8016. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8017. The number and types of parameters depend on the loaded effect. If an
  8018. effect parameter is not specified, the default value is set.
  8019. @subsection Examples
  8020. @itemize
  8021. @item
  8022. Apply the distort0r effect, setting the first two double parameters:
  8023. @example
  8024. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8025. @end example
  8026. @item
  8027. Apply the colordistance effect, taking a color as the first parameter:
  8028. @example
  8029. frei0r=colordistance:0.2/0.3/0.4
  8030. frei0r=colordistance:violet
  8031. frei0r=colordistance:0x112233
  8032. @end example
  8033. @item
  8034. Apply the perspective effect, specifying the top left and top right image
  8035. positions:
  8036. @example
  8037. frei0r=perspective:0.2/0.2|0.8/0.2
  8038. @end example
  8039. @end itemize
  8040. For more information, see
  8041. @url{http://frei0r.dyne.org}
  8042. @section fspp
  8043. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8044. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8045. processing filter, one of them is performed once per block, not per pixel.
  8046. This allows for much higher speed.
  8047. The filter accepts the following options:
  8048. @table @option
  8049. @item quality
  8050. Set quality. This option defines the number of levels for averaging. It accepts
  8051. an integer in the range 4-5. Default value is @code{4}.
  8052. @item qp
  8053. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8054. If not set, the filter will use the QP from the video stream (if available).
  8055. @item strength
  8056. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8057. more details but also more artifacts, while higher values make the image smoother
  8058. but also blurrier. Default value is @code{0} − PSNR optimal.
  8059. @item use_bframe_qp
  8060. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8061. option may cause flicker since the B-Frames have often larger QP. Default is
  8062. @code{0} (not enabled).
  8063. @end table
  8064. @section gblur
  8065. Apply Gaussian blur filter.
  8066. The filter accepts the following options:
  8067. @table @option
  8068. @item sigma
  8069. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8070. @item steps
  8071. Set number of steps for Gaussian approximation. Default is @code{1}.
  8072. @item planes
  8073. Set which planes to filter. By default all planes are filtered.
  8074. @item sigmaV
  8075. Set vertical sigma, if negative it will be same as @code{sigma}.
  8076. Default is @code{-1}.
  8077. @end table
  8078. @section geq
  8079. Apply generic equation to each pixel.
  8080. The filter accepts the following options:
  8081. @table @option
  8082. @item lum_expr, lum
  8083. Set the luminance expression.
  8084. @item cb_expr, cb
  8085. Set the chrominance blue expression.
  8086. @item cr_expr, cr
  8087. Set the chrominance red expression.
  8088. @item alpha_expr, a
  8089. Set the alpha expression.
  8090. @item red_expr, r
  8091. Set the red expression.
  8092. @item green_expr, g
  8093. Set the green expression.
  8094. @item blue_expr, b
  8095. Set the blue expression.
  8096. @end table
  8097. The colorspace is selected according to the specified options. If one
  8098. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8099. options is specified, the filter will automatically select a YCbCr
  8100. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8101. @option{blue_expr} options is specified, it will select an RGB
  8102. colorspace.
  8103. If one of the chrominance expression is not defined, it falls back on the other
  8104. one. If no alpha expression is specified it will evaluate to opaque value.
  8105. If none of chrominance expressions are specified, they will evaluate
  8106. to the luminance expression.
  8107. The expressions can use the following variables and functions:
  8108. @table @option
  8109. @item N
  8110. The sequential number of the filtered frame, starting from @code{0}.
  8111. @item X
  8112. @item Y
  8113. The coordinates of the current sample.
  8114. @item W
  8115. @item H
  8116. The width and height of the image.
  8117. @item SW
  8118. @item SH
  8119. Width and height scale depending on the currently filtered plane. It is the
  8120. ratio between the corresponding luma plane number of pixels and the current
  8121. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8122. @code{0.5,0.5} for chroma planes.
  8123. @item T
  8124. Time of the current frame, expressed in seconds.
  8125. @item p(x, y)
  8126. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8127. plane.
  8128. @item lum(x, y)
  8129. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8130. plane.
  8131. @item cb(x, y)
  8132. Return the value of the pixel at location (@var{x},@var{y}) of the
  8133. blue-difference chroma plane. Return 0 if there is no such plane.
  8134. @item cr(x, y)
  8135. Return the value of the pixel at location (@var{x},@var{y}) of the
  8136. red-difference chroma plane. Return 0 if there is no such plane.
  8137. @item r(x, y)
  8138. @item g(x, y)
  8139. @item b(x, y)
  8140. Return the value of the pixel at location (@var{x},@var{y}) of the
  8141. red/green/blue component. Return 0 if there is no such component.
  8142. @item alpha(x, y)
  8143. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8144. plane. Return 0 if there is no such plane.
  8145. @end table
  8146. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8147. automatically clipped to the closer edge.
  8148. @subsection Examples
  8149. @itemize
  8150. @item
  8151. Flip the image horizontally:
  8152. @example
  8153. geq=p(W-X\,Y)
  8154. @end example
  8155. @item
  8156. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8157. wavelength of 100 pixels:
  8158. @example
  8159. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8160. @end example
  8161. @item
  8162. Generate a fancy enigmatic moving light:
  8163. @example
  8164. 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
  8165. @end example
  8166. @item
  8167. Generate a quick emboss effect:
  8168. @example
  8169. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8170. @end example
  8171. @item
  8172. Modify RGB components depending on pixel position:
  8173. @example
  8174. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8175. @end example
  8176. @item
  8177. Create a radial gradient that is the same size as the input (also see
  8178. the @ref{vignette} filter):
  8179. @example
  8180. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8181. @end example
  8182. @end itemize
  8183. @section gradfun
  8184. Fix the banding artifacts that are sometimes introduced into nearly flat
  8185. regions by truncation to 8-bit color depth.
  8186. Interpolate the gradients that should go where the bands are, and
  8187. dither them.
  8188. It is designed for playback only. Do not use it prior to
  8189. lossy compression, because compression tends to lose the dither and
  8190. bring back the bands.
  8191. It accepts the following parameters:
  8192. @table @option
  8193. @item strength
  8194. The maximum amount by which the filter will change any one pixel. This is also
  8195. the threshold for detecting nearly flat regions. Acceptable values range from
  8196. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8197. valid range.
  8198. @item radius
  8199. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8200. gradients, but also prevents the filter from modifying the pixels near detailed
  8201. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8202. values will be clipped to the valid range.
  8203. @end table
  8204. Alternatively, the options can be specified as a flat string:
  8205. @var{strength}[:@var{radius}]
  8206. @subsection Examples
  8207. @itemize
  8208. @item
  8209. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8210. @example
  8211. gradfun=3.5:8
  8212. @end example
  8213. @item
  8214. Specify radius, omitting the strength (which will fall-back to the default
  8215. value):
  8216. @example
  8217. gradfun=radius=8
  8218. @end example
  8219. @end itemize
  8220. @section graphmonitor, agraphmonitor
  8221. Show various filtergraph stats.
  8222. With this filter one can debug complete filtergraph.
  8223. Especially issues with links filling with queued frames.
  8224. The filter accepts the following options:
  8225. @table @option
  8226. @item size, s
  8227. Set video output size. Default is @var{hd720}.
  8228. @item opacity, o
  8229. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8230. @item mode, m
  8231. Set output mode, can be @var{fulll} or @var{compact}.
  8232. In @var{compact} mode only filters with some queued frames have displayed stats.
  8233. @item flags, f
  8234. Set flags which enable which stats are shown in video.
  8235. Available values for flags are:
  8236. @table @samp
  8237. @item queue
  8238. Display number of queued frames in each link.
  8239. @item frame_count_in
  8240. Display number of frames taken from filter.
  8241. @item frame_count_out
  8242. Display number of frames given out from filter.
  8243. @item pts
  8244. Display current filtered frame pts.
  8245. @item time
  8246. Display current filtered frame time.
  8247. @item timebase
  8248. Display time base for filter link.
  8249. @item format
  8250. Display used format for filter link.
  8251. @item size
  8252. Display video size or number of audio channels in case of audio used by filter link.
  8253. @item rate
  8254. Display video frame rate or sample rate in case of audio used by filter link.
  8255. @end table
  8256. @item rate, r
  8257. Set upper limit for video rate of output stream, Default value is @var{25}.
  8258. This guarantee that output video frame rate will not be higher than this value.
  8259. @end table
  8260. @section greyedge
  8261. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8262. and corrects the scene colors accordingly.
  8263. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8264. The filter accepts the following options:
  8265. @table @option
  8266. @item difford
  8267. The order of differentiation to be applied on the scene. Must be chosen in the range
  8268. [0,2] and default value is 1.
  8269. @item minknorm
  8270. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8271. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8272. max value instead of calculating Minkowski distance.
  8273. @item sigma
  8274. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8275. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8276. can't be equal to 0 if @var{difford} is greater than 0.
  8277. @end table
  8278. @subsection Examples
  8279. @itemize
  8280. @item
  8281. Grey Edge:
  8282. @example
  8283. greyedge=difford=1:minknorm=5:sigma=2
  8284. @end example
  8285. @item
  8286. Max Edge:
  8287. @example
  8288. greyedge=difford=1:minknorm=0:sigma=2
  8289. @end example
  8290. @end itemize
  8291. @anchor{haldclut}
  8292. @section haldclut
  8293. Apply a Hald CLUT to a video stream.
  8294. First input is the video stream to process, and second one is the Hald CLUT.
  8295. The Hald CLUT input can be a simple picture or a complete video stream.
  8296. The filter accepts the following options:
  8297. @table @option
  8298. @item shortest
  8299. Force termination when the shortest input terminates. Default is @code{0}.
  8300. @item repeatlast
  8301. Continue applying the last CLUT after the end of the stream. A value of
  8302. @code{0} disable the filter after the last frame of the CLUT is reached.
  8303. Default is @code{1}.
  8304. @end table
  8305. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8306. filters share the same internals).
  8307. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8308. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8309. @subsection Workflow examples
  8310. @subsubsection Hald CLUT video stream
  8311. Generate an identity Hald CLUT stream altered with various effects:
  8312. @example
  8313. 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
  8314. @end example
  8315. Note: make sure you use a lossless codec.
  8316. Then use it with @code{haldclut} to apply it on some random stream:
  8317. @example
  8318. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8319. @end example
  8320. The Hald CLUT will be applied to the 10 first seconds (duration of
  8321. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8322. to the remaining frames of the @code{mandelbrot} stream.
  8323. @subsubsection Hald CLUT with preview
  8324. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8325. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8326. biggest possible square starting at the top left of the picture. The remaining
  8327. padding pixels (bottom or right) will be ignored. This area can be used to add
  8328. a preview of the Hald CLUT.
  8329. Typically, the following generated Hald CLUT will be supported by the
  8330. @code{haldclut} filter:
  8331. @example
  8332. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8333. pad=iw+320 [padded_clut];
  8334. smptebars=s=320x256, split [a][b];
  8335. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8336. [main][b] overlay=W-320" -frames:v 1 clut.png
  8337. @end example
  8338. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8339. bars are displayed on the right-top, and below the same color bars processed by
  8340. the color changes.
  8341. Then, the effect of this Hald CLUT can be visualized with:
  8342. @example
  8343. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8344. @end example
  8345. @section hflip
  8346. Flip the input video horizontally.
  8347. For example, to horizontally flip the input video with @command{ffmpeg}:
  8348. @example
  8349. ffmpeg -i in.avi -vf "hflip" out.avi
  8350. @end example
  8351. @section histeq
  8352. This filter applies a global color histogram equalization on a
  8353. per-frame basis.
  8354. It can be used to correct video that has a compressed range of pixel
  8355. intensities. The filter redistributes the pixel intensities to
  8356. equalize their distribution across the intensity range. It may be
  8357. viewed as an "automatically adjusting contrast filter". This filter is
  8358. useful only for correcting degraded or poorly captured source
  8359. video.
  8360. The filter accepts the following options:
  8361. @table @option
  8362. @item strength
  8363. Determine the amount of equalization to be applied. As the strength
  8364. is reduced, the distribution of pixel intensities more-and-more
  8365. approaches that of the input frame. The value must be a float number
  8366. in the range [0,1] and defaults to 0.200.
  8367. @item intensity
  8368. Set the maximum intensity that can generated and scale the output
  8369. values appropriately. The strength should be set as desired and then
  8370. the intensity can be limited if needed to avoid washing-out. The value
  8371. must be a float number in the range [0,1] and defaults to 0.210.
  8372. @item antibanding
  8373. Set the antibanding level. If enabled the filter will randomly vary
  8374. the luminance of output pixels by a small amount to avoid banding of
  8375. the histogram. Possible values are @code{none}, @code{weak} or
  8376. @code{strong}. It defaults to @code{none}.
  8377. @end table
  8378. @section histogram
  8379. Compute and draw a color distribution histogram for the input video.
  8380. The computed histogram is a representation of the color component
  8381. distribution in an image.
  8382. Standard histogram displays the color components distribution in an image.
  8383. Displays color graph for each color component. Shows distribution of
  8384. the Y, U, V, A or R, G, B components, depending on input format, in the
  8385. current frame. Below each graph a color component scale meter is shown.
  8386. The filter accepts the following options:
  8387. @table @option
  8388. @item level_height
  8389. Set height of level. Default value is @code{200}.
  8390. Allowed range is [50, 2048].
  8391. @item scale_height
  8392. Set height of color scale. Default value is @code{12}.
  8393. Allowed range is [0, 40].
  8394. @item display_mode
  8395. Set display mode.
  8396. It accepts the following values:
  8397. @table @samp
  8398. @item stack
  8399. Per color component graphs are placed below each other.
  8400. @item parade
  8401. Per color component graphs are placed side by side.
  8402. @item overlay
  8403. Presents information identical to that in the @code{parade}, except
  8404. that the graphs representing color components are superimposed directly
  8405. over one another.
  8406. @end table
  8407. Default is @code{stack}.
  8408. @item levels_mode
  8409. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8410. Default is @code{linear}.
  8411. @item components
  8412. Set what color components to display.
  8413. Default is @code{7}.
  8414. @item fgopacity
  8415. Set foreground opacity. Default is @code{0.7}.
  8416. @item bgopacity
  8417. Set background opacity. Default is @code{0.5}.
  8418. @end table
  8419. @subsection Examples
  8420. @itemize
  8421. @item
  8422. Calculate and draw histogram:
  8423. @example
  8424. ffplay -i input -vf histogram
  8425. @end example
  8426. @end itemize
  8427. @anchor{hqdn3d}
  8428. @section hqdn3d
  8429. This is a high precision/quality 3d denoise filter. It aims to reduce
  8430. image noise, producing smooth images and making still images really
  8431. still. It should enhance compressibility.
  8432. It accepts the following optional parameters:
  8433. @table @option
  8434. @item luma_spatial
  8435. A non-negative floating point number which specifies spatial luma strength.
  8436. It defaults to 4.0.
  8437. @item chroma_spatial
  8438. A non-negative floating point number which specifies spatial chroma strength.
  8439. It defaults to 3.0*@var{luma_spatial}/4.0.
  8440. @item luma_tmp
  8441. A floating point number which specifies luma temporal strength. It defaults to
  8442. 6.0*@var{luma_spatial}/4.0.
  8443. @item chroma_tmp
  8444. A floating point number which specifies chroma temporal strength. It defaults to
  8445. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8446. @end table
  8447. @anchor{hwdownload}
  8448. @section hwdownload
  8449. Download hardware frames to system memory.
  8450. The input must be in hardware frames, and the output a non-hardware format.
  8451. Not all formats will be supported on the output - it may be necessary to insert
  8452. an additional @option{format} filter immediately following in the graph to get
  8453. the output in a supported format.
  8454. @section hwmap
  8455. Map hardware frames to system memory or to another device.
  8456. This filter has several different modes of operation; which one is used depends
  8457. on the input and output formats:
  8458. @itemize
  8459. @item
  8460. Hardware frame input, normal frame output
  8461. Map the input frames to system memory and pass them to the output. If the
  8462. original hardware frame is later required (for example, after overlaying
  8463. something else on part of it), the @option{hwmap} filter can be used again
  8464. in the next mode to retrieve it.
  8465. @item
  8466. Normal frame input, hardware frame output
  8467. If the input is actually a software-mapped hardware frame, then unmap it -
  8468. that is, return the original hardware frame.
  8469. Otherwise, a device must be provided. Create new hardware surfaces on that
  8470. device for the output, then map them back to the software format at the input
  8471. and give those frames to the preceding filter. This will then act like the
  8472. @option{hwupload} filter, but may be able to avoid an additional copy when
  8473. the input is already in a compatible format.
  8474. @item
  8475. Hardware frame input and output
  8476. A device must be supplied for the output, either directly or with the
  8477. @option{derive_device} option. The input and output devices must be of
  8478. different types and compatible - the exact meaning of this is
  8479. system-dependent, but typically it means that they must refer to the same
  8480. underlying hardware context (for example, refer to the same graphics card).
  8481. If the input frames were originally created on the output device, then unmap
  8482. to retrieve the original frames.
  8483. Otherwise, map the frames to the output device - create new hardware frames
  8484. on the output corresponding to the frames on the input.
  8485. @end itemize
  8486. The following additional parameters are accepted:
  8487. @table @option
  8488. @item mode
  8489. Set the frame mapping mode. Some combination of:
  8490. @table @var
  8491. @item read
  8492. The mapped frame should be readable.
  8493. @item write
  8494. The mapped frame should be writeable.
  8495. @item overwrite
  8496. The mapping will always overwrite the entire frame.
  8497. This may improve performance in some cases, as the original contents of the
  8498. frame need not be loaded.
  8499. @item direct
  8500. The mapping must not involve any copying.
  8501. Indirect mappings to copies of frames are created in some cases where either
  8502. direct mapping is not possible or it would have unexpected properties.
  8503. Setting this flag ensures that the mapping is direct and will fail if that is
  8504. not possible.
  8505. @end table
  8506. Defaults to @var{read+write} if not specified.
  8507. @item derive_device @var{type}
  8508. Rather than using the device supplied at initialisation, instead derive a new
  8509. device of type @var{type} from the device the input frames exist on.
  8510. @item reverse
  8511. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8512. and map them back to the source. This may be necessary in some cases where
  8513. a mapping in one direction is required but only the opposite direction is
  8514. supported by the devices being used.
  8515. This option is dangerous - it may break the preceding filter in undefined
  8516. ways if there are any additional constraints on that filter's output.
  8517. Do not use it without fully understanding the implications of its use.
  8518. @end table
  8519. @anchor{hwupload}
  8520. @section hwupload
  8521. Upload system memory frames to hardware surfaces.
  8522. The device to upload to must be supplied when the filter is initialised. If
  8523. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8524. option.
  8525. @anchor{hwupload_cuda}
  8526. @section hwupload_cuda
  8527. Upload system memory frames to a CUDA device.
  8528. It accepts the following optional parameters:
  8529. @table @option
  8530. @item device
  8531. The number of the CUDA device to use
  8532. @end table
  8533. @section hqx
  8534. Apply a high-quality magnification filter designed for pixel art. This filter
  8535. was originally created by Maxim Stepin.
  8536. It accepts the following option:
  8537. @table @option
  8538. @item n
  8539. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8540. @code{hq3x} and @code{4} for @code{hq4x}.
  8541. Default is @code{3}.
  8542. @end table
  8543. @section hstack
  8544. Stack input videos horizontally.
  8545. All streams must be of same pixel format and of same height.
  8546. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8547. to create same output.
  8548. The filter accept the following option:
  8549. @table @option
  8550. @item inputs
  8551. Set number of input streams. Default is 2.
  8552. @item shortest
  8553. If set to 1, force the output to terminate when the shortest input
  8554. terminates. Default value is 0.
  8555. @end table
  8556. @section hue
  8557. Modify the hue and/or the saturation of the input.
  8558. It accepts the following parameters:
  8559. @table @option
  8560. @item h
  8561. Specify the hue angle as a number of degrees. It accepts an expression,
  8562. and defaults to "0".
  8563. @item s
  8564. Specify the saturation in the [-10,10] range. It accepts an expression and
  8565. defaults to "1".
  8566. @item H
  8567. Specify the hue angle as a number of radians. It accepts an
  8568. expression, and defaults to "0".
  8569. @item b
  8570. Specify the brightness in the [-10,10] range. It accepts an expression and
  8571. defaults to "0".
  8572. @end table
  8573. @option{h} and @option{H} are mutually exclusive, and can't be
  8574. specified at the same time.
  8575. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8576. expressions containing the following constants:
  8577. @table @option
  8578. @item n
  8579. frame count of the input frame starting from 0
  8580. @item pts
  8581. presentation timestamp of the input frame expressed in time base units
  8582. @item r
  8583. frame rate of the input video, NAN if the input frame rate is unknown
  8584. @item t
  8585. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8586. @item tb
  8587. time base of the input video
  8588. @end table
  8589. @subsection Examples
  8590. @itemize
  8591. @item
  8592. Set the hue to 90 degrees and the saturation to 1.0:
  8593. @example
  8594. hue=h=90:s=1
  8595. @end example
  8596. @item
  8597. Same command but expressing the hue in radians:
  8598. @example
  8599. hue=H=PI/2:s=1
  8600. @end example
  8601. @item
  8602. Rotate hue and make the saturation swing between 0
  8603. and 2 over a period of 1 second:
  8604. @example
  8605. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8606. @end example
  8607. @item
  8608. Apply a 3 seconds saturation fade-in effect starting at 0:
  8609. @example
  8610. hue="s=min(t/3\,1)"
  8611. @end example
  8612. The general fade-in expression can be written as:
  8613. @example
  8614. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8615. @end example
  8616. @item
  8617. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8618. @example
  8619. hue="s=max(0\, min(1\, (8-t)/3))"
  8620. @end example
  8621. The general fade-out expression can be written as:
  8622. @example
  8623. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8624. @end example
  8625. @end itemize
  8626. @subsection Commands
  8627. This filter supports the following commands:
  8628. @table @option
  8629. @item b
  8630. @item s
  8631. @item h
  8632. @item H
  8633. Modify the hue and/or the saturation and/or brightness of the input video.
  8634. The command accepts the same syntax of the corresponding option.
  8635. If the specified expression is not valid, it is kept at its current
  8636. value.
  8637. @end table
  8638. @section hysteresis
  8639. Grow first stream into second stream by connecting components.
  8640. This makes it possible to build more robust edge masks.
  8641. This filter accepts the following options:
  8642. @table @option
  8643. @item planes
  8644. Set which planes will be processed as bitmap, unprocessed planes will be
  8645. copied from first stream.
  8646. By default value 0xf, all planes will be processed.
  8647. @item threshold
  8648. Set threshold which is used in filtering. If pixel component value is higher than
  8649. this value filter algorithm for connecting components is activated.
  8650. By default value is 0.
  8651. @end table
  8652. @section idet
  8653. Detect video interlacing type.
  8654. This filter tries to detect if the input frames are interlaced, progressive,
  8655. top or bottom field first. It will also try to detect fields that are
  8656. repeated between adjacent frames (a sign of telecine).
  8657. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8658. Multiple frame detection incorporates the classification history of previous frames.
  8659. The filter will log these metadata values:
  8660. @table @option
  8661. @item single.current_frame
  8662. Detected type of current frame using single-frame detection. One of:
  8663. ``tff'' (top field first), ``bff'' (bottom field first),
  8664. ``progressive'', or ``undetermined''
  8665. @item single.tff
  8666. Cumulative number of frames detected as top field first using single-frame detection.
  8667. @item multiple.tff
  8668. Cumulative number of frames detected as top field first using multiple-frame detection.
  8669. @item single.bff
  8670. Cumulative number of frames detected as bottom field first using single-frame detection.
  8671. @item multiple.current_frame
  8672. Detected type of current frame using multiple-frame detection. One of:
  8673. ``tff'' (top field first), ``bff'' (bottom field first),
  8674. ``progressive'', or ``undetermined''
  8675. @item multiple.bff
  8676. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8677. @item single.progressive
  8678. Cumulative number of frames detected as progressive using single-frame detection.
  8679. @item multiple.progressive
  8680. Cumulative number of frames detected as progressive using multiple-frame detection.
  8681. @item single.undetermined
  8682. Cumulative number of frames that could not be classified using single-frame detection.
  8683. @item multiple.undetermined
  8684. Cumulative number of frames that could not be classified using multiple-frame detection.
  8685. @item repeated.current_frame
  8686. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8687. @item repeated.neither
  8688. Cumulative number of frames with no repeated field.
  8689. @item repeated.top
  8690. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8691. @item repeated.bottom
  8692. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8693. @end table
  8694. The filter accepts the following options:
  8695. @table @option
  8696. @item intl_thres
  8697. Set interlacing threshold.
  8698. @item prog_thres
  8699. Set progressive threshold.
  8700. @item rep_thres
  8701. Threshold for repeated field detection.
  8702. @item half_life
  8703. Number of frames after which a given frame's contribution to the
  8704. statistics is halved (i.e., it contributes only 0.5 to its
  8705. classification). The default of 0 means that all frames seen are given
  8706. full weight of 1.0 forever.
  8707. @item analyze_interlaced_flag
  8708. When this is not 0 then idet will use the specified number of frames to determine
  8709. if the interlaced flag is accurate, it will not count undetermined frames.
  8710. If the flag is found to be accurate it will be used without any further
  8711. computations, if it is found to be inaccurate it will be cleared without any
  8712. further computations. This allows inserting the idet filter as a low computational
  8713. method to clean up the interlaced flag
  8714. @end table
  8715. @section il
  8716. Deinterleave or interleave fields.
  8717. This filter allows one to process interlaced images fields without
  8718. deinterlacing them. Deinterleaving splits the input frame into 2
  8719. fields (so called half pictures). Odd lines are moved to the top
  8720. half of the output image, even lines to the bottom half.
  8721. You can process (filter) them independently and then re-interleave them.
  8722. The filter accepts the following options:
  8723. @table @option
  8724. @item luma_mode, l
  8725. @item chroma_mode, c
  8726. @item alpha_mode, a
  8727. Available values for @var{luma_mode}, @var{chroma_mode} and
  8728. @var{alpha_mode} are:
  8729. @table @samp
  8730. @item none
  8731. Do nothing.
  8732. @item deinterleave, d
  8733. Deinterleave fields, placing one above the other.
  8734. @item interleave, i
  8735. Interleave fields. Reverse the effect of deinterleaving.
  8736. @end table
  8737. Default value is @code{none}.
  8738. @item luma_swap, ls
  8739. @item chroma_swap, cs
  8740. @item alpha_swap, as
  8741. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8742. @end table
  8743. @section inflate
  8744. Apply inflate effect to the video.
  8745. This filter replaces the pixel by the local(3x3) average by taking into account
  8746. only values higher than the pixel.
  8747. It accepts the following options:
  8748. @table @option
  8749. @item threshold0
  8750. @item threshold1
  8751. @item threshold2
  8752. @item threshold3
  8753. Limit the maximum change for each plane, default is 65535.
  8754. If 0, plane will remain unchanged.
  8755. @end table
  8756. @section interlace
  8757. Simple interlacing filter from progressive contents. This interleaves upper (or
  8758. lower) lines from odd frames with lower (or upper) lines from even frames,
  8759. halving the frame rate and preserving image height.
  8760. @example
  8761. Original Original New Frame
  8762. Frame 'j' Frame 'j+1' (tff)
  8763. ========== =========== ==================
  8764. Line 0 --------------------> Frame 'j' Line 0
  8765. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8766. Line 2 ---------------------> Frame 'j' Line 2
  8767. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8768. ... ... ...
  8769. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8770. @end example
  8771. It accepts the following optional parameters:
  8772. @table @option
  8773. @item scan
  8774. This determines whether the interlaced frame is taken from the even
  8775. (tff - default) or odd (bff) lines of the progressive frame.
  8776. @item lowpass
  8777. Vertical lowpass filter to avoid twitter interlacing and
  8778. reduce moire patterns.
  8779. @table @samp
  8780. @item 0, off
  8781. Disable vertical lowpass filter
  8782. @item 1, linear
  8783. Enable linear filter (default)
  8784. @item 2, complex
  8785. Enable complex filter. This will slightly less reduce twitter and moire
  8786. but better retain detail and subjective sharpness impression.
  8787. @end table
  8788. @end table
  8789. @section kerndeint
  8790. Deinterlace input video by applying Donald Graft's adaptive kernel
  8791. deinterling. Work on interlaced parts of a video to produce
  8792. progressive frames.
  8793. The description of the accepted parameters follows.
  8794. @table @option
  8795. @item thresh
  8796. Set the threshold which affects the filter's tolerance when
  8797. determining if a pixel line must be processed. It must be an integer
  8798. in the range [0,255] and defaults to 10. A value of 0 will result in
  8799. applying the process on every pixels.
  8800. @item map
  8801. Paint pixels exceeding the threshold value to white if set to 1.
  8802. Default is 0.
  8803. @item order
  8804. Set the fields order. Swap fields if set to 1, leave fields alone if
  8805. 0. Default is 0.
  8806. @item sharp
  8807. Enable additional sharpening if set to 1. Default is 0.
  8808. @item twoway
  8809. Enable twoway sharpening if set to 1. Default is 0.
  8810. @end table
  8811. @subsection Examples
  8812. @itemize
  8813. @item
  8814. Apply default values:
  8815. @example
  8816. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8817. @end example
  8818. @item
  8819. Enable additional sharpening:
  8820. @example
  8821. kerndeint=sharp=1
  8822. @end example
  8823. @item
  8824. Paint processed pixels in white:
  8825. @example
  8826. kerndeint=map=1
  8827. @end example
  8828. @end itemize
  8829. @section lagfun
  8830. Slowly update darker pixels.
  8831. This filter makes short flashes of light appear longer.
  8832. This filter accepts the following options:
  8833. @table @option
  8834. @item decay
  8835. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  8836. @item planes
  8837. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  8838. @end table
  8839. @section lenscorrection
  8840. Correct radial lens distortion
  8841. This filter can be used to correct for radial distortion as can result from the use
  8842. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8843. one can use tools available for example as part of opencv or simply trial-and-error.
  8844. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8845. and extract the k1 and k2 coefficients from the resulting matrix.
  8846. Note that effectively the same filter is available in the open-source tools Krita and
  8847. Digikam from the KDE project.
  8848. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8849. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8850. brightness distribution, so you may want to use both filters together in certain
  8851. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8852. be applied before or after lens correction.
  8853. @subsection Options
  8854. The filter accepts the following options:
  8855. @table @option
  8856. @item cx
  8857. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8858. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8859. width. Default is 0.5.
  8860. @item cy
  8861. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8862. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8863. height. Default is 0.5.
  8864. @item k1
  8865. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8866. no correction. Default is 0.
  8867. @item k2
  8868. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8869. 0 means no correction. Default is 0.
  8870. @end table
  8871. The formula that generates the correction is:
  8872. @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)
  8873. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8874. distances from the focal point in the source and target images, respectively.
  8875. @section lensfun
  8876. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8877. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8878. to apply the lens correction. The filter will load the lensfun database and
  8879. query it to find the corresponding camera and lens entries in the database. As
  8880. long as these entries can be found with the given options, the filter can
  8881. perform corrections on frames. Note that incomplete strings will result in the
  8882. filter choosing the best match with the given options, and the filter will
  8883. output the chosen camera and lens models (logged with level "info"). You must
  8884. provide the make, camera model, and lens model as they are required.
  8885. The filter accepts the following options:
  8886. @table @option
  8887. @item make
  8888. The make of the camera (for example, "Canon"). This option is required.
  8889. @item model
  8890. The model of the camera (for example, "Canon EOS 100D"). This option is
  8891. required.
  8892. @item lens_model
  8893. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8894. option is required.
  8895. @item mode
  8896. The type of correction to apply. The following values are valid options:
  8897. @table @samp
  8898. @item vignetting
  8899. Enables fixing lens vignetting.
  8900. @item geometry
  8901. Enables fixing lens geometry. This is the default.
  8902. @item subpixel
  8903. Enables fixing chromatic aberrations.
  8904. @item vig_geo
  8905. Enables fixing lens vignetting and lens geometry.
  8906. @item vig_subpixel
  8907. Enables fixing lens vignetting and chromatic aberrations.
  8908. @item distortion
  8909. Enables fixing both lens geometry and chromatic aberrations.
  8910. @item all
  8911. Enables all possible corrections.
  8912. @end table
  8913. @item focal_length
  8914. The focal length of the image/video (zoom; expected constant for video). For
  8915. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8916. range should be chosen when using that lens. Default 18.
  8917. @item aperture
  8918. The aperture of the image/video (expected constant for video). Note that
  8919. aperture is only used for vignetting correction. Default 3.5.
  8920. @item focus_distance
  8921. The focus distance of the image/video (expected constant for video). Note that
  8922. focus distance is only used for vignetting and only slightly affects the
  8923. vignetting correction process. If unknown, leave it at the default value (which
  8924. is 1000).
  8925. @item scale
  8926. The scale factor which is applied after transformation. After correction the
  8927. video is no longer necessarily rectangular. This parameter controls how much of
  8928. the resulting image is visible. The value 0 means that a value will be chosen
  8929. automatically such that there is little or no unmapped area in the output
  8930. image. 1.0 means that no additional scaling is done. Lower values may result
  8931. in more of the corrected image being visible, while higher values may avoid
  8932. unmapped areas in the output.
  8933. @item target_geometry
  8934. The target geometry of the output image/video. The following values are valid
  8935. options:
  8936. @table @samp
  8937. @item rectilinear (default)
  8938. @item fisheye
  8939. @item panoramic
  8940. @item equirectangular
  8941. @item fisheye_orthographic
  8942. @item fisheye_stereographic
  8943. @item fisheye_equisolid
  8944. @item fisheye_thoby
  8945. @end table
  8946. @item reverse
  8947. Apply the reverse of image correction (instead of correcting distortion, apply
  8948. it).
  8949. @item interpolation
  8950. The type of interpolation used when correcting distortion. The following values
  8951. are valid options:
  8952. @table @samp
  8953. @item nearest
  8954. @item linear (default)
  8955. @item lanczos
  8956. @end table
  8957. @end table
  8958. @subsection Examples
  8959. @itemize
  8960. @item
  8961. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8962. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8963. aperture of "8.0".
  8964. @example
  8965. 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
  8966. @end example
  8967. @item
  8968. Apply the same as before, but only for the first 5 seconds of video.
  8969. @example
  8970. 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
  8971. @end example
  8972. @end itemize
  8973. @section libvmaf
  8974. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8975. score between two input videos.
  8976. The obtained VMAF score is printed through the logging system.
  8977. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8978. After installing the library it can be enabled using:
  8979. @code{./configure --enable-libvmaf --enable-version3}.
  8980. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8981. The filter has following options:
  8982. @table @option
  8983. @item model_path
  8984. Set the model path which is to be used for SVM.
  8985. Default value: @code{"vmaf_v0.6.1.pkl"}
  8986. @item log_path
  8987. Set the file path to be used to store logs.
  8988. @item log_fmt
  8989. Set the format of the log file (xml or json).
  8990. @item enable_transform
  8991. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  8992. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  8993. Default value: @code{false}
  8994. @item phone_model
  8995. Invokes the phone model which will generate VMAF scores higher than in the
  8996. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8997. @item psnr
  8998. Enables computing psnr along with vmaf.
  8999. @item ssim
  9000. Enables computing ssim along with vmaf.
  9001. @item ms_ssim
  9002. Enables computing ms_ssim along with vmaf.
  9003. @item pool
  9004. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9005. @item n_threads
  9006. Set number of threads to be used when computing vmaf.
  9007. @item n_subsample
  9008. Set interval for frame subsampling used when computing vmaf.
  9009. @item enable_conf_interval
  9010. Enables confidence interval.
  9011. @end table
  9012. This filter also supports the @ref{framesync} options.
  9013. On the below examples the input file @file{main.mpg} being processed is
  9014. compared with the reference file @file{ref.mpg}.
  9015. @example
  9016. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9017. @end example
  9018. Example with options:
  9019. @example
  9020. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9021. @end example
  9022. @section limiter
  9023. Limits the pixel components values to the specified range [min, max].
  9024. The filter accepts the following options:
  9025. @table @option
  9026. @item min
  9027. Lower bound. Defaults to the lowest allowed value for the input.
  9028. @item max
  9029. Upper bound. Defaults to the highest allowed value for the input.
  9030. @item planes
  9031. Specify which planes will be processed. Defaults to all available.
  9032. @end table
  9033. @section loop
  9034. Loop video frames.
  9035. The filter accepts the following options:
  9036. @table @option
  9037. @item loop
  9038. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9039. Default is 0.
  9040. @item size
  9041. Set maximal size in number of frames. Default is 0.
  9042. @item start
  9043. Set first frame of loop. Default is 0.
  9044. @end table
  9045. @subsection Examples
  9046. @itemize
  9047. @item
  9048. Loop single first frame infinitely:
  9049. @example
  9050. loop=loop=-1:size=1:start=0
  9051. @end example
  9052. @item
  9053. Loop single first frame 10 times:
  9054. @example
  9055. loop=loop=10:size=1:start=0
  9056. @end example
  9057. @item
  9058. Loop 10 first frames 5 times:
  9059. @example
  9060. loop=loop=5:size=10:start=0
  9061. @end example
  9062. @end itemize
  9063. @section lut1d
  9064. Apply a 1D LUT to an input video.
  9065. The filter accepts the following options:
  9066. @table @option
  9067. @item file
  9068. Set the 1D LUT file name.
  9069. Currently supported formats:
  9070. @table @samp
  9071. @item cube
  9072. Iridas
  9073. @item csp
  9074. cineSpace
  9075. @end table
  9076. @item interp
  9077. Select interpolation mode.
  9078. Available values are:
  9079. @table @samp
  9080. @item nearest
  9081. Use values from the nearest defined point.
  9082. @item linear
  9083. Interpolate values using the linear interpolation.
  9084. @item cosine
  9085. Interpolate values using the cosine interpolation.
  9086. @item cubic
  9087. Interpolate values using the cubic interpolation.
  9088. @item spline
  9089. Interpolate values using the spline interpolation.
  9090. @end table
  9091. @end table
  9092. @anchor{lut3d}
  9093. @section lut3d
  9094. Apply a 3D LUT to an input video.
  9095. The filter accepts the following options:
  9096. @table @option
  9097. @item file
  9098. Set the 3D LUT file name.
  9099. Currently supported formats:
  9100. @table @samp
  9101. @item 3dl
  9102. AfterEffects
  9103. @item cube
  9104. Iridas
  9105. @item dat
  9106. DaVinci
  9107. @item m3d
  9108. Pandora
  9109. @item csp
  9110. cineSpace
  9111. @end table
  9112. @item interp
  9113. Select interpolation mode.
  9114. Available values are:
  9115. @table @samp
  9116. @item nearest
  9117. Use values from the nearest defined point.
  9118. @item trilinear
  9119. Interpolate values using the 8 points defining a cube.
  9120. @item tetrahedral
  9121. Interpolate values using a tetrahedron.
  9122. @end table
  9123. @end table
  9124. This filter also supports the @ref{framesync} options.
  9125. @section lumakey
  9126. Turn certain luma values into transparency.
  9127. The filter accepts the following options:
  9128. @table @option
  9129. @item threshold
  9130. Set the luma which will be used as base for transparency.
  9131. Default value is @code{0}.
  9132. @item tolerance
  9133. Set the range of luma values to be keyed out.
  9134. Default value is @code{0}.
  9135. @item softness
  9136. Set the range of softness. Default value is @code{0}.
  9137. Use this to control gradual transition from zero to full transparency.
  9138. @end table
  9139. @section lut, lutrgb, lutyuv
  9140. Compute a look-up table for binding each pixel component input value
  9141. to an output value, and apply it to the input video.
  9142. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9143. to an RGB input video.
  9144. These filters accept the following parameters:
  9145. @table @option
  9146. @item c0
  9147. set first pixel component expression
  9148. @item c1
  9149. set second pixel component expression
  9150. @item c2
  9151. set third pixel component expression
  9152. @item c3
  9153. set fourth pixel component expression, corresponds to the alpha component
  9154. @item r
  9155. set red component expression
  9156. @item g
  9157. set green component expression
  9158. @item b
  9159. set blue component expression
  9160. @item a
  9161. alpha component expression
  9162. @item y
  9163. set Y/luminance component expression
  9164. @item u
  9165. set U/Cb component expression
  9166. @item v
  9167. set V/Cr component expression
  9168. @end table
  9169. Each of them specifies the expression to use for computing the lookup table for
  9170. the corresponding pixel component values.
  9171. The exact component associated to each of the @var{c*} options depends on the
  9172. format in input.
  9173. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9174. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9175. The expressions can contain the following constants and functions:
  9176. @table @option
  9177. @item w
  9178. @item h
  9179. The input width and height.
  9180. @item val
  9181. The input value for the pixel component.
  9182. @item clipval
  9183. The input value, clipped to the @var{minval}-@var{maxval} range.
  9184. @item maxval
  9185. The maximum value for the pixel component.
  9186. @item minval
  9187. The minimum value for the pixel component.
  9188. @item negval
  9189. The negated value for the pixel component value, clipped to the
  9190. @var{minval}-@var{maxval} range; it corresponds to the expression
  9191. "maxval-clipval+minval".
  9192. @item clip(val)
  9193. The computed value in @var{val}, clipped to the
  9194. @var{minval}-@var{maxval} range.
  9195. @item gammaval(gamma)
  9196. The computed gamma correction value of the pixel component value,
  9197. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9198. expression
  9199. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9200. @end table
  9201. All expressions default to "val".
  9202. @subsection Examples
  9203. @itemize
  9204. @item
  9205. Negate input video:
  9206. @example
  9207. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9208. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9209. @end example
  9210. The above is the same as:
  9211. @example
  9212. lutrgb="r=negval:g=negval:b=negval"
  9213. lutyuv="y=negval:u=negval:v=negval"
  9214. @end example
  9215. @item
  9216. Negate luminance:
  9217. @example
  9218. lutyuv=y=negval
  9219. @end example
  9220. @item
  9221. Remove chroma components, turning the video into a graytone image:
  9222. @example
  9223. lutyuv="u=128:v=128"
  9224. @end example
  9225. @item
  9226. Apply a luma burning effect:
  9227. @example
  9228. lutyuv="y=2*val"
  9229. @end example
  9230. @item
  9231. Remove green and blue components:
  9232. @example
  9233. lutrgb="g=0:b=0"
  9234. @end example
  9235. @item
  9236. Set a constant alpha channel value on input:
  9237. @example
  9238. format=rgba,lutrgb=a="maxval-minval/2"
  9239. @end example
  9240. @item
  9241. Correct luminance gamma by a factor of 0.5:
  9242. @example
  9243. lutyuv=y=gammaval(0.5)
  9244. @end example
  9245. @item
  9246. Discard least significant bits of luma:
  9247. @example
  9248. lutyuv=y='bitand(val, 128+64+32)'
  9249. @end example
  9250. @item
  9251. Technicolor like effect:
  9252. @example
  9253. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9254. @end example
  9255. @end itemize
  9256. @section lut2, tlut2
  9257. The @code{lut2} filter takes two input streams and outputs one
  9258. stream.
  9259. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9260. from one single stream.
  9261. This filter accepts the following parameters:
  9262. @table @option
  9263. @item c0
  9264. set first pixel component expression
  9265. @item c1
  9266. set second pixel component expression
  9267. @item c2
  9268. set third pixel component expression
  9269. @item c3
  9270. set fourth pixel component expression, corresponds to the alpha component
  9271. @item d
  9272. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9273. which means bit depth is automatically picked from first input format.
  9274. @end table
  9275. Each of them specifies the expression to use for computing the lookup table for
  9276. the corresponding pixel component values.
  9277. The exact component associated to each of the @var{c*} options depends on the
  9278. format in inputs.
  9279. The expressions can contain the following constants:
  9280. @table @option
  9281. @item w
  9282. @item h
  9283. The input width and height.
  9284. @item x
  9285. The first input value for the pixel component.
  9286. @item y
  9287. The second input value for the pixel component.
  9288. @item bdx
  9289. The first input video bit depth.
  9290. @item bdy
  9291. The second input video bit depth.
  9292. @end table
  9293. All expressions default to "x".
  9294. @subsection Examples
  9295. @itemize
  9296. @item
  9297. Highlight differences between two RGB video streams:
  9298. @example
  9299. 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)'
  9300. @end example
  9301. @item
  9302. Highlight differences between two YUV video streams:
  9303. @example
  9304. 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)'
  9305. @end example
  9306. @item
  9307. Show max difference between two video streams:
  9308. @example
  9309. 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)))'
  9310. @end example
  9311. @end itemize
  9312. @section maskedclamp
  9313. Clamp the first input stream with the second input and third input stream.
  9314. Returns the value of first stream to be between second input
  9315. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9316. This filter accepts the following options:
  9317. @table @option
  9318. @item undershoot
  9319. Default value is @code{0}.
  9320. @item overshoot
  9321. Default value is @code{0}.
  9322. @item planes
  9323. Set which planes will be processed as bitmap, unprocessed planes will be
  9324. copied from first stream.
  9325. By default value 0xf, all planes will be processed.
  9326. @end table
  9327. @section maskedmerge
  9328. Merge the first input stream with the second input stream using per pixel
  9329. weights in the third input stream.
  9330. A value of 0 in the third stream pixel component means that pixel component
  9331. from first stream is returned unchanged, while maximum value (eg. 255 for
  9332. 8-bit videos) means that pixel component from second stream is returned
  9333. unchanged. Intermediate values define the amount of merging between both
  9334. input stream's pixel components.
  9335. This filter accepts the following options:
  9336. @table @option
  9337. @item planes
  9338. Set which planes will be processed as bitmap, unprocessed planes will be
  9339. copied from first stream.
  9340. By default value 0xf, all planes will be processed.
  9341. @end table
  9342. @section maskfun
  9343. Create mask from input video.
  9344. For example it is useful to create motion masks after @code{tblend} filter.
  9345. This filter accepts the following options:
  9346. @table @option
  9347. @item low
  9348. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9349. @item high
  9350. Set high threshold. Any pixel component higher than this value will be set to max value
  9351. allowed for current pixel format.
  9352. @item planes
  9353. Set planes to filter, by default all available planes are filtered.
  9354. @item fill
  9355. Fill all frame pixels with this value.
  9356. @item sum
  9357. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9358. average, output frame will be completely filled with value set by @var{fill} option.
  9359. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9360. @end table
  9361. @section mcdeint
  9362. Apply motion-compensation deinterlacing.
  9363. It needs one field per frame as input and must thus be used together
  9364. with yadif=1/3 or equivalent.
  9365. This filter accepts the following options:
  9366. @table @option
  9367. @item mode
  9368. Set the deinterlacing mode.
  9369. It accepts one of the following values:
  9370. @table @samp
  9371. @item fast
  9372. @item medium
  9373. @item slow
  9374. use iterative motion estimation
  9375. @item extra_slow
  9376. like @samp{slow}, but use multiple reference frames.
  9377. @end table
  9378. Default value is @samp{fast}.
  9379. @item parity
  9380. Set the picture field parity assumed for the input video. It must be
  9381. one of the following values:
  9382. @table @samp
  9383. @item 0, tff
  9384. assume top field first
  9385. @item 1, bff
  9386. assume bottom field first
  9387. @end table
  9388. Default value is @samp{bff}.
  9389. @item qp
  9390. Set per-block quantization parameter (QP) used by the internal
  9391. encoder.
  9392. Higher values should result in a smoother motion vector field but less
  9393. optimal individual vectors. Default value is 1.
  9394. @end table
  9395. @section mergeplanes
  9396. Merge color channel components from several video streams.
  9397. The filter accepts up to 4 input streams, and merge selected input
  9398. planes to the output video.
  9399. This filter accepts the following options:
  9400. @table @option
  9401. @item mapping
  9402. Set input to output plane mapping. Default is @code{0}.
  9403. The mappings is specified as a bitmap. It should be specified as a
  9404. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9405. mapping for the first plane of the output stream. 'A' sets the number of
  9406. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9407. corresponding input to use (from 0 to 3). The rest of the mappings is
  9408. similar, 'Bb' describes the mapping for the output stream second
  9409. plane, 'Cc' describes the mapping for the output stream third plane and
  9410. 'Dd' describes the mapping for the output stream fourth plane.
  9411. @item format
  9412. Set output pixel format. Default is @code{yuva444p}.
  9413. @end table
  9414. @subsection Examples
  9415. @itemize
  9416. @item
  9417. Merge three gray video streams of same width and height into single video stream:
  9418. @example
  9419. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9420. @end example
  9421. @item
  9422. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9423. @example
  9424. [a0][a1]mergeplanes=0x00010210:yuva444p
  9425. @end example
  9426. @item
  9427. Swap Y and A plane in yuva444p stream:
  9428. @example
  9429. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9430. @end example
  9431. @item
  9432. Swap U and V plane in yuv420p stream:
  9433. @example
  9434. format=yuv420p,mergeplanes=0x000201:yuv420p
  9435. @end example
  9436. @item
  9437. Cast a rgb24 clip to yuv444p:
  9438. @example
  9439. format=rgb24,mergeplanes=0x000102:yuv444p
  9440. @end example
  9441. @end itemize
  9442. @section mestimate
  9443. Estimate and export motion vectors using block matching algorithms.
  9444. Motion vectors are stored in frame side data to be used by other filters.
  9445. This filter accepts the following options:
  9446. @table @option
  9447. @item method
  9448. Specify the motion estimation method. Accepts one of the following values:
  9449. @table @samp
  9450. @item esa
  9451. Exhaustive search algorithm.
  9452. @item tss
  9453. Three step search algorithm.
  9454. @item tdls
  9455. Two dimensional logarithmic search algorithm.
  9456. @item ntss
  9457. New three step search algorithm.
  9458. @item fss
  9459. Four step search algorithm.
  9460. @item ds
  9461. Diamond search algorithm.
  9462. @item hexbs
  9463. Hexagon-based search algorithm.
  9464. @item epzs
  9465. Enhanced predictive zonal search algorithm.
  9466. @item umh
  9467. Uneven multi-hexagon search algorithm.
  9468. @end table
  9469. Default value is @samp{esa}.
  9470. @item mb_size
  9471. Macroblock size. Default @code{16}.
  9472. @item search_param
  9473. Search parameter. Default @code{7}.
  9474. @end table
  9475. @section midequalizer
  9476. Apply Midway Image Equalization effect using two video streams.
  9477. Midway Image Equalization adjusts a pair of images to have the same
  9478. histogram, while maintaining their dynamics as much as possible. It's
  9479. useful for e.g. matching exposures from a pair of stereo cameras.
  9480. This filter has two inputs and one output, which must be of same pixel format, but
  9481. may be of different sizes. The output of filter is first input adjusted with
  9482. midway histogram of both inputs.
  9483. This filter accepts the following option:
  9484. @table @option
  9485. @item planes
  9486. Set which planes to process. Default is @code{15}, which is all available planes.
  9487. @end table
  9488. @section minterpolate
  9489. Convert the video to specified frame rate using motion interpolation.
  9490. This filter accepts the following options:
  9491. @table @option
  9492. @item fps
  9493. 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}.
  9494. @item mi_mode
  9495. Motion interpolation mode. Following values are accepted:
  9496. @table @samp
  9497. @item dup
  9498. Duplicate previous or next frame for interpolating new ones.
  9499. @item blend
  9500. Blend source frames. Interpolated frame is mean of previous and next frames.
  9501. @item mci
  9502. Motion compensated interpolation. Following options are effective when this mode is selected:
  9503. @table @samp
  9504. @item mc_mode
  9505. Motion compensation mode. Following values are accepted:
  9506. @table @samp
  9507. @item obmc
  9508. Overlapped block motion compensation.
  9509. @item aobmc
  9510. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9511. @end table
  9512. Default mode is @samp{obmc}.
  9513. @item me_mode
  9514. Motion estimation mode. Following values are accepted:
  9515. @table @samp
  9516. @item bidir
  9517. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9518. @item bilat
  9519. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9520. @end table
  9521. Default mode is @samp{bilat}.
  9522. @item me
  9523. The algorithm to be used for motion estimation. Following values are accepted:
  9524. @table @samp
  9525. @item esa
  9526. Exhaustive search algorithm.
  9527. @item tss
  9528. Three step search algorithm.
  9529. @item tdls
  9530. Two dimensional logarithmic search algorithm.
  9531. @item ntss
  9532. New three step search algorithm.
  9533. @item fss
  9534. Four step search algorithm.
  9535. @item ds
  9536. Diamond search algorithm.
  9537. @item hexbs
  9538. Hexagon-based search algorithm.
  9539. @item epzs
  9540. Enhanced predictive zonal search algorithm.
  9541. @item umh
  9542. Uneven multi-hexagon search algorithm.
  9543. @end table
  9544. Default algorithm is @samp{epzs}.
  9545. @item mb_size
  9546. Macroblock size. Default @code{16}.
  9547. @item search_param
  9548. Motion estimation search parameter. Default @code{32}.
  9549. @item vsbmc
  9550. 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).
  9551. @end table
  9552. @end table
  9553. @item scd
  9554. 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:
  9555. @table @samp
  9556. @item none
  9557. Disable scene change detection.
  9558. @item fdiff
  9559. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9560. @end table
  9561. Default method is @samp{fdiff}.
  9562. @item scd_threshold
  9563. Scene change detection threshold. Default is @code{5.0}.
  9564. @end table
  9565. @section mix
  9566. Mix several video input streams into one video stream.
  9567. A description of the accepted options follows.
  9568. @table @option
  9569. @item nb_inputs
  9570. The number of inputs. If unspecified, it defaults to 2.
  9571. @item weights
  9572. Specify weight of each input video stream as sequence.
  9573. Each weight is separated by space. If number of weights
  9574. is smaller than number of @var{frames} last specified
  9575. weight will be used for all remaining unset weights.
  9576. @item scale
  9577. Specify scale, if it is set it will be multiplied with sum
  9578. of each weight multiplied with pixel values to give final destination
  9579. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9580. @item duration
  9581. Specify how end of stream is determined.
  9582. @table @samp
  9583. @item longest
  9584. The duration of the longest input. (default)
  9585. @item shortest
  9586. The duration of the shortest input.
  9587. @item first
  9588. The duration of the first input.
  9589. @end table
  9590. @end table
  9591. @section mpdecimate
  9592. Drop frames that do not differ greatly from the previous frame in
  9593. order to reduce frame rate.
  9594. The main use of this filter is for very-low-bitrate encoding
  9595. (e.g. streaming over dialup modem), but it could in theory be used for
  9596. fixing movies that were inverse-telecined incorrectly.
  9597. A description of the accepted options follows.
  9598. @table @option
  9599. @item max
  9600. Set the maximum number of consecutive frames which can be dropped (if
  9601. positive), or the minimum interval between dropped frames (if
  9602. negative). If the value is 0, the frame is dropped disregarding the
  9603. number of previous sequentially dropped frames.
  9604. Default value is 0.
  9605. @item hi
  9606. @item lo
  9607. @item frac
  9608. Set the dropping threshold values.
  9609. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9610. represent actual pixel value differences, so a threshold of 64
  9611. corresponds to 1 unit of difference for each pixel, or the same spread
  9612. out differently over the block.
  9613. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9614. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9615. meaning the whole image) differ by more than a threshold of @option{lo}.
  9616. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9617. 64*5, and default value for @option{frac} is 0.33.
  9618. @end table
  9619. @section negate
  9620. Negate (invert) the input video.
  9621. It accepts the following option:
  9622. @table @option
  9623. @item negate_alpha
  9624. With value 1, it negates the alpha component, if present. Default value is 0.
  9625. @end table
  9626. @anchor{nlmeans}
  9627. @section nlmeans
  9628. Denoise frames using Non-Local Means algorithm.
  9629. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9630. context similarity is defined by comparing their surrounding patches of size
  9631. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9632. around the pixel.
  9633. Note that the research area defines centers for patches, which means some
  9634. patches will be made of pixels outside that research area.
  9635. The filter accepts the following options.
  9636. @table @option
  9637. @item s
  9638. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9639. @item p
  9640. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9641. @item pc
  9642. Same as @option{p} but for chroma planes.
  9643. The default value is @var{0} and means automatic.
  9644. @item r
  9645. Set research size. Default is 15. Must be odd number in range [0, 99].
  9646. @item rc
  9647. Same as @option{r} but for chroma planes.
  9648. The default value is @var{0} and means automatic.
  9649. @end table
  9650. @section nnedi
  9651. Deinterlace video using neural network edge directed interpolation.
  9652. This filter accepts the following options:
  9653. @table @option
  9654. @item weights
  9655. Mandatory option, without binary file filter can not work.
  9656. Currently file can be found here:
  9657. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9658. @item deint
  9659. Set which frames to deinterlace, by default it is @code{all}.
  9660. Can be @code{all} or @code{interlaced}.
  9661. @item field
  9662. Set mode of operation.
  9663. Can be one of the following:
  9664. @table @samp
  9665. @item af
  9666. Use frame flags, both fields.
  9667. @item a
  9668. Use frame flags, single field.
  9669. @item t
  9670. Use top field only.
  9671. @item b
  9672. Use bottom field only.
  9673. @item tf
  9674. Use both fields, top first.
  9675. @item bf
  9676. Use both fields, bottom first.
  9677. @end table
  9678. @item planes
  9679. Set which planes to process, by default filter process all frames.
  9680. @item nsize
  9681. Set size of local neighborhood around each pixel, used by the predictor neural
  9682. network.
  9683. Can be one of the following:
  9684. @table @samp
  9685. @item s8x6
  9686. @item s16x6
  9687. @item s32x6
  9688. @item s48x6
  9689. @item s8x4
  9690. @item s16x4
  9691. @item s32x4
  9692. @end table
  9693. @item nns
  9694. Set the number of neurons in predictor neural network.
  9695. Can be one of the following:
  9696. @table @samp
  9697. @item n16
  9698. @item n32
  9699. @item n64
  9700. @item n128
  9701. @item n256
  9702. @end table
  9703. @item qual
  9704. Controls the number of different neural network predictions that are blended
  9705. together to compute the final output value. Can be @code{fast}, default or
  9706. @code{slow}.
  9707. @item etype
  9708. Set which set of weights to use in the predictor.
  9709. Can be one of the following:
  9710. @table @samp
  9711. @item a
  9712. weights trained to minimize absolute error
  9713. @item s
  9714. weights trained to minimize squared error
  9715. @end table
  9716. @item pscrn
  9717. Controls whether or not the prescreener neural network is used to decide
  9718. which pixels should be processed by the predictor neural network and which
  9719. can be handled by simple cubic interpolation.
  9720. The prescreener is trained to know whether cubic interpolation will be
  9721. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9722. The computational complexity of the prescreener nn is much less than that of
  9723. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9724. using the prescreener generally results in much faster processing.
  9725. The prescreener is pretty accurate, so the difference between using it and not
  9726. using it is almost always unnoticeable.
  9727. Can be one of the following:
  9728. @table @samp
  9729. @item none
  9730. @item original
  9731. @item new
  9732. @end table
  9733. Default is @code{new}.
  9734. @item fapprox
  9735. Set various debugging flags.
  9736. @end table
  9737. @section noformat
  9738. Force libavfilter not to use any of the specified pixel formats for the
  9739. input to the next filter.
  9740. It accepts the following parameters:
  9741. @table @option
  9742. @item pix_fmts
  9743. A '|'-separated list of pixel format names, such as
  9744. pix_fmts=yuv420p|monow|rgb24".
  9745. @end table
  9746. @subsection Examples
  9747. @itemize
  9748. @item
  9749. Force libavfilter to use a format different from @var{yuv420p} for the
  9750. input to the vflip filter:
  9751. @example
  9752. noformat=pix_fmts=yuv420p,vflip
  9753. @end example
  9754. @item
  9755. Convert the input video to any of the formats not contained in the list:
  9756. @example
  9757. noformat=yuv420p|yuv444p|yuv410p
  9758. @end example
  9759. @end itemize
  9760. @section noise
  9761. Add noise on video input frame.
  9762. The filter accepts the following options:
  9763. @table @option
  9764. @item all_seed
  9765. @item c0_seed
  9766. @item c1_seed
  9767. @item c2_seed
  9768. @item c3_seed
  9769. Set noise seed for specific pixel component or all pixel components in case
  9770. of @var{all_seed}. Default value is @code{123457}.
  9771. @item all_strength, alls
  9772. @item c0_strength, c0s
  9773. @item c1_strength, c1s
  9774. @item c2_strength, c2s
  9775. @item c3_strength, c3s
  9776. Set noise strength for specific pixel component or all pixel components in case
  9777. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9778. @item all_flags, allf
  9779. @item c0_flags, c0f
  9780. @item c1_flags, c1f
  9781. @item c2_flags, c2f
  9782. @item c3_flags, c3f
  9783. Set pixel component flags or set flags for all components if @var{all_flags}.
  9784. Available values for component flags are:
  9785. @table @samp
  9786. @item a
  9787. averaged temporal noise (smoother)
  9788. @item p
  9789. mix random noise with a (semi)regular pattern
  9790. @item t
  9791. temporal noise (noise pattern changes between frames)
  9792. @item u
  9793. uniform noise (gaussian otherwise)
  9794. @end table
  9795. @end table
  9796. @subsection Examples
  9797. Add temporal and uniform noise to input video:
  9798. @example
  9799. noise=alls=20:allf=t+u
  9800. @end example
  9801. @section normalize
  9802. Normalize RGB video (aka histogram stretching, contrast stretching).
  9803. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9804. For each channel of each frame, the filter computes the input range and maps
  9805. it linearly to the user-specified output range. The output range defaults
  9806. to the full dynamic range from pure black to pure white.
  9807. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9808. changes in brightness) caused when small dark or bright objects enter or leave
  9809. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9810. video camera, and, like a video camera, it may cause a period of over- or
  9811. under-exposure of the video.
  9812. The R,G,B channels can be normalized independently, which may cause some
  9813. color shifting, or linked together as a single channel, which prevents
  9814. color shifting. Linked normalization preserves hue. Independent normalization
  9815. does not, so it can be used to remove some color casts. Independent and linked
  9816. normalization can be combined in any ratio.
  9817. The normalize filter accepts the following options:
  9818. @table @option
  9819. @item blackpt
  9820. @item whitept
  9821. Colors which define the output range. The minimum input value is mapped to
  9822. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9823. The defaults are black and white respectively. Specifying white for
  9824. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9825. normalized video. Shades of grey can be used to reduce the dynamic range
  9826. (contrast). Specifying saturated colors here can create some interesting
  9827. effects.
  9828. @item smoothing
  9829. The number of previous frames to use for temporal smoothing. The input range
  9830. of each channel is smoothed using a rolling average over the current frame
  9831. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9832. smoothing).
  9833. @item independence
  9834. Controls the ratio of independent (color shifting) channel normalization to
  9835. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9836. independent. Defaults to 1.0 (fully independent).
  9837. @item strength
  9838. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9839. expensive no-op. Defaults to 1.0 (full strength).
  9840. @end table
  9841. @subsection Examples
  9842. Stretch video contrast to use the full dynamic range, with no temporal
  9843. smoothing; may flicker depending on the source content:
  9844. @example
  9845. normalize=blackpt=black:whitept=white:smoothing=0
  9846. @end example
  9847. As above, but with 50 frames of temporal smoothing; flicker should be
  9848. reduced, depending on the source content:
  9849. @example
  9850. normalize=blackpt=black:whitept=white:smoothing=50
  9851. @end example
  9852. As above, but with hue-preserving linked channel normalization:
  9853. @example
  9854. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9855. @end example
  9856. As above, but with half strength:
  9857. @example
  9858. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9859. @end example
  9860. Map the darkest input color to red, the brightest input color to cyan:
  9861. @example
  9862. normalize=blackpt=red:whitept=cyan
  9863. @end example
  9864. @section null
  9865. Pass the video source unchanged to the output.
  9866. @section ocr
  9867. Optical Character Recognition
  9868. This filter uses Tesseract for optical character recognition. To enable
  9869. compilation of this filter, you need to configure FFmpeg with
  9870. @code{--enable-libtesseract}.
  9871. It accepts the following options:
  9872. @table @option
  9873. @item datapath
  9874. Set datapath to tesseract data. Default is to use whatever was
  9875. set at installation.
  9876. @item language
  9877. Set language, default is "eng".
  9878. @item whitelist
  9879. Set character whitelist.
  9880. @item blacklist
  9881. Set character blacklist.
  9882. @end table
  9883. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9884. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  9885. @section ocv
  9886. Apply a video transform using libopencv.
  9887. To enable this filter, install the libopencv library and headers and
  9888. configure FFmpeg with @code{--enable-libopencv}.
  9889. It accepts the following parameters:
  9890. @table @option
  9891. @item filter_name
  9892. The name of the libopencv filter to apply.
  9893. @item filter_params
  9894. The parameters to pass to the libopencv filter. If not specified, the default
  9895. values are assumed.
  9896. @end table
  9897. Refer to the official libopencv documentation for more precise
  9898. information:
  9899. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9900. Several libopencv filters are supported; see the following subsections.
  9901. @anchor{dilate}
  9902. @subsection dilate
  9903. Dilate an image by using a specific structuring element.
  9904. It corresponds to the libopencv function @code{cvDilate}.
  9905. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9906. @var{struct_el} represents a structuring element, and has the syntax:
  9907. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9908. @var{cols} and @var{rows} represent the number of columns and rows of
  9909. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9910. point, and @var{shape} the shape for the structuring element. @var{shape}
  9911. must be "rect", "cross", "ellipse", or "custom".
  9912. If the value for @var{shape} is "custom", it must be followed by a
  9913. string of the form "=@var{filename}". The file with name
  9914. @var{filename} is assumed to represent a binary image, with each
  9915. printable character corresponding to a bright pixel. When a custom
  9916. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9917. or columns and rows of the read file are assumed instead.
  9918. The default value for @var{struct_el} is "3x3+0x0/rect".
  9919. @var{nb_iterations} specifies the number of times the transform is
  9920. applied to the image, and defaults to 1.
  9921. Some examples:
  9922. @example
  9923. # Use the default values
  9924. ocv=dilate
  9925. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9926. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9927. # Read the shape from the file diamond.shape, iterating two times.
  9928. # The file diamond.shape may contain a pattern of characters like this
  9929. # *
  9930. # ***
  9931. # *****
  9932. # ***
  9933. # *
  9934. # The specified columns and rows are ignored
  9935. # but the anchor point coordinates are not
  9936. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9937. @end example
  9938. @subsection erode
  9939. Erode an image by using a specific structuring element.
  9940. It corresponds to the libopencv function @code{cvErode}.
  9941. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9942. with the same syntax and semantics as the @ref{dilate} filter.
  9943. @subsection smooth
  9944. Smooth the input video.
  9945. The filter takes the following parameters:
  9946. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9947. @var{type} is the type of smooth filter to apply, and must be one of
  9948. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9949. or "bilateral". The default value is "gaussian".
  9950. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9951. depend on the smooth type. @var{param1} and
  9952. @var{param2} accept integer positive values or 0. @var{param3} and
  9953. @var{param4} accept floating point values.
  9954. The default value for @var{param1} is 3. The default value for the
  9955. other parameters is 0.
  9956. These parameters correspond to the parameters assigned to the
  9957. libopencv function @code{cvSmooth}.
  9958. @section oscilloscope
  9959. 2D Video Oscilloscope.
  9960. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9961. It accepts the following parameters:
  9962. @table @option
  9963. @item x
  9964. Set scope center x position.
  9965. @item y
  9966. Set scope center y position.
  9967. @item s
  9968. Set scope size, relative to frame diagonal.
  9969. @item t
  9970. Set scope tilt/rotation.
  9971. @item o
  9972. Set trace opacity.
  9973. @item tx
  9974. Set trace center x position.
  9975. @item ty
  9976. Set trace center y position.
  9977. @item tw
  9978. Set trace width, relative to width of frame.
  9979. @item th
  9980. Set trace height, relative to height of frame.
  9981. @item c
  9982. Set which components to trace. By default it traces first three components.
  9983. @item g
  9984. Draw trace grid. By default is enabled.
  9985. @item st
  9986. Draw some statistics. By default is enabled.
  9987. @item sc
  9988. Draw scope. By default is enabled.
  9989. @end table
  9990. @subsection Examples
  9991. @itemize
  9992. @item
  9993. Inspect full first row of video frame.
  9994. @example
  9995. oscilloscope=x=0.5:y=0:s=1
  9996. @end example
  9997. @item
  9998. Inspect full last row of video frame.
  9999. @example
  10000. oscilloscope=x=0.5:y=1:s=1
  10001. @end example
  10002. @item
  10003. Inspect full 5th line of video frame of height 1080.
  10004. @example
  10005. oscilloscope=x=0.5:y=5/1080:s=1
  10006. @end example
  10007. @item
  10008. Inspect full last column of video frame.
  10009. @example
  10010. oscilloscope=x=1:y=0.5:s=1:t=1
  10011. @end example
  10012. @end itemize
  10013. @anchor{overlay}
  10014. @section overlay
  10015. Overlay one video on top of another.
  10016. It takes two inputs and has one output. The first input is the "main"
  10017. video on which the second input is overlaid.
  10018. It accepts the following parameters:
  10019. A description of the accepted options follows.
  10020. @table @option
  10021. @item x
  10022. @item y
  10023. Set the expression for the x and y coordinates of the overlaid video
  10024. on the main video. Default value is "0" for both expressions. In case
  10025. the expression is invalid, it is set to a huge value (meaning that the
  10026. overlay will not be displayed within the output visible area).
  10027. @item eof_action
  10028. See @ref{framesync}.
  10029. @item eval
  10030. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10031. It accepts the following values:
  10032. @table @samp
  10033. @item init
  10034. only evaluate expressions once during the filter initialization or
  10035. when a command is processed
  10036. @item frame
  10037. evaluate expressions for each incoming frame
  10038. @end table
  10039. Default value is @samp{frame}.
  10040. @item shortest
  10041. See @ref{framesync}.
  10042. @item format
  10043. Set the format for the output video.
  10044. It accepts the following values:
  10045. @table @samp
  10046. @item yuv420
  10047. force YUV420 output
  10048. @item yuv422
  10049. force YUV422 output
  10050. @item yuv444
  10051. force YUV444 output
  10052. @item rgb
  10053. force packed RGB output
  10054. @item gbrp
  10055. force planar RGB output
  10056. @item auto
  10057. automatically pick format
  10058. @end table
  10059. Default value is @samp{yuv420}.
  10060. @item repeatlast
  10061. See @ref{framesync}.
  10062. @item alpha
  10063. Set format of alpha of the overlaid video, it can be @var{straight} or
  10064. @var{premultiplied}. Default is @var{straight}.
  10065. @end table
  10066. The @option{x}, and @option{y} expressions can contain the following
  10067. parameters.
  10068. @table @option
  10069. @item main_w, W
  10070. @item main_h, H
  10071. The main input width and height.
  10072. @item overlay_w, w
  10073. @item overlay_h, h
  10074. The overlay input width and height.
  10075. @item x
  10076. @item y
  10077. The computed values for @var{x} and @var{y}. They are evaluated for
  10078. each new frame.
  10079. @item hsub
  10080. @item vsub
  10081. horizontal and vertical chroma subsample values of the output
  10082. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10083. @var{vsub} is 1.
  10084. @item n
  10085. the number of input frame, starting from 0
  10086. @item pos
  10087. the position in the file of the input frame, NAN if unknown
  10088. @item t
  10089. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10090. @end table
  10091. This filter also supports the @ref{framesync} options.
  10092. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10093. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10094. when @option{eval} is set to @samp{init}.
  10095. Be aware that frames are taken from each input video in timestamp
  10096. order, hence, if their initial timestamps differ, it is a good idea
  10097. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10098. have them begin in the same zero timestamp, as the example for
  10099. the @var{movie} filter does.
  10100. You can chain together more overlays but you should test the
  10101. efficiency of such approach.
  10102. @subsection Commands
  10103. This filter supports the following commands:
  10104. @table @option
  10105. @item x
  10106. @item y
  10107. Modify the x and y of the overlay input.
  10108. The command accepts the same syntax of the corresponding option.
  10109. If the specified expression is not valid, it is kept at its current
  10110. value.
  10111. @end table
  10112. @subsection Examples
  10113. @itemize
  10114. @item
  10115. Draw the overlay at 10 pixels from the bottom right corner of the main
  10116. video:
  10117. @example
  10118. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10119. @end example
  10120. Using named options the example above becomes:
  10121. @example
  10122. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10123. @end example
  10124. @item
  10125. Insert a transparent PNG logo in the bottom left corner of the input,
  10126. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10127. @example
  10128. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10129. @end example
  10130. @item
  10131. Insert 2 different transparent PNG logos (second logo on bottom
  10132. right corner) using the @command{ffmpeg} tool:
  10133. @example
  10134. 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
  10135. @end example
  10136. @item
  10137. Add a transparent color layer on top of the main video; @code{WxH}
  10138. must specify the size of the main input to the overlay filter:
  10139. @example
  10140. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10141. @end example
  10142. @item
  10143. Play an original video and a filtered version (here with the deshake
  10144. filter) side by side using the @command{ffplay} tool:
  10145. @example
  10146. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10147. @end example
  10148. The above command is the same as:
  10149. @example
  10150. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10151. @end example
  10152. @item
  10153. Make a sliding overlay appearing from the left to the right top part of the
  10154. screen starting since time 2:
  10155. @example
  10156. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10157. @end example
  10158. @item
  10159. Compose output by putting two input videos side to side:
  10160. @example
  10161. ffmpeg -i left.avi -i right.avi -filter_complex "
  10162. nullsrc=size=200x100 [background];
  10163. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10164. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10165. [background][left] overlay=shortest=1 [background+left];
  10166. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10167. "
  10168. @end example
  10169. @item
  10170. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10171. @example
  10172. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10173. -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]'
  10174. masked.avi
  10175. @end example
  10176. @item
  10177. Chain several overlays in cascade:
  10178. @example
  10179. nullsrc=s=200x200 [bg];
  10180. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10181. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10182. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10183. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10184. [in3] null, [mid2] overlay=100:100 [out0]
  10185. @end example
  10186. @end itemize
  10187. @section owdenoise
  10188. Apply Overcomplete Wavelet denoiser.
  10189. The filter accepts the following options:
  10190. @table @option
  10191. @item depth
  10192. Set depth.
  10193. Larger depth values will denoise lower frequency components more, but
  10194. slow down filtering.
  10195. Must be an int in the range 8-16, default is @code{8}.
  10196. @item luma_strength, ls
  10197. Set luma strength.
  10198. Must be a double value in the range 0-1000, default is @code{1.0}.
  10199. @item chroma_strength, cs
  10200. Set chroma strength.
  10201. Must be a double value in the range 0-1000, default is @code{1.0}.
  10202. @end table
  10203. @anchor{pad}
  10204. @section pad
  10205. Add paddings to the input image, and place the original input at the
  10206. provided @var{x}, @var{y} coordinates.
  10207. It accepts the following parameters:
  10208. @table @option
  10209. @item width, w
  10210. @item height, h
  10211. Specify an expression for the size of the output image with the
  10212. paddings added. If the value for @var{width} or @var{height} is 0, the
  10213. corresponding input size is used for the output.
  10214. The @var{width} expression can reference the value set by the
  10215. @var{height} expression, and vice versa.
  10216. The default value of @var{width} and @var{height} is 0.
  10217. @item x
  10218. @item y
  10219. Specify the offsets to place the input image at within the padded area,
  10220. with respect to the top/left border of the output image.
  10221. The @var{x} expression can reference the value set by the @var{y}
  10222. expression, and vice versa.
  10223. The default value of @var{x} and @var{y} is 0.
  10224. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10225. so the input image is centered on the padded area.
  10226. @item color
  10227. Specify the color of the padded area. For the syntax of this option,
  10228. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10229. manual,ffmpeg-utils}.
  10230. The default value of @var{color} is "black".
  10231. @item eval
  10232. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10233. It accepts the following values:
  10234. @table @samp
  10235. @item init
  10236. Only evaluate expressions once during the filter initialization or when
  10237. a command is processed.
  10238. @item frame
  10239. Evaluate expressions for each incoming frame.
  10240. @end table
  10241. Default value is @samp{init}.
  10242. @item aspect
  10243. Pad to aspect instead to a resolution.
  10244. @end table
  10245. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10246. options are expressions containing the following constants:
  10247. @table @option
  10248. @item in_w
  10249. @item in_h
  10250. The input video width and height.
  10251. @item iw
  10252. @item ih
  10253. These are the same as @var{in_w} and @var{in_h}.
  10254. @item out_w
  10255. @item out_h
  10256. The output width and height (the size of the padded area), as
  10257. specified by the @var{width} and @var{height} expressions.
  10258. @item ow
  10259. @item oh
  10260. These are the same as @var{out_w} and @var{out_h}.
  10261. @item x
  10262. @item y
  10263. The x and y offsets as specified by the @var{x} and @var{y}
  10264. expressions, or NAN if not yet specified.
  10265. @item a
  10266. same as @var{iw} / @var{ih}
  10267. @item sar
  10268. input sample aspect ratio
  10269. @item dar
  10270. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10271. @item hsub
  10272. @item vsub
  10273. The horizontal and vertical chroma subsample values. For example for the
  10274. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10275. @end table
  10276. @subsection Examples
  10277. @itemize
  10278. @item
  10279. Add paddings with the color "violet" to the input video. The output video
  10280. size is 640x480, and the top-left corner of the input video is placed at
  10281. column 0, row 40
  10282. @example
  10283. pad=640:480:0:40:violet
  10284. @end example
  10285. The example above is equivalent to the following command:
  10286. @example
  10287. pad=width=640:height=480:x=0:y=40:color=violet
  10288. @end example
  10289. @item
  10290. Pad the input to get an output with dimensions increased by 3/2,
  10291. and put the input video at the center of the padded area:
  10292. @example
  10293. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10294. @end example
  10295. @item
  10296. Pad the input to get a squared output with size equal to the maximum
  10297. value between the input width and height, and put the input video at
  10298. the center of the padded area:
  10299. @example
  10300. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10301. @end example
  10302. @item
  10303. Pad the input to get a final w/h ratio of 16:9:
  10304. @example
  10305. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10306. @end example
  10307. @item
  10308. In case of anamorphic video, in order to set the output display aspect
  10309. correctly, it is necessary to use @var{sar} in the expression,
  10310. according to the relation:
  10311. @example
  10312. (ih * X / ih) * sar = output_dar
  10313. X = output_dar / sar
  10314. @end example
  10315. Thus the previous example needs to be modified to:
  10316. @example
  10317. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10318. @end example
  10319. @item
  10320. Double the output size and put the input video in the bottom-right
  10321. corner of the output padded area:
  10322. @example
  10323. pad="2*iw:2*ih:ow-iw:oh-ih"
  10324. @end example
  10325. @end itemize
  10326. @anchor{palettegen}
  10327. @section palettegen
  10328. Generate one palette for a whole video stream.
  10329. It accepts the following options:
  10330. @table @option
  10331. @item max_colors
  10332. Set the maximum number of colors to quantize in the palette.
  10333. Note: the palette will still contain 256 colors; the unused palette entries
  10334. will be black.
  10335. @item reserve_transparent
  10336. Create a palette of 255 colors maximum and reserve the last one for
  10337. transparency. Reserving the transparency color is useful for GIF optimization.
  10338. If not set, the maximum of colors in the palette will be 256. You probably want
  10339. to disable this option for a standalone image.
  10340. Set by default.
  10341. @item transparency_color
  10342. Set the color that will be used as background for transparency.
  10343. @item stats_mode
  10344. Set statistics mode.
  10345. It accepts the following values:
  10346. @table @samp
  10347. @item full
  10348. Compute full frame histograms.
  10349. @item diff
  10350. Compute histograms only for the part that differs from previous frame. This
  10351. might be relevant to give more importance to the moving part of your input if
  10352. the background is static.
  10353. @item single
  10354. Compute new histogram for each frame.
  10355. @end table
  10356. Default value is @var{full}.
  10357. @end table
  10358. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10359. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10360. color quantization of the palette. This information is also visible at
  10361. @var{info} logging level.
  10362. @subsection Examples
  10363. @itemize
  10364. @item
  10365. Generate a representative palette of a given video using @command{ffmpeg}:
  10366. @example
  10367. ffmpeg -i input.mkv -vf palettegen palette.png
  10368. @end example
  10369. @end itemize
  10370. @section paletteuse
  10371. Use a palette to downsample an input video stream.
  10372. The filter takes two inputs: one video stream and a palette. The palette must
  10373. be a 256 pixels image.
  10374. It accepts the following options:
  10375. @table @option
  10376. @item dither
  10377. Select dithering mode. Available algorithms are:
  10378. @table @samp
  10379. @item bayer
  10380. Ordered 8x8 bayer dithering (deterministic)
  10381. @item heckbert
  10382. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10383. Note: this dithering is sometimes considered "wrong" and is included as a
  10384. reference.
  10385. @item floyd_steinberg
  10386. Floyd and Steingberg dithering (error diffusion)
  10387. @item sierra2
  10388. Frankie Sierra dithering v2 (error diffusion)
  10389. @item sierra2_4a
  10390. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10391. @end table
  10392. Default is @var{sierra2_4a}.
  10393. @item bayer_scale
  10394. When @var{bayer} dithering is selected, this option defines the scale of the
  10395. pattern (how much the crosshatch pattern is visible). A low value means more
  10396. visible pattern for less banding, and higher value means less visible pattern
  10397. at the cost of more banding.
  10398. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10399. @item diff_mode
  10400. If set, define the zone to process
  10401. @table @samp
  10402. @item rectangle
  10403. Only the changing rectangle will be reprocessed. This is similar to GIF
  10404. cropping/offsetting compression mechanism. This option can be useful for speed
  10405. if only a part of the image is changing, and has use cases such as limiting the
  10406. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10407. moving scene (it leads to more deterministic output if the scene doesn't change
  10408. much, and as a result less moving noise and better GIF compression).
  10409. @end table
  10410. Default is @var{none}.
  10411. @item new
  10412. Take new palette for each output frame.
  10413. @item alpha_threshold
  10414. Sets the alpha threshold for transparency. Alpha values above this threshold
  10415. will be treated as completely opaque, and values below this threshold will be
  10416. treated as completely transparent.
  10417. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10418. @end table
  10419. @subsection Examples
  10420. @itemize
  10421. @item
  10422. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10423. using @command{ffmpeg}:
  10424. @example
  10425. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10426. @end example
  10427. @end itemize
  10428. @section perspective
  10429. Correct perspective of video not recorded perpendicular to the screen.
  10430. A description of the accepted parameters follows.
  10431. @table @option
  10432. @item x0
  10433. @item y0
  10434. @item x1
  10435. @item y1
  10436. @item x2
  10437. @item y2
  10438. @item x3
  10439. @item y3
  10440. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10441. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10442. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10443. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10444. then the corners of the source will be sent to the specified coordinates.
  10445. The expressions can use the following variables:
  10446. @table @option
  10447. @item W
  10448. @item H
  10449. the width and height of video frame.
  10450. @item in
  10451. Input frame count.
  10452. @item on
  10453. Output frame count.
  10454. @end table
  10455. @item interpolation
  10456. Set interpolation for perspective correction.
  10457. It accepts the following values:
  10458. @table @samp
  10459. @item linear
  10460. @item cubic
  10461. @end table
  10462. Default value is @samp{linear}.
  10463. @item sense
  10464. Set interpretation of coordinate options.
  10465. It accepts the following values:
  10466. @table @samp
  10467. @item 0, source
  10468. Send point in the source specified by the given coordinates to
  10469. the corners of the destination.
  10470. @item 1, destination
  10471. Send the corners of the source to the point in the destination specified
  10472. by the given coordinates.
  10473. Default value is @samp{source}.
  10474. @end table
  10475. @item eval
  10476. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10477. It accepts the following values:
  10478. @table @samp
  10479. @item init
  10480. only evaluate expressions once during the filter initialization or
  10481. when a command is processed
  10482. @item frame
  10483. evaluate expressions for each incoming frame
  10484. @end table
  10485. Default value is @samp{init}.
  10486. @end table
  10487. @section phase
  10488. Delay interlaced video by one field time so that the field order changes.
  10489. The intended use is to fix PAL movies that have been captured with the
  10490. opposite field order to the film-to-video transfer.
  10491. A description of the accepted parameters follows.
  10492. @table @option
  10493. @item mode
  10494. Set phase mode.
  10495. It accepts the following values:
  10496. @table @samp
  10497. @item t
  10498. Capture field order top-first, transfer bottom-first.
  10499. Filter will delay the bottom field.
  10500. @item b
  10501. Capture field order bottom-first, transfer top-first.
  10502. Filter will delay the top field.
  10503. @item p
  10504. Capture and transfer with the same field order. This mode only exists
  10505. for the documentation of the other options to refer to, but if you
  10506. actually select it, the filter will faithfully do nothing.
  10507. @item a
  10508. Capture field order determined automatically by field flags, transfer
  10509. opposite.
  10510. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10511. basis using field flags. If no field information is available,
  10512. then this works just like @samp{u}.
  10513. @item u
  10514. Capture unknown or varying, transfer opposite.
  10515. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10516. analyzing the images and selecting the alternative that produces best
  10517. match between the fields.
  10518. @item T
  10519. Capture top-first, transfer unknown or varying.
  10520. Filter selects among @samp{t} and @samp{p} using image analysis.
  10521. @item B
  10522. Capture bottom-first, transfer unknown or varying.
  10523. Filter selects among @samp{b} and @samp{p} using image analysis.
  10524. @item A
  10525. Capture determined by field flags, transfer unknown or varying.
  10526. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10527. image analysis. If no field information is available, then this works just
  10528. like @samp{U}. This is the default mode.
  10529. @item U
  10530. Both capture and transfer unknown or varying.
  10531. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10532. @end table
  10533. @end table
  10534. @section pixdesctest
  10535. Pixel format descriptor test filter, mainly useful for internal
  10536. testing. The output video should be equal to the input video.
  10537. For example:
  10538. @example
  10539. format=monow, pixdesctest
  10540. @end example
  10541. can be used to test the monowhite pixel format descriptor definition.
  10542. @section pixscope
  10543. Display sample values of color channels. Mainly useful for checking color
  10544. and levels. Minimum supported resolution is 640x480.
  10545. The filters accept the following options:
  10546. @table @option
  10547. @item x
  10548. Set scope X position, relative offset on X axis.
  10549. @item y
  10550. Set scope Y position, relative offset on Y axis.
  10551. @item w
  10552. Set scope width.
  10553. @item h
  10554. Set scope height.
  10555. @item o
  10556. Set window opacity. This window also holds statistics about pixel area.
  10557. @item wx
  10558. Set window X position, relative offset on X axis.
  10559. @item wy
  10560. Set window Y position, relative offset on Y axis.
  10561. @end table
  10562. @section pp
  10563. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10564. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10565. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10566. Each subfilter and some options have a short and a long name that can be used
  10567. interchangeably, i.e. dr/dering are the same.
  10568. The filters accept the following options:
  10569. @table @option
  10570. @item subfilters
  10571. Set postprocessing subfilters string.
  10572. @end table
  10573. All subfilters share common options to determine their scope:
  10574. @table @option
  10575. @item a/autoq
  10576. Honor the quality commands for this subfilter.
  10577. @item c/chrom
  10578. Do chrominance filtering, too (default).
  10579. @item y/nochrom
  10580. Do luminance filtering only (no chrominance).
  10581. @item n/noluma
  10582. Do chrominance filtering only (no luminance).
  10583. @end table
  10584. These options can be appended after the subfilter name, separated by a '|'.
  10585. Available subfilters are:
  10586. @table @option
  10587. @item hb/hdeblock[|difference[|flatness]]
  10588. Horizontal deblocking filter
  10589. @table @option
  10590. @item difference
  10591. Difference factor where higher values mean more deblocking (default: @code{32}).
  10592. @item flatness
  10593. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10594. @end table
  10595. @item vb/vdeblock[|difference[|flatness]]
  10596. Vertical deblocking filter
  10597. @table @option
  10598. @item difference
  10599. Difference factor where higher values mean more deblocking (default: @code{32}).
  10600. @item flatness
  10601. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10602. @end table
  10603. @item ha/hadeblock[|difference[|flatness]]
  10604. Accurate horizontal deblocking filter
  10605. @table @option
  10606. @item difference
  10607. Difference factor where higher values mean more deblocking (default: @code{32}).
  10608. @item flatness
  10609. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10610. @end table
  10611. @item va/vadeblock[|difference[|flatness]]
  10612. Accurate vertical deblocking filter
  10613. @table @option
  10614. @item difference
  10615. Difference factor where higher values mean more deblocking (default: @code{32}).
  10616. @item flatness
  10617. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10618. @end table
  10619. @end table
  10620. The horizontal and vertical deblocking filters share the difference and
  10621. flatness values so you cannot set different horizontal and vertical
  10622. thresholds.
  10623. @table @option
  10624. @item h1/x1hdeblock
  10625. Experimental horizontal deblocking filter
  10626. @item v1/x1vdeblock
  10627. Experimental vertical deblocking filter
  10628. @item dr/dering
  10629. Deringing filter
  10630. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10631. @table @option
  10632. @item threshold1
  10633. larger -> stronger filtering
  10634. @item threshold2
  10635. larger -> stronger filtering
  10636. @item threshold3
  10637. larger -> stronger filtering
  10638. @end table
  10639. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10640. @table @option
  10641. @item f/fullyrange
  10642. Stretch luminance to @code{0-255}.
  10643. @end table
  10644. @item lb/linblenddeint
  10645. Linear blend deinterlacing filter that deinterlaces the given block by
  10646. filtering all lines with a @code{(1 2 1)} filter.
  10647. @item li/linipoldeint
  10648. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10649. linearly interpolating every second line.
  10650. @item ci/cubicipoldeint
  10651. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10652. cubically interpolating every second line.
  10653. @item md/mediandeint
  10654. Median deinterlacing filter that deinterlaces the given block by applying a
  10655. median filter to every second line.
  10656. @item fd/ffmpegdeint
  10657. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10658. second line with a @code{(-1 4 2 4 -1)} filter.
  10659. @item l5/lowpass5
  10660. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10661. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10662. @item fq/forceQuant[|quantizer]
  10663. Overrides the quantizer table from the input with the constant quantizer you
  10664. specify.
  10665. @table @option
  10666. @item quantizer
  10667. Quantizer to use
  10668. @end table
  10669. @item de/default
  10670. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10671. @item fa/fast
  10672. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10673. @item ac
  10674. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10675. @end table
  10676. @subsection Examples
  10677. @itemize
  10678. @item
  10679. Apply horizontal and vertical deblocking, deringing and automatic
  10680. brightness/contrast:
  10681. @example
  10682. pp=hb/vb/dr/al
  10683. @end example
  10684. @item
  10685. Apply default filters without brightness/contrast correction:
  10686. @example
  10687. pp=de/-al
  10688. @end example
  10689. @item
  10690. Apply default filters and temporal denoiser:
  10691. @example
  10692. pp=default/tmpnoise|1|2|3
  10693. @end example
  10694. @item
  10695. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10696. automatically depending on available CPU time:
  10697. @example
  10698. pp=hb|y/vb|a
  10699. @end example
  10700. @end itemize
  10701. @section pp7
  10702. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10703. similar to spp = 6 with 7 point DCT, where only the center sample is
  10704. used after IDCT.
  10705. The filter accepts the following options:
  10706. @table @option
  10707. @item qp
  10708. Force a constant quantization parameter. It accepts an integer in range
  10709. 0 to 63. If not set, the filter will use the QP from the video stream
  10710. (if available).
  10711. @item mode
  10712. Set thresholding mode. Available modes are:
  10713. @table @samp
  10714. @item hard
  10715. Set hard thresholding.
  10716. @item soft
  10717. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10718. @item medium
  10719. Set medium thresholding (good results, default).
  10720. @end table
  10721. @end table
  10722. @section premultiply
  10723. Apply alpha premultiply effect to input video stream using first plane
  10724. of second stream as alpha.
  10725. Both streams must have same dimensions and same pixel format.
  10726. The filter accepts the following option:
  10727. @table @option
  10728. @item planes
  10729. Set which planes will be processed, unprocessed planes will be copied.
  10730. By default value 0xf, all planes will be processed.
  10731. @item inplace
  10732. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10733. @end table
  10734. @section prewitt
  10735. Apply prewitt operator to input video stream.
  10736. The filter accepts the following option:
  10737. @table @option
  10738. @item planes
  10739. Set which planes will be processed, unprocessed planes will be copied.
  10740. By default value 0xf, all planes will be processed.
  10741. @item scale
  10742. Set value which will be multiplied with filtered result.
  10743. @item delta
  10744. Set value which will be added to filtered result.
  10745. @end table
  10746. @anchor{program_opencl}
  10747. @section program_opencl
  10748. Filter video using an OpenCL program.
  10749. @table @option
  10750. @item source
  10751. OpenCL program source file.
  10752. @item kernel
  10753. Kernel name in program.
  10754. @item inputs
  10755. Number of inputs to the filter. Defaults to 1.
  10756. @item size, s
  10757. Size of output frames. Defaults to the same as the first input.
  10758. @end table
  10759. The program source file must contain a kernel function with the given name,
  10760. which will be run once for each plane of the output. Each run on a plane
  10761. gets enqueued as a separate 2D global NDRange with one work-item for each
  10762. pixel to be generated. The global ID offset for each work-item is therefore
  10763. the coordinates of a pixel in the destination image.
  10764. The kernel function needs to take the following arguments:
  10765. @itemize
  10766. @item
  10767. Destination image, @var{__write_only image2d_t}.
  10768. This image will become the output; the kernel should write all of it.
  10769. @item
  10770. Frame index, @var{unsigned int}.
  10771. This is a counter starting from zero and increasing by one for each frame.
  10772. @item
  10773. Source images, @var{__read_only image2d_t}.
  10774. These are the most recent images on each input. The kernel may read from
  10775. them to generate the output, but they can't be written to.
  10776. @end itemize
  10777. Example programs:
  10778. @itemize
  10779. @item
  10780. Copy the input to the output (output must be the same size as the input).
  10781. @verbatim
  10782. __kernel void copy(__write_only image2d_t destination,
  10783. unsigned int index,
  10784. __read_only image2d_t source)
  10785. {
  10786. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10787. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10788. float4 value = read_imagef(source, sampler, location);
  10789. write_imagef(destination, location, value);
  10790. }
  10791. @end verbatim
  10792. @item
  10793. Apply a simple transformation, rotating the input by an amount increasing
  10794. with the index counter. Pixel values are linearly interpolated by the
  10795. sampler, and the output need not have the same dimensions as the input.
  10796. @verbatim
  10797. __kernel void rotate_image(__write_only image2d_t dst,
  10798. unsigned int index,
  10799. __read_only image2d_t src)
  10800. {
  10801. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10802. CLK_FILTER_LINEAR);
  10803. float angle = (float)index / 100.0f;
  10804. float2 dst_dim = convert_float2(get_image_dim(dst));
  10805. float2 src_dim = convert_float2(get_image_dim(src));
  10806. float2 dst_cen = dst_dim / 2.0f;
  10807. float2 src_cen = src_dim / 2.0f;
  10808. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10809. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10810. float2 src_pos = {
  10811. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10812. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10813. };
  10814. src_pos = src_pos * src_dim / dst_dim;
  10815. float2 src_loc = src_pos + src_cen;
  10816. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10817. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10818. write_imagef(dst, dst_loc, 0.5f);
  10819. else
  10820. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10821. }
  10822. @end verbatim
  10823. @item
  10824. Blend two inputs together, with the amount of each input used varying
  10825. with the index counter.
  10826. @verbatim
  10827. __kernel void blend_images(__write_only image2d_t dst,
  10828. unsigned int index,
  10829. __read_only image2d_t src1,
  10830. __read_only image2d_t src2)
  10831. {
  10832. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10833. CLK_FILTER_LINEAR);
  10834. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10835. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10836. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10837. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10838. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10839. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10840. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10841. }
  10842. @end verbatim
  10843. @end itemize
  10844. @section pseudocolor
  10845. Alter frame colors in video with pseudocolors.
  10846. This filter accept the following options:
  10847. @table @option
  10848. @item c0
  10849. set pixel first component expression
  10850. @item c1
  10851. set pixel second component expression
  10852. @item c2
  10853. set pixel third component expression
  10854. @item c3
  10855. set pixel fourth component expression, corresponds to the alpha component
  10856. @item i
  10857. set component to use as base for altering colors
  10858. @end table
  10859. Each of them specifies the expression to use for computing the lookup table for
  10860. the corresponding pixel component values.
  10861. The expressions can contain the following constants and functions:
  10862. @table @option
  10863. @item w
  10864. @item h
  10865. The input width and height.
  10866. @item val
  10867. The input value for the pixel component.
  10868. @item ymin, umin, vmin, amin
  10869. The minimum allowed component value.
  10870. @item ymax, umax, vmax, amax
  10871. The maximum allowed component value.
  10872. @end table
  10873. All expressions default to "val".
  10874. @subsection Examples
  10875. @itemize
  10876. @item
  10877. Change too high luma values to gradient:
  10878. @example
  10879. 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'"
  10880. @end example
  10881. @end itemize
  10882. @section psnr
  10883. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10884. Ratio) between two input videos.
  10885. This filter takes in input two input videos, the first input is
  10886. considered the "main" source and is passed unchanged to the
  10887. output. The second input is used as a "reference" video for computing
  10888. the PSNR.
  10889. Both video inputs must have the same resolution and pixel format for
  10890. this filter to work correctly. Also it assumes that both inputs
  10891. have the same number of frames, which are compared one by one.
  10892. The obtained average PSNR is printed through the logging system.
  10893. The filter stores the accumulated MSE (mean squared error) of each
  10894. frame, and at the end of the processing it is averaged across all frames
  10895. equally, and the following formula is applied to obtain the PSNR:
  10896. @example
  10897. PSNR = 10*log10(MAX^2/MSE)
  10898. @end example
  10899. Where MAX is the average of the maximum values of each component of the
  10900. image.
  10901. The description of the accepted parameters follows.
  10902. @table @option
  10903. @item stats_file, f
  10904. If specified the filter will use the named file to save the PSNR of
  10905. each individual frame. When filename equals "-" the data is sent to
  10906. standard output.
  10907. @item stats_version
  10908. Specifies which version of the stats file format to use. Details of
  10909. each format are written below.
  10910. Default value is 1.
  10911. @item stats_add_max
  10912. Determines whether the max value is output to the stats log.
  10913. Default value is 0.
  10914. Requires stats_version >= 2. If this is set and stats_version < 2,
  10915. the filter will return an error.
  10916. @end table
  10917. This filter also supports the @ref{framesync} options.
  10918. The file printed if @var{stats_file} is selected, contains a sequence of
  10919. key/value pairs of the form @var{key}:@var{value} for each compared
  10920. couple of frames.
  10921. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10922. the list of per-frame-pair stats, with key value pairs following the frame
  10923. format with the following parameters:
  10924. @table @option
  10925. @item psnr_log_version
  10926. The version of the log file format. Will match @var{stats_version}.
  10927. @item fields
  10928. A comma separated list of the per-frame-pair parameters included in
  10929. the log.
  10930. @end table
  10931. A description of each shown per-frame-pair parameter follows:
  10932. @table @option
  10933. @item n
  10934. sequential number of the input frame, starting from 1
  10935. @item mse_avg
  10936. Mean Square Error pixel-by-pixel average difference of the compared
  10937. frames, averaged over all the image components.
  10938. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10939. Mean Square Error pixel-by-pixel average difference of the compared
  10940. frames for the component specified by the suffix.
  10941. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10942. Peak Signal to Noise ratio of the compared frames for the component
  10943. specified by the suffix.
  10944. @item max_avg, max_y, max_u, max_v
  10945. Maximum allowed value for each channel, and average over all
  10946. channels.
  10947. @end table
  10948. For example:
  10949. @example
  10950. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10951. [main][ref] psnr="stats_file=stats.log" [out]
  10952. @end example
  10953. On this example the input file being processed is compared with the
  10954. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10955. is stored in @file{stats.log}.
  10956. @anchor{pullup}
  10957. @section pullup
  10958. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10959. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10960. content.
  10961. The pullup filter is designed to take advantage of future context in making
  10962. its decisions. This filter is stateless in the sense that it does not lock
  10963. onto a pattern to follow, but it instead looks forward to the following
  10964. fields in order to identify matches and rebuild progressive frames.
  10965. To produce content with an even framerate, insert the fps filter after
  10966. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10967. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10968. The filter accepts the following options:
  10969. @table @option
  10970. @item jl
  10971. @item jr
  10972. @item jt
  10973. @item jb
  10974. These options set the amount of "junk" to ignore at the left, right, top, and
  10975. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10976. while top and bottom are in units of 2 lines.
  10977. The default is 8 pixels on each side.
  10978. @item sb
  10979. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10980. filter generating an occasional mismatched frame, but it may also cause an
  10981. excessive number of frames to be dropped during high motion sequences.
  10982. Conversely, setting it to -1 will make filter match fields more easily.
  10983. This may help processing of video where there is slight blurring between
  10984. the fields, but may also cause there to be interlaced frames in the output.
  10985. Default value is @code{0}.
  10986. @item mp
  10987. Set the metric plane to use. It accepts the following values:
  10988. @table @samp
  10989. @item l
  10990. Use luma plane.
  10991. @item u
  10992. Use chroma blue plane.
  10993. @item v
  10994. Use chroma red plane.
  10995. @end table
  10996. This option may be set to use chroma plane instead of the default luma plane
  10997. for doing filter's computations. This may improve accuracy on very clean
  10998. source material, but more likely will decrease accuracy, especially if there
  10999. is chroma noise (rainbow effect) or any grayscale video.
  11000. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11001. load and make pullup usable in realtime on slow machines.
  11002. @end table
  11003. For best results (without duplicated frames in the output file) it is
  11004. necessary to change the output frame rate. For example, to inverse
  11005. telecine NTSC input:
  11006. @example
  11007. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11008. @end example
  11009. @section qp
  11010. Change video quantization parameters (QP).
  11011. The filter accepts the following option:
  11012. @table @option
  11013. @item qp
  11014. Set expression for quantization parameter.
  11015. @end table
  11016. The expression is evaluated through the eval API and can contain, among others,
  11017. the following constants:
  11018. @table @var
  11019. @item known
  11020. 1 if index is not 129, 0 otherwise.
  11021. @item qp
  11022. Sequential index starting from -129 to 128.
  11023. @end table
  11024. @subsection Examples
  11025. @itemize
  11026. @item
  11027. Some equation like:
  11028. @example
  11029. qp=2+2*sin(PI*qp)
  11030. @end example
  11031. @end itemize
  11032. @section random
  11033. Flush video frames from internal cache of frames into a random order.
  11034. No frame is discarded.
  11035. Inspired by @ref{frei0r} nervous filter.
  11036. @table @option
  11037. @item frames
  11038. Set size in number of frames of internal cache, in range from @code{2} to
  11039. @code{512}. Default is @code{30}.
  11040. @item seed
  11041. Set seed for random number generator, must be an integer included between
  11042. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11043. less than @code{0}, the filter will try to use a good random seed on a
  11044. best effort basis.
  11045. @end table
  11046. @section readeia608
  11047. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11048. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11049. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11050. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11051. @table @option
  11052. @item lavfi.readeia608.X.cc
  11053. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11054. @item lavfi.readeia608.X.line
  11055. The number of the line on which the EIA-608 data was identified and read.
  11056. @end table
  11057. This filter accepts the following options:
  11058. @table @option
  11059. @item scan_min
  11060. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11061. @item scan_max
  11062. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11063. @item mac
  11064. Set minimal acceptable amplitude change for sync codes detection.
  11065. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11066. @item spw
  11067. Set the ratio of width reserved for sync code detection.
  11068. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11069. @item mhd
  11070. Set the max peaks height difference for sync code detection.
  11071. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11072. @item mpd
  11073. Set max peaks period difference for sync code detection.
  11074. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11075. @item msd
  11076. Set the first two max start code bits differences.
  11077. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11078. @item bhd
  11079. Set the minimum ratio of bits height compared to 3rd start code bit.
  11080. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11081. @item th_w
  11082. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11083. @item th_b
  11084. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11085. @item chp
  11086. Enable checking the parity bit. In the event of a parity error, the filter will output
  11087. @code{0x00} for that character. Default is false.
  11088. @end table
  11089. @subsection Examples
  11090. @itemize
  11091. @item
  11092. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11093. @example
  11094. 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
  11095. @end example
  11096. @end itemize
  11097. @section readvitc
  11098. Read vertical interval timecode (VITC) information from the top lines of a
  11099. video frame.
  11100. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11101. timecode value, if a valid timecode has been detected. Further metadata key
  11102. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11103. timecode data has been found or not.
  11104. This filter accepts the following options:
  11105. @table @option
  11106. @item scan_max
  11107. Set the maximum number of lines to scan for VITC data. If the value is set to
  11108. @code{-1} the full video frame is scanned. Default is @code{45}.
  11109. @item thr_b
  11110. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11111. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11112. @item thr_w
  11113. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11114. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11115. @end table
  11116. @subsection Examples
  11117. @itemize
  11118. @item
  11119. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11120. draw @code{--:--:--:--} as a placeholder:
  11121. @example
  11122. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11123. @end example
  11124. @end itemize
  11125. @section remap
  11126. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11127. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11128. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11129. value for pixel will be used for destination pixel.
  11130. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11131. will have Xmap/Ymap video stream dimensions.
  11132. Xmap and Ymap input video streams are 16bit depth, single channel.
  11133. @section removegrain
  11134. The removegrain filter is a spatial denoiser for progressive video.
  11135. @table @option
  11136. @item m0
  11137. Set mode for the first plane.
  11138. @item m1
  11139. Set mode for the second plane.
  11140. @item m2
  11141. Set mode for the third plane.
  11142. @item m3
  11143. Set mode for the fourth plane.
  11144. @end table
  11145. Range of mode is from 0 to 24. Description of each mode follows:
  11146. @table @var
  11147. @item 0
  11148. Leave input plane unchanged. Default.
  11149. @item 1
  11150. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11151. @item 2
  11152. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11153. @item 3
  11154. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11155. @item 4
  11156. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11157. This is equivalent to a median filter.
  11158. @item 5
  11159. Line-sensitive clipping giving the minimal change.
  11160. @item 6
  11161. Line-sensitive clipping, intermediate.
  11162. @item 7
  11163. Line-sensitive clipping, intermediate.
  11164. @item 8
  11165. Line-sensitive clipping, intermediate.
  11166. @item 9
  11167. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11168. @item 10
  11169. Replaces the target pixel with the closest neighbour.
  11170. @item 11
  11171. [1 2 1] horizontal and vertical kernel blur.
  11172. @item 12
  11173. Same as mode 11.
  11174. @item 13
  11175. Bob mode, interpolates top field from the line where the neighbours
  11176. pixels are the closest.
  11177. @item 14
  11178. Bob mode, interpolates bottom field from the line where the neighbours
  11179. pixels are the closest.
  11180. @item 15
  11181. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11182. interpolation formula.
  11183. @item 16
  11184. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11185. interpolation formula.
  11186. @item 17
  11187. Clips the pixel with the minimum and maximum of respectively the maximum and
  11188. minimum of each pair of opposite neighbour pixels.
  11189. @item 18
  11190. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11191. the current pixel is minimal.
  11192. @item 19
  11193. Replaces the pixel with the average of its 8 neighbours.
  11194. @item 20
  11195. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11196. @item 21
  11197. Clips pixels using the averages of opposite neighbour.
  11198. @item 22
  11199. Same as mode 21 but simpler and faster.
  11200. @item 23
  11201. Small edge and halo removal, but reputed useless.
  11202. @item 24
  11203. Similar as 23.
  11204. @end table
  11205. @section removelogo
  11206. Suppress a TV station logo, using an image file to determine which
  11207. pixels comprise the logo. It works by filling in the pixels that
  11208. comprise the logo with neighboring pixels.
  11209. The filter accepts the following options:
  11210. @table @option
  11211. @item filename, f
  11212. Set the filter bitmap file, which can be any image format supported by
  11213. libavformat. The width and height of the image file must match those of the
  11214. video stream being processed.
  11215. @end table
  11216. Pixels in the provided bitmap image with a value of zero are not
  11217. considered part of the logo, non-zero pixels are considered part of
  11218. the logo. If you use white (255) for the logo and black (0) for the
  11219. rest, you will be safe. For making the filter bitmap, it is
  11220. recommended to take a screen capture of a black frame with the logo
  11221. visible, and then using a threshold filter followed by the erode
  11222. filter once or twice.
  11223. If needed, little splotches can be fixed manually. Remember that if
  11224. logo pixels are not covered, the filter quality will be much
  11225. reduced. Marking too many pixels as part of the logo does not hurt as
  11226. much, but it will increase the amount of blurring needed to cover over
  11227. the image and will destroy more information than necessary, and extra
  11228. pixels will slow things down on a large logo.
  11229. @section repeatfields
  11230. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11231. fields based on its value.
  11232. @section reverse
  11233. Reverse a video clip.
  11234. Warning: This filter requires memory to buffer the entire clip, so trimming
  11235. is suggested.
  11236. @subsection Examples
  11237. @itemize
  11238. @item
  11239. Take the first 5 seconds of a clip, and reverse it.
  11240. @example
  11241. trim=end=5,reverse
  11242. @end example
  11243. @end itemize
  11244. @section rgbashift
  11245. Shift R/G/B/A pixels horizontally and/or vertically.
  11246. The filter accepts the following options:
  11247. @table @option
  11248. @item rh
  11249. Set amount to shift red horizontally.
  11250. @item rv
  11251. Set amount to shift red vertically.
  11252. @item gh
  11253. Set amount to shift green horizontally.
  11254. @item gv
  11255. Set amount to shift green vertically.
  11256. @item bh
  11257. Set amount to shift blue horizontally.
  11258. @item bv
  11259. Set amount to shift blue vertically.
  11260. @item ah
  11261. Set amount to shift alpha horizontally.
  11262. @item av
  11263. Set amount to shift alpha vertically.
  11264. @item edge
  11265. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11266. @end table
  11267. @section roberts
  11268. Apply roberts cross operator to input video stream.
  11269. The filter accepts the following option:
  11270. @table @option
  11271. @item planes
  11272. Set which planes will be processed, unprocessed planes will be copied.
  11273. By default value 0xf, all planes will be processed.
  11274. @item scale
  11275. Set value which will be multiplied with filtered result.
  11276. @item delta
  11277. Set value which will be added to filtered result.
  11278. @end table
  11279. @section rotate
  11280. Rotate video by an arbitrary angle expressed in radians.
  11281. The filter accepts the following options:
  11282. A description of the optional parameters follows.
  11283. @table @option
  11284. @item angle, a
  11285. Set an expression for the angle by which to rotate the input video
  11286. clockwise, expressed as a number of radians. A negative value will
  11287. result in a counter-clockwise rotation. By default it is set to "0".
  11288. This expression is evaluated for each frame.
  11289. @item out_w, ow
  11290. Set the output width expression, default value is "iw".
  11291. This expression is evaluated just once during configuration.
  11292. @item out_h, oh
  11293. Set the output height expression, default value is "ih".
  11294. This expression is evaluated just once during configuration.
  11295. @item bilinear
  11296. Enable bilinear interpolation if set to 1, a value of 0 disables
  11297. it. Default value is 1.
  11298. @item fillcolor, c
  11299. Set the color used to fill the output area not covered by the rotated
  11300. image. For the general syntax of this option, check the
  11301. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11302. If the special value "none" is selected then no
  11303. background is printed (useful for example if the background is never shown).
  11304. Default value is "black".
  11305. @end table
  11306. The expressions for the angle and the output size can contain the
  11307. following constants and functions:
  11308. @table @option
  11309. @item n
  11310. sequential number of the input frame, starting from 0. It is always NAN
  11311. before the first frame is filtered.
  11312. @item t
  11313. time in seconds of the input frame, it is set to 0 when the filter is
  11314. configured. It is always NAN before the first frame is filtered.
  11315. @item hsub
  11316. @item vsub
  11317. horizontal and vertical chroma subsample values. For example for the
  11318. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11319. @item in_w, iw
  11320. @item in_h, ih
  11321. the input video width and height
  11322. @item out_w, ow
  11323. @item out_h, oh
  11324. the output width and height, that is the size of the padded area as
  11325. specified by the @var{width} and @var{height} expressions
  11326. @item rotw(a)
  11327. @item roth(a)
  11328. the minimal width/height required for completely containing the input
  11329. video rotated by @var{a} radians.
  11330. These are only available when computing the @option{out_w} and
  11331. @option{out_h} expressions.
  11332. @end table
  11333. @subsection Examples
  11334. @itemize
  11335. @item
  11336. Rotate the input by PI/6 radians clockwise:
  11337. @example
  11338. rotate=PI/6
  11339. @end example
  11340. @item
  11341. Rotate the input by PI/6 radians counter-clockwise:
  11342. @example
  11343. rotate=-PI/6
  11344. @end example
  11345. @item
  11346. Rotate the input by 45 degrees clockwise:
  11347. @example
  11348. rotate=45*PI/180
  11349. @end example
  11350. @item
  11351. Apply a constant rotation with period T, starting from an angle of PI/3:
  11352. @example
  11353. rotate=PI/3+2*PI*t/T
  11354. @end example
  11355. @item
  11356. Make the input video rotation oscillating with a period of T
  11357. seconds and an amplitude of A radians:
  11358. @example
  11359. rotate=A*sin(2*PI/T*t)
  11360. @end example
  11361. @item
  11362. Rotate the video, output size is chosen so that the whole rotating
  11363. input video is always completely contained in the output:
  11364. @example
  11365. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11366. @end example
  11367. @item
  11368. Rotate the video, reduce the output size so that no background is ever
  11369. shown:
  11370. @example
  11371. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11372. @end example
  11373. @end itemize
  11374. @subsection Commands
  11375. The filter supports the following commands:
  11376. @table @option
  11377. @item a, angle
  11378. Set the angle expression.
  11379. The command accepts the same syntax of the corresponding option.
  11380. If the specified expression is not valid, it is kept at its current
  11381. value.
  11382. @end table
  11383. @section sab
  11384. Apply Shape Adaptive Blur.
  11385. The filter accepts the following options:
  11386. @table @option
  11387. @item luma_radius, lr
  11388. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11389. value is 1.0. A greater value will result in a more blurred image, and
  11390. in slower processing.
  11391. @item luma_pre_filter_radius, lpfr
  11392. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11393. value is 1.0.
  11394. @item luma_strength, ls
  11395. Set luma maximum difference between pixels to still be considered, must
  11396. be a value in the 0.1-100.0 range, default value is 1.0.
  11397. @item chroma_radius, cr
  11398. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11399. greater value will result in a more blurred image, and in slower
  11400. processing.
  11401. @item chroma_pre_filter_radius, cpfr
  11402. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11403. @item chroma_strength, cs
  11404. Set chroma maximum difference between pixels to still be considered,
  11405. must be a value in the -0.9-100.0 range.
  11406. @end table
  11407. Each chroma option value, if not explicitly specified, is set to the
  11408. corresponding luma option value.
  11409. @anchor{scale}
  11410. @section scale
  11411. Scale (resize) the input video, using the libswscale library.
  11412. The scale filter forces the output display aspect ratio to be the same
  11413. of the input, by changing the output sample aspect ratio.
  11414. If the input image format is different from the format requested by
  11415. the next filter, the scale filter will convert the input to the
  11416. requested format.
  11417. @subsection Options
  11418. The filter accepts the following options, or any of the options
  11419. supported by the libswscale scaler.
  11420. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11421. the complete list of scaler options.
  11422. @table @option
  11423. @item width, w
  11424. @item height, h
  11425. Set the output video dimension expression. Default value is the input
  11426. dimension.
  11427. If the @var{width} or @var{w} value is 0, the input width is used for
  11428. the output. If the @var{height} or @var{h} value is 0, the input height
  11429. is used for the output.
  11430. If one and only one of the values is -n with n >= 1, the scale filter
  11431. will use a value that maintains the aspect ratio of the input image,
  11432. calculated from the other specified dimension. After that it will,
  11433. however, make sure that the calculated dimension is divisible by n and
  11434. adjust the value if necessary.
  11435. If both values are -n with n >= 1, the behavior will be identical to
  11436. both values being set to 0 as previously detailed.
  11437. See below for the list of accepted constants for use in the dimension
  11438. expression.
  11439. @item eval
  11440. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11441. @table @samp
  11442. @item init
  11443. Only evaluate expressions once during the filter initialization or when a command is processed.
  11444. @item frame
  11445. Evaluate expressions for each incoming frame.
  11446. @end table
  11447. Default value is @samp{init}.
  11448. @item interl
  11449. Set the interlacing mode. It accepts the following values:
  11450. @table @samp
  11451. @item 1
  11452. Force interlaced aware scaling.
  11453. @item 0
  11454. Do not apply interlaced scaling.
  11455. @item -1
  11456. Select interlaced aware scaling depending on whether the source frames
  11457. are flagged as interlaced or not.
  11458. @end table
  11459. Default value is @samp{0}.
  11460. @item flags
  11461. Set libswscale scaling flags. See
  11462. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11463. complete list of values. If not explicitly specified the filter applies
  11464. the default flags.
  11465. @item param0, param1
  11466. Set libswscale input parameters for scaling algorithms that need them. See
  11467. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11468. complete documentation. If not explicitly specified the filter applies
  11469. empty parameters.
  11470. @item size, s
  11471. Set the video size. For the syntax of this option, check the
  11472. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11473. @item in_color_matrix
  11474. @item out_color_matrix
  11475. Set in/output YCbCr color space type.
  11476. This allows the autodetected value to be overridden as well as allows forcing
  11477. a specific value used for the output and encoder.
  11478. If not specified, the color space type depends on the pixel format.
  11479. Possible values:
  11480. @table @samp
  11481. @item auto
  11482. Choose automatically.
  11483. @item bt709
  11484. Format conforming to International Telecommunication Union (ITU)
  11485. Recommendation BT.709.
  11486. @item fcc
  11487. Set color space conforming to the United States Federal Communications
  11488. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11489. @item bt601
  11490. Set color space conforming to:
  11491. @itemize
  11492. @item
  11493. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11494. @item
  11495. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11496. @item
  11497. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11498. @end itemize
  11499. @item smpte240m
  11500. Set color space conforming to SMPTE ST 240:1999.
  11501. @end table
  11502. @item in_range
  11503. @item out_range
  11504. Set in/output YCbCr sample range.
  11505. This allows the autodetected value to be overridden as well as allows forcing
  11506. a specific value used for the output and encoder. If not specified, the
  11507. range depends on the pixel format. Possible values:
  11508. @table @samp
  11509. @item auto/unknown
  11510. Choose automatically.
  11511. @item jpeg/full/pc
  11512. Set full range (0-255 in case of 8-bit luma).
  11513. @item mpeg/limited/tv
  11514. Set "MPEG" range (16-235 in case of 8-bit luma).
  11515. @end table
  11516. @item force_original_aspect_ratio
  11517. Enable decreasing or increasing output video width or height if necessary to
  11518. keep the original aspect ratio. Possible values:
  11519. @table @samp
  11520. @item disable
  11521. Scale the video as specified and disable this feature.
  11522. @item decrease
  11523. The output video dimensions will automatically be decreased if needed.
  11524. @item increase
  11525. The output video dimensions will automatically be increased if needed.
  11526. @end table
  11527. One useful instance of this option is that when you know a specific device's
  11528. maximum allowed resolution, you can use this to limit the output video to
  11529. that, while retaining the aspect ratio. For example, device A allows
  11530. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11531. decrease) and specifying 1280x720 to the command line makes the output
  11532. 1280x533.
  11533. Please note that this is a different thing than specifying -1 for @option{w}
  11534. or @option{h}, you still need to specify the output resolution for this option
  11535. to work.
  11536. @end table
  11537. The values of the @option{w} and @option{h} options are expressions
  11538. containing the following constants:
  11539. @table @var
  11540. @item in_w
  11541. @item in_h
  11542. The input width and height
  11543. @item iw
  11544. @item ih
  11545. These are the same as @var{in_w} and @var{in_h}.
  11546. @item out_w
  11547. @item out_h
  11548. The output (scaled) width and height
  11549. @item ow
  11550. @item oh
  11551. These are the same as @var{out_w} and @var{out_h}
  11552. @item a
  11553. The same as @var{iw} / @var{ih}
  11554. @item sar
  11555. input sample aspect ratio
  11556. @item dar
  11557. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11558. @item hsub
  11559. @item vsub
  11560. horizontal and vertical input chroma subsample values. For example for the
  11561. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11562. @item ohsub
  11563. @item ovsub
  11564. horizontal and vertical output chroma subsample values. For example for the
  11565. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11566. @end table
  11567. @subsection Examples
  11568. @itemize
  11569. @item
  11570. Scale the input video to a size of 200x100
  11571. @example
  11572. scale=w=200:h=100
  11573. @end example
  11574. This is equivalent to:
  11575. @example
  11576. scale=200:100
  11577. @end example
  11578. or:
  11579. @example
  11580. scale=200x100
  11581. @end example
  11582. @item
  11583. Specify a size abbreviation for the output size:
  11584. @example
  11585. scale=qcif
  11586. @end example
  11587. which can also be written as:
  11588. @example
  11589. scale=size=qcif
  11590. @end example
  11591. @item
  11592. Scale the input to 2x:
  11593. @example
  11594. scale=w=2*iw:h=2*ih
  11595. @end example
  11596. @item
  11597. The above is the same as:
  11598. @example
  11599. scale=2*in_w:2*in_h
  11600. @end example
  11601. @item
  11602. Scale the input to 2x with forced interlaced scaling:
  11603. @example
  11604. scale=2*iw:2*ih:interl=1
  11605. @end example
  11606. @item
  11607. Scale the input to half size:
  11608. @example
  11609. scale=w=iw/2:h=ih/2
  11610. @end example
  11611. @item
  11612. Increase the width, and set the height to the same size:
  11613. @example
  11614. scale=3/2*iw:ow
  11615. @end example
  11616. @item
  11617. Seek Greek harmony:
  11618. @example
  11619. scale=iw:1/PHI*iw
  11620. scale=ih*PHI:ih
  11621. @end example
  11622. @item
  11623. Increase the height, and set the width to 3/2 of the height:
  11624. @example
  11625. scale=w=3/2*oh:h=3/5*ih
  11626. @end example
  11627. @item
  11628. Increase the size, making the size a multiple of the chroma
  11629. subsample values:
  11630. @example
  11631. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11632. @end example
  11633. @item
  11634. Increase the width to a maximum of 500 pixels,
  11635. keeping the same aspect ratio as the input:
  11636. @example
  11637. scale=w='min(500\, iw*3/2):h=-1'
  11638. @end example
  11639. @item
  11640. Make pixels square by combining scale and setsar:
  11641. @example
  11642. scale='trunc(ih*dar):ih',setsar=1/1
  11643. @end example
  11644. @item
  11645. Make pixels square by combining scale and setsar,
  11646. making sure the resulting resolution is even (required by some codecs):
  11647. @example
  11648. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11649. @end example
  11650. @end itemize
  11651. @subsection Commands
  11652. This filter supports the following commands:
  11653. @table @option
  11654. @item width, w
  11655. @item height, h
  11656. Set the output video dimension expression.
  11657. The command accepts the same syntax of the corresponding option.
  11658. If the specified expression is not valid, it is kept at its current
  11659. value.
  11660. @end table
  11661. @section scale_npp
  11662. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11663. format conversion on CUDA video frames. Setting the output width and height
  11664. works in the same way as for the @var{scale} filter.
  11665. The following additional options are accepted:
  11666. @table @option
  11667. @item format
  11668. The pixel format of the output CUDA frames. If set to the string "same" (the
  11669. default), the input format will be kept. Note that automatic format negotiation
  11670. and conversion is not yet supported for hardware frames
  11671. @item interp_algo
  11672. The interpolation algorithm used for resizing. One of the following:
  11673. @table @option
  11674. @item nn
  11675. Nearest neighbour.
  11676. @item linear
  11677. @item cubic
  11678. @item cubic2p_bspline
  11679. 2-parameter cubic (B=1, C=0)
  11680. @item cubic2p_catmullrom
  11681. 2-parameter cubic (B=0, C=1/2)
  11682. @item cubic2p_b05c03
  11683. 2-parameter cubic (B=1/2, C=3/10)
  11684. @item super
  11685. Supersampling
  11686. @item lanczos
  11687. @end table
  11688. @end table
  11689. @section scale2ref
  11690. Scale (resize) the input video, based on a reference video.
  11691. See the scale filter for available options, scale2ref supports the same but
  11692. uses the reference video instead of the main input as basis. scale2ref also
  11693. supports the following additional constants for the @option{w} and
  11694. @option{h} options:
  11695. @table @var
  11696. @item main_w
  11697. @item main_h
  11698. The main input video's width and height
  11699. @item main_a
  11700. The same as @var{main_w} / @var{main_h}
  11701. @item main_sar
  11702. The main input video's sample aspect ratio
  11703. @item main_dar, mdar
  11704. The main input video's display aspect ratio. Calculated from
  11705. @code{(main_w / main_h) * main_sar}.
  11706. @item main_hsub
  11707. @item main_vsub
  11708. The main input video's horizontal and vertical chroma subsample values.
  11709. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11710. is 1.
  11711. @end table
  11712. @subsection Examples
  11713. @itemize
  11714. @item
  11715. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11716. @example
  11717. 'scale2ref[b][a];[a][b]overlay'
  11718. @end example
  11719. @item
  11720. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  11721. @example
  11722. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  11723. @end example
  11724. @end itemize
  11725. @anchor{selectivecolor}
  11726. @section selectivecolor
  11727. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11728. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11729. by the "purity" of the color (that is, how saturated it already is).
  11730. This filter is similar to the Adobe Photoshop Selective Color tool.
  11731. The filter accepts the following options:
  11732. @table @option
  11733. @item correction_method
  11734. Select color correction method.
  11735. Available values are:
  11736. @table @samp
  11737. @item absolute
  11738. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11739. component value).
  11740. @item relative
  11741. Specified adjustments are relative to the original component value.
  11742. @end table
  11743. Default is @code{absolute}.
  11744. @item reds
  11745. Adjustments for red pixels (pixels where the red component is the maximum)
  11746. @item yellows
  11747. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11748. @item greens
  11749. Adjustments for green pixels (pixels where the green component is the maximum)
  11750. @item cyans
  11751. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11752. @item blues
  11753. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11754. @item magentas
  11755. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11756. @item whites
  11757. Adjustments for white pixels (pixels where all components are greater than 128)
  11758. @item neutrals
  11759. Adjustments for all pixels except pure black and pure white
  11760. @item blacks
  11761. Adjustments for black pixels (pixels where all components are lesser than 128)
  11762. @item psfile
  11763. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11764. @end table
  11765. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11766. 4 space separated floating point adjustment values in the [-1,1] range,
  11767. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11768. pixels of its range.
  11769. @subsection Examples
  11770. @itemize
  11771. @item
  11772. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11773. increase magenta by 27% in blue areas:
  11774. @example
  11775. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11776. @end example
  11777. @item
  11778. Use a Photoshop selective color preset:
  11779. @example
  11780. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11781. @end example
  11782. @end itemize
  11783. @anchor{separatefields}
  11784. @section separatefields
  11785. The @code{separatefields} takes a frame-based video input and splits
  11786. each frame into its components fields, producing a new half height clip
  11787. with twice the frame rate and twice the frame count.
  11788. This filter use field-dominance information in frame to decide which
  11789. of each pair of fields to place first in the output.
  11790. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11791. @section setdar, setsar
  11792. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11793. output video.
  11794. This is done by changing the specified Sample (aka Pixel) Aspect
  11795. Ratio, according to the following equation:
  11796. @example
  11797. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11798. @end example
  11799. Keep in mind that the @code{setdar} filter does not modify the pixel
  11800. dimensions of the video frame. Also, the display aspect ratio set by
  11801. this filter may be changed by later filters in the filterchain,
  11802. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11803. applied.
  11804. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11805. the filter output video.
  11806. Note that as a consequence of the application of this filter, the
  11807. output display aspect ratio will change according to the equation
  11808. above.
  11809. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11810. filter may be changed by later filters in the filterchain, e.g. if
  11811. another "setsar" or a "setdar" filter is applied.
  11812. It accepts the following parameters:
  11813. @table @option
  11814. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11815. Set the aspect ratio used by the filter.
  11816. The parameter can be a floating point number string, an expression, or
  11817. a string of the form @var{num}:@var{den}, where @var{num} and
  11818. @var{den} are the numerator and denominator of the aspect ratio. If
  11819. the parameter is not specified, it is assumed the value "0".
  11820. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11821. should be escaped.
  11822. @item max
  11823. Set the maximum integer value to use for expressing numerator and
  11824. denominator when reducing the expressed aspect ratio to a rational.
  11825. Default value is @code{100}.
  11826. @end table
  11827. The parameter @var{sar} is an expression containing
  11828. the following constants:
  11829. @table @option
  11830. @item E, PI, PHI
  11831. These are approximated values for the mathematical constants e
  11832. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11833. @item w, h
  11834. The input width and height.
  11835. @item a
  11836. These are the same as @var{w} / @var{h}.
  11837. @item sar
  11838. The input sample aspect ratio.
  11839. @item dar
  11840. The input display aspect ratio. It is the same as
  11841. (@var{w} / @var{h}) * @var{sar}.
  11842. @item hsub, vsub
  11843. Horizontal and vertical chroma subsample values. For example, for the
  11844. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11845. @end table
  11846. @subsection Examples
  11847. @itemize
  11848. @item
  11849. To change the display aspect ratio to 16:9, specify one of the following:
  11850. @example
  11851. setdar=dar=1.77777
  11852. setdar=dar=16/9
  11853. @end example
  11854. @item
  11855. To change the sample aspect ratio to 10:11, specify:
  11856. @example
  11857. setsar=sar=10/11
  11858. @end example
  11859. @item
  11860. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11861. 1000 in the aspect ratio reduction, use the command:
  11862. @example
  11863. setdar=ratio=16/9:max=1000
  11864. @end example
  11865. @end itemize
  11866. @anchor{setfield}
  11867. @section setfield
  11868. Force field for the output video frame.
  11869. The @code{setfield} filter marks the interlace type field for the
  11870. output frames. It does not change the input frame, but only sets the
  11871. corresponding property, which affects how the frame is treated by
  11872. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11873. The filter accepts the following options:
  11874. @table @option
  11875. @item mode
  11876. Available values are:
  11877. @table @samp
  11878. @item auto
  11879. Keep the same field property.
  11880. @item bff
  11881. Mark the frame as bottom-field-first.
  11882. @item tff
  11883. Mark the frame as top-field-first.
  11884. @item prog
  11885. Mark the frame as progressive.
  11886. @end table
  11887. @end table
  11888. @anchor{setparams}
  11889. @section setparams
  11890. Force frame parameter for the output video frame.
  11891. The @code{setparams} filter marks interlace and color range for the
  11892. output frames. It does not change the input frame, but only sets the
  11893. corresponding property, which affects how the frame is treated by
  11894. filters/encoders.
  11895. @table @option
  11896. @item field_mode
  11897. Available values are:
  11898. @table @samp
  11899. @item auto
  11900. Keep the same field property (default).
  11901. @item bff
  11902. Mark the frame as bottom-field-first.
  11903. @item tff
  11904. Mark the frame as top-field-first.
  11905. @item prog
  11906. Mark the frame as progressive.
  11907. @end table
  11908. @item range
  11909. Available values are:
  11910. @table @samp
  11911. @item auto
  11912. Keep the same color range property (default).
  11913. @item unspecified, unknown
  11914. Mark the frame as unspecified color range.
  11915. @item limited, tv, mpeg
  11916. Mark the frame as limited range.
  11917. @item full, pc, jpeg
  11918. Mark the frame as full range.
  11919. @end table
  11920. @item color_primaries
  11921. Set the color primaries.
  11922. Available values are:
  11923. @table @samp
  11924. @item auto
  11925. Keep the same color primaries property (default).
  11926. @item bt709
  11927. @item unknown
  11928. @item bt470m
  11929. @item bt470bg
  11930. @item smpte170m
  11931. @item smpte240m
  11932. @item film
  11933. @item bt2020
  11934. @item smpte428
  11935. @item smpte431
  11936. @item smpte432
  11937. @item jedec-p22
  11938. @end table
  11939. @item color_trc
  11940. Set the color transfer.
  11941. Available values are:
  11942. @table @samp
  11943. @item auto
  11944. Keep the same color trc property (default).
  11945. @item bt709
  11946. @item unknown
  11947. @item bt470m
  11948. @item bt470bg
  11949. @item smpte170m
  11950. @item smpte240m
  11951. @item linear
  11952. @item log100
  11953. @item log316
  11954. @item iec61966-2-4
  11955. @item bt1361e
  11956. @item iec61966-2-1
  11957. @item bt2020-10
  11958. @item bt2020-12
  11959. @item smpte2084
  11960. @item smpte428
  11961. @item arib-std-b67
  11962. @end table
  11963. @item colorspace
  11964. Set the colorspace.
  11965. Available values are:
  11966. @table @samp
  11967. @item auto
  11968. Keep the same colorspace property (default).
  11969. @item gbr
  11970. @item bt709
  11971. @item unknown
  11972. @item fcc
  11973. @item bt470bg
  11974. @item smpte170m
  11975. @item smpte240m
  11976. @item ycgco
  11977. @item bt2020nc
  11978. @item bt2020c
  11979. @item smpte2085
  11980. @item chroma-derived-nc
  11981. @item chroma-derived-c
  11982. @item ictcp
  11983. @end table
  11984. @end table
  11985. @section showinfo
  11986. Show a line containing various information for each input video frame.
  11987. The input video is not modified.
  11988. This filter supports the following options:
  11989. @table @option
  11990. @item checksum
  11991. Calculate checksums of each plane. By default enabled.
  11992. @end table
  11993. The shown line contains a sequence of key/value pairs of the form
  11994. @var{key}:@var{value}.
  11995. The following values are shown in the output:
  11996. @table @option
  11997. @item n
  11998. The (sequential) number of the input frame, starting from 0.
  11999. @item pts
  12000. The Presentation TimeStamp of the input frame, expressed as a number of
  12001. time base units. The time base unit depends on the filter input pad.
  12002. @item pts_time
  12003. The Presentation TimeStamp of the input frame, expressed as a number of
  12004. seconds.
  12005. @item pos
  12006. The position of the frame in the input stream, or -1 if this information is
  12007. unavailable and/or meaningless (for example in case of synthetic video).
  12008. @item fmt
  12009. The pixel format name.
  12010. @item sar
  12011. The sample aspect ratio of the input frame, expressed in the form
  12012. @var{num}/@var{den}.
  12013. @item s
  12014. The size of the input frame. For the syntax of this option, check the
  12015. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12016. @item i
  12017. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12018. for bottom field first).
  12019. @item iskey
  12020. This is 1 if the frame is a key frame, 0 otherwise.
  12021. @item type
  12022. The picture type of the input frame ("I" for an I-frame, "P" for a
  12023. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12024. Also refer to the documentation of the @code{AVPictureType} enum and of
  12025. the @code{av_get_picture_type_char} function defined in
  12026. @file{libavutil/avutil.h}.
  12027. @item checksum
  12028. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12029. @item plane_checksum
  12030. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12031. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12032. @end table
  12033. @section showpalette
  12034. Displays the 256 colors palette of each frame. This filter is only relevant for
  12035. @var{pal8} pixel format frames.
  12036. It accepts the following option:
  12037. @table @option
  12038. @item s
  12039. Set the size of the box used to represent one palette color entry. Default is
  12040. @code{30} (for a @code{30x30} pixel box).
  12041. @end table
  12042. @section shuffleframes
  12043. Reorder and/or duplicate and/or drop video frames.
  12044. It accepts the following parameters:
  12045. @table @option
  12046. @item mapping
  12047. Set the destination indexes of input frames.
  12048. This is space or '|' separated list of indexes that maps input frames to output
  12049. frames. Number of indexes also sets maximal value that each index may have.
  12050. '-1' index have special meaning and that is to drop frame.
  12051. @end table
  12052. The first frame has the index 0. The default is to keep the input unchanged.
  12053. @subsection Examples
  12054. @itemize
  12055. @item
  12056. Swap second and third frame of every three frames of the input:
  12057. @example
  12058. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12059. @end example
  12060. @item
  12061. Swap 10th and 1st frame of every ten frames of the input:
  12062. @example
  12063. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12064. @end example
  12065. @end itemize
  12066. @section shuffleplanes
  12067. Reorder and/or duplicate video planes.
  12068. It accepts the following parameters:
  12069. @table @option
  12070. @item map0
  12071. The index of the input plane to be used as the first output plane.
  12072. @item map1
  12073. The index of the input plane to be used as the second output plane.
  12074. @item map2
  12075. The index of the input plane to be used as the third output plane.
  12076. @item map3
  12077. The index of the input plane to be used as the fourth output plane.
  12078. @end table
  12079. The first plane has the index 0. The default is to keep the input unchanged.
  12080. @subsection Examples
  12081. @itemize
  12082. @item
  12083. Swap the second and third planes of the input:
  12084. @example
  12085. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12086. @end example
  12087. @end itemize
  12088. @anchor{signalstats}
  12089. @section signalstats
  12090. Evaluate various visual metrics that assist in determining issues associated
  12091. with the digitization of analog video media.
  12092. By default the filter will log these metadata values:
  12093. @table @option
  12094. @item YMIN
  12095. Display the minimal Y value contained within the input frame. Expressed in
  12096. range of [0-255].
  12097. @item YLOW
  12098. Display the Y value at the 10% percentile within the input frame. Expressed in
  12099. range of [0-255].
  12100. @item YAVG
  12101. Display the average Y value within the input frame. Expressed in range of
  12102. [0-255].
  12103. @item YHIGH
  12104. Display the Y value at the 90% percentile within the input frame. Expressed in
  12105. range of [0-255].
  12106. @item YMAX
  12107. Display the maximum Y value contained within the input frame. Expressed in
  12108. range of [0-255].
  12109. @item UMIN
  12110. Display the minimal U value contained within the input frame. Expressed in
  12111. range of [0-255].
  12112. @item ULOW
  12113. Display the U value at the 10% percentile within the input frame. Expressed in
  12114. range of [0-255].
  12115. @item UAVG
  12116. Display the average U value within the input frame. Expressed in range of
  12117. [0-255].
  12118. @item UHIGH
  12119. Display the U value at the 90% percentile within the input frame. Expressed in
  12120. range of [0-255].
  12121. @item UMAX
  12122. Display the maximum U value contained within the input frame. Expressed in
  12123. range of [0-255].
  12124. @item VMIN
  12125. Display the minimal V value contained within the input frame. Expressed in
  12126. range of [0-255].
  12127. @item VLOW
  12128. Display the V value at the 10% percentile within the input frame. Expressed in
  12129. range of [0-255].
  12130. @item VAVG
  12131. Display the average V value within the input frame. Expressed in range of
  12132. [0-255].
  12133. @item VHIGH
  12134. Display the V value at the 90% percentile within the input frame. Expressed in
  12135. range of [0-255].
  12136. @item VMAX
  12137. Display the maximum V value contained within the input frame. Expressed in
  12138. range of [0-255].
  12139. @item SATMIN
  12140. Display the minimal saturation value contained within the input frame.
  12141. Expressed in range of [0-~181.02].
  12142. @item SATLOW
  12143. Display the saturation value at the 10% percentile within the input frame.
  12144. Expressed in range of [0-~181.02].
  12145. @item SATAVG
  12146. Display the average saturation value within the input frame. Expressed in range
  12147. of [0-~181.02].
  12148. @item SATHIGH
  12149. Display the saturation value at the 90% percentile within the input frame.
  12150. Expressed in range of [0-~181.02].
  12151. @item SATMAX
  12152. Display the maximum saturation value contained within the input frame.
  12153. Expressed in range of [0-~181.02].
  12154. @item HUEMED
  12155. Display the median value for hue within the input frame. Expressed in range of
  12156. [0-360].
  12157. @item HUEAVG
  12158. Display the average value for hue within the input frame. Expressed in range of
  12159. [0-360].
  12160. @item YDIF
  12161. Display the average of sample value difference between all values of the Y
  12162. plane in the current frame and corresponding values of the previous input frame.
  12163. Expressed in range of [0-255].
  12164. @item UDIF
  12165. Display the average of sample value difference between all values of the U
  12166. plane in the current frame and corresponding values of the previous input frame.
  12167. Expressed in range of [0-255].
  12168. @item VDIF
  12169. Display the average of sample value difference between all values of the V
  12170. plane in the current frame and corresponding values of the previous input frame.
  12171. Expressed in range of [0-255].
  12172. @item YBITDEPTH
  12173. Display bit depth of Y plane in current frame.
  12174. Expressed in range of [0-16].
  12175. @item UBITDEPTH
  12176. Display bit depth of U plane in current frame.
  12177. Expressed in range of [0-16].
  12178. @item VBITDEPTH
  12179. Display bit depth of V plane in current frame.
  12180. Expressed in range of [0-16].
  12181. @end table
  12182. The filter accepts the following options:
  12183. @table @option
  12184. @item stat
  12185. @item out
  12186. @option{stat} specify an additional form of image analysis.
  12187. @option{out} output video with the specified type of pixel highlighted.
  12188. Both options accept the following values:
  12189. @table @samp
  12190. @item tout
  12191. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12192. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12193. include the results of video dropouts, head clogs, or tape tracking issues.
  12194. @item vrep
  12195. Identify @var{vertical line repetition}. Vertical line repetition includes
  12196. similar rows of pixels within a frame. In born-digital video vertical line
  12197. repetition is common, but this pattern is uncommon in video digitized from an
  12198. analog source. When it occurs in video that results from the digitization of an
  12199. analog source it can indicate concealment from a dropout compensator.
  12200. @item brng
  12201. Identify pixels that fall outside of legal broadcast range.
  12202. @end table
  12203. @item color, c
  12204. Set the highlight color for the @option{out} option. The default color is
  12205. yellow.
  12206. @end table
  12207. @subsection Examples
  12208. @itemize
  12209. @item
  12210. Output data of various video metrics:
  12211. @example
  12212. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12213. @end example
  12214. @item
  12215. Output specific data about the minimum and maximum values of the Y plane per frame:
  12216. @example
  12217. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12218. @end example
  12219. @item
  12220. Playback video while highlighting pixels that are outside of broadcast range in red.
  12221. @example
  12222. ffplay example.mov -vf signalstats="out=brng:color=red"
  12223. @end example
  12224. @item
  12225. Playback video with signalstats metadata drawn over the frame.
  12226. @example
  12227. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12228. @end example
  12229. The contents of signalstat_drawtext.txt used in the command are:
  12230. @example
  12231. time %@{pts:hms@}
  12232. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12233. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12234. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12235. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12236. @end example
  12237. @end itemize
  12238. @anchor{signature}
  12239. @section signature
  12240. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12241. input. In this case the matching between the inputs can be calculated additionally.
  12242. The filter always passes through the first input. The signature of each stream can
  12243. be written into a file.
  12244. It accepts the following options:
  12245. @table @option
  12246. @item detectmode
  12247. Enable or disable the matching process.
  12248. Available values are:
  12249. @table @samp
  12250. @item off
  12251. Disable the calculation of a matching (default).
  12252. @item full
  12253. Calculate the matching for the whole video and output whether the whole video
  12254. matches or only parts.
  12255. @item fast
  12256. Calculate only until a matching is found or the video ends. Should be faster in
  12257. some cases.
  12258. @end table
  12259. @item nb_inputs
  12260. Set the number of inputs. The option value must be a non negative integer.
  12261. Default value is 1.
  12262. @item filename
  12263. Set the path to which the output is written. If there is more than one input,
  12264. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12265. integer), that will be replaced with the input number. If no filename is
  12266. specified, no output will be written. This is the default.
  12267. @item format
  12268. Choose the output format.
  12269. Available values are:
  12270. @table @samp
  12271. @item binary
  12272. Use the specified binary representation (default).
  12273. @item xml
  12274. Use the specified xml representation.
  12275. @end table
  12276. @item th_d
  12277. Set threshold to detect one word as similar. The option value must be an integer
  12278. greater than zero. The default value is 9000.
  12279. @item th_dc
  12280. Set threshold to detect all words as similar. The option value must be an integer
  12281. greater than zero. The default value is 60000.
  12282. @item th_xh
  12283. Set threshold to detect frames as similar. The option value must be an integer
  12284. greater than zero. The default value is 116.
  12285. @item th_di
  12286. Set the minimum length of a sequence in frames to recognize it as matching
  12287. sequence. The option value must be a non negative integer value.
  12288. The default value is 0.
  12289. @item th_it
  12290. Set the minimum relation, that matching frames to all frames must have.
  12291. The option value must be a double value between 0 and 1. The default value is 0.5.
  12292. @end table
  12293. @subsection Examples
  12294. @itemize
  12295. @item
  12296. To calculate the signature of an input video and store it in signature.bin:
  12297. @example
  12298. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12299. @end example
  12300. @item
  12301. To detect whether two videos match and store the signatures in XML format in
  12302. signature0.xml and signature1.xml:
  12303. @example
  12304. 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 -
  12305. @end example
  12306. @end itemize
  12307. @anchor{smartblur}
  12308. @section smartblur
  12309. Blur the input video without impacting the outlines.
  12310. It accepts the following options:
  12311. @table @option
  12312. @item luma_radius, lr
  12313. Set the luma radius. The option value must be a float number in
  12314. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12315. used to blur the image (slower if larger). Default value is 1.0.
  12316. @item luma_strength, ls
  12317. Set the luma strength. The option value must be a float number
  12318. in the range [-1.0,1.0] that configures the blurring. A value included
  12319. in [0.0,1.0] will blur the image whereas a value included in
  12320. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12321. @item luma_threshold, lt
  12322. Set the luma threshold used as a coefficient to determine
  12323. whether a pixel should be blurred or not. The option value must be an
  12324. integer in the range [-30,30]. A value of 0 will filter all the image,
  12325. a value included in [0,30] will filter flat areas and a value included
  12326. in [-30,0] will filter edges. Default value is 0.
  12327. @item chroma_radius, cr
  12328. Set the chroma radius. The option value must be a float number in
  12329. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12330. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12331. @item chroma_strength, cs
  12332. Set the chroma strength. The option value must be a float number
  12333. in the range [-1.0,1.0] that configures the blurring. A value included
  12334. in [0.0,1.0] will blur the image whereas a value included in
  12335. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12336. @item chroma_threshold, ct
  12337. Set the chroma threshold used as a coefficient to determine
  12338. whether a pixel should be blurred or not. The option value must be an
  12339. integer in the range [-30,30]. A value of 0 will filter all the image,
  12340. a value included in [0,30] will filter flat areas and a value included
  12341. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12342. @end table
  12343. If a chroma option is not explicitly set, the corresponding luma value
  12344. is set.
  12345. @section ssim
  12346. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12347. This filter takes in input two input videos, the first input is
  12348. considered the "main" source and is passed unchanged to the
  12349. output. The second input is used as a "reference" video for computing
  12350. the SSIM.
  12351. Both video inputs must have the same resolution and pixel format for
  12352. this filter to work correctly. Also it assumes that both inputs
  12353. have the same number of frames, which are compared one by one.
  12354. The filter stores the calculated SSIM of each frame.
  12355. The description of the accepted parameters follows.
  12356. @table @option
  12357. @item stats_file, f
  12358. If specified the filter will use the named file to save the SSIM of
  12359. each individual frame. When filename equals "-" the data is sent to
  12360. standard output.
  12361. @end table
  12362. The file printed if @var{stats_file} is selected, contains a sequence of
  12363. key/value pairs of the form @var{key}:@var{value} for each compared
  12364. couple of frames.
  12365. A description of each shown parameter follows:
  12366. @table @option
  12367. @item n
  12368. sequential number of the input frame, starting from 1
  12369. @item Y, U, V, R, G, B
  12370. SSIM of the compared frames for the component specified by the suffix.
  12371. @item All
  12372. SSIM of the compared frames for the whole frame.
  12373. @item dB
  12374. Same as above but in dB representation.
  12375. @end table
  12376. This filter also supports the @ref{framesync} options.
  12377. For example:
  12378. @example
  12379. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12380. [main][ref] ssim="stats_file=stats.log" [out]
  12381. @end example
  12382. On this example the input file being processed is compared with the
  12383. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12384. is stored in @file{stats.log}.
  12385. Another example with both psnr and ssim at same time:
  12386. @example
  12387. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12388. @end example
  12389. @section stereo3d
  12390. Convert between different stereoscopic image formats.
  12391. The filters accept the following options:
  12392. @table @option
  12393. @item in
  12394. Set stereoscopic image format of input.
  12395. Available values for input image formats are:
  12396. @table @samp
  12397. @item sbsl
  12398. side by side parallel (left eye left, right eye right)
  12399. @item sbsr
  12400. side by side crosseye (right eye left, left eye right)
  12401. @item sbs2l
  12402. side by side parallel with half width resolution
  12403. (left eye left, right eye right)
  12404. @item sbs2r
  12405. side by side crosseye with half width resolution
  12406. (right eye left, left eye right)
  12407. @item abl
  12408. above-below (left eye above, right eye below)
  12409. @item abr
  12410. above-below (right eye above, left eye below)
  12411. @item ab2l
  12412. above-below with half height resolution
  12413. (left eye above, right eye below)
  12414. @item ab2r
  12415. above-below with half height resolution
  12416. (right eye above, left eye below)
  12417. @item al
  12418. alternating frames (left eye first, right eye second)
  12419. @item ar
  12420. alternating frames (right eye first, left eye second)
  12421. @item irl
  12422. interleaved rows (left eye has top row, right eye starts on next row)
  12423. @item irr
  12424. interleaved rows (right eye has top row, left eye starts on next row)
  12425. @item icl
  12426. interleaved columns, left eye first
  12427. @item icr
  12428. interleaved columns, right eye first
  12429. Default value is @samp{sbsl}.
  12430. @end table
  12431. @item out
  12432. Set stereoscopic image format of output.
  12433. @table @samp
  12434. @item sbsl
  12435. side by side parallel (left eye left, right eye right)
  12436. @item sbsr
  12437. side by side crosseye (right eye left, left eye right)
  12438. @item sbs2l
  12439. side by side parallel with half width resolution
  12440. (left eye left, right eye right)
  12441. @item sbs2r
  12442. side by side crosseye with half width resolution
  12443. (right eye left, left eye right)
  12444. @item abl
  12445. above-below (left eye above, right eye below)
  12446. @item abr
  12447. above-below (right eye above, left eye below)
  12448. @item ab2l
  12449. above-below with half height resolution
  12450. (left eye above, right eye below)
  12451. @item ab2r
  12452. above-below with half height resolution
  12453. (right eye above, left eye below)
  12454. @item al
  12455. alternating frames (left eye first, right eye second)
  12456. @item ar
  12457. alternating frames (right eye first, left eye second)
  12458. @item irl
  12459. interleaved rows (left eye has top row, right eye starts on next row)
  12460. @item irr
  12461. interleaved rows (right eye has top row, left eye starts on next row)
  12462. @item arbg
  12463. anaglyph red/blue gray
  12464. (red filter on left eye, blue filter on right eye)
  12465. @item argg
  12466. anaglyph red/green gray
  12467. (red filter on left eye, green filter on right eye)
  12468. @item arcg
  12469. anaglyph red/cyan gray
  12470. (red filter on left eye, cyan filter on right eye)
  12471. @item arch
  12472. anaglyph red/cyan half colored
  12473. (red filter on left eye, cyan filter on right eye)
  12474. @item arcc
  12475. anaglyph red/cyan color
  12476. (red filter on left eye, cyan filter on right eye)
  12477. @item arcd
  12478. anaglyph red/cyan color optimized with the least squares projection of dubois
  12479. (red filter on left eye, cyan filter on right eye)
  12480. @item agmg
  12481. anaglyph green/magenta gray
  12482. (green filter on left eye, magenta filter on right eye)
  12483. @item agmh
  12484. anaglyph green/magenta half colored
  12485. (green filter on left eye, magenta filter on right eye)
  12486. @item agmc
  12487. anaglyph green/magenta colored
  12488. (green filter on left eye, magenta filter on right eye)
  12489. @item agmd
  12490. anaglyph green/magenta color optimized with the least squares projection of dubois
  12491. (green filter on left eye, magenta filter on right eye)
  12492. @item aybg
  12493. anaglyph yellow/blue gray
  12494. (yellow filter on left eye, blue filter on right eye)
  12495. @item aybh
  12496. anaglyph yellow/blue half colored
  12497. (yellow filter on left eye, blue filter on right eye)
  12498. @item aybc
  12499. anaglyph yellow/blue colored
  12500. (yellow filter on left eye, blue filter on right eye)
  12501. @item aybd
  12502. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12503. (yellow filter on left eye, blue filter on right eye)
  12504. @item ml
  12505. mono output (left eye only)
  12506. @item mr
  12507. mono output (right eye only)
  12508. @item chl
  12509. checkerboard, left eye first
  12510. @item chr
  12511. checkerboard, right eye first
  12512. @item icl
  12513. interleaved columns, left eye first
  12514. @item icr
  12515. interleaved columns, right eye first
  12516. @item hdmi
  12517. HDMI frame pack
  12518. @end table
  12519. Default value is @samp{arcd}.
  12520. @end table
  12521. @subsection Examples
  12522. @itemize
  12523. @item
  12524. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12525. @example
  12526. stereo3d=sbsl:aybd
  12527. @end example
  12528. @item
  12529. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12530. @example
  12531. stereo3d=abl:sbsr
  12532. @end example
  12533. @end itemize
  12534. @section streamselect, astreamselect
  12535. Select video or audio streams.
  12536. The filter accepts the following options:
  12537. @table @option
  12538. @item inputs
  12539. Set number of inputs. Default is 2.
  12540. @item map
  12541. Set input indexes to remap to outputs.
  12542. @end table
  12543. @subsection Commands
  12544. The @code{streamselect} and @code{astreamselect} filter supports the following
  12545. commands:
  12546. @table @option
  12547. @item map
  12548. Set input indexes to remap to outputs.
  12549. @end table
  12550. @subsection Examples
  12551. @itemize
  12552. @item
  12553. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12554. @example
  12555. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12556. @end example
  12557. @item
  12558. Same as above, but for audio:
  12559. @example
  12560. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12561. @end example
  12562. @end itemize
  12563. @section sobel
  12564. Apply sobel operator to input video stream.
  12565. The filter accepts the following option:
  12566. @table @option
  12567. @item planes
  12568. Set which planes will be processed, unprocessed planes will be copied.
  12569. By default value 0xf, all planes will be processed.
  12570. @item scale
  12571. Set value which will be multiplied with filtered result.
  12572. @item delta
  12573. Set value which will be added to filtered result.
  12574. @end table
  12575. @anchor{spp}
  12576. @section spp
  12577. Apply a simple postprocessing filter that compresses and decompresses the image
  12578. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12579. and average the results.
  12580. The filter accepts the following options:
  12581. @table @option
  12582. @item quality
  12583. Set quality. This option defines the number of levels for averaging. It accepts
  12584. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12585. effect. A value of @code{6} means the higher quality. For each increment of
  12586. that value the speed drops by a factor of approximately 2. Default value is
  12587. @code{3}.
  12588. @item qp
  12589. Force a constant quantization parameter. If not set, the filter will use the QP
  12590. from the video stream (if available).
  12591. @item mode
  12592. Set thresholding mode. Available modes are:
  12593. @table @samp
  12594. @item hard
  12595. Set hard thresholding (default).
  12596. @item soft
  12597. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12598. @end table
  12599. @item use_bframe_qp
  12600. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12601. option may cause flicker since the B-Frames have often larger QP. Default is
  12602. @code{0} (not enabled).
  12603. @end table
  12604. @section sr
  12605. Scale the input by applying one of the super-resolution methods based on
  12606. convolutional neural networks. Supported models:
  12607. @itemize
  12608. @item
  12609. Super-Resolution Convolutional Neural Network model (SRCNN).
  12610. See @url{https://arxiv.org/abs/1501.00092}.
  12611. @item
  12612. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12613. See @url{https://arxiv.org/abs/1609.05158}.
  12614. @end itemize
  12615. Training scripts as well as scripts for model generation can be found at
  12616. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12617. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12618. The filter accepts the following options:
  12619. @table @option
  12620. @item dnn_backend
  12621. Specify which DNN backend to use for model loading and execution. This option accepts
  12622. the following values:
  12623. @table @samp
  12624. @item native
  12625. Native implementation of DNN loading and execution.
  12626. @item tensorflow
  12627. TensorFlow backend. To enable this backend you
  12628. need to install the TensorFlow for C library (see
  12629. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12630. @code{--enable-libtensorflow}
  12631. @end table
  12632. Default value is @samp{native}.
  12633. @item model
  12634. Set path to model file specifying network architecture and its parameters.
  12635. Note that different backends use different file formats. TensorFlow backend
  12636. can load files for both formats, while native backend can load files for only
  12637. its format.
  12638. @item scale_factor
  12639. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12640. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12641. input upscaled using bicubic upscaling with proper scale factor.
  12642. @end table
  12643. @anchor{subtitles}
  12644. @section subtitles
  12645. Draw subtitles on top of input video using the libass library.
  12646. To enable compilation of this filter you need to configure FFmpeg with
  12647. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12648. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12649. Alpha) subtitles format.
  12650. The filter accepts the following options:
  12651. @table @option
  12652. @item filename, f
  12653. Set the filename of the subtitle file to read. It must be specified.
  12654. @item original_size
  12655. Specify the size of the original video, the video for which the ASS file
  12656. was composed. For the syntax of this option, check the
  12657. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12658. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12659. correctly scale the fonts if the aspect ratio has been changed.
  12660. @item fontsdir
  12661. Set a directory path containing fonts that can be used by the filter.
  12662. These fonts will be used in addition to whatever the font provider uses.
  12663. @item alpha
  12664. Process alpha channel, by default alpha channel is untouched.
  12665. @item charenc
  12666. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12667. useful if not UTF-8.
  12668. @item stream_index, si
  12669. Set subtitles stream index. @code{subtitles} filter only.
  12670. @item force_style
  12671. Override default style or script info parameters of the subtitles. It accepts a
  12672. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12673. @end table
  12674. If the first key is not specified, it is assumed that the first value
  12675. specifies the @option{filename}.
  12676. For example, to render the file @file{sub.srt} on top of the input
  12677. video, use the command:
  12678. @example
  12679. subtitles=sub.srt
  12680. @end example
  12681. which is equivalent to:
  12682. @example
  12683. subtitles=filename=sub.srt
  12684. @end example
  12685. To render the default subtitles stream from file @file{video.mkv}, use:
  12686. @example
  12687. subtitles=video.mkv
  12688. @end example
  12689. To render the second subtitles stream from that file, use:
  12690. @example
  12691. subtitles=video.mkv:si=1
  12692. @end example
  12693. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12694. @code{DejaVu Serif}, use:
  12695. @example
  12696. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12697. @end example
  12698. @section super2xsai
  12699. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12700. Interpolate) pixel art scaling algorithm.
  12701. Useful for enlarging pixel art images without reducing sharpness.
  12702. @section swaprect
  12703. Swap two rectangular objects in video.
  12704. This filter accepts the following options:
  12705. @table @option
  12706. @item w
  12707. Set object width.
  12708. @item h
  12709. Set object height.
  12710. @item x1
  12711. Set 1st rect x coordinate.
  12712. @item y1
  12713. Set 1st rect y coordinate.
  12714. @item x2
  12715. Set 2nd rect x coordinate.
  12716. @item y2
  12717. Set 2nd rect y coordinate.
  12718. All expressions are evaluated once for each frame.
  12719. @end table
  12720. The all options are expressions containing the following constants:
  12721. @table @option
  12722. @item w
  12723. @item h
  12724. The input width and height.
  12725. @item a
  12726. same as @var{w} / @var{h}
  12727. @item sar
  12728. input sample aspect ratio
  12729. @item dar
  12730. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12731. @item n
  12732. The number of the input frame, starting from 0.
  12733. @item t
  12734. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12735. @item pos
  12736. the position in the file of the input frame, NAN if unknown
  12737. @end table
  12738. @section swapuv
  12739. Swap U & V plane.
  12740. @section telecine
  12741. Apply telecine process to the video.
  12742. This filter accepts the following options:
  12743. @table @option
  12744. @item first_field
  12745. @table @samp
  12746. @item top, t
  12747. top field first
  12748. @item bottom, b
  12749. bottom field first
  12750. The default value is @code{top}.
  12751. @end table
  12752. @item pattern
  12753. A string of numbers representing the pulldown pattern you wish to apply.
  12754. The default value is @code{23}.
  12755. @end table
  12756. @example
  12757. Some typical patterns:
  12758. NTSC output (30i):
  12759. 27.5p: 32222
  12760. 24p: 23 (classic)
  12761. 24p: 2332 (preferred)
  12762. 20p: 33
  12763. 18p: 334
  12764. 16p: 3444
  12765. PAL output (25i):
  12766. 27.5p: 12222
  12767. 24p: 222222222223 ("Euro pulldown")
  12768. 16.67p: 33
  12769. 16p: 33333334
  12770. @end example
  12771. @section threshold
  12772. Apply threshold effect to video stream.
  12773. This filter needs four video streams to perform thresholding.
  12774. First stream is stream we are filtering.
  12775. Second stream is holding threshold values, third stream is holding min values,
  12776. and last, fourth stream is holding max values.
  12777. The filter accepts the following option:
  12778. @table @option
  12779. @item planes
  12780. Set which planes will be processed, unprocessed planes will be copied.
  12781. By default value 0xf, all planes will be processed.
  12782. @end table
  12783. For example if first stream pixel's component value is less then threshold value
  12784. of pixel component from 2nd threshold stream, third stream value will picked,
  12785. otherwise fourth stream pixel component value will be picked.
  12786. Using color source filter one can perform various types of thresholding:
  12787. @subsection Examples
  12788. @itemize
  12789. @item
  12790. Binary threshold, using gray color as threshold:
  12791. @example
  12792. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12793. @end example
  12794. @item
  12795. Inverted binary threshold, using gray color as threshold:
  12796. @example
  12797. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12798. @end example
  12799. @item
  12800. Truncate binary threshold, using gray color as threshold:
  12801. @example
  12802. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12803. @end example
  12804. @item
  12805. Threshold to zero, using gray color as threshold:
  12806. @example
  12807. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12808. @end example
  12809. @item
  12810. Inverted threshold to zero, using gray color as threshold:
  12811. @example
  12812. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12813. @end example
  12814. @end itemize
  12815. @section thumbnail
  12816. Select the most representative frame in a given sequence of consecutive frames.
  12817. The filter accepts the following options:
  12818. @table @option
  12819. @item n
  12820. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12821. will pick one of them, and then handle the next batch of @var{n} frames until
  12822. the end. Default is @code{100}.
  12823. @end table
  12824. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12825. value will result in a higher memory usage, so a high value is not recommended.
  12826. @subsection Examples
  12827. @itemize
  12828. @item
  12829. Extract one picture each 50 frames:
  12830. @example
  12831. thumbnail=50
  12832. @end example
  12833. @item
  12834. Complete example of a thumbnail creation with @command{ffmpeg}:
  12835. @example
  12836. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12837. @end example
  12838. @end itemize
  12839. @section tile
  12840. Tile several successive frames together.
  12841. The filter accepts the following options:
  12842. @table @option
  12843. @item layout
  12844. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12845. this option, check the
  12846. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12847. @item nb_frames
  12848. Set the maximum number of frames to render in the given area. It must be less
  12849. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12850. the area will be used.
  12851. @item margin
  12852. Set the outer border margin in pixels.
  12853. @item padding
  12854. Set the inner border thickness (i.e. the number of pixels between frames). For
  12855. more advanced padding options (such as having different values for the edges),
  12856. refer to the pad video filter.
  12857. @item color
  12858. Specify the color of the unused area. For the syntax of this option, check the
  12859. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12860. The default value of @var{color} is "black".
  12861. @item overlap
  12862. Set the number of frames to overlap when tiling several successive frames together.
  12863. The value must be between @code{0} and @var{nb_frames - 1}.
  12864. @item init_padding
  12865. Set the number of frames to initially be empty before displaying first output frame.
  12866. This controls how soon will one get first output frame.
  12867. The value must be between @code{0} and @var{nb_frames - 1}.
  12868. @end table
  12869. @subsection Examples
  12870. @itemize
  12871. @item
  12872. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12873. @example
  12874. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12875. @end example
  12876. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12877. duplicating each output frame to accommodate the originally detected frame
  12878. rate.
  12879. @item
  12880. Display @code{5} pictures in an area of @code{3x2} frames,
  12881. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12882. mixed flat and named options:
  12883. @example
  12884. tile=3x2:nb_frames=5:padding=7:margin=2
  12885. @end example
  12886. @end itemize
  12887. @section tinterlace
  12888. Perform various types of temporal field interlacing.
  12889. Frames are counted starting from 1, so the first input frame is
  12890. considered odd.
  12891. The filter accepts the following options:
  12892. @table @option
  12893. @item mode
  12894. Specify the mode of the interlacing. This option can also be specified
  12895. as a value alone. See below for a list of values for this option.
  12896. Available values are:
  12897. @table @samp
  12898. @item merge, 0
  12899. Move odd frames into the upper field, even into the lower field,
  12900. generating a double height frame at half frame rate.
  12901. @example
  12902. ------> time
  12903. Input:
  12904. Frame 1 Frame 2 Frame 3 Frame 4
  12905. 11111 22222 33333 44444
  12906. 11111 22222 33333 44444
  12907. 11111 22222 33333 44444
  12908. 11111 22222 33333 44444
  12909. Output:
  12910. 11111 33333
  12911. 22222 44444
  12912. 11111 33333
  12913. 22222 44444
  12914. 11111 33333
  12915. 22222 44444
  12916. 11111 33333
  12917. 22222 44444
  12918. @end example
  12919. @item drop_even, 1
  12920. Only output odd frames, even frames are dropped, generating a frame with
  12921. unchanged height at half frame rate.
  12922. @example
  12923. ------> time
  12924. Input:
  12925. Frame 1 Frame 2 Frame 3 Frame 4
  12926. 11111 22222 33333 44444
  12927. 11111 22222 33333 44444
  12928. 11111 22222 33333 44444
  12929. 11111 22222 33333 44444
  12930. Output:
  12931. 11111 33333
  12932. 11111 33333
  12933. 11111 33333
  12934. 11111 33333
  12935. @end example
  12936. @item drop_odd, 2
  12937. Only output even frames, odd frames are dropped, generating a frame with
  12938. unchanged height at half frame rate.
  12939. @example
  12940. ------> time
  12941. Input:
  12942. Frame 1 Frame 2 Frame 3 Frame 4
  12943. 11111 22222 33333 44444
  12944. 11111 22222 33333 44444
  12945. 11111 22222 33333 44444
  12946. 11111 22222 33333 44444
  12947. Output:
  12948. 22222 44444
  12949. 22222 44444
  12950. 22222 44444
  12951. 22222 44444
  12952. @end example
  12953. @item pad, 3
  12954. Expand each frame to full height, but pad alternate lines with black,
  12955. generating a frame with double height at the same input frame rate.
  12956. @example
  12957. ------> time
  12958. Input:
  12959. Frame 1 Frame 2 Frame 3 Frame 4
  12960. 11111 22222 33333 44444
  12961. 11111 22222 33333 44444
  12962. 11111 22222 33333 44444
  12963. 11111 22222 33333 44444
  12964. Output:
  12965. 11111 ..... 33333 .....
  12966. ..... 22222 ..... 44444
  12967. 11111 ..... 33333 .....
  12968. ..... 22222 ..... 44444
  12969. 11111 ..... 33333 .....
  12970. ..... 22222 ..... 44444
  12971. 11111 ..... 33333 .....
  12972. ..... 22222 ..... 44444
  12973. @end example
  12974. @item interleave_top, 4
  12975. Interleave the upper field from odd frames with the lower field from
  12976. even frames, generating a frame with unchanged height at half frame rate.
  12977. @example
  12978. ------> time
  12979. Input:
  12980. Frame 1 Frame 2 Frame 3 Frame 4
  12981. 11111<- 22222 33333<- 44444
  12982. 11111 22222<- 33333 44444<-
  12983. 11111<- 22222 33333<- 44444
  12984. 11111 22222<- 33333 44444<-
  12985. Output:
  12986. 11111 33333
  12987. 22222 44444
  12988. 11111 33333
  12989. 22222 44444
  12990. @end example
  12991. @item interleave_bottom, 5
  12992. Interleave the lower field from odd frames with the upper field from
  12993. even frames, generating a frame with unchanged height at half frame rate.
  12994. @example
  12995. ------> time
  12996. Input:
  12997. Frame 1 Frame 2 Frame 3 Frame 4
  12998. 11111 22222<- 33333 44444<-
  12999. 11111<- 22222 33333<- 44444
  13000. 11111 22222<- 33333 44444<-
  13001. 11111<- 22222 33333<- 44444
  13002. Output:
  13003. 22222 44444
  13004. 11111 33333
  13005. 22222 44444
  13006. 11111 33333
  13007. @end example
  13008. @item interlacex2, 6
  13009. Double frame rate with unchanged height. Frames are inserted each
  13010. containing the second temporal field from the previous input frame and
  13011. the first temporal field from the next input frame. This mode relies on
  13012. the top_field_first flag. Useful for interlaced video displays with no
  13013. field synchronisation.
  13014. @example
  13015. ------> time
  13016. Input:
  13017. Frame 1 Frame 2 Frame 3 Frame 4
  13018. 11111 22222 33333 44444
  13019. 11111 22222 33333 44444
  13020. 11111 22222 33333 44444
  13021. 11111 22222 33333 44444
  13022. Output:
  13023. 11111 22222 22222 33333 33333 44444 44444
  13024. 11111 11111 22222 22222 33333 33333 44444
  13025. 11111 22222 22222 33333 33333 44444 44444
  13026. 11111 11111 22222 22222 33333 33333 44444
  13027. @end example
  13028. @item mergex2, 7
  13029. Move odd frames into the upper field, even into the lower field,
  13030. generating a double height frame at same frame rate.
  13031. @example
  13032. ------> time
  13033. Input:
  13034. Frame 1 Frame 2 Frame 3 Frame 4
  13035. 11111 22222 33333 44444
  13036. 11111 22222 33333 44444
  13037. 11111 22222 33333 44444
  13038. 11111 22222 33333 44444
  13039. Output:
  13040. 11111 33333 33333 55555
  13041. 22222 22222 44444 44444
  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. @end example
  13049. @end table
  13050. Numeric values are deprecated but are accepted for backward
  13051. compatibility reasons.
  13052. Default mode is @code{merge}.
  13053. @item flags
  13054. Specify flags influencing the filter process.
  13055. Available value for @var{flags} is:
  13056. @table @option
  13057. @item low_pass_filter, vlfp
  13058. Enable linear vertical low-pass filtering in the filter.
  13059. Vertical low-pass filtering is required when creating an interlaced
  13060. destination from a progressive source which contains high-frequency
  13061. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13062. patterning.
  13063. @item complex_filter, cvlfp
  13064. Enable complex vertical low-pass filtering.
  13065. This will slightly less reduce interlace 'twitter' and Moire
  13066. patterning but better retain detail and subjective sharpness impression.
  13067. @end table
  13068. Vertical low-pass filtering can only be enabled for @option{mode}
  13069. @var{interleave_top} and @var{interleave_bottom}.
  13070. @end table
  13071. @section tmix
  13072. Mix successive video frames.
  13073. A description of the accepted options follows.
  13074. @table @option
  13075. @item frames
  13076. The number of successive frames to mix. If unspecified, it defaults to 3.
  13077. @item weights
  13078. Specify weight of each input video frame.
  13079. Each weight is separated by space. If number of weights is smaller than
  13080. number of @var{frames} last specified weight will be used for all remaining
  13081. unset weights.
  13082. @item scale
  13083. Specify scale, if it is set it will be multiplied with sum
  13084. of each weight multiplied with pixel values to give final destination
  13085. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13086. @end table
  13087. @subsection Examples
  13088. @itemize
  13089. @item
  13090. Average 7 successive frames:
  13091. @example
  13092. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13093. @end example
  13094. @item
  13095. Apply simple temporal convolution:
  13096. @example
  13097. tmix=frames=3:weights="-1 3 -1"
  13098. @end example
  13099. @item
  13100. Similar as above but only showing temporal differences:
  13101. @example
  13102. tmix=frames=3:weights="-1 2 -1":scale=1
  13103. @end example
  13104. @end itemize
  13105. @anchor{tonemap}
  13106. @section tonemap
  13107. Tone map colors from different dynamic ranges.
  13108. This filter expects data in single precision floating point, as it needs to
  13109. operate on (and can output) out-of-range values. Another filter, such as
  13110. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13111. The tonemapping algorithms implemented only work on linear light, so input
  13112. data should be linearized beforehand (and possibly correctly tagged).
  13113. @example
  13114. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13115. @end example
  13116. @subsection Options
  13117. The filter accepts the following options.
  13118. @table @option
  13119. @item tonemap
  13120. Set the tone map algorithm to use.
  13121. Possible values are:
  13122. @table @var
  13123. @item none
  13124. Do not apply any tone map, only desaturate overbright pixels.
  13125. @item clip
  13126. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13127. in-range values, while distorting out-of-range values.
  13128. @item linear
  13129. Stretch the entire reference gamut to a linear multiple of the display.
  13130. @item gamma
  13131. Fit a logarithmic transfer between the tone curves.
  13132. @item reinhard
  13133. Preserve overall image brightness with a simple curve, using nonlinear
  13134. contrast, which results in flattening details and degrading color accuracy.
  13135. @item hable
  13136. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13137. of slightly darkening everything. Use it when detail preservation is more
  13138. important than color and brightness accuracy.
  13139. @item mobius
  13140. Smoothly map out-of-range values, while retaining contrast and colors for
  13141. in-range material as much as possible. Use it when color accuracy is more
  13142. important than detail preservation.
  13143. @end table
  13144. Default is none.
  13145. @item param
  13146. Tune the tone mapping algorithm.
  13147. This affects the following algorithms:
  13148. @table @var
  13149. @item none
  13150. Ignored.
  13151. @item linear
  13152. Specifies the scale factor to use while stretching.
  13153. Default to 1.0.
  13154. @item gamma
  13155. Specifies the exponent of the function.
  13156. Default to 1.8.
  13157. @item clip
  13158. Specify an extra linear coefficient to multiply into the signal before clipping.
  13159. Default to 1.0.
  13160. @item reinhard
  13161. Specify the local contrast coefficient at the display peak.
  13162. Default to 0.5, which means that in-gamut values will be about half as bright
  13163. as when clipping.
  13164. @item hable
  13165. Ignored.
  13166. @item mobius
  13167. Specify the transition point from linear to mobius transform. Every value
  13168. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13169. more accurate the result will be, at the cost of losing bright details.
  13170. Default to 0.3, which due to the steep initial slope still preserves in-range
  13171. colors fairly accurately.
  13172. @end table
  13173. @item desat
  13174. Apply desaturation for highlights that exceed this level of brightness. The
  13175. higher the parameter, the more color information will be preserved. This
  13176. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13177. (smoothly) turning into white instead. This makes images feel more natural,
  13178. at the cost of reducing information about out-of-range colors.
  13179. The default of 2.0 is somewhat conservative and will mostly just apply to
  13180. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13181. This option works only if the input frame has a supported color tag.
  13182. @item peak
  13183. Override signal/nominal/reference peak with this value. Useful when the
  13184. embedded peak information in display metadata is not reliable or when tone
  13185. mapping from a lower range to a higher range.
  13186. @end table
  13187. @section tpad
  13188. Temporarily pad video frames.
  13189. The filter accepts the following options:
  13190. @table @option
  13191. @item start
  13192. Specify number of delay frames before input video stream.
  13193. @item stop
  13194. Specify number of padding frames after input video stream.
  13195. Set to -1 to pad indefinitely.
  13196. @item start_mode
  13197. Set kind of frames added to beginning of stream.
  13198. Can be either @var{add} or @var{clone}.
  13199. With @var{add} frames of solid-color are added.
  13200. With @var{clone} frames are clones of first frame.
  13201. @item stop_mode
  13202. Set kind of frames added to end of stream.
  13203. Can be either @var{add} or @var{clone}.
  13204. With @var{add} frames of solid-color are added.
  13205. With @var{clone} frames are clones of last frame.
  13206. @item start_duration, stop_duration
  13207. Specify the duration of the start/stop delay. See
  13208. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13209. for the accepted syntax.
  13210. These options override @var{start} and @var{stop}.
  13211. @item color
  13212. Specify the color of the padded area. For the syntax of this option,
  13213. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13214. manual,ffmpeg-utils}.
  13215. The default value of @var{color} is "black".
  13216. @end table
  13217. @anchor{transpose}
  13218. @section transpose
  13219. Transpose rows with columns in the input video and optionally flip it.
  13220. It accepts the following parameters:
  13221. @table @option
  13222. @item dir
  13223. Specify the transposition direction.
  13224. Can assume the following values:
  13225. @table @samp
  13226. @item 0, 4, cclock_flip
  13227. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13228. @example
  13229. L.R L.l
  13230. . . -> . .
  13231. l.r R.r
  13232. @end example
  13233. @item 1, 5, clock
  13234. Rotate by 90 degrees clockwise, that is:
  13235. @example
  13236. L.R l.L
  13237. . . -> . .
  13238. l.r r.R
  13239. @end example
  13240. @item 2, 6, cclock
  13241. Rotate by 90 degrees counterclockwise, that is:
  13242. @example
  13243. L.R R.r
  13244. . . -> . .
  13245. l.r L.l
  13246. @end example
  13247. @item 3, 7, clock_flip
  13248. Rotate by 90 degrees clockwise and vertically flip, that is:
  13249. @example
  13250. L.R r.R
  13251. . . -> . .
  13252. l.r l.L
  13253. @end example
  13254. @end table
  13255. For values between 4-7, the transposition is only done if the input
  13256. video geometry is portrait and not landscape. These values are
  13257. deprecated, the @code{passthrough} option should be used instead.
  13258. Numerical values are deprecated, and should be dropped in favor of
  13259. symbolic constants.
  13260. @item passthrough
  13261. Do not apply the transposition if the input geometry matches the one
  13262. specified by the specified value. It accepts the following values:
  13263. @table @samp
  13264. @item none
  13265. Always apply transposition.
  13266. @item portrait
  13267. Preserve portrait geometry (when @var{height} >= @var{width}).
  13268. @item landscape
  13269. Preserve landscape geometry (when @var{width} >= @var{height}).
  13270. @end table
  13271. Default value is @code{none}.
  13272. @end table
  13273. For example to rotate by 90 degrees clockwise and preserve portrait
  13274. layout:
  13275. @example
  13276. transpose=dir=1:passthrough=portrait
  13277. @end example
  13278. The command above can also be specified as:
  13279. @example
  13280. transpose=1:portrait
  13281. @end example
  13282. @section transpose_npp
  13283. Transpose rows with columns in the input video and optionally flip it.
  13284. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13285. It accepts the following parameters:
  13286. @table @option
  13287. @item dir
  13288. Specify the transposition direction.
  13289. Can assume the following values:
  13290. @table @samp
  13291. @item cclock_flip
  13292. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13293. @item clock
  13294. Rotate by 90 degrees clockwise.
  13295. @item cclock
  13296. Rotate by 90 degrees counterclockwise.
  13297. @item clock_flip
  13298. Rotate by 90 degrees clockwise and vertically flip.
  13299. @end table
  13300. @item passthrough
  13301. Do not apply the transposition if the input geometry matches the one
  13302. specified by the specified value. It accepts the following values:
  13303. @table @samp
  13304. @item none
  13305. Always apply transposition. (default)
  13306. @item portrait
  13307. Preserve portrait geometry (when @var{height} >= @var{width}).
  13308. @item landscape
  13309. Preserve landscape geometry (when @var{width} >= @var{height}).
  13310. @end table
  13311. @end table
  13312. @section trim
  13313. Trim the input so that the output contains one continuous subpart of the input.
  13314. It accepts the following parameters:
  13315. @table @option
  13316. @item start
  13317. Specify the time of the start of the kept section, i.e. the frame with the
  13318. timestamp @var{start} will be the first frame in the output.
  13319. @item end
  13320. Specify the time of the first frame that will be dropped, i.e. the frame
  13321. immediately preceding the one with the timestamp @var{end} will be the last
  13322. frame in the output.
  13323. @item start_pts
  13324. This is the same as @var{start}, except this option sets the start timestamp
  13325. in timebase units instead of seconds.
  13326. @item end_pts
  13327. This is the same as @var{end}, except this option sets the end timestamp
  13328. in timebase units instead of seconds.
  13329. @item duration
  13330. The maximum duration of the output in seconds.
  13331. @item start_frame
  13332. The number of the first frame that should be passed to the output.
  13333. @item end_frame
  13334. The number of the first frame that should be dropped.
  13335. @end table
  13336. @option{start}, @option{end}, and @option{duration} are expressed as time
  13337. duration specifications; see
  13338. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13339. for the accepted syntax.
  13340. Note that the first two sets of the start/end options and the @option{duration}
  13341. option look at the frame timestamp, while the _frame variants simply count the
  13342. frames that pass through the filter. Also note that this filter does not modify
  13343. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13344. setpts filter after the trim filter.
  13345. If multiple start or end options are set, this filter tries to be greedy and
  13346. keep all the frames that match at least one of the specified constraints. To keep
  13347. only the part that matches all the constraints at once, chain multiple trim
  13348. filters.
  13349. The defaults are such that all the input is kept. So it is possible to set e.g.
  13350. just the end values to keep everything before the specified time.
  13351. Examples:
  13352. @itemize
  13353. @item
  13354. Drop everything except the second minute of input:
  13355. @example
  13356. ffmpeg -i INPUT -vf trim=60:120
  13357. @end example
  13358. @item
  13359. Keep only the first second:
  13360. @example
  13361. ffmpeg -i INPUT -vf trim=duration=1
  13362. @end example
  13363. @end itemize
  13364. @section unpremultiply
  13365. Apply alpha unpremultiply effect to input video stream using first plane
  13366. of second stream as alpha.
  13367. Both streams must have same dimensions and same pixel format.
  13368. The filter accepts the following option:
  13369. @table @option
  13370. @item planes
  13371. Set which planes will be processed, unprocessed planes will be copied.
  13372. By default value 0xf, all planes will be processed.
  13373. If the format has 1 or 2 components, then luma is bit 0.
  13374. If the format has 3 or 4 components:
  13375. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13376. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13377. If present, the alpha channel is always the last bit.
  13378. @item inplace
  13379. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13380. @end table
  13381. @anchor{unsharp}
  13382. @section unsharp
  13383. Sharpen or blur the input video.
  13384. It accepts the following parameters:
  13385. @table @option
  13386. @item luma_msize_x, lx
  13387. Set the luma matrix horizontal size. It must be an odd integer between
  13388. 3 and 23. The default value is 5.
  13389. @item luma_msize_y, ly
  13390. Set the luma matrix vertical size. It must be an odd integer between 3
  13391. and 23. The default value is 5.
  13392. @item luma_amount, la
  13393. Set the luma effect strength. It must be a floating point number, reasonable
  13394. values lay between -1.5 and 1.5.
  13395. Negative values will blur the input video, while positive values will
  13396. sharpen it, a value of zero will disable the effect.
  13397. Default value is 1.0.
  13398. @item chroma_msize_x, cx
  13399. Set the chroma matrix horizontal size. It must be an odd integer
  13400. between 3 and 23. The default value is 5.
  13401. @item chroma_msize_y, cy
  13402. Set the chroma matrix vertical size. It must be an odd integer
  13403. between 3 and 23. The default value is 5.
  13404. @item chroma_amount, ca
  13405. Set the chroma effect strength. It must be a floating point number, reasonable
  13406. values lay between -1.5 and 1.5.
  13407. Negative values will blur the input video, while positive values will
  13408. sharpen it, a value of zero will disable the effect.
  13409. Default value is 0.0.
  13410. @end table
  13411. All parameters are optional and default to the equivalent of the
  13412. string '5:5:1.0:5:5:0.0'.
  13413. @subsection Examples
  13414. @itemize
  13415. @item
  13416. Apply strong luma sharpen effect:
  13417. @example
  13418. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13419. @end example
  13420. @item
  13421. Apply a strong blur of both luma and chroma parameters:
  13422. @example
  13423. unsharp=7:7:-2:7:7:-2
  13424. @end example
  13425. @end itemize
  13426. @section uspp
  13427. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13428. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13429. shifts and average the results.
  13430. The way this differs from the behavior of spp is that uspp actually encodes &
  13431. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13432. DCT similar to MJPEG.
  13433. The filter accepts the following options:
  13434. @table @option
  13435. @item quality
  13436. Set quality. This option defines the number of levels for averaging. It accepts
  13437. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13438. effect. A value of @code{8} means the higher quality. For each increment of
  13439. that value the speed drops by a factor of approximately 2. Default value is
  13440. @code{3}.
  13441. @item qp
  13442. Force a constant quantization parameter. If not set, the filter will use the QP
  13443. from the video stream (if available).
  13444. @end table
  13445. @section vaguedenoiser
  13446. Apply a wavelet based denoiser.
  13447. It transforms each frame from the video input into the wavelet domain,
  13448. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13449. the obtained coefficients. It does an inverse wavelet transform after.
  13450. Due to wavelet properties, it should give a nice smoothed result, and
  13451. reduced noise, without blurring picture features.
  13452. This filter accepts the following options:
  13453. @table @option
  13454. @item threshold
  13455. The filtering strength. The higher, the more filtered the video will be.
  13456. Hard thresholding can use a higher threshold than soft thresholding
  13457. before the video looks overfiltered. Default value is 2.
  13458. @item method
  13459. The filtering method the filter will use.
  13460. It accepts the following values:
  13461. @table @samp
  13462. @item hard
  13463. All values under the threshold will be zeroed.
  13464. @item soft
  13465. All values under the threshold will be zeroed. All values above will be
  13466. reduced by the threshold.
  13467. @item garrote
  13468. Scales or nullifies coefficients - intermediary between (more) soft and
  13469. (less) hard thresholding.
  13470. @end table
  13471. Default is garrote.
  13472. @item nsteps
  13473. Number of times, the wavelet will decompose the picture. Picture can't
  13474. be decomposed beyond a particular point (typically, 8 for a 640x480
  13475. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13476. @item percent
  13477. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13478. @item planes
  13479. A list of the planes to process. By default all planes are processed.
  13480. @end table
  13481. @section vectorscope
  13482. Display 2 color component values in the two dimensional graph (which is called
  13483. a vectorscope).
  13484. This filter accepts the following options:
  13485. @table @option
  13486. @item mode, m
  13487. Set vectorscope mode.
  13488. It accepts the following values:
  13489. @table @samp
  13490. @item gray
  13491. Gray values are displayed on graph, higher brightness means more pixels have
  13492. same component color value on location in graph. This is the default mode.
  13493. @item color
  13494. Gray values are displayed on graph. Surrounding pixels values which are not
  13495. present in video frame are drawn in gradient of 2 color components which are
  13496. set by option @code{x} and @code{y}. The 3rd color component is static.
  13497. @item color2
  13498. Actual color components values present in video frame are displayed on graph.
  13499. @item color3
  13500. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13501. on graph increases value of another color component, which is luminance by
  13502. default values of @code{x} and @code{y}.
  13503. @item color4
  13504. Actual colors present in video frame are displayed on graph. If two different
  13505. colors map to same position on graph then color with higher value of component
  13506. not present in graph is picked.
  13507. @item color5
  13508. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13509. component picked from radial gradient.
  13510. @end table
  13511. @item x
  13512. Set which color component will be represented on X-axis. Default is @code{1}.
  13513. @item y
  13514. Set which color component will be represented on Y-axis. Default is @code{2}.
  13515. @item intensity, i
  13516. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13517. of color component which represents frequency of (X, Y) location in graph.
  13518. @item envelope, e
  13519. @table @samp
  13520. @item none
  13521. No envelope, this is default.
  13522. @item instant
  13523. Instant envelope, even darkest single pixel will be clearly highlighted.
  13524. @item peak
  13525. Hold maximum and minimum values presented in graph over time. This way you
  13526. can still spot out of range values without constantly looking at vectorscope.
  13527. @item peak+instant
  13528. Peak and instant envelope combined together.
  13529. @end table
  13530. @item graticule, g
  13531. Set what kind of graticule to draw.
  13532. @table @samp
  13533. @item none
  13534. @item green
  13535. @item color
  13536. @end table
  13537. @item opacity, o
  13538. Set graticule opacity.
  13539. @item flags, f
  13540. Set graticule flags.
  13541. @table @samp
  13542. @item white
  13543. Draw graticule for white point.
  13544. @item black
  13545. Draw graticule for black point.
  13546. @item name
  13547. Draw color points short names.
  13548. @end table
  13549. @item bgopacity, b
  13550. Set background opacity.
  13551. @item lthreshold, l
  13552. Set low threshold for color component not represented on X or Y axis.
  13553. Values lower than this value will be ignored. Default is 0.
  13554. Note this value is multiplied with actual max possible value one pixel component
  13555. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13556. is 0.1 * 255 = 25.
  13557. @item hthreshold, h
  13558. Set high threshold for color component not represented on X or Y axis.
  13559. Values higher than this value will be ignored. Default is 1.
  13560. Note this value is multiplied with actual max possible value one pixel component
  13561. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13562. is 0.9 * 255 = 230.
  13563. @item colorspace, c
  13564. Set what kind of colorspace to use when drawing graticule.
  13565. @table @samp
  13566. @item auto
  13567. @item 601
  13568. @item 709
  13569. @end table
  13570. Default is auto.
  13571. @end table
  13572. @anchor{vidstabdetect}
  13573. @section vidstabdetect
  13574. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13575. @ref{vidstabtransform} for pass 2.
  13576. This filter generates a file with relative translation and rotation
  13577. transform information about subsequent frames, which is then used by
  13578. the @ref{vidstabtransform} filter.
  13579. To enable compilation of this filter you need to configure FFmpeg with
  13580. @code{--enable-libvidstab}.
  13581. This filter accepts the following options:
  13582. @table @option
  13583. @item result
  13584. Set the path to the file used to write the transforms information.
  13585. Default value is @file{transforms.trf}.
  13586. @item shakiness
  13587. Set how shaky the video is and how quick the camera is. It accepts an
  13588. integer in the range 1-10, a value of 1 means little shakiness, a
  13589. value of 10 means strong shakiness. Default value is 5.
  13590. @item accuracy
  13591. Set the accuracy of the detection process. It must be a value in the
  13592. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13593. accuracy. Default value is 15.
  13594. @item stepsize
  13595. Set stepsize of the search process. The region around minimum is
  13596. scanned with 1 pixel resolution. Default value is 6.
  13597. @item mincontrast
  13598. Set minimum contrast. Below this value a local measurement field is
  13599. discarded. Must be a floating point value in the range 0-1. Default
  13600. value is 0.3.
  13601. @item tripod
  13602. Set reference frame number for tripod mode.
  13603. If enabled, the motion of the frames is compared to a reference frame
  13604. in the filtered stream, identified by the specified number. The idea
  13605. is to compensate all movements in a more-or-less static scene and keep
  13606. the camera view absolutely still.
  13607. If set to 0, it is disabled. The frames are counted starting from 1.
  13608. @item show
  13609. Show fields and transforms in the resulting frames. It accepts an
  13610. integer in the range 0-2. Default value is 0, which disables any
  13611. visualization.
  13612. @end table
  13613. @subsection Examples
  13614. @itemize
  13615. @item
  13616. Use default values:
  13617. @example
  13618. vidstabdetect
  13619. @end example
  13620. @item
  13621. Analyze strongly shaky movie and put the results in file
  13622. @file{mytransforms.trf}:
  13623. @example
  13624. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13625. @end example
  13626. @item
  13627. Visualize the result of internal transformations in the resulting
  13628. video:
  13629. @example
  13630. vidstabdetect=show=1
  13631. @end example
  13632. @item
  13633. Analyze a video with medium shakiness using @command{ffmpeg}:
  13634. @example
  13635. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13636. @end example
  13637. @end itemize
  13638. @anchor{vidstabtransform}
  13639. @section vidstabtransform
  13640. Video stabilization/deshaking: pass 2 of 2,
  13641. see @ref{vidstabdetect} for pass 1.
  13642. Read a file with transform information for each frame and
  13643. apply/compensate them. Together with the @ref{vidstabdetect}
  13644. filter this can be used to deshake videos. See also
  13645. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13646. the @ref{unsharp} filter, see below.
  13647. To enable compilation of this filter you need to configure FFmpeg with
  13648. @code{--enable-libvidstab}.
  13649. @subsection Options
  13650. @table @option
  13651. @item input
  13652. Set path to the file used to read the transforms. Default value is
  13653. @file{transforms.trf}.
  13654. @item smoothing
  13655. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13656. camera movements. Default value is 10.
  13657. For example a number of 10 means that 21 frames are used (10 in the
  13658. past and 10 in the future) to smoothen the motion in the video. A
  13659. larger value leads to a smoother video, but limits the acceleration of
  13660. the camera (pan/tilt movements). 0 is a special case where a static
  13661. camera is simulated.
  13662. @item optalgo
  13663. Set the camera path optimization algorithm.
  13664. Accepted values are:
  13665. @table @samp
  13666. @item gauss
  13667. gaussian kernel low-pass filter on camera motion (default)
  13668. @item avg
  13669. averaging on transformations
  13670. @end table
  13671. @item maxshift
  13672. Set maximal number of pixels to translate frames. Default value is -1,
  13673. meaning no limit.
  13674. @item maxangle
  13675. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13676. value is -1, meaning no limit.
  13677. @item crop
  13678. Specify how to deal with borders that may be visible due to movement
  13679. compensation.
  13680. Available values are:
  13681. @table @samp
  13682. @item keep
  13683. keep image information from previous frame (default)
  13684. @item black
  13685. fill the border black
  13686. @end table
  13687. @item invert
  13688. Invert transforms if set to 1. Default value is 0.
  13689. @item relative
  13690. Consider transforms as relative to previous frame if set to 1,
  13691. absolute if set to 0. Default value is 0.
  13692. @item zoom
  13693. Set percentage to zoom. A positive value will result in a zoom-in
  13694. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13695. zoom).
  13696. @item optzoom
  13697. Set optimal zooming to avoid borders.
  13698. Accepted values are:
  13699. @table @samp
  13700. @item 0
  13701. disabled
  13702. @item 1
  13703. optimal static zoom value is determined (only very strong movements
  13704. will lead to visible borders) (default)
  13705. @item 2
  13706. optimal adaptive zoom value is determined (no borders will be
  13707. visible), see @option{zoomspeed}
  13708. @end table
  13709. Note that the value given at zoom is added to the one calculated here.
  13710. @item zoomspeed
  13711. Set percent to zoom maximally each frame (enabled when
  13712. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13713. 0.25.
  13714. @item interpol
  13715. Specify type of interpolation.
  13716. Available values are:
  13717. @table @samp
  13718. @item no
  13719. no interpolation
  13720. @item linear
  13721. linear only horizontal
  13722. @item bilinear
  13723. linear in both directions (default)
  13724. @item bicubic
  13725. cubic in both directions (slow)
  13726. @end table
  13727. @item tripod
  13728. Enable virtual tripod mode if set to 1, which is equivalent to
  13729. @code{relative=0:smoothing=0}. Default value is 0.
  13730. Use also @code{tripod} option of @ref{vidstabdetect}.
  13731. @item debug
  13732. Increase log verbosity if set to 1. Also the detected global motions
  13733. are written to the temporary file @file{global_motions.trf}. Default
  13734. value is 0.
  13735. @end table
  13736. @subsection Examples
  13737. @itemize
  13738. @item
  13739. Use @command{ffmpeg} for a typical stabilization with default values:
  13740. @example
  13741. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13742. @end example
  13743. Note the use of the @ref{unsharp} filter which is always recommended.
  13744. @item
  13745. Zoom in a bit more and load transform data from a given file:
  13746. @example
  13747. vidstabtransform=zoom=5:input="mytransforms.trf"
  13748. @end example
  13749. @item
  13750. Smoothen the video even more:
  13751. @example
  13752. vidstabtransform=smoothing=30
  13753. @end example
  13754. @end itemize
  13755. @section vflip
  13756. Flip the input video vertically.
  13757. For example, to vertically flip a video with @command{ffmpeg}:
  13758. @example
  13759. ffmpeg -i in.avi -vf "vflip" out.avi
  13760. @end example
  13761. @section vfrdet
  13762. Detect variable frame rate video.
  13763. This filter tries to detect if the input is variable or constant frame rate.
  13764. At end it will output number of frames detected as having variable delta pts,
  13765. and ones with constant delta pts.
  13766. If there was frames with variable delta, than it will also show min and max delta
  13767. encountered.
  13768. @section vibrance
  13769. Boost or alter saturation.
  13770. The filter accepts the following options:
  13771. @table @option
  13772. @item intensity
  13773. Set strength of boost if positive value or strength of alter if negative value.
  13774. Default is 0. Allowed range is from -2 to 2.
  13775. @item rbal
  13776. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13777. @item gbal
  13778. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13779. @item bbal
  13780. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13781. @item rlum
  13782. Set the red luma coefficient.
  13783. @item glum
  13784. Set the green luma coefficient.
  13785. @item blum
  13786. Set the blue luma coefficient.
  13787. @item alternate
  13788. If @code{intensity} is negative and this is set to 1, colors will change,
  13789. otherwise colors will be less saturated, more towards gray.
  13790. @end table
  13791. @anchor{vignette}
  13792. @section vignette
  13793. Make or reverse a natural vignetting effect.
  13794. The filter accepts the following options:
  13795. @table @option
  13796. @item angle, a
  13797. Set lens angle expression as a number of radians.
  13798. The value is clipped in the @code{[0,PI/2]} range.
  13799. Default value: @code{"PI/5"}
  13800. @item x0
  13801. @item y0
  13802. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13803. by default.
  13804. @item mode
  13805. Set forward/backward mode.
  13806. Available modes are:
  13807. @table @samp
  13808. @item forward
  13809. The larger the distance from the central point, the darker the image becomes.
  13810. @item backward
  13811. The larger the distance from the central point, the brighter the image becomes.
  13812. This can be used to reverse a vignette effect, though there is no automatic
  13813. detection to extract the lens @option{angle} and other settings (yet). It can
  13814. also be used to create a burning effect.
  13815. @end table
  13816. Default value is @samp{forward}.
  13817. @item eval
  13818. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13819. It accepts the following values:
  13820. @table @samp
  13821. @item init
  13822. Evaluate expressions only once during the filter initialization.
  13823. @item frame
  13824. Evaluate expressions for each incoming frame. This is way slower than the
  13825. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13826. allows advanced dynamic expressions.
  13827. @end table
  13828. Default value is @samp{init}.
  13829. @item dither
  13830. Set dithering to reduce the circular banding effects. Default is @code{1}
  13831. (enabled).
  13832. @item aspect
  13833. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13834. Setting this value to the SAR of the input will make a rectangular vignetting
  13835. following the dimensions of the video.
  13836. Default is @code{1/1}.
  13837. @end table
  13838. @subsection Expressions
  13839. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13840. following parameters.
  13841. @table @option
  13842. @item w
  13843. @item h
  13844. input width and height
  13845. @item n
  13846. the number of input frame, starting from 0
  13847. @item pts
  13848. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13849. @var{TB} units, NAN if undefined
  13850. @item r
  13851. frame rate of the input video, NAN if the input frame rate is unknown
  13852. @item t
  13853. the PTS (Presentation TimeStamp) of the filtered video frame,
  13854. expressed in seconds, NAN if undefined
  13855. @item tb
  13856. time base of the input video
  13857. @end table
  13858. @subsection Examples
  13859. @itemize
  13860. @item
  13861. Apply simple strong vignetting effect:
  13862. @example
  13863. vignette=PI/4
  13864. @end example
  13865. @item
  13866. Make a flickering vignetting:
  13867. @example
  13868. vignette='PI/4+random(1)*PI/50':eval=frame
  13869. @end example
  13870. @end itemize
  13871. @section vmafmotion
  13872. Obtain the average vmaf motion score of a video.
  13873. It is one of the component filters of VMAF.
  13874. The obtained average motion score is printed through the logging system.
  13875. In the below example the input file @file{ref.mpg} is being processed and score
  13876. is computed.
  13877. @example
  13878. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13879. @end example
  13880. @section vstack
  13881. Stack input videos vertically.
  13882. All streams must be of same pixel format and of same width.
  13883. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13884. to create same output.
  13885. The filter accept the following option:
  13886. @table @option
  13887. @item inputs
  13888. Set number of input streams. Default is 2.
  13889. @item shortest
  13890. If set to 1, force the output to terminate when the shortest input
  13891. terminates. Default value is 0.
  13892. @end table
  13893. @section w3fdif
  13894. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13895. Deinterlacing Filter").
  13896. Based on the process described by Martin Weston for BBC R&D, and
  13897. implemented based on the de-interlace algorithm written by Jim
  13898. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13899. uses filter coefficients calculated by BBC R&D.
  13900. This filter use field-dominance information in frame to decide which
  13901. of each pair of fields to place first in the output.
  13902. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  13903. There are two sets of filter coefficients, so called "simple":
  13904. and "complex". Which set of filter coefficients is used can
  13905. be set by passing an optional parameter:
  13906. @table @option
  13907. @item filter
  13908. Set the interlacing filter coefficients. Accepts one of the following values:
  13909. @table @samp
  13910. @item simple
  13911. Simple filter coefficient set.
  13912. @item complex
  13913. More-complex filter coefficient set.
  13914. @end table
  13915. Default value is @samp{complex}.
  13916. @item deint
  13917. Specify which frames to deinterlace. Accept one of the following values:
  13918. @table @samp
  13919. @item all
  13920. Deinterlace all frames,
  13921. @item interlaced
  13922. Only deinterlace frames marked as interlaced.
  13923. @end table
  13924. Default value is @samp{all}.
  13925. @end table
  13926. @section waveform
  13927. Video waveform monitor.
  13928. The waveform monitor plots color component intensity. By default luminance
  13929. only. Each column of the waveform corresponds to a column of pixels in the
  13930. source video.
  13931. It accepts the following options:
  13932. @table @option
  13933. @item mode, m
  13934. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13935. In row mode, the graph on the left side represents color component value 0 and
  13936. the right side represents value = 255. In column mode, the top side represents
  13937. color component value = 0 and bottom side represents value = 255.
  13938. @item intensity, i
  13939. Set intensity. Smaller values are useful to find out how many values of the same
  13940. luminance are distributed across input rows/columns.
  13941. Default value is @code{0.04}. Allowed range is [0, 1].
  13942. @item mirror, r
  13943. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13944. In mirrored mode, higher values will be represented on the left
  13945. side for @code{row} mode and at the top for @code{column} mode. Default is
  13946. @code{1} (mirrored).
  13947. @item display, d
  13948. Set display mode.
  13949. It accepts the following values:
  13950. @table @samp
  13951. @item overlay
  13952. Presents information identical to that in the @code{parade}, except
  13953. that the graphs representing color components are superimposed directly
  13954. over one another.
  13955. This display mode makes it easier to spot relative differences or similarities
  13956. in overlapping areas of the color components that are supposed to be identical,
  13957. such as neutral whites, grays, or blacks.
  13958. @item stack
  13959. Display separate graph for the color components side by side in
  13960. @code{row} mode or one below the other in @code{column} mode.
  13961. @item parade
  13962. Display separate graph for the color components side by side in
  13963. @code{column} mode or one below the other in @code{row} mode.
  13964. Using this display mode makes it easy to spot color casts in the highlights
  13965. and shadows of an image, by comparing the contours of the top and the bottom
  13966. graphs of each waveform. Since whites, grays, and blacks are characterized
  13967. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13968. should display three waveforms of roughly equal width/height. If not, the
  13969. correction is easy to perform by making level adjustments the three waveforms.
  13970. @end table
  13971. Default is @code{stack}.
  13972. @item components, c
  13973. Set which color components to display. Default is 1, which means only luminance
  13974. or red color component if input is in RGB colorspace. If is set for example to
  13975. 7 it will display all 3 (if) available color components.
  13976. @item envelope, e
  13977. @table @samp
  13978. @item none
  13979. No envelope, this is default.
  13980. @item instant
  13981. Instant envelope, minimum and maximum values presented in graph will be easily
  13982. visible even with small @code{step} value.
  13983. @item peak
  13984. Hold minimum and maximum values presented in graph across time. This way you
  13985. can still spot out of range values without constantly looking at waveforms.
  13986. @item peak+instant
  13987. Peak and instant envelope combined together.
  13988. @end table
  13989. @item filter, f
  13990. @table @samp
  13991. @item lowpass
  13992. No filtering, this is default.
  13993. @item flat
  13994. Luma and chroma combined together.
  13995. @item aflat
  13996. Similar as above, but shows difference between blue and red chroma.
  13997. @item xflat
  13998. Similar as above, but use different colors.
  13999. @item chroma
  14000. Displays only chroma.
  14001. @item color
  14002. Displays actual color value on waveform.
  14003. @item acolor
  14004. Similar as above, but with luma showing frequency of chroma values.
  14005. @end table
  14006. @item graticule, g
  14007. Set which graticule to display.
  14008. @table @samp
  14009. @item none
  14010. Do not display graticule.
  14011. @item green
  14012. Display green graticule showing legal broadcast ranges.
  14013. @item orange
  14014. Display orange graticule showing legal broadcast ranges.
  14015. @end table
  14016. @item opacity, o
  14017. Set graticule opacity.
  14018. @item flags, fl
  14019. Set graticule flags.
  14020. @table @samp
  14021. @item numbers
  14022. Draw numbers above lines. By default enabled.
  14023. @item dots
  14024. Draw dots instead of lines.
  14025. @end table
  14026. @item scale, s
  14027. Set scale used for displaying graticule.
  14028. @table @samp
  14029. @item digital
  14030. @item millivolts
  14031. @item ire
  14032. @end table
  14033. Default is digital.
  14034. @item bgopacity, b
  14035. Set background opacity.
  14036. @end table
  14037. @section weave, doubleweave
  14038. The @code{weave} takes a field-based video input and join
  14039. each two sequential fields into single frame, producing a new double
  14040. height clip with half the frame rate and half the frame count.
  14041. The @code{doubleweave} works same as @code{weave} but without
  14042. halving frame rate and frame count.
  14043. It accepts the following option:
  14044. @table @option
  14045. @item first_field
  14046. Set first field. Available values are:
  14047. @table @samp
  14048. @item top, t
  14049. Set the frame as top-field-first.
  14050. @item bottom, b
  14051. Set the frame as bottom-field-first.
  14052. @end table
  14053. @end table
  14054. @subsection Examples
  14055. @itemize
  14056. @item
  14057. Interlace video using @ref{select} and @ref{separatefields} filter:
  14058. @example
  14059. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14060. @end example
  14061. @end itemize
  14062. @section xbr
  14063. Apply the xBR high-quality magnification filter which is designed for pixel
  14064. art. It follows a set of edge-detection rules, see
  14065. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14066. It accepts the following option:
  14067. @table @option
  14068. @item n
  14069. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14070. @code{3xBR} and @code{4} for @code{4xBR}.
  14071. Default is @code{3}.
  14072. @end table
  14073. @section xmedian
  14074. Pick median pixels from several input videos.
  14075. The filter accept the following options:
  14076. @table @option
  14077. @item nb_inputs
  14078. Set number of inputs. This must be odd number.
  14079. Default is 3. Allowed range is from 3 to 255.
  14080. @item planes
  14081. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14082. @end table
  14083. @section xstack
  14084. Stack video inputs into custom layout.
  14085. All streams must be of same pixel format.
  14086. The filter accept the following option:
  14087. @table @option
  14088. @item inputs
  14089. Set number of input streams. Default is 2.
  14090. @item layout
  14091. Specify layout of inputs.
  14092. This option requires the desired layout configuration to be explicitly set by the user.
  14093. This sets position of each video input in output. Each input
  14094. is separated by '|'.
  14095. The first number represents the column, and the second number represents the row.
  14096. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14097. where X is video input from which to take width or height.
  14098. Multiple values can be used when separated by '+'. In such
  14099. case values are summed together.
  14100. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14101. a layout must be set by the user.
  14102. @item shortest
  14103. If set to 1, force the output to terminate when the shortest input
  14104. terminates. Default value is 0.
  14105. @end table
  14106. @subsection Examples
  14107. @itemize
  14108. @item
  14109. Display 4 inputs into 2x2 grid,
  14110. note that if inputs are of different sizes unused gaps might appear,
  14111. as not all of output video is used.
  14112. @example
  14113. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14114. @end example
  14115. @item
  14116. Display 4 inputs into 1x4 grid,
  14117. note that if inputs are of different sizes unused gaps might appear,
  14118. as not all of output video is used.
  14119. @example
  14120. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14121. @end example
  14122. @item
  14123. Display 9 inputs into 3x3 grid,
  14124. note that if inputs are of different sizes unused gaps might appear,
  14125. as not all of output video is used.
  14126. @example
  14127. 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
  14128. @end example
  14129. @end itemize
  14130. @anchor{yadif}
  14131. @section yadif
  14132. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14133. filter").
  14134. It accepts the following parameters:
  14135. @table @option
  14136. @item mode
  14137. The interlacing mode to adopt. It accepts one of the following values:
  14138. @table @option
  14139. @item 0, send_frame
  14140. Output one frame for each frame.
  14141. @item 1, send_field
  14142. Output one frame for each field.
  14143. @item 2, send_frame_nospatial
  14144. Like @code{send_frame}, but it skips the spatial interlacing check.
  14145. @item 3, send_field_nospatial
  14146. Like @code{send_field}, but it skips the spatial interlacing check.
  14147. @end table
  14148. The default value is @code{send_frame}.
  14149. @item parity
  14150. The picture field parity assumed for the input interlaced video. It accepts one
  14151. of the following values:
  14152. @table @option
  14153. @item 0, tff
  14154. Assume the top field is first.
  14155. @item 1, bff
  14156. Assume the bottom field is first.
  14157. @item -1, auto
  14158. Enable automatic detection of field parity.
  14159. @end table
  14160. The default value is @code{auto}.
  14161. If the interlacing is unknown or the decoder does not export this information,
  14162. top field first will be assumed.
  14163. @item deint
  14164. Specify which frames to deinterlace. Accept one of the following
  14165. values:
  14166. @table @option
  14167. @item 0, all
  14168. Deinterlace all frames.
  14169. @item 1, interlaced
  14170. Only deinterlace frames marked as interlaced.
  14171. @end table
  14172. The default value is @code{all}.
  14173. @end table
  14174. @section yadif_cuda
  14175. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14176. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14177. and/or nvenc.
  14178. It accepts the following parameters:
  14179. @table @option
  14180. @item mode
  14181. The interlacing mode to adopt. It accepts one of the following values:
  14182. @table @option
  14183. @item 0, send_frame
  14184. Output one frame for each frame.
  14185. @item 1, send_field
  14186. Output one frame for each field.
  14187. @item 2, send_frame_nospatial
  14188. Like @code{send_frame}, but it skips the spatial interlacing check.
  14189. @item 3, send_field_nospatial
  14190. Like @code{send_field}, but it skips the spatial interlacing check.
  14191. @end table
  14192. The default value is @code{send_frame}.
  14193. @item parity
  14194. The picture field parity assumed for the input interlaced video. It accepts one
  14195. of the following values:
  14196. @table @option
  14197. @item 0, tff
  14198. Assume the top field is first.
  14199. @item 1, bff
  14200. Assume the bottom field is first.
  14201. @item -1, auto
  14202. Enable automatic detection of field parity.
  14203. @end table
  14204. The default value is @code{auto}.
  14205. If the interlacing is unknown or the decoder does not export this information,
  14206. top field first will be assumed.
  14207. @item deint
  14208. Specify which frames to deinterlace. Accept one of the following
  14209. values:
  14210. @table @option
  14211. @item 0, all
  14212. Deinterlace all frames.
  14213. @item 1, interlaced
  14214. Only deinterlace frames marked as interlaced.
  14215. @end table
  14216. The default value is @code{all}.
  14217. @end table
  14218. @section zoompan
  14219. Apply Zoom & Pan effect.
  14220. This filter accepts the following options:
  14221. @table @option
  14222. @item zoom, z
  14223. Set the zoom expression. Range is 1-10. Default is 1.
  14224. @item x
  14225. @item y
  14226. Set the x and y expression. Default is 0.
  14227. @item d
  14228. Set the duration expression in number of frames.
  14229. This sets for how many number of frames effect will last for
  14230. single input image.
  14231. @item s
  14232. Set the output image size, default is 'hd720'.
  14233. @item fps
  14234. Set the output frame rate, default is '25'.
  14235. @end table
  14236. Each expression can contain the following constants:
  14237. @table @option
  14238. @item in_w, iw
  14239. Input width.
  14240. @item in_h, ih
  14241. Input height.
  14242. @item out_w, ow
  14243. Output width.
  14244. @item out_h, oh
  14245. Output height.
  14246. @item in
  14247. Input frame count.
  14248. @item on
  14249. Output frame count.
  14250. @item x
  14251. @item y
  14252. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14253. for current input frame.
  14254. @item px
  14255. @item py
  14256. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14257. not yet such frame (first input frame).
  14258. @item zoom
  14259. Last calculated zoom from 'z' expression for current input frame.
  14260. @item pzoom
  14261. Last calculated zoom of last output frame of previous input frame.
  14262. @item duration
  14263. Number of output frames for current input frame. Calculated from 'd' expression
  14264. for each input frame.
  14265. @item pduration
  14266. number of output frames created for previous input frame
  14267. @item a
  14268. Rational number: input width / input height
  14269. @item sar
  14270. sample aspect ratio
  14271. @item dar
  14272. display aspect ratio
  14273. @end table
  14274. @subsection Examples
  14275. @itemize
  14276. @item
  14277. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14278. @example
  14279. 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
  14280. @end example
  14281. @item
  14282. Zoom-in up to 1.5 and pan always at center of picture:
  14283. @example
  14284. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14285. @end example
  14286. @item
  14287. Same as above but without pausing:
  14288. @example
  14289. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14290. @end example
  14291. @end itemize
  14292. @anchor{zscale}
  14293. @section zscale
  14294. Scale (resize) the input video, using the z.lib library:
  14295. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14296. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14297. The zscale filter forces the output display aspect ratio to be the same
  14298. as the input, by changing the output sample aspect ratio.
  14299. If the input image format is different from the format requested by
  14300. the next filter, the zscale filter will convert the input to the
  14301. requested format.
  14302. @subsection Options
  14303. The filter accepts the following options.
  14304. @table @option
  14305. @item width, w
  14306. @item height, h
  14307. Set the output video dimension expression. Default value is the input
  14308. dimension.
  14309. If the @var{width} or @var{w} value is 0, the input width is used for
  14310. the output. If the @var{height} or @var{h} value is 0, the input height
  14311. is used for the output.
  14312. If one and only one of the values is -n with n >= 1, the zscale filter
  14313. will use a value that maintains the aspect ratio of the input image,
  14314. calculated from the other specified dimension. After that it will,
  14315. however, make sure that the calculated dimension is divisible by n and
  14316. adjust the value if necessary.
  14317. If both values are -n with n >= 1, the behavior will be identical to
  14318. both values being set to 0 as previously detailed.
  14319. See below for the list of accepted constants for use in the dimension
  14320. expression.
  14321. @item size, s
  14322. Set the video size. For the syntax of this option, check the
  14323. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14324. @item dither, d
  14325. Set the dither type.
  14326. Possible values are:
  14327. @table @var
  14328. @item none
  14329. @item ordered
  14330. @item random
  14331. @item error_diffusion
  14332. @end table
  14333. Default is none.
  14334. @item filter, f
  14335. Set the resize filter type.
  14336. Possible values are:
  14337. @table @var
  14338. @item point
  14339. @item bilinear
  14340. @item bicubic
  14341. @item spline16
  14342. @item spline36
  14343. @item lanczos
  14344. @end table
  14345. Default is bilinear.
  14346. @item range, r
  14347. Set the color range.
  14348. Possible values are:
  14349. @table @var
  14350. @item input
  14351. @item limited
  14352. @item full
  14353. @end table
  14354. Default is same as input.
  14355. @item primaries, p
  14356. Set the color primaries.
  14357. Possible values are:
  14358. @table @var
  14359. @item input
  14360. @item 709
  14361. @item unspecified
  14362. @item 170m
  14363. @item 240m
  14364. @item 2020
  14365. @end table
  14366. Default is same as input.
  14367. @item transfer, t
  14368. Set the transfer characteristics.
  14369. Possible values are:
  14370. @table @var
  14371. @item input
  14372. @item 709
  14373. @item unspecified
  14374. @item 601
  14375. @item linear
  14376. @item 2020_10
  14377. @item 2020_12
  14378. @item smpte2084
  14379. @item iec61966-2-1
  14380. @item arib-std-b67
  14381. @end table
  14382. Default is same as input.
  14383. @item matrix, m
  14384. Set the colorspace matrix.
  14385. Possible value are:
  14386. @table @var
  14387. @item input
  14388. @item 709
  14389. @item unspecified
  14390. @item 470bg
  14391. @item 170m
  14392. @item 2020_ncl
  14393. @item 2020_cl
  14394. @end table
  14395. Default is same as input.
  14396. @item rangein, rin
  14397. Set the input color range.
  14398. Possible values are:
  14399. @table @var
  14400. @item input
  14401. @item limited
  14402. @item full
  14403. @end table
  14404. Default is same as input.
  14405. @item primariesin, pin
  14406. Set the input color primaries.
  14407. Possible values are:
  14408. @table @var
  14409. @item input
  14410. @item 709
  14411. @item unspecified
  14412. @item 170m
  14413. @item 240m
  14414. @item 2020
  14415. @end table
  14416. Default is same as input.
  14417. @item transferin, tin
  14418. Set the input transfer characteristics.
  14419. Possible values are:
  14420. @table @var
  14421. @item input
  14422. @item 709
  14423. @item unspecified
  14424. @item 601
  14425. @item linear
  14426. @item 2020_10
  14427. @item 2020_12
  14428. @end table
  14429. Default is same as input.
  14430. @item matrixin, min
  14431. Set the input colorspace matrix.
  14432. Possible value are:
  14433. @table @var
  14434. @item input
  14435. @item 709
  14436. @item unspecified
  14437. @item 470bg
  14438. @item 170m
  14439. @item 2020_ncl
  14440. @item 2020_cl
  14441. @end table
  14442. @item chromal, c
  14443. Set the output chroma location.
  14444. Possible values are:
  14445. @table @var
  14446. @item input
  14447. @item left
  14448. @item center
  14449. @item topleft
  14450. @item top
  14451. @item bottomleft
  14452. @item bottom
  14453. @end table
  14454. @item chromalin, cin
  14455. Set the input chroma location.
  14456. Possible values are:
  14457. @table @var
  14458. @item input
  14459. @item left
  14460. @item center
  14461. @item topleft
  14462. @item top
  14463. @item bottomleft
  14464. @item bottom
  14465. @end table
  14466. @item npl
  14467. Set the nominal peak luminance.
  14468. @end table
  14469. The values of the @option{w} and @option{h} options are expressions
  14470. containing the following constants:
  14471. @table @var
  14472. @item in_w
  14473. @item in_h
  14474. The input width and height
  14475. @item iw
  14476. @item ih
  14477. These are the same as @var{in_w} and @var{in_h}.
  14478. @item out_w
  14479. @item out_h
  14480. The output (scaled) width and height
  14481. @item ow
  14482. @item oh
  14483. These are the same as @var{out_w} and @var{out_h}
  14484. @item a
  14485. The same as @var{iw} / @var{ih}
  14486. @item sar
  14487. input sample aspect ratio
  14488. @item dar
  14489. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14490. @item hsub
  14491. @item vsub
  14492. horizontal and vertical input chroma subsample values. For example for the
  14493. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14494. @item ohsub
  14495. @item ovsub
  14496. horizontal and vertical output chroma subsample values. For example for the
  14497. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14498. @end table
  14499. @table @option
  14500. @end table
  14501. @c man end VIDEO FILTERS
  14502. @chapter OpenCL Video Filters
  14503. @c man begin OPENCL VIDEO FILTERS
  14504. Below is a description of the currently available OpenCL video filters.
  14505. To enable compilation of these filters you need to configure FFmpeg with
  14506. @code{--enable-opencl}.
  14507. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14508. @table @option
  14509. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14510. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14511. given device parameters.
  14512. @item -filter_hw_device @var{name}
  14513. Pass the hardware device called @var{name} to all filters in any filter graph.
  14514. @end table
  14515. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14516. @itemize
  14517. @item
  14518. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14519. @example
  14520. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14521. @end example
  14522. @end itemize
  14523. 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.
  14524. @section avgblur_opencl
  14525. Apply average blur filter.
  14526. The filter accepts the following options:
  14527. @table @option
  14528. @item sizeX
  14529. Set horizontal radius size.
  14530. Range is @code{[1, 1024]} and default value is @code{1}.
  14531. @item planes
  14532. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14533. @item sizeY
  14534. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14535. @end table
  14536. @subsection Example
  14537. @itemize
  14538. @item
  14539. 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.
  14540. @example
  14541. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14542. @end example
  14543. @end itemize
  14544. @section boxblur_opencl
  14545. Apply a boxblur algorithm to the input video.
  14546. It accepts the following parameters:
  14547. @table @option
  14548. @item luma_radius, lr
  14549. @item luma_power, lp
  14550. @item chroma_radius, cr
  14551. @item chroma_power, cp
  14552. @item alpha_radius, ar
  14553. @item alpha_power, ap
  14554. @end table
  14555. A description of the accepted options follows.
  14556. @table @option
  14557. @item luma_radius, lr
  14558. @item chroma_radius, cr
  14559. @item alpha_radius, ar
  14560. Set an expression for the box radius in pixels used for blurring the
  14561. corresponding input plane.
  14562. The radius value must be a non-negative number, and must not be
  14563. greater than the value of the expression @code{min(w,h)/2} for the
  14564. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14565. planes.
  14566. Default value for @option{luma_radius} is "2". If not specified,
  14567. @option{chroma_radius} and @option{alpha_radius} default to the
  14568. corresponding value set for @option{luma_radius}.
  14569. The expressions can contain the following constants:
  14570. @table @option
  14571. @item w
  14572. @item h
  14573. The input width and height in pixels.
  14574. @item cw
  14575. @item ch
  14576. The input chroma image width and height in pixels.
  14577. @item hsub
  14578. @item vsub
  14579. The horizontal and vertical chroma subsample values. For example, for the
  14580. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14581. @end table
  14582. @item luma_power, lp
  14583. @item chroma_power, cp
  14584. @item alpha_power, ap
  14585. Specify how many times the boxblur filter is applied to the
  14586. corresponding plane.
  14587. Default value for @option{luma_power} is 2. If not specified,
  14588. @option{chroma_power} and @option{alpha_power} default to the
  14589. corresponding value set for @option{luma_power}.
  14590. A value of 0 will disable the effect.
  14591. @end table
  14592. @subsection Examples
  14593. 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.
  14594. @itemize
  14595. @item
  14596. Apply a boxblur filter with the luma, chroma, and alpha radius
  14597. 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.
  14598. @example
  14599. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14600. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14601. @end example
  14602. @item
  14603. 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.
  14604. For the luma plane, a 2x2 box radius will be run once.
  14605. For the chroma plane, a 4x4 box radius will be run 5 times.
  14606. For the alpha plane, a 3x3 box radius will be run 7 times.
  14607. @example
  14608. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14609. @end example
  14610. @end itemize
  14611. @section convolution_opencl
  14612. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14613. The filter accepts the following options:
  14614. @table @option
  14615. @item 0m
  14616. @item 1m
  14617. @item 2m
  14618. @item 3m
  14619. Set matrix for each plane.
  14620. Matrix is sequence of 9, 25 or 49 signed numbers.
  14621. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14622. @item 0rdiv
  14623. @item 1rdiv
  14624. @item 2rdiv
  14625. @item 3rdiv
  14626. Set multiplier for calculated value for each plane.
  14627. If unset or 0, it will be sum of all matrix elements.
  14628. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14629. @item 0bias
  14630. @item 1bias
  14631. @item 2bias
  14632. @item 3bias
  14633. Set bias for each plane. This value is added to the result of the multiplication.
  14634. Useful for making the overall image brighter or darker.
  14635. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14636. @end table
  14637. @subsection Examples
  14638. @itemize
  14639. @item
  14640. Apply sharpen:
  14641. @example
  14642. -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
  14643. @end example
  14644. @item
  14645. Apply blur:
  14646. @example
  14647. -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
  14648. @end example
  14649. @item
  14650. Apply edge enhance:
  14651. @example
  14652. -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
  14653. @end example
  14654. @item
  14655. Apply edge detect:
  14656. @example
  14657. -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
  14658. @end example
  14659. @item
  14660. Apply laplacian edge detector which includes diagonals:
  14661. @example
  14662. -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
  14663. @end example
  14664. @item
  14665. Apply emboss:
  14666. @example
  14667. -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
  14668. @end example
  14669. @end itemize
  14670. @section dilation_opencl
  14671. Apply dilation effect to the video.
  14672. This filter replaces the pixel by the local(3x3) maximum.
  14673. It accepts the following options:
  14674. @table @option
  14675. @item threshold0
  14676. @item threshold1
  14677. @item threshold2
  14678. @item threshold3
  14679. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14680. If @code{0}, plane will remain unchanged.
  14681. @item coordinates
  14682. Flag which specifies the pixel to refer to.
  14683. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14684. Flags to local 3x3 coordinates region centered on @code{x}:
  14685. 1 2 3
  14686. 4 x 5
  14687. 6 7 8
  14688. @end table
  14689. @subsection Example
  14690. @itemize
  14691. @item
  14692. 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.
  14693. @example
  14694. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14695. @end example
  14696. @end itemize
  14697. @section erosion_opencl
  14698. Apply erosion effect to the video.
  14699. This filter replaces the pixel by the local(3x3) minimum.
  14700. It accepts the following options:
  14701. @table @option
  14702. @item threshold0
  14703. @item threshold1
  14704. @item threshold2
  14705. @item threshold3
  14706. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14707. If @code{0}, plane will remain unchanged.
  14708. @item coordinates
  14709. Flag which specifies the pixel to refer to.
  14710. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14711. Flags to local 3x3 coordinates region centered on @code{x}:
  14712. 1 2 3
  14713. 4 x 5
  14714. 6 7 8
  14715. @end table
  14716. @subsection Example
  14717. @itemize
  14718. @item
  14719. 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.
  14720. @example
  14721. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14722. @end example
  14723. @end itemize
  14724. @section colorkey_opencl
  14725. RGB colorspace color keying.
  14726. The filter accepts the following options:
  14727. @table @option
  14728. @item color
  14729. The color which will be replaced with transparency.
  14730. @item similarity
  14731. Similarity percentage with the key color.
  14732. 0.01 matches only the exact key color, while 1.0 matches everything.
  14733. @item blend
  14734. Blend percentage.
  14735. 0.0 makes pixels either fully transparent, or not transparent at all.
  14736. Higher values result in semi-transparent pixels, with a higher transparency
  14737. the more similar the pixels color is to the key color.
  14738. @end table
  14739. @subsection Examples
  14740. @itemize
  14741. @item
  14742. Make every semi-green pixel in the input transparent with some slight blending:
  14743. @example
  14744. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  14745. @end example
  14746. @end itemize
  14747. @section nlmeans_opencl
  14748. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  14749. @section overlay_opencl
  14750. Overlay one video on top of another.
  14751. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14752. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14753. The filter accepts the following options:
  14754. @table @option
  14755. @item x
  14756. Set the x coordinate of the overlaid video on the main video.
  14757. Default value is @code{0}.
  14758. @item y
  14759. Set the x coordinate of the overlaid video on the main video.
  14760. Default value is @code{0}.
  14761. @end table
  14762. @subsection Examples
  14763. @itemize
  14764. @item
  14765. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14766. @example
  14767. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14768. @end example
  14769. @item
  14770. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14771. @example
  14772. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14773. @end example
  14774. @end itemize
  14775. @section prewitt_opencl
  14776. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14777. The filter accepts the following option:
  14778. @table @option
  14779. @item planes
  14780. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14781. @item scale
  14782. Set value which will be multiplied with filtered result.
  14783. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14784. @item delta
  14785. Set value which will be added to filtered result.
  14786. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14787. @end table
  14788. @subsection Example
  14789. @itemize
  14790. @item
  14791. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14792. @example
  14793. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14794. @end example
  14795. @end itemize
  14796. @section roberts_opencl
  14797. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14798. The filter accepts the following option:
  14799. @table @option
  14800. @item planes
  14801. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14802. @item scale
  14803. Set value which will be multiplied with filtered result.
  14804. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14805. @item delta
  14806. Set value which will be added to filtered result.
  14807. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14808. @end table
  14809. @subsection Example
  14810. @itemize
  14811. @item
  14812. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14813. @example
  14814. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14815. @end example
  14816. @end itemize
  14817. @section sobel_opencl
  14818. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14819. The filter accepts the following option:
  14820. @table @option
  14821. @item planes
  14822. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14823. @item scale
  14824. Set value which will be multiplied with filtered result.
  14825. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14826. @item delta
  14827. Set value which will be added to filtered result.
  14828. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14829. @end table
  14830. @subsection Example
  14831. @itemize
  14832. @item
  14833. Apply sobel operator with scale set to 2 and delta set to 10
  14834. @example
  14835. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14836. @end example
  14837. @end itemize
  14838. @section tonemap_opencl
  14839. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14840. It accepts the following parameters:
  14841. @table @option
  14842. @item tonemap
  14843. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14844. @item param
  14845. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14846. @item desat
  14847. Apply desaturation for highlights that exceed this level of brightness. The
  14848. higher the parameter, the more color information will be preserved. This
  14849. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14850. (smoothly) turning into white instead. This makes images feel more natural,
  14851. at the cost of reducing information about out-of-range colors.
  14852. The default value is 0.5, and the algorithm here is a little different from
  14853. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14854. @item threshold
  14855. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14856. is used to detect whether the scene has changed or not. If the distance between
  14857. the current frame average brightness and the current running average exceeds
  14858. a threshold value, we would re-calculate scene average and peak brightness.
  14859. The default value is 0.2.
  14860. @item format
  14861. Specify the output pixel format.
  14862. Currently supported formats are:
  14863. @table @var
  14864. @item p010
  14865. @item nv12
  14866. @end table
  14867. @item range, r
  14868. Set the output color range.
  14869. Possible values are:
  14870. @table @var
  14871. @item tv/mpeg
  14872. @item pc/jpeg
  14873. @end table
  14874. Default is same as input.
  14875. @item primaries, p
  14876. Set the output color primaries.
  14877. Possible values are:
  14878. @table @var
  14879. @item bt709
  14880. @item bt2020
  14881. @end table
  14882. Default is same as input.
  14883. @item transfer, t
  14884. Set the output transfer characteristics.
  14885. Possible values are:
  14886. @table @var
  14887. @item bt709
  14888. @item bt2020
  14889. @end table
  14890. Default is bt709.
  14891. @item matrix, m
  14892. Set the output colorspace matrix.
  14893. Possible value are:
  14894. @table @var
  14895. @item bt709
  14896. @item bt2020
  14897. @end table
  14898. Default is same as input.
  14899. @end table
  14900. @subsection Example
  14901. @itemize
  14902. @item
  14903. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14904. @example
  14905. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14906. @end example
  14907. @end itemize
  14908. @section unsharp_opencl
  14909. Sharpen or blur the input video.
  14910. It accepts the following parameters:
  14911. @table @option
  14912. @item luma_msize_x, lx
  14913. Set the luma matrix horizontal size.
  14914. Range is @code{[1, 23]} and default value is @code{5}.
  14915. @item luma_msize_y, ly
  14916. Set the luma matrix vertical size.
  14917. Range is @code{[1, 23]} and default value is @code{5}.
  14918. @item luma_amount, la
  14919. Set the luma effect strength.
  14920. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14921. Negative values will blur the input video, while positive values will
  14922. sharpen it, a value of zero will disable the effect.
  14923. @item chroma_msize_x, cx
  14924. Set the chroma matrix horizontal size.
  14925. Range is @code{[1, 23]} and default value is @code{5}.
  14926. @item chroma_msize_y, cy
  14927. Set the chroma matrix vertical size.
  14928. Range is @code{[1, 23]} and default value is @code{5}.
  14929. @item chroma_amount, ca
  14930. Set the chroma effect strength.
  14931. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14932. Negative values will blur the input video, while positive values will
  14933. sharpen it, a value of zero will disable the effect.
  14934. @end table
  14935. All parameters are optional and default to the equivalent of the
  14936. string '5:5:1.0:5:5:0.0'.
  14937. @subsection Examples
  14938. @itemize
  14939. @item
  14940. Apply strong luma sharpen effect:
  14941. @example
  14942. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14943. @end example
  14944. @item
  14945. Apply a strong blur of both luma and chroma parameters:
  14946. @example
  14947. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14948. @end example
  14949. @end itemize
  14950. @c man end OPENCL VIDEO FILTERS
  14951. @chapter Video Sources
  14952. @c man begin VIDEO SOURCES
  14953. Below is a description of the currently available video sources.
  14954. @section buffer
  14955. Buffer video frames, and make them available to the filter chain.
  14956. This source is mainly intended for a programmatic use, in particular
  14957. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14958. It accepts the following parameters:
  14959. @table @option
  14960. @item video_size
  14961. Specify the size (width and height) of the buffered video frames. For the
  14962. syntax of this option, check the
  14963. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14964. @item width
  14965. The input video width.
  14966. @item height
  14967. The input video height.
  14968. @item pix_fmt
  14969. A string representing the pixel format of the buffered video frames.
  14970. It may be a number corresponding to a pixel format, or a pixel format
  14971. name.
  14972. @item time_base
  14973. Specify the timebase assumed by the timestamps of the buffered frames.
  14974. @item frame_rate
  14975. Specify the frame rate expected for the video stream.
  14976. @item pixel_aspect, sar
  14977. The sample (pixel) aspect ratio of the input video.
  14978. @item sws_param
  14979. Specify the optional parameters to be used for the scale filter which
  14980. is automatically inserted when an input change is detected in the
  14981. input size or format.
  14982. @item hw_frames_ctx
  14983. When using a hardware pixel format, this should be a reference to an
  14984. AVHWFramesContext describing input frames.
  14985. @end table
  14986. For example:
  14987. @example
  14988. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14989. @end example
  14990. will instruct the source to accept video frames with size 320x240 and
  14991. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14992. square pixels (1:1 sample aspect ratio).
  14993. Since the pixel format with name "yuv410p" corresponds to the number 6
  14994. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14995. this example corresponds to:
  14996. @example
  14997. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14998. @end example
  14999. Alternatively, the options can be specified as a flat string, but this
  15000. syntax is deprecated:
  15001. @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}]
  15002. @section cellauto
  15003. Create a pattern generated by an elementary cellular automaton.
  15004. The initial state of the cellular automaton can be defined through the
  15005. @option{filename} and @option{pattern} options. If such options are
  15006. not specified an initial state is created randomly.
  15007. At each new frame a new row in the video is filled with the result of
  15008. the cellular automaton next generation. The behavior when the whole
  15009. frame is filled is defined by the @option{scroll} option.
  15010. This source accepts the following options:
  15011. @table @option
  15012. @item filename, f
  15013. Read the initial cellular automaton state, i.e. the starting row, from
  15014. the specified file.
  15015. In the file, each non-whitespace character is considered an alive
  15016. cell, a newline will terminate the row, and further characters in the
  15017. file will be ignored.
  15018. @item pattern, p
  15019. Read the initial cellular automaton state, i.e. the starting row, from
  15020. the specified string.
  15021. Each non-whitespace character in the string is considered an alive
  15022. cell, a newline will terminate the row, and further characters in the
  15023. string will be ignored.
  15024. @item rate, r
  15025. Set the video rate, that is the number of frames generated per second.
  15026. Default is 25.
  15027. @item random_fill_ratio, ratio
  15028. Set the random fill ratio for the initial cellular automaton row. It
  15029. is a floating point number value ranging from 0 to 1, defaults to
  15030. 1/PHI.
  15031. This option is ignored when a file or a pattern is specified.
  15032. @item random_seed, seed
  15033. Set the seed for filling randomly the initial row, must be an integer
  15034. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15035. set to -1, the filter will try to use a good random seed on a best
  15036. effort basis.
  15037. @item rule
  15038. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15039. Default value is 110.
  15040. @item size, s
  15041. Set the size of the output video. For the syntax of this option, check the
  15042. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15043. If @option{filename} or @option{pattern} is specified, the size is set
  15044. by default to the width of the specified initial state row, and the
  15045. height is set to @var{width} * PHI.
  15046. If @option{size} is set, it must contain the width of the specified
  15047. pattern string, and the specified pattern will be centered in the
  15048. larger row.
  15049. If a filename or a pattern string is not specified, the size value
  15050. defaults to "320x518" (used for a randomly generated initial state).
  15051. @item scroll
  15052. If set to 1, scroll the output upward when all the rows in the output
  15053. have been already filled. If set to 0, the new generated row will be
  15054. written over the top row just after the bottom row is filled.
  15055. Defaults to 1.
  15056. @item start_full, full
  15057. If set to 1, completely fill the output with generated rows before
  15058. outputting the first frame.
  15059. This is the default behavior, for disabling set the value to 0.
  15060. @item stitch
  15061. If set to 1, stitch the left and right row edges together.
  15062. This is the default behavior, for disabling set the value to 0.
  15063. @end table
  15064. @subsection Examples
  15065. @itemize
  15066. @item
  15067. Read the initial state from @file{pattern}, and specify an output of
  15068. size 200x400.
  15069. @example
  15070. cellauto=f=pattern:s=200x400
  15071. @end example
  15072. @item
  15073. Generate a random initial row with a width of 200 cells, with a fill
  15074. ratio of 2/3:
  15075. @example
  15076. cellauto=ratio=2/3:s=200x200
  15077. @end example
  15078. @item
  15079. Create a pattern generated by rule 18 starting by a single alive cell
  15080. centered on an initial row with width 100:
  15081. @example
  15082. cellauto=p=@@:s=100x400:full=0:rule=18
  15083. @end example
  15084. @item
  15085. Specify a more elaborated initial pattern:
  15086. @example
  15087. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15088. @end example
  15089. @end itemize
  15090. @anchor{coreimagesrc}
  15091. @section coreimagesrc
  15092. Video source generated on GPU using Apple's CoreImage API on OSX.
  15093. This video source is a specialized version of the @ref{coreimage} video filter.
  15094. Use a core image generator at the beginning of the applied filterchain to
  15095. generate the content.
  15096. The coreimagesrc video source accepts the following options:
  15097. @table @option
  15098. @item list_generators
  15099. List all available generators along with all their respective options as well as
  15100. possible minimum and maximum values along with the default values.
  15101. @example
  15102. list_generators=true
  15103. @end example
  15104. @item size, s
  15105. Specify the size of the sourced video. For the syntax of this option, check the
  15106. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15107. The default value is @code{320x240}.
  15108. @item rate, r
  15109. Specify the frame rate of the sourced video, as the number of frames
  15110. generated per second. It has to be a string in the format
  15111. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15112. number or a valid video frame rate abbreviation. The default value is
  15113. "25".
  15114. @item sar
  15115. Set the sample aspect ratio of the sourced video.
  15116. @item duration, d
  15117. Set the duration of the sourced video. See
  15118. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15119. for the accepted syntax.
  15120. If not specified, or the expressed duration is negative, the video is
  15121. supposed to be generated forever.
  15122. @end table
  15123. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15124. A complete filterchain can be used for further processing of the
  15125. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15126. and examples for details.
  15127. @subsection Examples
  15128. @itemize
  15129. @item
  15130. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15131. given as complete and escaped command-line for Apple's standard bash shell:
  15132. @example
  15133. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15134. @end example
  15135. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15136. need for a nullsrc video source.
  15137. @end itemize
  15138. @section mandelbrot
  15139. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15140. point specified with @var{start_x} and @var{start_y}.
  15141. This source accepts the following options:
  15142. @table @option
  15143. @item end_pts
  15144. Set the terminal pts value. Default value is 400.
  15145. @item end_scale
  15146. Set the terminal scale value.
  15147. Must be a floating point value. Default value is 0.3.
  15148. @item inner
  15149. Set the inner coloring mode, that is the algorithm used to draw the
  15150. Mandelbrot fractal internal region.
  15151. It shall assume one of the following values:
  15152. @table @option
  15153. @item black
  15154. Set black mode.
  15155. @item convergence
  15156. Show time until convergence.
  15157. @item mincol
  15158. Set color based on point closest to the origin of the iterations.
  15159. @item period
  15160. Set period mode.
  15161. @end table
  15162. Default value is @var{mincol}.
  15163. @item bailout
  15164. Set the bailout value. Default value is 10.0.
  15165. @item maxiter
  15166. Set the maximum of iterations performed by the rendering
  15167. algorithm. Default value is 7189.
  15168. @item outer
  15169. Set outer coloring mode.
  15170. It shall assume one of following values:
  15171. @table @option
  15172. @item iteration_count
  15173. Set iteration count mode.
  15174. @item normalized_iteration_count
  15175. set normalized iteration count mode.
  15176. @end table
  15177. Default value is @var{normalized_iteration_count}.
  15178. @item rate, r
  15179. Set frame rate, expressed as number of frames per second. Default
  15180. value is "25".
  15181. @item size, s
  15182. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15183. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15184. @item start_scale
  15185. Set the initial scale value. Default value is 3.0.
  15186. @item start_x
  15187. Set the initial x position. Must be a floating point value between
  15188. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15189. @item start_y
  15190. Set the initial y position. Must be a floating point value between
  15191. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15192. @end table
  15193. @section mptestsrc
  15194. Generate various test patterns, as generated by the MPlayer test filter.
  15195. The size of the generated video is fixed, and is 256x256.
  15196. This source is useful in particular for testing encoding features.
  15197. This source accepts the following options:
  15198. @table @option
  15199. @item rate, r
  15200. Specify the frame rate of the sourced video, as the number of frames
  15201. generated per second. It has to be a string in the format
  15202. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15203. number or a valid video frame rate abbreviation. The default value is
  15204. "25".
  15205. @item duration, d
  15206. Set the duration of the sourced video. See
  15207. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15208. for the accepted syntax.
  15209. If not specified, or the expressed duration is negative, the video is
  15210. supposed to be generated forever.
  15211. @item test, t
  15212. Set the number or the name of the test to perform. Supported tests are:
  15213. @table @option
  15214. @item dc_luma
  15215. @item dc_chroma
  15216. @item freq_luma
  15217. @item freq_chroma
  15218. @item amp_luma
  15219. @item amp_chroma
  15220. @item cbp
  15221. @item mv
  15222. @item ring1
  15223. @item ring2
  15224. @item all
  15225. @end table
  15226. Default value is "all", which will cycle through the list of all tests.
  15227. @end table
  15228. Some examples:
  15229. @example
  15230. mptestsrc=t=dc_luma
  15231. @end example
  15232. will generate a "dc_luma" test pattern.
  15233. @section frei0r_src
  15234. Provide a frei0r source.
  15235. To enable compilation of this filter you need to install the frei0r
  15236. header and configure FFmpeg with @code{--enable-frei0r}.
  15237. This source accepts the following parameters:
  15238. @table @option
  15239. @item size
  15240. The size of the video to generate. For the syntax of this option, check the
  15241. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15242. @item framerate
  15243. The framerate of the generated video. It may be a string of the form
  15244. @var{num}/@var{den} or a frame rate abbreviation.
  15245. @item filter_name
  15246. The name to the frei0r source to load. For more information regarding frei0r and
  15247. how to set the parameters, read the @ref{frei0r} section in the video filters
  15248. documentation.
  15249. @item filter_params
  15250. A '|'-separated list of parameters to pass to the frei0r source.
  15251. @end table
  15252. For example, to generate a frei0r partik0l source with size 200x200
  15253. and frame rate 10 which is overlaid on the overlay filter main input:
  15254. @example
  15255. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15256. @end example
  15257. @section life
  15258. Generate a life pattern.
  15259. This source is based on a generalization of John Conway's life game.
  15260. The sourced input represents a life grid, each pixel represents a cell
  15261. which can be in one of two possible states, alive or dead. Every cell
  15262. interacts with its eight neighbours, which are the cells that are
  15263. horizontally, vertically, or diagonally adjacent.
  15264. At each interaction the grid evolves according to the adopted rule,
  15265. which specifies the number of neighbor alive cells which will make a
  15266. cell stay alive or born. The @option{rule} option allows one to specify
  15267. the rule to adopt.
  15268. This source accepts the following options:
  15269. @table @option
  15270. @item filename, f
  15271. Set the file from which to read the initial grid state. In the file,
  15272. each non-whitespace character is considered an alive cell, and newline
  15273. is used to delimit the end of each row.
  15274. If this option is not specified, the initial grid is generated
  15275. randomly.
  15276. @item rate, r
  15277. Set the video rate, that is the number of frames generated per second.
  15278. Default is 25.
  15279. @item random_fill_ratio, ratio
  15280. Set the random fill ratio for the initial random grid. It is a
  15281. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15282. It is ignored when a file is specified.
  15283. @item random_seed, seed
  15284. Set the seed for filling the initial random grid, must be an integer
  15285. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15286. set to -1, the filter will try to use a good random seed on a best
  15287. effort basis.
  15288. @item rule
  15289. Set the life rule.
  15290. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15291. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15292. @var{NS} specifies the number of alive neighbor cells which make a
  15293. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15294. which make a dead cell to become alive (i.e. to "born").
  15295. "s" and "b" can be used in place of "S" and "B", respectively.
  15296. Alternatively a rule can be specified by an 18-bits integer. The 9
  15297. high order bits are used to encode the next cell state if it is alive
  15298. for each number of neighbor alive cells, the low order bits specify
  15299. the rule for "borning" new cells. Higher order bits encode for an
  15300. higher number of neighbor cells.
  15301. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15302. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15303. Default value is "S23/B3", which is the original Conway's game of life
  15304. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15305. cells, and will born a new cell if there are three alive cells around
  15306. a dead cell.
  15307. @item size, s
  15308. Set the size of the output video. For the syntax of this option, check the
  15309. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15310. If @option{filename} is specified, the size is set by default to the
  15311. same size of the input file. If @option{size} is set, it must contain
  15312. the size specified in the input file, and the initial grid defined in
  15313. that file is centered in the larger resulting area.
  15314. If a filename is not specified, the size value defaults to "320x240"
  15315. (used for a randomly generated initial grid).
  15316. @item stitch
  15317. If set to 1, stitch the left and right grid edges together, and the
  15318. top and bottom edges also. Defaults to 1.
  15319. @item mold
  15320. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15321. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15322. value from 0 to 255.
  15323. @item life_color
  15324. Set the color of living (or new born) cells.
  15325. @item death_color
  15326. Set the color of dead cells. If @option{mold} is set, this is the first color
  15327. used to represent a dead cell.
  15328. @item mold_color
  15329. Set mold color, for definitely dead and moldy cells.
  15330. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15331. ffmpeg-utils manual,ffmpeg-utils}.
  15332. @end table
  15333. @subsection Examples
  15334. @itemize
  15335. @item
  15336. Read a grid from @file{pattern}, and center it on a grid of size
  15337. 300x300 pixels:
  15338. @example
  15339. life=f=pattern:s=300x300
  15340. @end example
  15341. @item
  15342. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15343. @example
  15344. life=ratio=2/3:s=200x200
  15345. @end example
  15346. @item
  15347. Specify a custom rule for evolving a randomly generated grid:
  15348. @example
  15349. life=rule=S14/B34
  15350. @end example
  15351. @item
  15352. Full example with slow death effect (mold) using @command{ffplay}:
  15353. @example
  15354. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15355. @end example
  15356. @end itemize
  15357. @anchor{allrgb}
  15358. @anchor{allyuv}
  15359. @anchor{color}
  15360. @anchor{haldclutsrc}
  15361. @anchor{nullsrc}
  15362. @anchor{pal75bars}
  15363. @anchor{pal100bars}
  15364. @anchor{rgbtestsrc}
  15365. @anchor{smptebars}
  15366. @anchor{smptehdbars}
  15367. @anchor{testsrc}
  15368. @anchor{testsrc2}
  15369. @anchor{yuvtestsrc}
  15370. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15371. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15372. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15373. The @code{color} source provides an uniformly colored input.
  15374. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15375. @ref{haldclut} filter.
  15376. The @code{nullsrc} source returns unprocessed video frames. It is
  15377. mainly useful to be employed in analysis / debugging tools, or as the
  15378. source for filters which ignore the input data.
  15379. The @code{pal75bars} source generates a color bars pattern, based on
  15380. EBU PAL recommendations with 75% color levels.
  15381. The @code{pal100bars} source generates a color bars pattern, based on
  15382. EBU PAL recommendations with 100% color levels.
  15383. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15384. detecting RGB vs BGR issues. You should see a red, green and blue
  15385. stripe from top to bottom.
  15386. The @code{smptebars} source generates a color bars pattern, based on
  15387. the SMPTE Engineering Guideline EG 1-1990.
  15388. The @code{smptehdbars} source generates a color bars pattern, based on
  15389. the SMPTE RP 219-2002.
  15390. The @code{testsrc} source generates a test video pattern, showing a
  15391. color pattern, a scrolling gradient and a timestamp. This is mainly
  15392. intended for testing purposes.
  15393. The @code{testsrc2} source is similar to testsrc, but supports more
  15394. pixel formats instead of just @code{rgb24}. This allows using it as an
  15395. input for other tests without requiring a format conversion.
  15396. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15397. see a y, cb and cr stripe from top to bottom.
  15398. The sources accept the following parameters:
  15399. @table @option
  15400. @item level
  15401. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15402. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15403. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15404. coded on a @code{1/(N*N)} scale.
  15405. @item color, c
  15406. Specify the color of the source, only available in the @code{color}
  15407. source. For the syntax of this option, check the
  15408. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15409. @item size, s
  15410. Specify the size of the sourced video. For the syntax of this option, check the
  15411. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15412. The default value is @code{320x240}.
  15413. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15414. @code{haldclutsrc} filters.
  15415. @item rate, r
  15416. Specify the frame rate of the sourced video, as the number of frames
  15417. generated per second. It has to be a string in the format
  15418. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15419. number or a valid video frame rate abbreviation. The default value is
  15420. "25".
  15421. @item duration, d
  15422. Set the duration of the sourced video. See
  15423. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15424. for the accepted syntax.
  15425. If not specified, or the expressed duration is negative, the video is
  15426. supposed to be generated forever.
  15427. @item sar
  15428. Set the sample aspect ratio of the sourced video.
  15429. @item alpha
  15430. Specify the alpha (opacity) of the background, only available in the
  15431. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15432. 255 (fully opaque, the default).
  15433. @item decimals, n
  15434. Set the number of decimals to show in the timestamp, only available in the
  15435. @code{testsrc} source.
  15436. The displayed timestamp value will correspond to the original
  15437. timestamp value multiplied by the power of 10 of the specified
  15438. value. Default value is 0.
  15439. @end table
  15440. @subsection Examples
  15441. @itemize
  15442. @item
  15443. Generate a video with a duration of 5.3 seconds, with size
  15444. 176x144 and a frame rate of 10 frames per second:
  15445. @example
  15446. testsrc=duration=5.3:size=qcif:rate=10
  15447. @end example
  15448. @item
  15449. The following graph description will generate a red source
  15450. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15451. frames per second:
  15452. @example
  15453. color=c=red@@0.2:s=qcif:r=10
  15454. @end example
  15455. @item
  15456. If the input content is to be ignored, @code{nullsrc} can be used. The
  15457. following command generates noise in the luminance plane by employing
  15458. the @code{geq} filter:
  15459. @example
  15460. nullsrc=s=256x256, geq=random(1)*255:128:128
  15461. @end example
  15462. @end itemize
  15463. @subsection Commands
  15464. The @code{color} source supports the following commands:
  15465. @table @option
  15466. @item c, color
  15467. Set the color of the created image. Accepts the same syntax of the
  15468. corresponding @option{color} option.
  15469. @end table
  15470. @section openclsrc
  15471. Generate video using an OpenCL program.
  15472. @table @option
  15473. @item source
  15474. OpenCL program source file.
  15475. @item kernel
  15476. Kernel name in program.
  15477. @item size, s
  15478. Size of frames to generate. This must be set.
  15479. @item format
  15480. Pixel format to use for the generated frames. This must be set.
  15481. @item rate, r
  15482. Number of frames generated every second. Default value is '25'.
  15483. @end table
  15484. For details of how the program loading works, see the @ref{program_opencl}
  15485. filter.
  15486. Example programs:
  15487. @itemize
  15488. @item
  15489. Generate a colour ramp by setting pixel values from the position of the pixel
  15490. in the output image. (Note that this will work with all pixel formats, but
  15491. the generated output will not be the same.)
  15492. @verbatim
  15493. __kernel void ramp(__write_only image2d_t dst,
  15494. unsigned int index)
  15495. {
  15496. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15497. float4 val;
  15498. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15499. write_imagef(dst, loc, val);
  15500. }
  15501. @end verbatim
  15502. @item
  15503. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15504. @verbatim
  15505. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15506. unsigned int index)
  15507. {
  15508. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15509. float4 value = 0.0f;
  15510. int x = loc.x + index;
  15511. int y = loc.y + index;
  15512. while (x > 0 || y > 0) {
  15513. if (x % 3 == 1 && y % 3 == 1) {
  15514. value = 1.0f;
  15515. break;
  15516. }
  15517. x /= 3;
  15518. y /= 3;
  15519. }
  15520. write_imagef(dst, loc, value);
  15521. }
  15522. @end verbatim
  15523. @end itemize
  15524. @c man end VIDEO SOURCES
  15525. @chapter Video Sinks
  15526. @c man begin VIDEO SINKS
  15527. Below is a description of the currently available video sinks.
  15528. @section buffersink
  15529. Buffer video frames, and make them available to the end of the filter
  15530. graph.
  15531. This sink is mainly intended for programmatic use, in particular
  15532. through the interface defined in @file{libavfilter/buffersink.h}
  15533. or the options system.
  15534. It accepts a pointer to an AVBufferSinkContext structure, which
  15535. defines the incoming buffers' formats, to be passed as the opaque
  15536. parameter to @code{avfilter_init_filter} for initialization.
  15537. @section nullsink
  15538. Null video sink: do absolutely nothing with the input video. It is
  15539. mainly useful as a template and for use in analysis / debugging
  15540. tools.
  15541. @c man end VIDEO SINKS
  15542. @chapter Multimedia Filters
  15543. @c man begin MULTIMEDIA FILTERS
  15544. Below is a description of the currently available multimedia filters.
  15545. @section abitscope
  15546. Convert input audio to a video output, displaying the audio bit scope.
  15547. The filter accepts the following options:
  15548. @table @option
  15549. @item rate, r
  15550. Set frame rate, expressed as number of frames per second. Default
  15551. value is "25".
  15552. @item size, s
  15553. Specify the video size for the output. For the syntax of this option, check the
  15554. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15555. Default value is @code{1024x256}.
  15556. @item colors
  15557. Specify list of colors separated by space or by '|' which will be used to
  15558. draw channels. Unrecognized or missing colors will be replaced
  15559. by white color.
  15560. @end table
  15561. @section ahistogram
  15562. Convert input audio to a video output, displaying the volume histogram.
  15563. The filter accepts the following options:
  15564. @table @option
  15565. @item dmode
  15566. Specify how histogram is calculated.
  15567. It accepts the following values:
  15568. @table @samp
  15569. @item single
  15570. Use single histogram for all channels.
  15571. @item separate
  15572. Use separate histogram for each channel.
  15573. @end table
  15574. Default is @code{single}.
  15575. @item rate, r
  15576. Set frame rate, expressed as number of frames per second. Default
  15577. value is "25".
  15578. @item size, s
  15579. Specify the video size for the output. For the syntax of this option, check the
  15580. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15581. Default value is @code{hd720}.
  15582. @item scale
  15583. Set display scale.
  15584. It accepts the following values:
  15585. @table @samp
  15586. @item log
  15587. logarithmic
  15588. @item sqrt
  15589. square root
  15590. @item cbrt
  15591. cubic root
  15592. @item lin
  15593. linear
  15594. @item rlog
  15595. reverse logarithmic
  15596. @end table
  15597. Default is @code{log}.
  15598. @item ascale
  15599. Set amplitude scale.
  15600. It accepts the following values:
  15601. @table @samp
  15602. @item log
  15603. logarithmic
  15604. @item lin
  15605. linear
  15606. @end table
  15607. Default is @code{log}.
  15608. @item acount
  15609. Set how much frames to accumulate in histogram.
  15610. Default is 1. Setting this to -1 accumulates all frames.
  15611. @item rheight
  15612. Set histogram ratio of window height.
  15613. @item slide
  15614. Set sonogram sliding.
  15615. It accepts the following values:
  15616. @table @samp
  15617. @item replace
  15618. replace old rows with new ones.
  15619. @item scroll
  15620. scroll from top to bottom.
  15621. @end table
  15622. Default is @code{replace}.
  15623. @end table
  15624. @section aphasemeter
  15625. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15626. representing mean phase of current audio frame. A video output can also be produced and is
  15627. enabled by default. The audio is passed through as first output.
  15628. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15629. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15630. and @code{1} means channels are in phase.
  15631. The filter accepts the following options, all related to its video output:
  15632. @table @option
  15633. @item rate, r
  15634. Set the output frame rate. Default value is @code{25}.
  15635. @item size, s
  15636. Set the video size for the output. For the syntax of this option, check the
  15637. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15638. Default value is @code{800x400}.
  15639. @item rc
  15640. @item gc
  15641. @item bc
  15642. Specify the red, green, blue contrast. Default values are @code{2},
  15643. @code{7} and @code{1}.
  15644. Allowed range is @code{[0, 255]}.
  15645. @item mpc
  15646. Set color which will be used for drawing median phase. If color is
  15647. @code{none} which is default, no median phase value will be drawn.
  15648. @item video
  15649. Enable video output. Default is enabled.
  15650. @end table
  15651. @section avectorscope
  15652. Convert input audio to a video output, representing the audio vector
  15653. scope.
  15654. The filter is used to measure the difference between channels of stereo
  15655. audio stream. A monoaural signal, consisting of identical left and right
  15656. signal, results in straight vertical line. Any stereo separation is visible
  15657. as a deviation from this line, creating a Lissajous figure.
  15658. If the straight (or deviation from it) but horizontal line appears this
  15659. indicates that the left and right channels are out of phase.
  15660. The filter accepts the following options:
  15661. @table @option
  15662. @item mode, m
  15663. Set the vectorscope mode.
  15664. Available values are:
  15665. @table @samp
  15666. @item lissajous
  15667. Lissajous rotated by 45 degrees.
  15668. @item lissajous_xy
  15669. Same as above but not rotated.
  15670. @item polar
  15671. Shape resembling half of circle.
  15672. @end table
  15673. Default value is @samp{lissajous}.
  15674. @item size, s
  15675. Set the video size for the output. For the syntax of this option, check the
  15676. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15677. Default value is @code{400x400}.
  15678. @item rate, r
  15679. Set the output frame rate. Default value is @code{25}.
  15680. @item rc
  15681. @item gc
  15682. @item bc
  15683. @item ac
  15684. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15685. @code{160}, @code{80} and @code{255}.
  15686. Allowed range is @code{[0, 255]}.
  15687. @item rf
  15688. @item gf
  15689. @item bf
  15690. @item af
  15691. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15692. @code{10}, @code{5} and @code{5}.
  15693. Allowed range is @code{[0, 255]}.
  15694. @item zoom
  15695. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15696. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15697. @item draw
  15698. Set the vectorscope drawing mode.
  15699. Available values are:
  15700. @table @samp
  15701. @item dot
  15702. Draw dot for each sample.
  15703. @item line
  15704. Draw line between previous and current sample.
  15705. @end table
  15706. Default value is @samp{dot}.
  15707. @item scale
  15708. Specify amplitude scale of audio samples.
  15709. Available values are:
  15710. @table @samp
  15711. @item lin
  15712. Linear.
  15713. @item sqrt
  15714. Square root.
  15715. @item cbrt
  15716. Cubic root.
  15717. @item log
  15718. Logarithmic.
  15719. @end table
  15720. @item swap
  15721. Swap left channel axis with right channel axis.
  15722. @item mirror
  15723. Mirror axis.
  15724. @table @samp
  15725. @item none
  15726. No mirror.
  15727. @item x
  15728. Mirror only x axis.
  15729. @item y
  15730. Mirror only y axis.
  15731. @item xy
  15732. Mirror both axis.
  15733. @end table
  15734. @end table
  15735. @subsection Examples
  15736. @itemize
  15737. @item
  15738. Complete example using @command{ffplay}:
  15739. @example
  15740. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15741. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15742. @end example
  15743. @end itemize
  15744. @section bench, abench
  15745. Benchmark part of a filtergraph.
  15746. The filter accepts the following options:
  15747. @table @option
  15748. @item action
  15749. Start or stop a timer.
  15750. Available values are:
  15751. @table @samp
  15752. @item start
  15753. Get the current time, set it as frame metadata (using the key
  15754. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15755. @item stop
  15756. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15757. the input frame metadata to get the time difference. Time difference, average,
  15758. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15759. @code{min}) are then printed. The timestamps are expressed in seconds.
  15760. @end table
  15761. @end table
  15762. @subsection Examples
  15763. @itemize
  15764. @item
  15765. Benchmark @ref{selectivecolor} filter:
  15766. @example
  15767. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15768. @end example
  15769. @end itemize
  15770. @section concat
  15771. Concatenate audio and video streams, joining them together one after the
  15772. other.
  15773. The filter works on segments of synchronized video and audio streams. All
  15774. segments must have the same number of streams of each type, and that will
  15775. also be the number of streams at output.
  15776. The filter accepts the following options:
  15777. @table @option
  15778. @item n
  15779. Set the number of segments. Default is 2.
  15780. @item v
  15781. Set the number of output video streams, that is also the number of video
  15782. streams in each segment. Default is 1.
  15783. @item a
  15784. Set the number of output audio streams, that is also the number of audio
  15785. streams in each segment. Default is 0.
  15786. @item unsafe
  15787. Activate unsafe mode: do not fail if segments have a different format.
  15788. @end table
  15789. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15790. @var{a} audio outputs.
  15791. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15792. segment, in the same order as the outputs, then the inputs for the second
  15793. segment, etc.
  15794. Related streams do not always have exactly the same duration, for various
  15795. reasons including codec frame size or sloppy authoring. For that reason,
  15796. related synchronized streams (e.g. a video and its audio track) should be
  15797. concatenated at once. The concat filter will use the duration of the longest
  15798. stream in each segment (except the last one), and if necessary pad shorter
  15799. audio streams with silence.
  15800. For this filter to work correctly, all segments must start at timestamp 0.
  15801. All corresponding streams must have the same parameters in all segments; the
  15802. filtering system will automatically select a common pixel format for video
  15803. streams, and a common sample format, sample rate and channel layout for
  15804. audio streams, but other settings, such as resolution, must be converted
  15805. explicitly by the user.
  15806. Different frame rates are acceptable but will result in variable frame rate
  15807. at output; be sure to configure the output file to handle it.
  15808. @subsection Examples
  15809. @itemize
  15810. @item
  15811. Concatenate an opening, an episode and an ending, all in bilingual version
  15812. (video in stream 0, audio in streams 1 and 2):
  15813. @example
  15814. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15815. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15816. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15817. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15818. @end example
  15819. @item
  15820. Concatenate two parts, handling audio and video separately, using the
  15821. (a)movie sources, and adjusting the resolution:
  15822. @example
  15823. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15824. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15825. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15826. @end example
  15827. Note that a desync will happen at the stitch if the audio and video streams
  15828. do not have exactly the same duration in the first file.
  15829. @end itemize
  15830. @subsection Commands
  15831. This filter supports the following commands:
  15832. @table @option
  15833. @item next
  15834. Close the current segment and step to the next one
  15835. @end table
  15836. @section drawgraph, adrawgraph
  15837. Draw a graph using input video or audio metadata.
  15838. It accepts the following parameters:
  15839. @table @option
  15840. @item m1
  15841. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15842. @item fg1
  15843. Set 1st foreground color expression.
  15844. @item m2
  15845. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15846. @item fg2
  15847. Set 2nd foreground color expression.
  15848. @item m3
  15849. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15850. @item fg3
  15851. Set 3rd foreground color expression.
  15852. @item m4
  15853. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15854. @item fg4
  15855. Set 4th foreground color expression.
  15856. @item min
  15857. Set minimal value of metadata value.
  15858. @item max
  15859. Set maximal value of metadata value.
  15860. @item bg
  15861. Set graph background color. Default is white.
  15862. @item mode
  15863. Set graph mode.
  15864. Available values for mode is:
  15865. @table @samp
  15866. @item bar
  15867. @item dot
  15868. @item line
  15869. @end table
  15870. Default is @code{line}.
  15871. @item slide
  15872. Set slide mode.
  15873. Available values for slide is:
  15874. @table @samp
  15875. @item frame
  15876. Draw new frame when right border is reached.
  15877. @item replace
  15878. Replace old columns with new ones.
  15879. @item scroll
  15880. Scroll from right to left.
  15881. @item rscroll
  15882. Scroll from left to right.
  15883. @item picture
  15884. Draw single picture.
  15885. @end table
  15886. Default is @code{frame}.
  15887. @item size
  15888. Set size of graph video. For the syntax of this option, check the
  15889. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15890. The default value is @code{900x256}.
  15891. The foreground color expressions can use the following variables:
  15892. @table @option
  15893. @item MIN
  15894. Minimal value of metadata value.
  15895. @item MAX
  15896. Maximal value of metadata value.
  15897. @item VAL
  15898. Current metadata key value.
  15899. @end table
  15900. The color is defined as 0xAABBGGRR.
  15901. @end table
  15902. Example using metadata from @ref{signalstats} filter:
  15903. @example
  15904. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15905. @end example
  15906. Example using metadata from @ref{ebur128} filter:
  15907. @example
  15908. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15909. @end example
  15910. @anchor{ebur128}
  15911. @section ebur128
  15912. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  15913. level. By default, it logs a message at a frequency of 10Hz with the
  15914. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15915. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15916. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  15917. sample format is double-precision floating point. The input stream will be converted to
  15918. this specification, if needed. Users may need to insert aformat and/or aresample filters
  15919. after this filter to obtain the original parameters.
  15920. The filter also has a video output (see the @var{video} option) with a real
  15921. time graph to observe the loudness evolution. The graphic contains the logged
  15922. message mentioned above, so it is not printed anymore when this option is set,
  15923. unless the verbose logging is set. The main graphing area contains the
  15924. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15925. the momentary loudness (400 milliseconds), but can optionally be configured
  15926. to instead display short-term loudness (see @var{gauge}).
  15927. The green area marks a +/- 1LU target range around the target loudness
  15928. (-23LUFS by default, unless modified through @var{target}).
  15929. More information about the Loudness Recommendation EBU R128 on
  15930. @url{http://tech.ebu.ch/loudness}.
  15931. The filter accepts the following options:
  15932. @table @option
  15933. @item video
  15934. Activate the video output. The audio stream is passed unchanged whether this
  15935. option is set or no. The video stream will be the first output stream if
  15936. activated. Default is @code{0}.
  15937. @item size
  15938. Set the video size. This option is for video only. For the syntax of this
  15939. option, check the
  15940. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15941. Default and minimum resolution is @code{640x480}.
  15942. @item meter
  15943. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15944. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15945. other integer value between this range is allowed.
  15946. @item metadata
  15947. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15948. into 100ms output frames, each of them containing various loudness information
  15949. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15950. Default is @code{0}.
  15951. @item framelog
  15952. Force the frame logging level.
  15953. Available values are:
  15954. @table @samp
  15955. @item info
  15956. information logging level
  15957. @item verbose
  15958. verbose logging level
  15959. @end table
  15960. By default, the logging level is set to @var{info}. If the @option{video} or
  15961. the @option{metadata} options are set, it switches to @var{verbose}.
  15962. @item peak
  15963. Set peak mode(s).
  15964. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15965. values are:
  15966. @table @samp
  15967. @item none
  15968. Disable any peak mode (default).
  15969. @item sample
  15970. Enable sample-peak mode.
  15971. Simple peak mode looking for the higher sample value. It logs a message
  15972. for sample-peak (identified by @code{SPK}).
  15973. @item true
  15974. Enable true-peak mode.
  15975. If enabled, the peak lookup is done on an over-sampled version of the input
  15976. stream for better peak accuracy. It logs a message for true-peak.
  15977. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15978. This mode requires a build with @code{libswresample}.
  15979. @end table
  15980. @item dualmono
  15981. Treat mono input files as "dual mono". If a mono file is intended for playback
  15982. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15983. If set to @code{true}, this option will compensate for this effect.
  15984. Multi-channel input files are not affected by this option.
  15985. @item panlaw
  15986. Set a specific pan law to be used for the measurement of dual mono files.
  15987. This parameter is optional, and has a default value of -3.01dB.
  15988. @item target
  15989. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15990. This parameter is optional and has a default value of -23LUFS as specified
  15991. by EBU R128. However, material published online may prefer a level of -16LUFS
  15992. (e.g. for use with podcasts or video platforms).
  15993. @item gauge
  15994. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15995. @code{shortterm}. By default the momentary value will be used, but in certain
  15996. scenarios it may be more useful to observe the short term value instead (e.g.
  15997. live mixing).
  15998. @item scale
  15999. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16000. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16001. video output, not the summary or continuous log output.
  16002. @end table
  16003. @subsection Examples
  16004. @itemize
  16005. @item
  16006. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16007. @example
  16008. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16009. @end example
  16010. @item
  16011. Run an analysis with @command{ffmpeg}:
  16012. @example
  16013. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16014. @end example
  16015. @end itemize
  16016. @section interleave, ainterleave
  16017. Temporally interleave frames from several inputs.
  16018. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16019. These filters read frames from several inputs and send the oldest
  16020. queued frame to the output.
  16021. Input streams must have well defined, monotonically increasing frame
  16022. timestamp values.
  16023. In order to submit one frame to output, these filters need to enqueue
  16024. at least one frame for each input, so they cannot work in case one
  16025. input is not yet terminated and will not receive incoming frames.
  16026. For example consider the case when one input is a @code{select} filter
  16027. which always drops input frames. The @code{interleave} filter will keep
  16028. reading from that input, but it will never be able to send new frames
  16029. to output until the input sends an end-of-stream signal.
  16030. Also, depending on inputs synchronization, the filters will drop
  16031. frames in case one input receives more frames than the other ones, and
  16032. the queue is already filled.
  16033. These filters accept the following options:
  16034. @table @option
  16035. @item nb_inputs, n
  16036. Set the number of different inputs, it is 2 by default.
  16037. @end table
  16038. @subsection Examples
  16039. @itemize
  16040. @item
  16041. Interleave frames belonging to different streams using @command{ffmpeg}:
  16042. @example
  16043. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16044. @end example
  16045. @item
  16046. Add flickering blur effect:
  16047. @example
  16048. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16049. @end example
  16050. @end itemize
  16051. @section metadata, ametadata
  16052. Manipulate frame metadata.
  16053. This filter accepts the following options:
  16054. @table @option
  16055. @item mode
  16056. Set mode of operation of the filter.
  16057. Can be one of the following:
  16058. @table @samp
  16059. @item select
  16060. If both @code{value} and @code{key} is set, select frames
  16061. which have such metadata. If only @code{key} is set, select
  16062. every frame that has such key in metadata.
  16063. @item add
  16064. Add new metadata @code{key} and @code{value}. If key is already available
  16065. do nothing.
  16066. @item modify
  16067. Modify value of already present key.
  16068. @item delete
  16069. If @code{value} is set, delete only keys that have such value.
  16070. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16071. the frame.
  16072. @item print
  16073. Print key and its value if metadata was found. If @code{key} is not set print all
  16074. metadata values available in frame.
  16075. @end table
  16076. @item key
  16077. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16078. @item value
  16079. Set metadata value which will be used. This option is mandatory for
  16080. @code{modify} and @code{add} mode.
  16081. @item function
  16082. Which function to use when comparing metadata value and @code{value}.
  16083. Can be one of following:
  16084. @table @samp
  16085. @item same_str
  16086. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16087. @item starts_with
  16088. Values are interpreted as strings, returns true if metadata value starts with
  16089. the @code{value} option string.
  16090. @item less
  16091. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16092. @item equal
  16093. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16094. @item greater
  16095. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16096. @item expr
  16097. Values are interpreted as floats, returns true if expression from option @code{expr}
  16098. evaluates to true.
  16099. @end table
  16100. @item expr
  16101. Set expression which is used when @code{function} is set to @code{expr}.
  16102. The expression is evaluated through the eval API and can contain the following
  16103. constants:
  16104. @table @option
  16105. @item VALUE1
  16106. Float representation of @code{value} from metadata key.
  16107. @item VALUE2
  16108. Float representation of @code{value} as supplied by user in @code{value} option.
  16109. @end table
  16110. @item file
  16111. If specified in @code{print} mode, output is written to the named file. Instead of
  16112. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16113. for standard output. If @code{file} option is not set, output is written to the log
  16114. with AV_LOG_INFO loglevel.
  16115. @end table
  16116. @subsection Examples
  16117. @itemize
  16118. @item
  16119. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16120. between 0 and 1.
  16121. @example
  16122. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16123. @end example
  16124. @item
  16125. Print silencedetect output to file @file{metadata.txt}.
  16126. @example
  16127. silencedetect,ametadata=mode=print:file=metadata.txt
  16128. @end example
  16129. @item
  16130. Direct all metadata to a pipe with file descriptor 4.
  16131. @example
  16132. metadata=mode=print:file='pipe\:4'
  16133. @end example
  16134. @end itemize
  16135. @section perms, aperms
  16136. Set read/write permissions for the output frames.
  16137. These filters are mainly aimed at developers to test direct path in the
  16138. following filter in the filtergraph.
  16139. The filters accept the following options:
  16140. @table @option
  16141. @item mode
  16142. Select the permissions mode.
  16143. It accepts the following values:
  16144. @table @samp
  16145. @item none
  16146. Do nothing. This is the default.
  16147. @item ro
  16148. Set all the output frames read-only.
  16149. @item rw
  16150. Set all the output frames directly writable.
  16151. @item toggle
  16152. Make the frame read-only if writable, and writable if read-only.
  16153. @item random
  16154. Set each output frame read-only or writable randomly.
  16155. @end table
  16156. @item seed
  16157. Set the seed for the @var{random} mode, must be an integer included between
  16158. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16159. @code{-1}, the filter will try to use a good random seed on a best effort
  16160. basis.
  16161. @end table
  16162. Note: in case of auto-inserted filter between the permission filter and the
  16163. following one, the permission might not be received as expected in that
  16164. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16165. perms/aperms filter can avoid this problem.
  16166. @section realtime, arealtime
  16167. Slow down filtering to match real time approximately.
  16168. These filters will pause the filtering for a variable amount of time to
  16169. match the output rate with the input timestamps.
  16170. They are similar to the @option{re} option to @code{ffmpeg}.
  16171. They accept the following options:
  16172. @table @option
  16173. @item limit
  16174. Time limit for the pauses. Any pause longer than that will be considered
  16175. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16176. @item speed
  16177. Speed factor for processing. The value must be a float larger than zero.
  16178. Values larger than 1.0 will result in faster than realtime processing,
  16179. smaller will slow processing down. The @var{limit} is automatically adapted
  16180. accordingly. Default is 1.0.
  16181. A processing speed faster than what is possible without these filters cannot
  16182. be achieved.
  16183. @end table
  16184. @anchor{select}
  16185. @section select, aselect
  16186. Select frames to pass in output.
  16187. This filter accepts the following options:
  16188. @table @option
  16189. @item expr, e
  16190. Set expression, which is evaluated for each input frame.
  16191. If the expression is evaluated to zero, the frame is discarded.
  16192. If the evaluation result is negative or NaN, the frame is sent to the
  16193. first output; otherwise it is sent to the output with index
  16194. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16195. For example a value of @code{1.2} corresponds to the output with index
  16196. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16197. @item outputs, n
  16198. Set the number of outputs. The output to which to send the selected
  16199. frame is based on the result of the evaluation. Default value is 1.
  16200. @end table
  16201. The expression can contain the following constants:
  16202. @table @option
  16203. @item n
  16204. The (sequential) number of the filtered frame, starting from 0.
  16205. @item selected_n
  16206. The (sequential) number of the selected frame, starting from 0.
  16207. @item prev_selected_n
  16208. The sequential number of the last selected frame. It's NAN if undefined.
  16209. @item TB
  16210. The timebase of the input timestamps.
  16211. @item pts
  16212. The PTS (Presentation TimeStamp) of the filtered video frame,
  16213. expressed in @var{TB} units. It's NAN if undefined.
  16214. @item t
  16215. The PTS of the filtered video frame,
  16216. expressed in seconds. It's NAN if undefined.
  16217. @item prev_pts
  16218. The PTS of the previously filtered video frame. It's NAN if undefined.
  16219. @item prev_selected_pts
  16220. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16221. @item prev_selected_t
  16222. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16223. @item start_pts
  16224. The PTS of the first video frame in the video. It's NAN if undefined.
  16225. @item start_t
  16226. The time of the first video frame in the video. It's NAN if undefined.
  16227. @item pict_type @emph{(video only)}
  16228. The type of the filtered frame. It can assume one of the following
  16229. values:
  16230. @table @option
  16231. @item I
  16232. @item P
  16233. @item B
  16234. @item S
  16235. @item SI
  16236. @item SP
  16237. @item BI
  16238. @end table
  16239. @item interlace_type @emph{(video only)}
  16240. The frame interlace type. It can assume one of the following values:
  16241. @table @option
  16242. @item PROGRESSIVE
  16243. The frame is progressive (not interlaced).
  16244. @item TOPFIRST
  16245. The frame is top-field-first.
  16246. @item BOTTOMFIRST
  16247. The frame is bottom-field-first.
  16248. @end table
  16249. @item consumed_sample_n @emph{(audio only)}
  16250. the number of selected samples before the current frame
  16251. @item samples_n @emph{(audio only)}
  16252. the number of samples in the current frame
  16253. @item sample_rate @emph{(audio only)}
  16254. the input sample rate
  16255. @item key
  16256. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16257. @item pos
  16258. the position in the file of the filtered frame, -1 if the information
  16259. is not available (e.g. for synthetic video)
  16260. @item scene @emph{(video only)}
  16261. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16262. probability for the current frame to introduce a new scene, while a higher
  16263. value means the current frame is more likely to be one (see the example below)
  16264. @item concatdec_select
  16265. The concat demuxer can select only part of a concat input file by setting an
  16266. inpoint and an outpoint, but the output packets may not be entirely contained
  16267. in the selected interval. By using this variable, it is possible to skip frames
  16268. generated by the concat demuxer which are not exactly contained in the selected
  16269. interval.
  16270. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16271. and the @var{lavf.concat.duration} packet metadata values which are also
  16272. present in the decoded frames.
  16273. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16274. start_time and either the duration metadata is missing or the frame pts is less
  16275. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16276. missing.
  16277. That basically means that an input frame is selected if its pts is within the
  16278. interval set by the concat demuxer.
  16279. @end table
  16280. The default value of the select expression is "1".
  16281. @subsection Examples
  16282. @itemize
  16283. @item
  16284. Select all frames in input:
  16285. @example
  16286. select
  16287. @end example
  16288. The example above is the same as:
  16289. @example
  16290. select=1
  16291. @end example
  16292. @item
  16293. Skip all frames:
  16294. @example
  16295. select=0
  16296. @end example
  16297. @item
  16298. Select only I-frames:
  16299. @example
  16300. select='eq(pict_type\,I)'
  16301. @end example
  16302. @item
  16303. Select one frame every 100:
  16304. @example
  16305. select='not(mod(n\,100))'
  16306. @end example
  16307. @item
  16308. Select only frames contained in the 10-20 time interval:
  16309. @example
  16310. select=between(t\,10\,20)
  16311. @end example
  16312. @item
  16313. Select only I-frames contained in the 10-20 time interval:
  16314. @example
  16315. select=between(t\,10\,20)*eq(pict_type\,I)
  16316. @end example
  16317. @item
  16318. Select frames with a minimum distance of 10 seconds:
  16319. @example
  16320. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16321. @end example
  16322. @item
  16323. Use aselect to select only audio frames with samples number > 100:
  16324. @example
  16325. aselect='gt(samples_n\,100)'
  16326. @end example
  16327. @item
  16328. Create a mosaic of the first scenes:
  16329. @example
  16330. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16331. @end example
  16332. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16333. choice.
  16334. @item
  16335. Send even and odd frames to separate outputs, and compose them:
  16336. @example
  16337. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16338. @end example
  16339. @item
  16340. Select useful frames from an ffconcat file which is using inpoints and
  16341. outpoints but where the source files are not intra frame only.
  16342. @example
  16343. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16344. @end example
  16345. @end itemize
  16346. @section sendcmd, asendcmd
  16347. Send commands to filters in the filtergraph.
  16348. These filters read commands to be sent to other filters in the
  16349. filtergraph.
  16350. @code{sendcmd} must be inserted between two video filters,
  16351. @code{asendcmd} must be inserted between two audio filters, but apart
  16352. from that they act the same way.
  16353. The specification of commands can be provided in the filter arguments
  16354. with the @var{commands} option, or in a file specified by the
  16355. @var{filename} option.
  16356. These filters accept the following options:
  16357. @table @option
  16358. @item commands, c
  16359. Set the commands to be read and sent to the other filters.
  16360. @item filename, f
  16361. Set the filename of the commands to be read and sent to the other
  16362. filters.
  16363. @end table
  16364. @subsection Commands syntax
  16365. A commands description consists of a sequence of interval
  16366. specifications, comprising a list of commands to be executed when a
  16367. particular event related to that interval occurs. The occurring event
  16368. is typically the current frame time entering or leaving a given time
  16369. interval.
  16370. An interval is specified by the following syntax:
  16371. @example
  16372. @var{START}[-@var{END}] @var{COMMANDS};
  16373. @end example
  16374. The time interval is specified by the @var{START} and @var{END} times.
  16375. @var{END} is optional and defaults to the maximum time.
  16376. The current frame time is considered within the specified interval if
  16377. it is included in the interval [@var{START}, @var{END}), that is when
  16378. the time is greater or equal to @var{START} and is lesser than
  16379. @var{END}.
  16380. @var{COMMANDS} consists of a sequence of one or more command
  16381. specifications, separated by ",", relating to that interval. The
  16382. syntax of a command specification is given by:
  16383. @example
  16384. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16385. @end example
  16386. @var{FLAGS} is optional and specifies the type of events relating to
  16387. the time interval which enable sending the specified command, and must
  16388. be a non-null sequence of identifier flags separated by "+" or "|" and
  16389. enclosed between "[" and "]".
  16390. The following flags are recognized:
  16391. @table @option
  16392. @item enter
  16393. The command is sent when the current frame timestamp enters the
  16394. specified interval. In other words, the command is sent when the
  16395. previous frame timestamp was not in the given interval, and the
  16396. current is.
  16397. @item leave
  16398. The command is sent when the current frame timestamp leaves the
  16399. specified interval. In other words, the command is sent when the
  16400. previous frame timestamp was in the given interval, and the
  16401. current is not.
  16402. @end table
  16403. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16404. assumed.
  16405. @var{TARGET} specifies the target of the command, usually the name of
  16406. the filter class or a specific filter instance name.
  16407. @var{COMMAND} specifies the name of the command for the target filter.
  16408. @var{ARG} is optional and specifies the optional list of argument for
  16409. the given @var{COMMAND}.
  16410. Between one interval specification and another, whitespaces, or
  16411. sequences of characters starting with @code{#} until the end of line,
  16412. are ignored and can be used to annotate comments.
  16413. A simplified BNF description of the commands specification syntax
  16414. follows:
  16415. @example
  16416. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16417. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16418. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16419. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16420. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16421. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16422. @end example
  16423. @subsection Examples
  16424. @itemize
  16425. @item
  16426. Specify audio tempo change at second 4:
  16427. @example
  16428. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16429. @end example
  16430. @item
  16431. Target a specific filter instance:
  16432. @example
  16433. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16434. @end example
  16435. @item
  16436. Specify a list of drawtext and hue commands in a file.
  16437. @example
  16438. # show text in the interval 5-10
  16439. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16440. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16441. # desaturate the image in the interval 15-20
  16442. 15.0-20.0 [enter] hue s 0,
  16443. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16444. [leave] hue s 1,
  16445. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16446. # apply an exponential saturation fade-out effect, starting from time 25
  16447. 25 [enter] hue s exp(25-t)
  16448. @end example
  16449. A filtergraph allowing to read and process the above command list
  16450. stored in a file @file{test.cmd}, can be specified with:
  16451. @example
  16452. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16453. @end example
  16454. @end itemize
  16455. @anchor{setpts}
  16456. @section setpts, asetpts
  16457. Change the PTS (presentation timestamp) of the input frames.
  16458. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16459. This filter accepts the following options:
  16460. @table @option
  16461. @item expr
  16462. The expression which is evaluated for each frame to construct its timestamp.
  16463. @end table
  16464. The expression is evaluated through the eval API and can contain the following
  16465. constants:
  16466. @table @option
  16467. @item FRAME_RATE, FR
  16468. frame rate, only defined for constant frame-rate video
  16469. @item PTS
  16470. The presentation timestamp in input
  16471. @item N
  16472. The count of the input frame for video or the number of consumed samples,
  16473. not including the current frame for audio, starting from 0.
  16474. @item NB_CONSUMED_SAMPLES
  16475. The number of consumed samples, not including the current frame (only
  16476. audio)
  16477. @item NB_SAMPLES, S
  16478. The number of samples in the current frame (only audio)
  16479. @item SAMPLE_RATE, SR
  16480. The audio sample rate.
  16481. @item STARTPTS
  16482. The PTS of the first frame.
  16483. @item STARTT
  16484. the time in seconds of the first frame
  16485. @item INTERLACED
  16486. State whether the current frame is interlaced.
  16487. @item T
  16488. the time in seconds of the current frame
  16489. @item POS
  16490. original position in the file of the frame, or undefined if undefined
  16491. for the current frame
  16492. @item PREV_INPTS
  16493. The previous input PTS.
  16494. @item PREV_INT
  16495. previous input time in seconds
  16496. @item PREV_OUTPTS
  16497. The previous output PTS.
  16498. @item PREV_OUTT
  16499. previous output time in seconds
  16500. @item RTCTIME
  16501. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16502. instead.
  16503. @item RTCSTART
  16504. The wallclock (RTC) time at the start of the movie in microseconds.
  16505. @item TB
  16506. The timebase of the input timestamps.
  16507. @end table
  16508. @subsection Examples
  16509. @itemize
  16510. @item
  16511. Start counting PTS from zero
  16512. @example
  16513. setpts=PTS-STARTPTS
  16514. @end example
  16515. @item
  16516. Apply fast motion effect:
  16517. @example
  16518. setpts=0.5*PTS
  16519. @end example
  16520. @item
  16521. Apply slow motion effect:
  16522. @example
  16523. setpts=2.0*PTS
  16524. @end example
  16525. @item
  16526. Set fixed rate of 25 frames per second:
  16527. @example
  16528. setpts=N/(25*TB)
  16529. @end example
  16530. @item
  16531. Set fixed rate 25 fps with some jitter:
  16532. @example
  16533. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16534. @end example
  16535. @item
  16536. Apply an offset of 10 seconds to the input PTS:
  16537. @example
  16538. setpts=PTS+10/TB
  16539. @end example
  16540. @item
  16541. Generate timestamps from a "live source" and rebase onto the current timebase:
  16542. @example
  16543. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16544. @end example
  16545. @item
  16546. Generate timestamps by counting samples:
  16547. @example
  16548. asetpts=N/SR/TB
  16549. @end example
  16550. @end itemize
  16551. @section setrange
  16552. Force color range for the output video frame.
  16553. The @code{setrange} filter marks the color range property for the
  16554. output frames. It does not change the input frame, but only sets the
  16555. corresponding property, which affects how the frame is treated by
  16556. following filters.
  16557. The filter accepts the following options:
  16558. @table @option
  16559. @item range
  16560. Available values are:
  16561. @table @samp
  16562. @item auto
  16563. Keep the same color range property.
  16564. @item unspecified, unknown
  16565. Set the color range as unspecified.
  16566. @item limited, tv, mpeg
  16567. Set the color range as limited.
  16568. @item full, pc, jpeg
  16569. Set the color range as full.
  16570. @end table
  16571. @end table
  16572. @section settb, asettb
  16573. Set the timebase to use for the output frames timestamps.
  16574. It is mainly useful for testing timebase configuration.
  16575. It accepts the following parameters:
  16576. @table @option
  16577. @item expr, tb
  16578. The expression which is evaluated into the output timebase.
  16579. @end table
  16580. The value for @option{tb} is an arithmetic expression representing a
  16581. rational. The expression can contain the constants "AVTB" (the default
  16582. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16583. audio only). Default value is "intb".
  16584. @subsection Examples
  16585. @itemize
  16586. @item
  16587. Set the timebase to 1/25:
  16588. @example
  16589. settb=expr=1/25
  16590. @end example
  16591. @item
  16592. Set the timebase to 1/10:
  16593. @example
  16594. settb=expr=0.1
  16595. @end example
  16596. @item
  16597. Set the timebase to 1001/1000:
  16598. @example
  16599. settb=1+0.001
  16600. @end example
  16601. @item
  16602. Set the timebase to 2*intb:
  16603. @example
  16604. settb=2*intb
  16605. @end example
  16606. @item
  16607. Set the default timebase value:
  16608. @example
  16609. settb=AVTB
  16610. @end example
  16611. @end itemize
  16612. @section showcqt
  16613. Convert input audio to a video output representing frequency spectrum
  16614. logarithmically using Brown-Puckette constant Q transform algorithm with
  16615. direct frequency domain coefficient calculation (but the transform itself
  16616. is not really constant Q, instead the Q factor is actually variable/clamped),
  16617. with musical tone scale, from E0 to D#10.
  16618. The filter accepts the following options:
  16619. @table @option
  16620. @item size, s
  16621. Specify the video size for the output. It must be even. For the syntax of this option,
  16622. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16623. Default value is @code{1920x1080}.
  16624. @item fps, rate, r
  16625. Set the output frame rate. Default value is @code{25}.
  16626. @item bar_h
  16627. Set the bargraph height. It must be even. Default value is @code{-1} which
  16628. computes the bargraph height automatically.
  16629. @item axis_h
  16630. Set the axis height. It must be even. Default value is @code{-1} which computes
  16631. the axis height automatically.
  16632. @item sono_h
  16633. Set the sonogram height. It must be even. Default value is @code{-1} which
  16634. computes the sonogram height automatically.
  16635. @item fullhd
  16636. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16637. instead. Default value is @code{1}.
  16638. @item sono_v, volume
  16639. Specify the sonogram volume expression. It can contain variables:
  16640. @table @option
  16641. @item bar_v
  16642. the @var{bar_v} evaluated expression
  16643. @item frequency, freq, f
  16644. the frequency where it is evaluated
  16645. @item timeclamp, tc
  16646. the value of @var{timeclamp} option
  16647. @end table
  16648. and functions:
  16649. @table @option
  16650. @item a_weighting(f)
  16651. A-weighting of equal loudness
  16652. @item b_weighting(f)
  16653. B-weighting of equal loudness
  16654. @item c_weighting(f)
  16655. C-weighting of equal loudness.
  16656. @end table
  16657. Default value is @code{16}.
  16658. @item bar_v, volume2
  16659. Specify the bargraph volume expression. It can contain variables:
  16660. @table @option
  16661. @item sono_v
  16662. the @var{sono_v} evaluated expression
  16663. @item frequency, freq, f
  16664. the frequency where it is evaluated
  16665. @item timeclamp, tc
  16666. the value of @var{timeclamp} option
  16667. @end table
  16668. and functions:
  16669. @table @option
  16670. @item a_weighting(f)
  16671. A-weighting of equal loudness
  16672. @item b_weighting(f)
  16673. B-weighting of equal loudness
  16674. @item c_weighting(f)
  16675. C-weighting of equal loudness.
  16676. @end table
  16677. Default value is @code{sono_v}.
  16678. @item sono_g, gamma
  16679. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16680. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16681. Acceptable range is @code{[1, 7]}.
  16682. @item bar_g, gamma2
  16683. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16684. @code{[1, 7]}.
  16685. @item bar_t
  16686. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16687. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16688. @item timeclamp, tc
  16689. Specify the transform timeclamp. At low frequency, there is trade-off between
  16690. accuracy in time domain and frequency domain. If timeclamp is lower,
  16691. event in time domain is represented more accurately (such as fast bass drum),
  16692. otherwise event in frequency domain is represented more accurately
  16693. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16694. @item attack
  16695. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16696. limits future samples by applying asymmetric windowing in time domain, useful
  16697. when low latency is required. Accepted range is @code{[0, 1]}.
  16698. @item basefreq
  16699. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16700. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16701. @item endfreq
  16702. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16703. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16704. @item coeffclamp
  16705. This option is deprecated and ignored.
  16706. @item tlength
  16707. Specify the transform length in time domain. Use this option to control accuracy
  16708. trade-off between time domain and frequency domain at every frequency sample.
  16709. It can contain variables:
  16710. @table @option
  16711. @item frequency, freq, f
  16712. the frequency where it is evaluated
  16713. @item timeclamp, tc
  16714. the value of @var{timeclamp} option.
  16715. @end table
  16716. Default value is @code{384*tc/(384+tc*f)}.
  16717. @item count
  16718. Specify the transform count for every video frame. Default value is @code{6}.
  16719. Acceptable range is @code{[1, 30]}.
  16720. @item fcount
  16721. Specify the transform count for every single pixel. Default value is @code{0},
  16722. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16723. @item fontfile
  16724. Specify font file for use with freetype to draw the axis. If not specified,
  16725. use embedded font. Note that drawing with font file or embedded font is not
  16726. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16727. option instead.
  16728. @item font
  16729. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16730. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16731. @item fontcolor
  16732. Specify font color expression. This is arithmetic expression that should return
  16733. integer value 0xRRGGBB. It can contain variables:
  16734. @table @option
  16735. @item frequency, freq, f
  16736. the frequency where it is evaluated
  16737. @item timeclamp, tc
  16738. the value of @var{timeclamp} option
  16739. @end table
  16740. and functions:
  16741. @table @option
  16742. @item midi(f)
  16743. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16744. @item r(x), g(x), b(x)
  16745. red, green, and blue value of intensity x.
  16746. @end table
  16747. Default value is @code{st(0, (midi(f)-59.5)/12);
  16748. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16749. r(1-ld(1)) + b(ld(1))}.
  16750. @item axisfile
  16751. Specify image file to draw the axis. This option override @var{fontfile} and
  16752. @var{fontcolor} option.
  16753. @item axis, text
  16754. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16755. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16756. Default value is @code{1}.
  16757. @item csp
  16758. Set colorspace. The accepted values are:
  16759. @table @samp
  16760. @item unspecified
  16761. Unspecified (default)
  16762. @item bt709
  16763. BT.709
  16764. @item fcc
  16765. FCC
  16766. @item bt470bg
  16767. BT.470BG or BT.601-6 625
  16768. @item smpte170m
  16769. SMPTE-170M or BT.601-6 525
  16770. @item smpte240m
  16771. SMPTE-240M
  16772. @item bt2020ncl
  16773. BT.2020 with non-constant luminance
  16774. @end table
  16775. @item cscheme
  16776. Set spectrogram color scheme. This is list of floating point values with format
  16777. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16778. The default is @code{1|0.5|0|0|0.5|1}.
  16779. @end table
  16780. @subsection Examples
  16781. @itemize
  16782. @item
  16783. Playing audio while showing the spectrum:
  16784. @example
  16785. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16786. @end example
  16787. @item
  16788. Same as above, but with frame rate 30 fps:
  16789. @example
  16790. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16791. @end example
  16792. @item
  16793. Playing at 1280x720:
  16794. @example
  16795. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16796. @end example
  16797. @item
  16798. Disable sonogram display:
  16799. @example
  16800. sono_h=0
  16801. @end example
  16802. @item
  16803. A1 and its harmonics: A1, A2, (near)E3, A3:
  16804. @example
  16805. 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),
  16806. asplit[a][out1]; [a] showcqt [out0]'
  16807. @end example
  16808. @item
  16809. Same as above, but with more accuracy in frequency domain:
  16810. @example
  16811. 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),
  16812. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16813. @end example
  16814. @item
  16815. Custom volume:
  16816. @example
  16817. bar_v=10:sono_v=bar_v*a_weighting(f)
  16818. @end example
  16819. @item
  16820. Custom gamma, now spectrum is linear to the amplitude.
  16821. @example
  16822. bar_g=2:sono_g=2
  16823. @end example
  16824. @item
  16825. Custom tlength equation:
  16826. @example
  16827. 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)))'
  16828. @end example
  16829. @item
  16830. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16831. @example
  16832. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16833. @end example
  16834. @item
  16835. Custom font using fontconfig:
  16836. @example
  16837. font='Courier New,Monospace,mono|bold'
  16838. @end example
  16839. @item
  16840. Custom frequency range with custom axis using image file:
  16841. @example
  16842. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16843. @end example
  16844. @end itemize
  16845. @section showfreqs
  16846. Convert input audio to video output representing the audio power spectrum.
  16847. Audio amplitude is on Y-axis while frequency is on X-axis.
  16848. The filter accepts the following options:
  16849. @table @option
  16850. @item size, s
  16851. Specify size of video. For the syntax of this option, check the
  16852. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16853. Default is @code{1024x512}.
  16854. @item mode
  16855. Set display mode.
  16856. This set how each frequency bin will be represented.
  16857. It accepts the following values:
  16858. @table @samp
  16859. @item line
  16860. @item bar
  16861. @item dot
  16862. @end table
  16863. Default is @code{bar}.
  16864. @item ascale
  16865. Set amplitude scale.
  16866. It accepts the following values:
  16867. @table @samp
  16868. @item lin
  16869. Linear scale.
  16870. @item sqrt
  16871. Square root scale.
  16872. @item cbrt
  16873. Cubic root scale.
  16874. @item log
  16875. Logarithmic scale.
  16876. @end table
  16877. Default is @code{log}.
  16878. @item fscale
  16879. Set frequency scale.
  16880. It accepts the following values:
  16881. @table @samp
  16882. @item lin
  16883. Linear scale.
  16884. @item log
  16885. Logarithmic scale.
  16886. @item rlog
  16887. Reverse logarithmic scale.
  16888. @end table
  16889. Default is @code{lin}.
  16890. @item win_size
  16891. Set window size.
  16892. It accepts the following values:
  16893. @table @samp
  16894. @item w16
  16895. @item w32
  16896. @item w64
  16897. @item w128
  16898. @item w256
  16899. @item w512
  16900. @item w1024
  16901. @item w2048
  16902. @item w4096
  16903. @item w8192
  16904. @item w16384
  16905. @item w32768
  16906. @item w65536
  16907. @end table
  16908. Default is @code{w2048}
  16909. @item win_func
  16910. Set windowing function.
  16911. It accepts the following values:
  16912. @table @samp
  16913. @item rect
  16914. @item bartlett
  16915. @item hanning
  16916. @item hamming
  16917. @item blackman
  16918. @item welch
  16919. @item flattop
  16920. @item bharris
  16921. @item bnuttall
  16922. @item bhann
  16923. @item sine
  16924. @item nuttall
  16925. @item lanczos
  16926. @item gauss
  16927. @item tukey
  16928. @item dolph
  16929. @item cauchy
  16930. @item parzen
  16931. @item poisson
  16932. @item bohman
  16933. @end table
  16934. Default is @code{hanning}.
  16935. @item overlap
  16936. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16937. which means optimal overlap for selected window function will be picked.
  16938. @item averaging
  16939. Set time averaging. Setting this to 0 will display current maximal peaks.
  16940. Default is @code{1}, which means time averaging is disabled.
  16941. @item colors
  16942. Specify list of colors separated by space or by '|' which will be used to
  16943. draw channel frequencies. Unrecognized or missing colors will be replaced
  16944. by white color.
  16945. @item cmode
  16946. Set channel display mode.
  16947. It accepts the following values:
  16948. @table @samp
  16949. @item combined
  16950. @item separate
  16951. @end table
  16952. Default is @code{combined}.
  16953. @item minamp
  16954. Set minimum amplitude used in @code{log} amplitude scaler.
  16955. @end table
  16956. @anchor{showspectrum}
  16957. @section showspectrum
  16958. Convert input audio to a video output, representing the audio frequency
  16959. spectrum.
  16960. The filter accepts the following options:
  16961. @table @option
  16962. @item size, s
  16963. Specify the video size for the output. For the syntax of this option, check the
  16964. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16965. Default value is @code{640x512}.
  16966. @item slide
  16967. Specify how the spectrum should slide along the window.
  16968. It accepts the following values:
  16969. @table @samp
  16970. @item replace
  16971. the samples start again on the left when they reach the right
  16972. @item scroll
  16973. the samples scroll from right to left
  16974. @item fullframe
  16975. frames are only produced when the samples reach the right
  16976. @item rscroll
  16977. the samples scroll from left to right
  16978. @end table
  16979. Default value is @code{replace}.
  16980. @item mode
  16981. Specify display mode.
  16982. It accepts the following values:
  16983. @table @samp
  16984. @item combined
  16985. all channels are displayed in the same row
  16986. @item separate
  16987. all channels are displayed in separate rows
  16988. @end table
  16989. Default value is @samp{combined}.
  16990. @item color
  16991. Specify display color mode.
  16992. It accepts the following values:
  16993. @table @samp
  16994. @item channel
  16995. each channel is displayed in a separate color
  16996. @item intensity
  16997. each channel is displayed using the same color scheme
  16998. @item rainbow
  16999. each channel is displayed using the rainbow color scheme
  17000. @item moreland
  17001. each channel is displayed using the moreland color scheme
  17002. @item nebulae
  17003. each channel is displayed using the nebulae color scheme
  17004. @item fire
  17005. each channel is displayed using the fire color scheme
  17006. @item fiery
  17007. each channel is displayed using the fiery color scheme
  17008. @item fruit
  17009. each channel is displayed using the fruit color scheme
  17010. @item cool
  17011. each channel is displayed using the cool color scheme
  17012. @item magma
  17013. each channel is displayed using the magma color scheme
  17014. @item green
  17015. each channel is displayed using the green color scheme
  17016. @item viridis
  17017. each channel is displayed using the viridis color scheme
  17018. @item plasma
  17019. each channel is displayed using the plasma color scheme
  17020. @item cividis
  17021. each channel is displayed using the cividis color scheme
  17022. @item terrain
  17023. each channel is displayed using the terrain color scheme
  17024. @end table
  17025. Default value is @samp{channel}.
  17026. @item scale
  17027. Specify scale used for calculating intensity color values.
  17028. It accepts the following values:
  17029. @table @samp
  17030. @item lin
  17031. linear
  17032. @item sqrt
  17033. square root, default
  17034. @item cbrt
  17035. cubic root
  17036. @item log
  17037. logarithmic
  17038. @item 4thrt
  17039. 4th root
  17040. @item 5thrt
  17041. 5th root
  17042. @end table
  17043. Default value is @samp{sqrt}.
  17044. @item fscale
  17045. Specify frequency scale.
  17046. It accepts the following values:
  17047. @table @samp
  17048. @item lin
  17049. linear
  17050. @item log
  17051. logarithmic
  17052. @end table
  17053. Default value is @samp{lin}.
  17054. @item saturation
  17055. Set saturation modifier for displayed colors. Negative values provide
  17056. alternative color scheme. @code{0} is no saturation at all.
  17057. Saturation must be in [-10.0, 10.0] range.
  17058. Default value is @code{1}.
  17059. @item win_func
  17060. Set window function.
  17061. It accepts the following values:
  17062. @table @samp
  17063. @item rect
  17064. @item bartlett
  17065. @item hann
  17066. @item hanning
  17067. @item hamming
  17068. @item blackman
  17069. @item welch
  17070. @item flattop
  17071. @item bharris
  17072. @item bnuttall
  17073. @item bhann
  17074. @item sine
  17075. @item nuttall
  17076. @item lanczos
  17077. @item gauss
  17078. @item tukey
  17079. @item dolph
  17080. @item cauchy
  17081. @item parzen
  17082. @item poisson
  17083. @item bohman
  17084. @end table
  17085. Default value is @code{hann}.
  17086. @item orientation
  17087. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17088. @code{horizontal}. Default is @code{vertical}.
  17089. @item overlap
  17090. Set ratio of overlap window. Default value is @code{0}.
  17091. When value is @code{1} overlap is set to recommended size for specific
  17092. window function currently used.
  17093. @item gain
  17094. Set scale gain for calculating intensity color values.
  17095. Default value is @code{1}.
  17096. @item data
  17097. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17098. @item rotation
  17099. Set color rotation, must be in [-1.0, 1.0] range.
  17100. Default value is @code{0}.
  17101. @item start
  17102. Set start frequency from which to display spectrogram. Default is @code{0}.
  17103. @item stop
  17104. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17105. @item fps
  17106. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17107. @item legend
  17108. Draw time and frequency axes and legends. Default is disabled.
  17109. @end table
  17110. The usage is very similar to the showwaves filter; see the examples in that
  17111. section.
  17112. @subsection Examples
  17113. @itemize
  17114. @item
  17115. Large window with logarithmic color scaling:
  17116. @example
  17117. showspectrum=s=1280x480:scale=log
  17118. @end example
  17119. @item
  17120. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17121. @example
  17122. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17123. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17124. @end example
  17125. @end itemize
  17126. @section showspectrumpic
  17127. Convert input audio to a single video frame, representing the audio frequency
  17128. spectrum.
  17129. The filter accepts the following options:
  17130. @table @option
  17131. @item size, s
  17132. Specify the video size for the output. For the syntax of this option, check the
  17133. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17134. Default value is @code{4096x2048}.
  17135. @item mode
  17136. Specify display mode.
  17137. It accepts the following values:
  17138. @table @samp
  17139. @item combined
  17140. all channels are displayed in the same row
  17141. @item separate
  17142. all channels are displayed in separate rows
  17143. @end table
  17144. Default value is @samp{combined}.
  17145. @item color
  17146. Specify display color mode.
  17147. It accepts the following values:
  17148. @table @samp
  17149. @item channel
  17150. each channel is displayed in a separate color
  17151. @item intensity
  17152. each channel is displayed using the same color scheme
  17153. @item rainbow
  17154. each channel is displayed using the rainbow color scheme
  17155. @item moreland
  17156. each channel is displayed using the moreland color scheme
  17157. @item nebulae
  17158. each channel is displayed using the nebulae color scheme
  17159. @item fire
  17160. each channel is displayed using the fire color scheme
  17161. @item fiery
  17162. each channel is displayed using the fiery color scheme
  17163. @item fruit
  17164. each channel is displayed using the fruit color scheme
  17165. @item cool
  17166. each channel is displayed using the cool color scheme
  17167. @item magma
  17168. each channel is displayed using the magma color scheme
  17169. @item green
  17170. each channel is displayed using the green color scheme
  17171. @item viridis
  17172. each channel is displayed using the viridis color scheme
  17173. @item plasma
  17174. each channel is displayed using the plasma color scheme
  17175. @item cividis
  17176. each channel is displayed using the cividis color scheme
  17177. @item terrain
  17178. each channel is displayed using the terrain color scheme
  17179. @end table
  17180. Default value is @samp{intensity}.
  17181. @item scale
  17182. Specify scale used for calculating intensity color values.
  17183. It accepts the following values:
  17184. @table @samp
  17185. @item lin
  17186. linear
  17187. @item sqrt
  17188. square root, default
  17189. @item cbrt
  17190. cubic root
  17191. @item log
  17192. logarithmic
  17193. @item 4thrt
  17194. 4th root
  17195. @item 5thrt
  17196. 5th root
  17197. @end table
  17198. Default value is @samp{log}.
  17199. @item fscale
  17200. Specify frequency scale.
  17201. It accepts the following values:
  17202. @table @samp
  17203. @item lin
  17204. linear
  17205. @item log
  17206. logarithmic
  17207. @end table
  17208. Default value is @samp{lin}.
  17209. @item saturation
  17210. Set saturation modifier for displayed colors. Negative values provide
  17211. alternative color scheme. @code{0} is no saturation at all.
  17212. Saturation must be in [-10.0, 10.0] range.
  17213. Default value is @code{1}.
  17214. @item win_func
  17215. Set window function.
  17216. It accepts the following values:
  17217. @table @samp
  17218. @item rect
  17219. @item bartlett
  17220. @item hann
  17221. @item hanning
  17222. @item hamming
  17223. @item blackman
  17224. @item welch
  17225. @item flattop
  17226. @item bharris
  17227. @item bnuttall
  17228. @item bhann
  17229. @item sine
  17230. @item nuttall
  17231. @item lanczos
  17232. @item gauss
  17233. @item tukey
  17234. @item dolph
  17235. @item cauchy
  17236. @item parzen
  17237. @item poisson
  17238. @item bohman
  17239. @end table
  17240. Default value is @code{hann}.
  17241. @item orientation
  17242. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17243. @code{horizontal}. Default is @code{vertical}.
  17244. @item gain
  17245. Set scale gain for calculating intensity color values.
  17246. Default value is @code{1}.
  17247. @item legend
  17248. Draw time and frequency axes and legends. Default is enabled.
  17249. @item rotation
  17250. Set color rotation, must be in [-1.0, 1.0] range.
  17251. Default value is @code{0}.
  17252. @item start
  17253. Set start frequency from which to display spectrogram. Default is @code{0}.
  17254. @item stop
  17255. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17256. @end table
  17257. @subsection Examples
  17258. @itemize
  17259. @item
  17260. Extract an audio spectrogram of a whole audio track
  17261. in a 1024x1024 picture using @command{ffmpeg}:
  17262. @example
  17263. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17264. @end example
  17265. @end itemize
  17266. @section showvolume
  17267. Convert input audio volume to a video output.
  17268. The filter accepts the following options:
  17269. @table @option
  17270. @item rate, r
  17271. Set video rate.
  17272. @item b
  17273. Set border width, allowed range is [0, 5]. Default is 1.
  17274. @item w
  17275. Set channel width, allowed range is [80, 8192]. Default is 400.
  17276. @item h
  17277. Set channel height, allowed range is [1, 900]. Default is 20.
  17278. @item f
  17279. Set fade, allowed range is [0, 1]. Default is 0.95.
  17280. @item c
  17281. Set volume color expression.
  17282. The expression can use the following variables:
  17283. @table @option
  17284. @item VOLUME
  17285. Current max volume of channel in dB.
  17286. @item PEAK
  17287. Current peak.
  17288. @item CHANNEL
  17289. Current channel number, starting from 0.
  17290. @end table
  17291. @item t
  17292. If set, displays channel names. Default is enabled.
  17293. @item v
  17294. If set, displays volume values. Default is enabled.
  17295. @item o
  17296. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17297. default is @code{h}.
  17298. @item s
  17299. Set step size, allowed range is [0, 5]. Default is 0, which means
  17300. step is disabled.
  17301. @item p
  17302. Set background opacity, allowed range is [0, 1]. Default is 0.
  17303. @item m
  17304. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17305. default is @code{p}.
  17306. @item ds
  17307. Set display scale, can be linear: @code{lin} or log: @code{log},
  17308. default is @code{lin}.
  17309. @item dm
  17310. In second.
  17311. If set to > 0., display a line for the max level
  17312. in the previous seconds.
  17313. default is disabled: @code{0.}
  17314. @item dmc
  17315. The color of the max line. Use when @code{dm} option is set to > 0.
  17316. default is: @code{orange}
  17317. @end table
  17318. @section showwaves
  17319. Convert input audio to a video output, representing the samples waves.
  17320. The filter accepts the following options:
  17321. @table @option
  17322. @item size, s
  17323. Specify the video size for the output. For the syntax of this option, check the
  17324. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17325. Default value is @code{600x240}.
  17326. @item mode
  17327. Set display mode.
  17328. Available values are:
  17329. @table @samp
  17330. @item point
  17331. Draw a point for each sample.
  17332. @item line
  17333. Draw a vertical line for each sample.
  17334. @item p2p
  17335. Draw a point for each sample and a line between them.
  17336. @item cline
  17337. Draw a centered vertical line for each sample.
  17338. @end table
  17339. Default value is @code{point}.
  17340. @item n
  17341. Set the number of samples which are printed on the same column. A
  17342. larger value will decrease the frame rate. Must be a positive
  17343. integer. This option can be set only if the value for @var{rate}
  17344. is not explicitly specified.
  17345. @item rate, r
  17346. Set the (approximate) output frame rate. This is done by setting the
  17347. option @var{n}. Default value is "25".
  17348. @item split_channels
  17349. Set if channels should be drawn separately or overlap. Default value is 0.
  17350. @item colors
  17351. Set colors separated by '|' which are going to be used for drawing of each channel.
  17352. @item scale
  17353. Set amplitude scale.
  17354. Available values are:
  17355. @table @samp
  17356. @item lin
  17357. Linear.
  17358. @item log
  17359. Logarithmic.
  17360. @item sqrt
  17361. Square root.
  17362. @item cbrt
  17363. Cubic root.
  17364. @end table
  17365. Default is linear.
  17366. @item draw
  17367. Set the draw mode. This is mostly useful to set for high @var{n}.
  17368. Available values are:
  17369. @table @samp
  17370. @item scale
  17371. Scale pixel values for each drawn sample.
  17372. @item full
  17373. Draw every sample directly.
  17374. @end table
  17375. Default value is @code{scale}.
  17376. @end table
  17377. @subsection Examples
  17378. @itemize
  17379. @item
  17380. Output the input file audio and the corresponding video representation
  17381. at the same time:
  17382. @example
  17383. amovie=a.mp3,asplit[out0],showwaves[out1]
  17384. @end example
  17385. @item
  17386. Create a synthetic signal and show it with showwaves, forcing a
  17387. frame rate of 30 frames per second:
  17388. @example
  17389. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17390. @end example
  17391. @end itemize
  17392. @section showwavespic
  17393. Convert input audio to a single video frame, representing the samples waves.
  17394. The filter accepts the following options:
  17395. @table @option
  17396. @item size, s
  17397. Specify the video size for the output. For the syntax of this option, check the
  17398. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17399. Default value is @code{600x240}.
  17400. @item split_channels
  17401. Set if channels should be drawn separately or overlap. Default value is 0.
  17402. @item colors
  17403. Set colors separated by '|' which are going to be used for drawing of each channel.
  17404. @item scale
  17405. Set amplitude scale.
  17406. Available values are:
  17407. @table @samp
  17408. @item lin
  17409. Linear.
  17410. @item log
  17411. Logarithmic.
  17412. @item sqrt
  17413. Square root.
  17414. @item cbrt
  17415. Cubic root.
  17416. @end table
  17417. Default is linear.
  17418. @item draw
  17419. Set the draw mode.
  17420. Available values are:
  17421. @table @samp
  17422. @item scale
  17423. Scale pixel values for each drawn sample.
  17424. @item full
  17425. Draw every sample directly.
  17426. @end table
  17427. Default value is @code{scale}.
  17428. @end table
  17429. @subsection Examples
  17430. @itemize
  17431. @item
  17432. Extract a channel split representation of the wave form of a whole audio track
  17433. in a 1024x800 picture using @command{ffmpeg}:
  17434. @example
  17435. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17436. @end example
  17437. @end itemize
  17438. @section sidedata, asidedata
  17439. Delete frame side data, or select frames based on it.
  17440. This filter accepts the following options:
  17441. @table @option
  17442. @item mode
  17443. Set mode of operation of the filter.
  17444. Can be one of the following:
  17445. @table @samp
  17446. @item select
  17447. Select every frame with side data of @code{type}.
  17448. @item delete
  17449. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17450. data in the frame.
  17451. @end table
  17452. @item type
  17453. Set side data type used with all modes. Must be set for @code{select} mode. For
  17454. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17455. in @file{libavutil/frame.h}. For example, to choose
  17456. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17457. @end table
  17458. @section spectrumsynth
  17459. Sythesize audio from 2 input video spectrums, first input stream represents
  17460. magnitude across time and second represents phase across time.
  17461. The filter will transform from frequency domain as displayed in videos back
  17462. to time domain as presented in audio output.
  17463. This filter is primarily created for reversing processed @ref{showspectrum}
  17464. filter outputs, but can synthesize sound from other spectrograms too.
  17465. But in such case results are going to be poor if the phase data is not
  17466. available, because in such cases phase data need to be recreated, usually
  17467. it's just recreated from random noise.
  17468. For best results use gray only output (@code{channel} color mode in
  17469. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17470. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17471. @code{data} option. Inputs videos should generally use @code{fullframe}
  17472. slide mode as that saves resources needed for decoding video.
  17473. The filter accepts the following options:
  17474. @table @option
  17475. @item sample_rate
  17476. Specify sample rate of output audio, the sample rate of audio from which
  17477. spectrum was generated may differ.
  17478. @item channels
  17479. Set number of channels represented in input video spectrums.
  17480. @item scale
  17481. Set scale which was used when generating magnitude input spectrum.
  17482. Can be @code{lin} or @code{log}. Default is @code{log}.
  17483. @item slide
  17484. Set slide which was used when generating inputs spectrums.
  17485. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17486. Default is @code{fullframe}.
  17487. @item win_func
  17488. Set window function used for resynthesis.
  17489. @item overlap
  17490. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17491. which means optimal overlap for selected window function will be picked.
  17492. @item orientation
  17493. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17494. Default is @code{vertical}.
  17495. @end table
  17496. @subsection Examples
  17497. @itemize
  17498. @item
  17499. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17500. then resynthesize videos back to audio with spectrumsynth:
  17501. @example
  17502. 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
  17503. 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
  17504. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17505. @end example
  17506. @end itemize
  17507. @section split, asplit
  17508. Split input into several identical outputs.
  17509. @code{asplit} works with audio input, @code{split} with video.
  17510. The filter accepts a single parameter which specifies the number of outputs. If
  17511. unspecified, it defaults to 2.
  17512. @subsection Examples
  17513. @itemize
  17514. @item
  17515. Create two separate outputs from the same input:
  17516. @example
  17517. [in] split [out0][out1]
  17518. @end example
  17519. @item
  17520. To create 3 or more outputs, you need to specify the number of
  17521. outputs, like in:
  17522. @example
  17523. [in] asplit=3 [out0][out1][out2]
  17524. @end example
  17525. @item
  17526. Create two separate outputs from the same input, one cropped and
  17527. one padded:
  17528. @example
  17529. [in] split [splitout1][splitout2];
  17530. [splitout1] crop=100:100:0:0 [cropout];
  17531. [splitout2] pad=200:200:100:100 [padout];
  17532. @end example
  17533. @item
  17534. Create 5 copies of the input audio with @command{ffmpeg}:
  17535. @example
  17536. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17537. @end example
  17538. @end itemize
  17539. @section zmq, azmq
  17540. Receive commands sent through a libzmq client, and forward them to
  17541. filters in the filtergraph.
  17542. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17543. must be inserted between two video filters, @code{azmq} between two
  17544. audio filters. Both are capable to send messages to any filter type.
  17545. To enable these filters you need to install the libzmq library and
  17546. headers and configure FFmpeg with @code{--enable-libzmq}.
  17547. For more information about libzmq see:
  17548. @url{http://www.zeromq.org/}
  17549. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17550. receives messages sent through a network interface defined by the
  17551. @option{bind_address} (or the abbreviation "@option{b}") option.
  17552. Default value of this option is @file{tcp://localhost:5555}. You may
  17553. want to alter this value to your needs, but do not forget to escape any
  17554. ':' signs (see @ref{filtergraph escaping}).
  17555. The received message must be in the form:
  17556. @example
  17557. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17558. @end example
  17559. @var{TARGET} specifies the target of the command, usually the name of
  17560. the filter class or a specific filter instance name. The default
  17561. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17562. but you can override this by using the @samp{filter_name@@id} syntax
  17563. (see @ref{Filtergraph syntax}).
  17564. @var{COMMAND} specifies the name of the command for the target filter.
  17565. @var{ARG} is optional and specifies the optional argument list for the
  17566. given @var{COMMAND}.
  17567. Upon reception, the message is processed and the corresponding command
  17568. is injected into the filtergraph. Depending on the result, the filter
  17569. will send a reply to the client, adopting the format:
  17570. @example
  17571. @var{ERROR_CODE} @var{ERROR_REASON}
  17572. @var{MESSAGE}
  17573. @end example
  17574. @var{MESSAGE} is optional.
  17575. @subsection Examples
  17576. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17577. be used to send commands processed by these filters.
  17578. Consider the following filtergraph generated by @command{ffplay}.
  17579. In this example the last overlay filter has an instance name. All other
  17580. filters will have default instance names.
  17581. @example
  17582. ffplay -dumpgraph 1 -f lavfi "
  17583. color=s=100x100:c=red [l];
  17584. color=s=100x100:c=blue [r];
  17585. nullsrc=s=200x100, zmq [bg];
  17586. [bg][l] overlay [bg+l];
  17587. [bg+l][r] overlay@@my=x=100 "
  17588. @end example
  17589. To change the color of the left side of the video, the following
  17590. command can be used:
  17591. @example
  17592. echo Parsed_color_0 c yellow | tools/zmqsend
  17593. @end example
  17594. To change the right side:
  17595. @example
  17596. echo Parsed_color_1 c pink | tools/zmqsend
  17597. @end example
  17598. To change the position of the right side:
  17599. @example
  17600. echo overlay@@my x 150 | tools/zmqsend
  17601. @end example
  17602. @c man end MULTIMEDIA FILTERS
  17603. @chapter Multimedia Sources
  17604. @c man begin MULTIMEDIA SOURCES
  17605. Below is a description of the currently available multimedia sources.
  17606. @section amovie
  17607. This is the same as @ref{movie} source, except it selects an audio
  17608. stream by default.
  17609. @anchor{movie}
  17610. @section movie
  17611. Read audio and/or video stream(s) from a movie container.
  17612. It accepts the following parameters:
  17613. @table @option
  17614. @item filename
  17615. The name of the resource to read (not necessarily a file; it can also be a
  17616. device or a stream accessed through some protocol).
  17617. @item format_name, f
  17618. Specifies the format assumed for the movie to read, and can be either
  17619. the name of a container or an input device. If not specified, the
  17620. format is guessed from @var{movie_name} or by probing.
  17621. @item seek_point, sp
  17622. Specifies the seek point in seconds. The frames will be output
  17623. starting from this seek point. The parameter is evaluated with
  17624. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17625. postfix. The default value is "0".
  17626. @item streams, s
  17627. Specifies the streams to read. Several streams can be specified,
  17628. separated by "+". The source will then have as many outputs, in the
  17629. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17630. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17631. respectively the default (best suited) video and audio stream. Default
  17632. is "dv", or "da" if the filter is called as "amovie".
  17633. @item stream_index, si
  17634. Specifies the index of the video stream to read. If the value is -1,
  17635. the most suitable video stream will be automatically selected. The default
  17636. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17637. audio instead of video.
  17638. @item loop
  17639. Specifies how many times to read the stream in sequence.
  17640. If the value is 0, the stream will be looped infinitely.
  17641. Default value is "1".
  17642. Note that when the movie is looped the source timestamps are not
  17643. changed, so it will generate non monotonically increasing timestamps.
  17644. @item discontinuity
  17645. Specifies the time difference between frames above which the point is
  17646. considered a timestamp discontinuity which is removed by adjusting the later
  17647. timestamps.
  17648. @end table
  17649. It allows overlaying a second video on top of the main input of
  17650. a filtergraph, as shown in this graph:
  17651. @example
  17652. input -----------> deltapts0 --> overlay --> output
  17653. ^
  17654. |
  17655. movie --> scale--> deltapts1 -------+
  17656. @end example
  17657. @subsection Examples
  17658. @itemize
  17659. @item
  17660. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17661. on top of the input labelled "in":
  17662. @example
  17663. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17664. [in] setpts=PTS-STARTPTS [main];
  17665. [main][over] overlay=16:16 [out]
  17666. @end example
  17667. @item
  17668. Read from a video4linux2 device, and overlay it on top of the input
  17669. labelled "in":
  17670. @example
  17671. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17672. [in] setpts=PTS-STARTPTS [main];
  17673. [main][over] overlay=16:16 [out]
  17674. @end example
  17675. @item
  17676. Read the first video stream and the audio stream with id 0x81 from
  17677. dvd.vob; the video is connected to the pad named "video" and the audio is
  17678. connected to the pad named "audio":
  17679. @example
  17680. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17681. @end example
  17682. @end itemize
  17683. @subsection Commands
  17684. Both movie and amovie support the following commands:
  17685. @table @option
  17686. @item seek
  17687. Perform seek using "av_seek_frame".
  17688. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17689. @itemize
  17690. @item
  17691. @var{stream_index}: If stream_index is -1, a default
  17692. stream is selected, and @var{timestamp} is automatically converted
  17693. from AV_TIME_BASE units to the stream specific time_base.
  17694. @item
  17695. @var{timestamp}: Timestamp in AVStream.time_base units
  17696. or, if no stream is specified, in AV_TIME_BASE units.
  17697. @item
  17698. @var{flags}: Flags which select direction and seeking mode.
  17699. @end itemize
  17700. @item get_duration
  17701. Get movie duration in AV_TIME_BASE units.
  17702. @end table
  17703. @c man end MULTIMEDIA SOURCES