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.

23769 lines
632KB

  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. Allowed range is from 16 to 131072.
  878. Default is @code{4096}
  879. @item win_func
  880. Set window function. Default is @code{hann}.
  881. @item overlap
  882. Set window overlap. If set to 1, the recommended overlap for selected
  883. window function will be picked. Default is @code{0.75}.
  884. @end table
  885. @subsection Examples
  886. @itemize
  887. @item
  888. Leave almost only low frequencies in audio:
  889. @example
  890. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  891. @end example
  892. @end itemize
  893. @anchor{afir}
  894. @section afir
  895. Apply an arbitrary Frequency Impulse Response filter.
  896. This filter is designed for applying long FIR filters,
  897. up to 60 seconds long.
  898. It can be used as component for digital crossover filters,
  899. room equalization, cross talk cancellation, wavefield synthesis,
  900. auralization, ambiophonics, ambisonics and spatialization.
  901. This filter uses second stream as FIR coefficients.
  902. If second stream holds single channel, it will be used
  903. for all input channels in first stream, otherwise
  904. number of channels in second stream must be same as
  905. number of channels in first stream.
  906. It accepts the following parameters:
  907. @table @option
  908. @item dry
  909. Set dry gain. This sets input gain.
  910. @item wet
  911. Set wet gain. This sets final output gain.
  912. @item length
  913. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  914. @item gtype
  915. Enable applying gain measured from power of IR.
  916. Set which approach to use for auto gain measurement.
  917. @table @option
  918. @item none
  919. Do not apply any gain.
  920. @item peak
  921. select peak gain, very conservative approach. This is default value.
  922. @item dc
  923. select DC gain, limited application.
  924. @item gn
  925. select gain to noise approach, this is most popular one.
  926. @end table
  927. @item irgain
  928. Set gain to be applied to IR coefficients before filtering.
  929. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  930. @item irfmt
  931. Set format of IR stream. Can be @code{mono} or @code{input}.
  932. Default is @code{input}.
  933. @item maxir
  934. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  935. Allowed range is 0.1 to 60 seconds.
  936. @item response
  937. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  938. By default it is disabled.
  939. @item channel
  940. Set for which IR channel to display frequency response. By default is first channel
  941. displayed. This option is used only when @var{response} is enabled.
  942. @item size
  943. Set video stream size. This option is used only when @var{response} is enabled.
  944. @item rate
  945. Set video stream frame rate. This option is used only when @var{response} is enabled.
  946. @item minp
  947. Set minimal partition size used for convolution. Default is @var{8192}.
  948. Allowed range is from @var{8} to @var{32768}.
  949. Lower values decreases latency at cost of higher CPU usage.
  950. @item maxp
  951. Set maximal partition size used for convolution. Default is @var{8192}.
  952. Allowed range is from @var{8} to @var{32768}.
  953. Lower values may increase CPU usage.
  954. @end table
  955. @subsection Examples
  956. @itemize
  957. @item
  958. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  959. @example
  960. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  961. @end example
  962. @end itemize
  963. @anchor{aformat}
  964. @section aformat
  965. Set output format constraints for the input audio. The framework will
  966. negotiate the most appropriate format to minimize conversions.
  967. It accepts the following parameters:
  968. @table @option
  969. @item sample_fmts
  970. A '|'-separated list of requested sample formats.
  971. @item sample_rates
  972. A '|'-separated list of requested sample rates.
  973. @item channel_layouts
  974. A '|'-separated list of requested channel layouts.
  975. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  976. for the required syntax.
  977. @end table
  978. If a parameter is omitted, all values are allowed.
  979. Force the output to either unsigned 8-bit or signed 16-bit stereo
  980. @example
  981. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  982. @end example
  983. @section agate
  984. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  985. processing reduces disturbing noise between useful signals.
  986. Gating is done by detecting the volume below a chosen level @var{threshold}
  987. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  988. floor is set via @var{range}. Because an exact manipulation of the signal
  989. would cause distortion of the waveform the reduction can be levelled over
  990. time. This is done by setting @var{attack} and @var{release}.
  991. @var{attack} determines how long the signal has to fall below the threshold
  992. before any reduction will occur and @var{release} sets the time the signal
  993. has to rise above the threshold to reduce the reduction again.
  994. Shorter signals than the chosen attack time will be left untouched.
  995. @table @option
  996. @item level_in
  997. Set input level before filtering.
  998. Default is 1. Allowed range is from 0.015625 to 64.
  999. @item mode
  1000. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1001. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1002. will be amplified, expanding dynamic range in upward direction.
  1003. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1004. @item range
  1005. Set the level of gain reduction when the signal is below the threshold.
  1006. Default is 0.06125. Allowed range is from 0 to 1.
  1007. Setting this to 0 disables reduction and then filter behaves like expander.
  1008. @item threshold
  1009. If a signal rises above this level the gain reduction is released.
  1010. Default is 0.125. Allowed range is from 0 to 1.
  1011. @item ratio
  1012. Set a ratio by which the signal is reduced.
  1013. Default is 2. Allowed range is from 1 to 9000.
  1014. @item attack
  1015. Amount of milliseconds the signal has to rise above the threshold before gain
  1016. reduction stops.
  1017. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1018. @item release
  1019. Amount of milliseconds the signal has to fall below the threshold before the
  1020. reduction is increased again. Default is 250 milliseconds.
  1021. Allowed range is from 0.01 to 9000.
  1022. @item makeup
  1023. Set amount of amplification of signal after processing.
  1024. Default is 1. Allowed range is from 1 to 64.
  1025. @item knee
  1026. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1027. Default is 2.828427125. Allowed range is from 1 to 8.
  1028. @item detection
  1029. Choose if exact signal should be taken for detection or an RMS like one.
  1030. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1031. @item link
  1032. Choose if the average level between all channels or the louder channel affects
  1033. the reduction.
  1034. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1035. @end table
  1036. @section aiir
  1037. Apply an arbitrary Infinite Impulse Response filter.
  1038. It accepts the following parameters:
  1039. @table @option
  1040. @item z
  1041. Set numerator/zeros coefficients.
  1042. @item p
  1043. Set denominator/poles coefficients.
  1044. @item k
  1045. Set channels gains.
  1046. @item dry_gain
  1047. Set input gain.
  1048. @item wet_gain
  1049. Set output gain.
  1050. @item f
  1051. Set coefficients format.
  1052. @table @samp
  1053. @item tf
  1054. transfer function
  1055. @item zp
  1056. Z-plane zeros/poles, cartesian (default)
  1057. @item pr
  1058. Z-plane zeros/poles, polar radians
  1059. @item pd
  1060. Z-plane zeros/poles, polar degrees
  1061. @end table
  1062. @item r
  1063. Set kind of processing.
  1064. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1065. @item e
  1066. Set filtering precision.
  1067. @table @samp
  1068. @item dbl
  1069. double-precision floating-point (default)
  1070. @item flt
  1071. single-precision floating-point
  1072. @item i32
  1073. 32-bit integers
  1074. @item i16
  1075. 16-bit integers
  1076. @end table
  1077. @item mix
  1078. How much to use filtered signal in output. Default is 1.
  1079. Range is between 0 and 1.
  1080. @item response
  1081. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1082. By default it is disabled.
  1083. @item channel
  1084. Set for which IR channel to display frequency response. By default is first channel
  1085. displayed. This option is used only when @var{response} is enabled.
  1086. @item size
  1087. Set video stream size. This option is used only when @var{response} is enabled.
  1088. @end table
  1089. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1090. order.
  1091. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1092. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1093. imaginary unit.
  1094. Different coefficients and gains can be provided for every channel, in such case
  1095. use '|' to separate coefficients or gains. Last provided coefficients will be
  1096. used for all remaining channels.
  1097. @subsection Examples
  1098. @itemize
  1099. @item
  1100. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1101. @example
  1102. 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
  1103. @end example
  1104. @item
  1105. Same as above but in @code{zp} format:
  1106. @example
  1107. 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
  1108. @end example
  1109. @end itemize
  1110. @section alimiter
  1111. The limiter prevents an input signal from rising over a desired threshold.
  1112. This limiter uses lookahead technology to prevent your signal from distorting.
  1113. It means that there is a small delay after the signal is processed. Keep in mind
  1114. that the delay it produces is the attack time you set.
  1115. The filter accepts the following options:
  1116. @table @option
  1117. @item level_in
  1118. Set input gain. Default is 1.
  1119. @item level_out
  1120. Set output gain. Default is 1.
  1121. @item limit
  1122. Don't let signals above this level pass the limiter. Default is 1.
  1123. @item attack
  1124. The limiter will reach its attenuation level in this amount of time in
  1125. milliseconds. Default is 5 milliseconds.
  1126. @item release
  1127. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1128. Default is 50 milliseconds.
  1129. @item asc
  1130. When gain reduction is always needed ASC takes care of releasing to an
  1131. average reduction level rather than reaching a reduction of 0 in the release
  1132. time.
  1133. @item asc_level
  1134. Select how much the release time is affected by ASC, 0 means nearly no changes
  1135. in release time while 1 produces higher release times.
  1136. @item level
  1137. Auto level output signal. Default is enabled.
  1138. This normalizes audio back to 0dB if enabled.
  1139. @end table
  1140. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1141. with @ref{aresample} before applying this filter.
  1142. @section allpass
  1143. Apply a two-pole all-pass filter with central frequency (in Hz)
  1144. @var{frequency}, and filter-width @var{width}.
  1145. An all-pass filter changes the audio's frequency to phase relationship
  1146. without changing its frequency to amplitude relationship.
  1147. The filter accepts the following options:
  1148. @table @option
  1149. @item frequency, f
  1150. Set frequency in Hz.
  1151. @item width_type, t
  1152. Set method to specify band-width of filter.
  1153. @table @option
  1154. @item h
  1155. Hz
  1156. @item q
  1157. Q-Factor
  1158. @item o
  1159. octave
  1160. @item s
  1161. slope
  1162. @item k
  1163. kHz
  1164. @end table
  1165. @item width, w
  1166. Specify the band-width of a filter in width_type units.
  1167. @item mix, m
  1168. How much to use filtered signal in output. Default is 1.
  1169. Range is between 0 and 1.
  1170. @item channels, c
  1171. Specify which channels to filter, by default all available are filtered.
  1172. @end table
  1173. @subsection Commands
  1174. This filter supports the following commands:
  1175. @table @option
  1176. @item frequency, f
  1177. Change allpass frequency.
  1178. Syntax for the command is : "@var{frequency}"
  1179. @item width_type, t
  1180. Change allpass width_type.
  1181. Syntax for the command is : "@var{width_type}"
  1182. @item width, w
  1183. Change allpass width.
  1184. Syntax for the command is : "@var{width}"
  1185. @item mix, m
  1186. Change allpass mix.
  1187. Syntax for the command is : "@var{mix}"
  1188. @end table
  1189. @section aloop
  1190. Loop audio samples.
  1191. The filter accepts the following options:
  1192. @table @option
  1193. @item loop
  1194. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1195. Default is 0.
  1196. @item size
  1197. Set maximal number of samples. Default is 0.
  1198. @item start
  1199. Set first sample of loop. Default is 0.
  1200. @end table
  1201. @anchor{amerge}
  1202. @section amerge
  1203. Merge two or more audio streams into a single multi-channel stream.
  1204. The filter accepts the following options:
  1205. @table @option
  1206. @item inputs
  1207. Set the number of inputs. Default is 2.
  1208. @end table
  1209. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1210. the channel layout of the output will be set accordingly and the channels
  1211. will be reordered as necessary. If the channel layouts of the inputs are not
  1212. disjoint, the output will have all the channels of the first input then all
  1213. the channels of the second input, in that order, and the channel layout of
  1214. the output will be the default value corresponding to the total number of
  1215. channels.
  1216. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1217. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1218. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1219. first input, b1 is the first channel of the second input).
  1220. On the other hand, if both input are in stereo, the output channels will be
  1221. in the default order: a1, a2, b1, b2, and the channel layout will be
  1222. arbitrarily set to 4.0, which may or may not be the expected value.
  1223. All inputs must have the same sample rate, and format.
  1224. If inputs do not have the same duration, the output will stop with the
  1225. shortest.
  1226. @subsection Examples
  1227. @itemize
  1228. @item
  1229. Merge two mono files into a stereo stream:
  1230. @example
  1231. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1232. @end example
  1233. @item
  1234. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1235. @example
  1236. 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
  1237. @end example
  1238. @end itemize
  1239. @section amix
  1240. Mixes multiple audio inputs into a single output.
  1241. Note that this filter only supports float samples (the @var{amerge}
  1242. and @var{pan} audio filters support many formats). If the @var{amix}
  1243. input has integer samples then @ref{aresample} will be automatically
  1244. inserted to perform the conversion to float samples.
  1245. For example
  1246. @example
  1247. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1248. @end example
  1249. will mix 3 input audio streams to a single output with the same duration as the
  1250. first input and a dropout transition time of 3 seconds.
  1251. It accepts the following parameters:
  1252. @table @option
  1253. @item inputs
  1254. The number of inputs. If unspecified, it defaults to 2.
  1255. @item duration
  1256. How to determine the end-of-stream.
  1257. @table @option
  1258. @item longest
  1259. The duration of the longest input. (default)
  1260. @item shortest
  1261. The duration of the shortest input.
  1262. @item first
  1263. The duration of the first input.
  1264. @end table
  1265. @item dropout_transition
  1266. The transition time, in seconds, for volume renormalization when an input
  1267. stream ends. The default value is 2 seconds.
  1268. @item weights
  1269. Specify weight of each input audio stream as sequence.
  1270. Each weight is separated by space. By default all inputs have same weight.
  1271. @end table
  1272. @section amultiply
  1273. Multiply first audio stream with second audio stream and store result
  1274. in output audio stream. Multiplication is done by multiplying each
  1275. sample from first stream with sample at same position from second stream.
  1276. With this element-wise multiplication one can create amplitude fades and
  1277. amplitude modulations.
  1278. @section anequalizer
  1279. High-order parametric multiband equalizer for each channel.
  1280. It accepts the following parameters:
  1281. @table @option
  1282. @item params
  1283. This option string is in format:
  1284. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1285. Each equalizer band is separated by '|'.
  1286. @table @option
  1287. @item chn
  1288. Set channel number to which equalization will be applied.
  1289. If input doesn't have that channel the entry is ignored.
  1290. @item f
  1291. Set central frequency for band.
  1292. If input doesn't have that frequency the entry is ignored.
  1293. @item w
  1294. Set band width in hertz.
  1295. @item g
  1296. Set band gain in dB.
  1297. @item t
  1298. Set filter type for band, optional, can be:
  1299. @table @samp
  1300. @item 0
  1301. Butterworth, this is default.
  1302. @item 1
  1303. Chebyshev type 1.
  1304. @item 2
  1305. Chebyshev type 2.
  1306. @end table
  1307. @end table
  1308. @item curves
  1309. With this option activated frequency response of anequalizer is displayed
  1310. in video stream.
  1311. @item size
  1312. Set video stream size. Only useful if curves option is activated.
  1313. @item mgain
  1314. Set max gain that will be displayed. Only useful if curves option is activated.
  1315. Setting this to a reasonable value makes it possible to display gain which is derived from
  1316. neighbour bands which are too close to each other and thus produce higher gain
  1317. when both are activated.
  1318. @item fscale
  1319. Set frequency scale used to draw frequency response in video output.
  1320. Can be linear or logarithmic. Default is logarithmic.
  1321. @item colors
  1322. Set color for each channel curve which is going to be displayed in video stream.
  1323. This is list of color names separated by space or by '|'.
  1324. Unrecognised or missing colors will be replaced by white color.
  1325. @end table
  1326. @subsection Examples
  1327. @itemize
  1328. @item
  1329. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1330. for first 2 channels using Chebyshev type 1 filter:
  1331. @example
  1332. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1333. @end example
  1334. @end itemize
  1335. @subsection Commands
  1336. This filter supports the following commands:
  1337. @table @option
  1338. @item change
  1339. Alter existing filter parameters.
  1340. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1341. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1342. error is returned.
  1343. @var{freq} set new frequency parameter.
  1344. @var{width} set new width parameter in herz.
  1345. @var{gain} set new gain parameter in dB.
  1346. Full filter invocation with asendcmd may look like this:
  1347. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1348. @end table
  1349. @section anlmdn
  1350. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1351. Each sample is adjusted by looking for other samples with similar contexts. This
  1352. context similarity is defined by comparing their surrounding patches of size
  1353. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1354. The filter accepts the following options.
  1355. @table @option
  1356. @item s
  1357. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1358. @item p
  1359. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1360. Default value is 2 milliseconds.
  1361. @item r
  1362. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1363. Default value is 6 milliseconds.
  1364. @item o
  1365. Set the output mode.
  1366. It accepts the following values:
  1367. @table @option
  1368. @item i
  1369. Pass input unchanged.
  1370. @item o
  1371. Pass noise filtered out.
  1372. @item n
  1373. Pass only noise.
  1374. Default value is @var{o}.
  1375. @end table
  1376. @item m
  1377. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1378. @end table
  1379. @subsection Commands
  1380. This filter supports the following commands:
  1381. @table @option
  1382. @item s
  1383. Change denoise strength. Argument is single float number.
  1384. Syntax for the command is : "@var{s}"
  1385. @item o
  1386. Change output mode.
  1387. Syntax for the command is : "i", "o" or "n" string.
  1388. @end table
  1389. @section anull
  1390. Pass the audio source unchanged to the output.
  1391. @section apad
  1392. Pad the end of an audio stream with silence.
  1393. This can be used together with @command{ffmpeg} @option{-shortest} to
  1394. extend audio streams to the same length as the video stream.
  1395. A description of the accepted options follows.
  1396. @table @option
  1397. @item packet_size
  1398. Set silence packet size. Default value is 4096.
  1399. @item pad_len
  1400. Set the number of samples of silence to add to the end. After the
  1401. value is reached, the stream is terminated. This option is mutually
  1402. exclusive with @option{whole_len}.
  1403. @item whole_len
  1404. Set the minimum total number of samples in the output audio stream. If
  1405. the value is longer than the input audio length, silence is added to
  1406. the end, until the value is reached. This option is mutually exclusive
  1407. with @option{pad_len}.
  1408. @item pad_dur
  1409. Specify the duration of samples of silence to add. See
  1410. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1411. for the accepted syntax. Used only if set to non-zero value.
  1412. @item whole_dur
  1413. Specify the minimum total duration in the output audio stream. See
  1414. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1415. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1416. the input audio length, silence is added to the end, until the value is reached.
  1417. This option is mutually exclusive with @option{pad_dur}
  1418. @end table
  1419. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1420. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1421. the input stream indefinitely.
  1422. @subsection Examples
  1423. @itemize
  1424. @item
  1425. Add 1024 samples of silence to the end of the input:
  1426. @example
  1427. apad=pad_len=1024
  1428. @end example
  1429. @item
  1430. Make sure the audio output will contain at least 10000 samples, pad
  1431. the input with silence if required:
  1432. @example
  1433. apad=whole_len=10000
  1434. @end example
  1435. @item
  1436. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1437. video stream will always result the shortest and will be converted
  1438. until the end in the output file when using the @option{shortest}
  1439. option:
  1440. @example
  1441. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1442. @end example
  1443. @end itemize
  1444. @section aphaser
  1445. Add a phasing effect to the input audio.
  1446. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1447. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1448. A description of the accepted parameters follows.
  1449. @table @option
  1450. @item in_gain
  1451. Set input gain. Default is 0.4.
  1452. @item out_gain
  1453. Set output gain. Default is 0.74
  1454. @item delay
  1455. Set delay in milliseconds. Default is 3.0.
  1456. @item decay
  1457. Set decay. Default is 0.4.
  1458. @item speed
  1459. Set modulation speed in Hz. Default is 0.5.
  1460. @item type
  1461. Set modulation type. Default is triangular.
  1462. It accepts the following values:
  1463. @table @samp
  1464. @item triangular, t
  1465. @item sinusoidal, s
  1466. @end table
  1467. @end table
  1468. @section apulsator
  1469. Audio pulsator is something between an autopanner and a tremolo.
  1470. But it can produce funny stereo effects as well. Pulsator changes the volume
  1471. of the left and right channel based on a LFO (low frequency oscillator) with
  1472. different waveforms and shifted phases.
  1473. This filter have the ability to define an offset between left and right
  1474. channel. An offset of 0 means that both LFO shapes match each other.
  1475. The left and right channel are altered equally - a conventional tremolo.
  1476. An offset of 50% means that the shape of the right channel is exactly shifted
  1477. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1478. an autopanner. At 1 both curves match again. Every setting in between moves the
  1479. phase shift gapless between all stages and produces some "bypassing" sounds with
  1480. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1481. the 0.5) the faster the signal passes from the left to the right speaker.
  1482. The filter accepts the following options:
  1483. @table @option
  1484. @item level_in
  1485. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1486. @item level_out
  1487. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1488. @item mode
  1489. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1490. sawup or sawdown. Default is sine.
  1491. @item amount
  1492. Set modulation. Define how much of original signal is affected by the LFO.
  1493. @item offset_l
  1494. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1495. @item offset_r
  1496. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1497. @item width
  1498. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1499. @item timing
  1500. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1501. @item bpm
  1502. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1503. is set to bpm.
  1504. @item ms
  1505. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1506. is set to ms.
  1507. @item hz
  1508. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1509. if timing is set to hz.
  1510. @end table
  1511. @anchor{aresample}
  1512. @section aresample
  1513. Resample the input audio to the specified parameters, using the
  1514. libswresample library. If none are specified then the filter will
  1515. automatically convert between its input and output.
  1516. This filter is also able to stretch/squeeze the audio data to make it match
  1517. the timestamps or to inject silence / cut out audio to make it match the
  1518. timestamps, do a combination of both or do neither.
  1519. The filter accepts the syntax
  1520. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1521. expresses a sample rate and @var{resampler_options} is a list of
  1522. @var{key}=@var{value} pairs, separated by ":". See the
  1523. @ref{Resampler Options,,"Resampler Options" section in the
  1524. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1525. for the complete list of supported options.
  1526. @subsection Examples
  1527. @itemize
  1528. @item
  1529. Resample the input audio to 44100Hz:
  1530. @example
  1531. aresample=44100
  1532. @end example
  1533. @item
  1534. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1535. samples per second compensation:
  1536. @example
  1537. aresample=async=1000
  1538. @end example
  1539. @end itemize
  1540. @section areverse
  1541. Reverse an audio clip.
  1542. Warning: This filter requires memory to buffer the entire clip, so trimming
  1543. is suggested.
  1544. @subsection Examples
  1545. @itemize
  1546. @item
  1547. Take the first 5 seconds of a clip, and reverse it.
  1548. @example
  1549. atrim=end=5,areverse
  1550. @end example
  1551. @end itemize
  1552. @section asetnsamples
  1553. Set the number of samples per each output audio frame.
  1554. The last output packet may contain a different number of samples, as
  1555. the filter will flush all the remaining samples when the input audio
  1556. signals its end.
  1557. The filter accepts the following options:
  1558. @table @option
  1559. @item nb_out_samples, n
  1560. Set the number of frames per each output audio frame. The number is
  1561. intended as the number of samples @emph{per each channel}.
  1562. Default value is 1024.
  1563. @item pad, p
  1564. If set to 1, the filter will pad the last audio frame with zeroes, so
  1565. that the last frame will contain the same number of samples as the
  1566. previous ones. Default value is 1.
  1567. @end table
  1568. For example, to set the number of per-frame samples to 1234 and
  1569. disable padding for the last frame, use:
  1570. @example
  1571. asetnsamples=n=1234:p=0
  1572. @end example
  1573. @section asetrate
  1574. Set the sample rate without altering the PCM data.
  1575. This will result in a change of speed and pitch.
  1576. The filter accepts the following options:
  1577. @table @option
  1578. @item sample_rate, r
  1579. Set the output sample rate. Default is 44100 Hz.
  1580. @end table
  1581. @section ashowinfo
  1582. Show a line containing various information for each input audio frame.
  1583. The input audio is not modified.
  1584. The shown line contains a sequence of key/value pairs of the form
  1585. @var{key}:@var{value}.
  1586. The following values are shown in the output:
  1587. @table @option
  1588. @item n
  1589. The (sequential) number of the input frame, starting from 0.
  1590. @item pts
  1591. The presentation timestamp of the input frame, in time base units; the time base
  1592. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1593. @item pts_time
  1594. The presentation timestamp of the input frame in seconds.
  1595. @item pos
  1596. position of the frame in the input stream, -1 if this information in
  1597. unavailable and/or meaningless (for example in case of synthetic audio)
  1598. @item fmt
  1599. The sample format.
  1600. @item chlayout
  1601. The channel layout.
  1602. @item rate
  1603. The sample rate for the audio frame.
  1604. @item nb_samples
  1605. The number of samples (per channel) in the frame.
  1606. @item checksum
  1607. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1608. audio, the data is treated as if all the planes were concatenated.
  1609. @item plane_checksums
  1610. A list of Adler-32 checksums for each data plane.
  1611. @end table
  1612. @section asoftclip
  1613. Apply audio soft clipping.
  1614. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1615. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1616. This filter accepts the following options:
  1617. @table @option
  1618. @item type
  1619. Set type of soft-clipping.
  1620. It accepts the following values:
  1621. @table @option
  1622. @item tanh
  1623. @item atan
  1624. @item cubic
  1625. @item exp
  1626. @item alg
  1627. @item quintic
  1628. @item sin
  1629. @end table
  1630. @item param
  1631. Set additional parameter which controls sigmoid function.
  1632. @end table
  1633. @section asr
  1634. Automatic Speech Recognition
  1635. This filter uses PocketSphinx for speech recognition. To enable
  1636. compilation of this filter, you need to configure FFmpeg with
  1637. @code{--enable-pocketsphinx}.
  1638. It accepts the following options:
  1639. @table @option
  1640. @item rate
  1641. Set sampling rate of input audio. Defaults is @code{16000}.
  1642. This need to match speech models, otherwise one will get poor results.
  1643. @item hmm
  1644. Set dictionary containing acoustic model files.
  1645. @item dict
  1646. Set pronunciation dictionary.
  1647. @item lm
  1648. Set language model file.
  1649. @item lmctl
  1650. Set language model set.
  1651. @item lmname
  1652. Set which language model to use.
  1653. @item logfn
  1654. Set output for log messages.
  1655. @end table
  1656. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1657. @anchor{astats}
  1658. @section astats
  1659. Display time domain statistical information about the audio channels.
  1660. Statistics are calculated and displayed for each audio channel and,
  1661. where applicable, an overall figure is also given.
  1662. It accepts the following option:
  1663. @table @option
  1664. @item length
  1665. Short window length in seconds, used for peak and trough RMS measurement.
  1666. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1667. @item metadata
  1668. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1669. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1670. disabled.
  1671. Available keys for each channel are:
  1672. DC_offset
  1673. Min_level
  1674. Max_level
  1675. Min_difference
  1676. Max_difference
  1677. Mean_difference
  1678. RMS_difference
  1679. Peak_level
  1680. RMS_peak
  1681. RMS_trough
  1682. Crest_factor
  1683. Flat_factor
  1684. Peak_count
  1685. Bit_depth
  1686. Dynamic_range
  1687. Zero_crossings
  1688. Zero_crossings_rate
  1689. Number_of_NaNs
  1690. Number_of_Infs
  1691. Number_of_denormals
  1692. and for Overall:
  1693. DC_offset
  1694. Min_level
  1695. Max_level
  1696. Min_difference
  1697. Max_difference
  1698. Mean_difference
  1699. RMS_difference
  1700. Peak_level
  1701. RMS_level
  1702. RMS_peak
  1703. RMS_trough
  1704. Flat_factor
  1705. Peak_count
  1706. Bit_depth
  1707. Number_of_samples
  1708. Number_of_NaNs
  1709. Number_of_Infs
  1710. Number_of_denormals
  1711. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1712. this @code{lavfi.astats.Overall.Peak_count}.
  1713. For description what each key means read below.
  1714. @item reset
  1715. Set number of frame after which stats are going to be recalculated.
  1716. Default is disabled.
  1717. @item measure_perchannel
  1718. Select the entries which need to be measured per channel. The metadata keys can
  1719. be used as flags, default is @option{all} which measures everything.
  1720. @option{none} disables all per channel measurement.
  1721. @item measure_overall
  1722. Select the entries which need to be measured overall. The metadata keys can
  1723. be used as flags, default is @option{all} which measures everything.
  1724. @option{none} disables all overall measurement.
  1725. @end table
  1726. A description of each shown parameter follows:
  1727. @table @option
  1728. @item DC offset
  1729. Mean amplitude displacement from zero.
  1730. @item Min level
  1731. Minimal sample level.
  1732. @item Max level
  1733. Maximal sample level.
  1734. @item Min difference
  1735. Minimal difference between two consecutive samples.
  1736. @item Max difference
  1737. Maximal difference between two consecutive samples.
  1738. @item Mean difference
  1739. Mean difference between two consecutive samples.
  1740. The average of each difference between two consecutive samples.
  1741. @item RMS difference
  1742. Root Mean Square difference between two consecutive samples.
  1743. @item Peak level dB
  1744. @item RMS level dB
  1745. Standard peak and RMS level measured in dBFS.
  1746. @item RMS peak dB
  1747. @item RMS trough dB
  1748. Peak and trough values for RMS level measured over a short window.
  1749. @item Crest factor
  1750. Standard ratio of peak to RMS level (note: not in dB).
  1751. @item Flat factor
  1752. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1753. (i.e. either @var{Min level} or @var{Max level}).
  1754. @item Peak count
  1755. Number of occasions (not the number of samples) that the signal attained either
  1756. @var{Min level} or @var{Max level}.
  1757. @item Bit depth
  1758. Overall bit depth of audio. Number of bits used for each sample.
  1759. @item Dynamic range
  1760. Measured dynamic range of audio in dB.
  1761. @item Zero crossings
  1762. Number of points where the waveform crosses the zero level axis.
  1763. @item Zero crossings rate
  1764. Rate of Zero crossings and number of audio samples.
  1765. @end table
  1766. @section atempo
  1767. Adjust audio tempo.
  1768. The filter accepts exactly one parameter, the audio tempo. If not
  1769. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1770. be in the [0.5, 100.0] range.
  1771. Note that tempo greater than 2 will skip some samples rather than
  1772. blend them in. If for any reason this is a concern it is always
  1773. possible to daisy-chain several instances of atempo to achieve the
  1774. desired product tempo.
  1775. @subsection Examples
  1776. @itemize
  1777. @item
  1778. Slow down audio to 80% tempo:
  1779. @example
  1780. atempo=0.8
  1781. @end example
  1782. @item
  1783. To speed up audio to 300% tempo:
  1784. @example
  1785. atempo=3
  1786. @end example
  1787. @item
  1788. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1789. @example
  1790. atempo=sqrt(3),atempo=sqrt(3)
  1791. @end example
  1792. @end itemize
  1793. @section atrim
  1794. Trim the input so that the output contains one continuous subpart of the input.
  1795. It accepts the following parameters:
  1796. @table @option
  1797. @item start
  1798. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1799. sample with the timestamp @var{start} will be the first sample in the output.
  1800. @item end
  1801. Specify time of the first audio sample that will be dropped, i.e. the
  1802. audio sample immediately preceding the one with the timestamp @var{end} will be
  1803. the last sample in the output.
  1804. @item start_pts
  1805. Same as @var{start}, except this option sets the start timestamp in samples
  1806. instead of seconds.
  1807. @item end_pts
  1808. Same as @var{end}, except this option sets the end timestamp in samples instead
  1809. of seconds.
  1810. @item duration
  1811. The maximum duration of the output in seconds.
  1812. @item start_sample
  1813. The number of the first sample that should be output.
  1814. @item end_sample
  1815. The number of the first sample that should be dropped.
  1816. @end table
  1817. @option{start}, @option{end}, and @option{duration} are expressed as time
  1818. duration specifications; see
  1819. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1820. Note that the first two sets of the start/end options and the @option{duration}
  1821. option look at the frame timestamp, while the _sample options simply count the
  1822. samples that pass through the filter. So start/end_pts and start/end_sample will
  1823. give different results when the timestamps are wrong, inexact or do not start at
  1824. zero. Also note that this filter does not modify the timestamps. If you wish
  1825. to have the output timestamps start at zero, insert the asetpts filter after the
  1826. atrim filter.
  1827. If multiple start or end options are set, this filter tries to be greedy and
  1828. keep all samples that match at least one of the specified constraints. To keep
  1829. only the part that matches all the constraints at once, chain multiple atrim
  1830. filters.
  1831. The defaults are such that all the input is kept. So it is possible to set e.g.
  1832. just the end values to keep everything before the specified time.
  1833. Examples:
  1834. @itemize
  1835. @item
  1836. Drop everything except the second minute of input:
  1837. @example
  1838. ffmpeg -i INPUT -af atrim=60:120
  1839. @end example
  1840. @item
  1841. Keep only the first 1000 samples:
  1842. @example
  1843. ffmpeg -i INPUT -af atrim=end_sample=1000
  1844. @end example
  1845. @end itemize
  1846. @section bandpass
  1847. Apply a two-pole Butterworth band-pass filter with central
  1848. frequency @var{frequency}, and (3dB-point) band-width width.
  1849. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1850. instead of the default: constant 0dB peak gain.
  1851. The filter roll off at 6dB per octave (20dB per decade).
  1852. The filter accepts the following options:
  1853. @table @option
  1854. @item frequency, f
  1855. Set the filter's central frequency. Default is @code{3000}.
  1856. @item csg
  1857. Constant skirt gain if set to 1. Defaults to 0.
  1858. @item width_type, t
  1859. Set method to specify band-width of filter.
  1860. @table @option
  1861. @item h
  1862. Hz
  1863. @item q
  1864. Q-Factor
  1865. @item o
  1866. octave
  1867. @item s
  1868. slope
  1869. @item k
  1870. kHz
  1871. @end table
  1872. @item width, w
  1873. Specify the band-width of a filter in width_type units.
  1874. @item mix, m
  1875. How much to use filtered signal in output. Default is 1.
  1876. Range is between 0 and 1.
  1877. @item channels, c
  1878. Specify which channels to filter, by default all available are filtered.
  1879. @end table
  1880. @subsection Commands
  1881. This filter supports the following commands:
  1882. @table @option
  1883. @item frequency, f
  1884. Change bandpass frequency.
  1885. Syntax for the command is : "@var{frequency}"
  1886. @item width_type, t
  1887. Change bandpass width_type.
  1888. Syntax for the command is : "@var{width_type}"
  1889. @item width, w
  1890. Change bandpass width.
  1891. Syntax for the command is : "@var{width}"
  1892. @item mix, m
  1893. Change bandpass mix.
  1894. Syntax for the command is : "@var{mix}"
  1895. @end table
  1896. @section bandreject
  1897. Apply a two-pole Butterworth band-reject filter with central
  1898. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1899. The filter roll off at 6dB per octave (20dB per decade).
  1900. The filter accepts the following options:
  1901. @table @option
  1902. @item frequency, f
  1903. Set the filter's central frequency. Default is @code{3000}.
  1904. @item width_type, t
  1905. Set method to specify band-width of filter.
  1906. @table @option
  1907. @item h
  1908. Hz
  1909. @item q
  1910. Q-Factor
  1911. @item o
  1912. octave
  1913. @item s
  1914. slope
  1915. @item k
  1916. kHz
  1917. @end table
  1918. @item width, w
  1919. Specify the band-width of a filter in width_type units.
  1920. @item mix, m
  1921. How much to use filtered signal in output. Default is 1.
  1922. Range is between 0 and 1.
  1923. @item channels, c
  1924. Specify which channels to filter, by default all available are filtered.
  1925. @end table
  1926. @subsection Commands
  1927. This filter supports the following commands:
  1928. @table @option
  1929. @item frequency, f
  1930. Change bandreject frequency.
  1931. Syntax for the command is : "@var{frequency}"
  1932. @item width_type, t
  1933. Change bandreject width_type.
  1934. Syntax for the command is : "@var{width_type}"
  1935. @item width, w
  1936. Change bandreject width.
  1937. Syntax for the command is : "@var{width}"
  1938. @item mix, m
  1939. Change bandreject mix.
  1940. Syntax for the command is : "@var{mix}"
  1941. @end table
  1942. @section bass, lowshelf
  1943. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1944. shelving filter with a response similar to that of a standard
  1945. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1946. The filter accepts the following options:
  1947. @table @option
  1948. @item gain, g
  1949. Give the gain at 0 Hz. Its useful range is about -20
  1950. (for a large cut) to +20 (for a large boost).
  1951. Beware of clipping when using a positive gain.
  1952. @item frequency, f
  1953. Set the filter's central frequency and so can be used
  1954. to extend or reduce the frequency range to be boosted or cut.
  1955. The default value is @code{100} Hz.
  1956. @item width_type, t
  1957. Set method to specify band-width of filter.
  1958. @table @option
  1959. @item h
  1960. Hz
  1961. @item q
  1962. Q-Factor
  1963. @item o
  1964. octave
  1965. @item s
  1966. slope
  1967. @item k
  1968. kHz
  1969. @end table
  1970. @item width, w
  1971. Determine how steep is the filter's shelf transition.
  1972. @item mix, m
  1973. How much to use filtered signal in output. Default is 1.
  1974. Range is between 0 and 1.
  1975. @item channels, c
  1976. Specify which channels to filter, by default all available are filtered.
  1977. @end table
  1978. @subsection Commands
  1979. This filter supports the following commands:
  1980. @table @option
  1981. @item frequency, f
  1982. Change bass frequency.
  1983. Syntax for the command is : "@var{frequency}"
  1984. @item width_type, t
  1985. Change bass width_type.
  1986. Syntax for the command is : "@var{width_type}"
  1987. @item width, w
  1988. Change bass width.
  1989. Syntax for the command is : "@var{width}"
  1990. @item gain, g
  1991. Change bass gain.
  1992. Syntax for the command is : "@var{gain}"
  1993. @item mix, m
  1994. Change bass mix.
  1995. Syntax for the command is : "@var{mix}"
  1996. @end table
  1997. @section biquad
  1998. Apply a biquad IIR filter with the given coefficients.
  1999. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2000. are the numerator and denominator coefficients respectively.
  2001. and @var{channels}, @var{c} specify which channels to filter, by default all
  2002. available are filtered.
  2003. @subsection Commands
  2004. This filter supports the following commands:
  2005. @table @option
  2006. @item a0
  2007. @item a1
  2008. @item a2
  2009. @item b0
  2010. @item b1
  2011. @item b2
  2012. Change biquad parameter.
  2013. Syntax for the command is : "@var{value}"
  2014. @item mix, m
  2015. How much to use filtered signal in output. Default is 1.
  2016. Range is between 0 and 1.
  2017. @end table
  2018. @section bs2b
  2019. Bauer stereo to binaural transformation, which improves headphone listening of
  2020. stereo audio records.
  2021. To enable compilation of this filter you need to configure FFmpeg with
  2022. @code{--enable-libbs2b}.
  2023. It accepts the following parameters:
  2024. @table @option
  2025. @item profile
  2026. Pre-defined crossfeed level.
  2027. @table @option
  2028. @item default
  2029. Default level (fcut=700, feed=50).
  2030. @item cmoy
  2031. Chu Moy circuit (fcut=700, feed=60).
  2032. @item jmeier
  2033. Jan Meier circuit (fcut=650, feed=95).
  2034. @end table
  2035. @item fcut
  2036. Cut frequency (in Hz).
  2037. @item feed
  2038. Feed level (in Hz).
  2039. @end table
  2040. @section channelmap
  2041. Remap input channels to new locations.
  2042. It accepts the following parameters:
  2043. @table @option
  2044. @item map
  2045. Map channels from input to output. The argument is a '|'-separated list of
  2046. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2047. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2048. channel (e.g. FL for front left) or its index in the input channel layout.
  2049. @var{out_channel} is the name of the output channel or its index in the output
  2050. channel layout. If @var{out_channel} is not given then it is implicitly an
  2051. index, starting with zero and increasing by one for each mapping.
  2052. @item channel_layout
  2053. The channel layout of the output stream.
  2054. @end table
  2055. If no mapping is present, the filter will implicitly map input channels to
  2056. output channels, preserving indices.
  2057. @subsection Examples
  2058. @itemize
  2059. @item
  2060. For example, assuming a 5.1+downmix input MOV file,
  2061. @example
  2062. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2063. @end example
  2064. will create an output WAV file tagged as stereo from the downmix channels of
  2065. the input.
  2066. @item
  2067. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2068. @example
  2069. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2070. @end example
  2071. @end itemize
  2072. @section channelsplit
  2073. Split each channel from an input audio stream into a separate output stream.
  2074. It accepts the following parameters:
  2075. @table @option
  2076. @item channel_layout
  2077. The channel layout of the input stream. The default is "stereo".
  2078. @item channels
  2079. A channel layout describing the channels to be extracted as separate output streams
  2080. or "all" to extract each input channel as a separate stream. The default is "all".
  2081. Choosing channels not present in channel layout in the input will result in an error.
  2082. @end table
  2083. @subsection Examples
  2084. @itemize
  2085. @item
  2086. For example, assuming a stereo input MP3 file,
  2087. @example
  2088. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2089. @end example
  2090. will create an output Matroska file with two audio streams, one containing only
  2091. the left channel and the other the right channel.
  2092. @item
  2093. Split a 5.1 WAV file into per-channel files:
  2094. @example
  2095. ffmpeg -i in.wav -filter_complex
  2096. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2097. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2098. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2099. side_right.wav
  2100. @end example
  2101. @item
  2102. Extract only LFE from a 5.1 WAV file:
  2103. @example
  2104. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2105. -map '[LFE]' lfe.wav
  2106. @end example
  2107. @end itemize
  2108. @section chorus
  2109. Add a chorus effect to the audio.
  2110. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2111. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2112. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2113. The modulation depth defines the range the modulated delay is played before or after
  2114. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2115. sound tuned around the original one, like in a chorus where some vocals are slightly
  2116. off key.
  2117. It accepts the following parameters:
  2118. @table @option
  2119. @item in_gain
  2120. Set input gain. Default is 0.4.
  2121. @item out_gain
  2122. Set output gain. Default is 0.4.
  2123. @item delays
  2124. Set delays. A typical delay is around 40ms to 60ms.
  2125. @item decays
  2126. Set decays.
  2127. @item speeds
  2128. Set speeds.
  2129. @item depths
  2130. Set depths.
  2131. @end table
  2132. @subsection Examples
  2133. @itemize
  2134. @item
  2135. A single delay:
  2136. @example
  2137. chorus=0.7:0.9:55:0.4:0.25:2
  2138. @end example
  2139. @item
  2140. Two delays:
  2141. @example
  2142. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2143. @end example
  2144. @item
  2145. Fuller sounding chorus with three delays:
  2146. @example
  2147. 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
  2148. @end example
  2149. @end itemize
  2150. @section compand
  2151. Compress or expand the audio's dynamic range.
  2152. It accepts the following parameters:
  2153. @table @option
  2154. @item attacks
  2155. @item decays
  2156. A list of times in seconds for each channel over which the instantaneous level
  2157. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2158. increase of volume and @var{decays} refers to decrease of volume. For most
  2159. situations, the attack time (response to the audio getting louder) should be
  2160. shorter than the decay time, because the human ear is more sensitive to sudden
  2161. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2162. a typical value for decay is 0.8 seconds.
  2163. If specified number of attacks & decays is lower than number of channels, the last
  2164. set attack/decay will be used for all remaining channels.
  2165. @item points
  2166. A list of points for the transfer function, specified in dB relative to the
  2167. maximum possible signal amplitude. Each key points list must be defined using
  2168. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2169. @code{x0/y0 x1/y1 x2/y2 ....}
  2170. The input values must be in strictly increasing order but the transfer function
  2171. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2172. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2173. function are @code{-70/-70|-60/-20|1/0}.
  2174. @item soft-knee
  2175. Set the curve radius in dB for all joints. It defaults to 0.01.
  2176. @item gain
  2177. Set the additional gain in dB to be applied at all points on the transfer
  2178. function. This allows for easy adjustment of the overall gain.
  2179. It defaults to 0.
  2180. @item volume
  2181. Set an initial volume, in dB, to be assumed for each channel when filtering
  2182. starts. This permits the user to supply a nominal level initially, so that, for
  2183. example, a very large gain is not applied to initial signal levels before the
  2184. companding has begun to operate. A typical value for audio which is initially
  2185. quiet is -90 dB. It defaults to 0.
  2186. @item delay
  2187. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2188. delayed before being fed to the volume adjuster. Specifying a delay
  2189. approximately equal to the attack/decay times allows the filter to effectively
  2190. operate in predictive rather than reactive mode. It defaults to 0.
  2191. @end table
  2192. @subsection Examples
  2193. @itemize
  2194. @item
  2195. Make music with both quiet and loud passages suitable for listening to in a
  2196. noisy environment:
  2197. @example
  2198. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2199. @end example
  2200. Another example for audio with whisper and explosion parts:
  2201. @example
  2202. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2203. @end example
  2204. @item
  2205. A noise gate for when the noise is at a lower level than the signal:
  2206. @example
  2207. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2208. @end example
  2209. @item
  2210. Here is another noise gate, this time for when the noise is at a higher level
  2211. than the signal (making it, in some ways, similar to squelch):
  2212. @example
  2213. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2214. @end example
  2215. @item
  2216. 2:1 compression starting at -6dB:
  2217. @example
  2218. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2219. @end example
  2220. @item
  2221. 2:1 compression starting at -9dB:
  2222. @example
  2223. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2224. @end example
  2225. @item
  2226. 2:1 compression starting at -12dB:
  2227. @example
  2228. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2229. @end example
  2230. @item
  2231. 2:1 compression starting at -18dB:
  2232. @example
  2233. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2234. @end example
  2235. @item
  2236. 3:1 compression starting at -15dB:
  2237. @example
  2238. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2239. @end example
  2240. @item
  2241. Compressor/Gate:
  2242. @example
  2243. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2244. @end example
  2245. @item
  2246. Expander:
  2247. @example
  2248. 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
  2249. @end example
  2250. @item
  2251. Hard limiter at -6dB:
  2252. @example
  2253. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2254. @end example
  2255. @item
  2256. Hard limiter at -12dB:
  2257. @example
  2258. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2259. @end example
  2260. @item
  2261. Hard noise gate at -35 dB:
  2262. @example
  2263. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2264. @end example
  2265. @item
  2266. Soft limiter:
  2267. @example
  2268. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2269. @end example
  2270. @end itemize
  2271. @section compensationdelay
  2272. Compensation Delay Line is a metric based delay to compensate differing
  2273. positions of microphones or speakers.
  2274. For example, you have recorded guitar with two microphones placed in
  2275. different location. Because the front of sound wave has fixed speed in
  2276. normal conditions, the phasing of microphones can vary and depends on
  2277. their location and interposition. The best sound mix can be achieved when
  2278. these microphones are in phase (synchronized). Note that distance of
  2279. ~30 cm between microphones makes one microphone to capture signal in
  2280. antiphase to another microphone. That makes the final mix sounding moody.
  2281. This filter helps to solve phasing problems by adding different delays
  2282. to each microphone track and make them synchronized.
  2283. The best result can be reached when you take one track as base and
  2284. synchronize other tracks one by one with it.
  2285. Remember that synchronization/delay tolerance depends on sample rate, too.
  2286. Higher sample rates will give more tolerance.
  2287. It accepts the following parameters:
  2288. @table @option
  2289. @item mm
  2290. Set millimeters distance. This is compensation distance for fine tuning.
  2291. Default is 0.
  2292. @item cm
  2293. Set cm distance. This is compensation distance for tightening distance setup.
  2294. Default is 0.
  2295. @item m
  2296. Set meters distance. This is compensation distance for hard distance setup.
  2297. Default is 0.
  2298. @item dry
  2299. Set dry amount. Amount of unprocessed (dry) signal.
  2300. Default is 0.
  2301. @item wet
  2302. Set wet amount. Amount of processed (wet) signal.
  2303. Default is 1.
  2304. @item temp
  2305. Set temperature degree in Celsius. This is the temperature of the environment.
  2306. Default is 20.
  2307. @end table
  2308. @section crossfeed
  2309. Apply headphone crossfeed filter.
  2310. Crossfeed is the process of blending the left and right channels of stereo
  2311. audio recording.
  2312. It is mainly used to reduce extreme stereo separation of low frequencies.
  2313. The intent is to produce more speaker like sound to the listener.
  2314. The filter accepts the following options:
  2315. @table @option
  2316. @item strength
  2317. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2318. This sets gain of low shelf filter for side part of stereo image.
  2319. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2320. @item range
  2321. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2322. This sets cut off frequency of low shelf filter. Default is cut off near
  2323. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2324. @item level_in
  2325. Set input gain. Default is 0.9.
  2326. @item level_out
  2327. Set output gain. Default is 1.
  2328. @end table
  2329. @section crystalizer
  2330. Simple algorithm to expand audio dynamic range.
  2331. The filter accepts the following options:
  2332. @table @option
  2333. @item i
  2334. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2335. (unchanged sound) to 10.0 (maximum effect).
  2336. @item c
  2337. Enable clipping. By default is enabled.
  2338. @end table
  2339. @section dcshift
  2340. Apply a DC shift to the audio.
  2341. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2342. in the recording chain) from the audio. The effect of a DC offset is reduced
  2343. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2344. a signal has a DC offset.
  2345. @table @option
  2346. @item shift
  2347. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2348. the audio.
  2349. @item limitergain
  2350. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2351. used to prevent clipping.
  2352. @end table
  2353. @section deesser
  2354. Apply de-essing to the audio samples.
  2355. @table @option
  2356. @item i
  2357. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2358. Default is 0.
  2359. @item m
  2360. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2361. Default is 0.5.
  2362. @item f
  2363. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2364. Default is 0.5.
  2365. @item s
  2366. Set the output mode.
  2367. It accepts the following values:
  2368. @table @option
  2369. @item i
  2370. Pass input unchanged.
  2371. @item o
  2372. Pass ess filtered out.
  2373. @item e
  2374. Pass only ess.
  2375. Default value is @var{o}.
  2376. @end table
  2377. @end table
  2378. @section drmeter
  2379. Measure audio dynamic range.
  2380. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2381. is found in transition material. And anything less that 8 have very poor dynamics
  2382. and is very compressed.
  2383. The filter accepts the following options:
  2384. @table @option
  2385. @item length
  2386. Set window length in seconds used to split audio into segments of equal length.
  2387. Default is 3 seconds.
  2388. @end table
  2389. @section dynaudnorm
  2390. Dynamic Audio Normalizer.
  2391. This filter applies a certain amount of gain to the input audio in order
  2392. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2393. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2394. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2395. This allows for applying extra gain to the "quiet" sections of the audio
  2396. while avoiding distortions or clipping the "loud" sections. In other words:
  2397. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2398. sections, in the sense that the volume of each section is brought to the
  2399. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2400. this goal *without* applying "dynamic range compressing". It will retain 100%
  2401. of the dynamic range *within* each section of the audio file.
  2402. @table @option
  2403. @item framelen, f
  2404. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2405. Default is 500 milliseconds.
  2406. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2407. referred to as frames. This is required, because a peak magnitude has no
  2408. meaning for just a single sample value. Instead, we need to determine the
  2409. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2410. normalizer would simply use the peak magnitude of the complete file, the
  2411. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2412. frame. The length of a frame is specified in milliseconds. By default, the
  2413. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2414. been found to give good results with most files.
  2415. Note that the exact frame length, in number of samples, will be determined
  2416. automatically, based on the sampling rate of the individual input audio file.
  2417. @item gausssize, g
  2418. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2419. number. Default is 31.
  2420. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2421. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2422. is specified in frames, centered around the current frame. For the sake of
  2423. simplicity, this must be an odd number. Consequently, the default value of 31
  2424. takes into account the current frame, as well as the 15 preceding frames and
  2425. the 15 subsequent frames. Using a larger window results in a stronger
  2426. smoothing effect and thus in less gain variation, i.e. slower gain
  2427. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2428. effect and thus in more gain variation, i.e. faster gain adaptation.
  2429. In other words, the more you increase this value, the more the Dynamic Audio
  2430. Normalizer will behave like a "traditional" normalization filter. On the
  2431. contrary, the more you decrease this value, the more the Dynamic Audio
  2432. Normalizer will behave like a dynamic range compressor.
  2433. @item peak, p
  2434. Set the target peak value. This specifies the highest permissible magnitude
  2435. level for the normalized audio input. This filter will try to approach the
  2436. target peak magnitude as closely as possible, but at the same time it also
  2437. makes sure that the normalized signal will never exceed the peak magnitude.
  2438. A frame's maximum local gain factor is imposed directly by the target peak
  2439. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2440. It is not recommended to go above this value.
  2441. @item maxgain, m
  2442. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2443. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2444. factor for each input frame, i.e. the maximum gain factor that does not
  2445. result in clipping or distortion. The maximum gain factor is determined by
  2446. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2447. additionally bounds the frame's maximum gain factor by a predetermined
  2448. (global) maximum gain factor. This is done in order to avoid excessive gain
  2449. factors in "silent" or almost silent frames. By default, the maximum gain
  2450. factor is 10.0, For most inputs the default value should be sufficient and
  2451. it usually is not recommended to increase this value. Though, for input
  2452. with an extremely low overall volume level, it may be necessary to allow even
  2453. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2454. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2455. Instead, a "sigmoid" threshold function will be applied. This way, the
  2456. gain factors will smoothly approach the threshold value, but never exceed that
  2457. value.
  2458. @item targetrms, r
  2459. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2460. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2461. This means that the maximum local gain factor for each frame is defined
  2462. (only) by the frame's highest magnitude sample. This way, the samples can
  2463. be amplified as much as possible without exceeding the maximum signal
  2464. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2465. Normalizer can also take into account the frame's root mean square,
  2466. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2467. determine the power of a time-varying signal. It is therefore considered
  2468. that the RMS is a better approximation of the "perceived loudness" than
  2469. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2470. frames to a constant RMS value, a uniform "perceived loudness" can be
  2471. established. If a target RMS value has been specified, a frame's local gain
  2472. factor is defined as the factor that would result in exactly that RMS value.
  2473. Note, however, that the maximum local gain factor is still restricted by the
  2474. frame's highest magnitude sample, in order to prevent clipping.
  2475. @item coupling, n
  2476. Enable channels coupling. By default is enabled.
  2477. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2478. amount. This means the same gain factor will be applied to all channels, i.e.
  2479. the maximum possible gain factor is determined by the "loudest" channel.
  2480. However, in some recordings, it may happen that the volume of the different
  2481. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2482. In this case, this option can be used to disable the channel coupling. This way,
  2483. the gain factor will be determined independently for each channel, depending
  2484. only on the individual channel's highest magnitude sample. This allows for
  2485. harmonizing the volume of the different channels.
  2486. @item correctdc, c
  2487. Enable DC bias correction. By default is disabled.
  2488. An audio signal (in the time domain) is a sequence of sample values.
  2489. In the Dynamic Audio Normalizer these sample values are represented in the
  2490. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2491. audio signal, or "waveform", should be centered around the zero point.
  2492. That means if we calculate the mean value of all samples in a file, or in a
  2493. single frame, then the result should be 0.0 or at least very close to that
  2494. value. If, however, there is a significant deviation of the mean value from
  2495. 0.0, in either positive or negative direction, this is referred to as a
  2496. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2497. Audio Normalizer provides optional DC bias correction.
  2498. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2499. the mean value, or "DC correction" offset, of each input frame and subtract
  2500. that value from all of the frame's sample values which ensures those samples
  2501. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2502. boundaries, the DC correction offset values will be interpolated smoothly
  2503. between neighbouring frames.
  2504. @item altboundary, b
  2505. Enable alternative boundary mode. By default is disabled.
  2506. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2507. around each frame. This includes the preceding frames as well as the
  2508. subsequent frames. However, for the "boundary" frames, located at the very
  2509. beginning and at the very end of the audio file, not all neighbouring
  2510. frames are available. In particular, for the first few frames in the audio
  2511. file, the preceding frames are not known. And, similarly, for the last few
  2512. frames in the audio file, the subsequent frames are not known. Thus, the
  2513. question arises which gain factors should be assumed for the missing frames
  2514. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2515. to deal with this situation. The default boundary mode assumes a gain factor
  2516. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2517. "fade out" at the beginning and at the end of the input, respectively.
  2518. @item compress, s
  2519. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2520. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2521. compression. This means that signal peaks will not be pruned and thus the
  2522. full dynamic range will be retained within each local neighbourhood. However,
  2523. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2524. normalization algorithm with a more "traditional" compression.
  2525. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2526. (thresholding) function. If (and only if) the compression feature is enabled,
  2527. all input frames will be processed by a soft knee thresholding function prior
  2528. to the actual normalization process. Put simply, the thresholding function is
  2529. going to prune all samples whose magnitude exceeds a certain threshold value.
  2530. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2531. value. Instead, the threshold value will be adjusted for each individual
  2532. frame.
  2533. In general, smaller parameters result in stronger compression, and vice versa.
  2534. Values below 3.0 are not recommended, because audible distortion may appear.
  2535. @end table
  2536. @section earwax
  2537. Make audio easier to listen to on headphones.
  2538. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2539. so that when listened to on headphones the stereo image is moved from
  2540. inside your head (standard for headphones) to outside and in front of
  2541. the listener (standard for speakers).
  2542. Ported from SoX.
  2543. @section equalizer
  2544. Apply a two-pole peaking equalisation (EQ) filter. With this
  2545. filter, the signal-level at and around a selected frequency can
  2546. be increased or decreased, whilst (unlike bandpass and bandreject
  2547. filters) that at all other frequencies is unchanged.
  2548. In order to produce complex equalisation curves, this filter can
  2549. be given several times, each with a different central frequency.
  2550. The filter accepts the following options:
  2551. @table @option
  2552. @item frequency, f
  2553. Set the filter's central frequency in Hz.
  2554. @item width_type, t
  2555. Set method to specify band-width of filter.
  2556. @table @option
  2557. @item h
  2558. Hz
  2559. @item q
  2560. Q-Factor
  2561. @item o
  2562. octave
  2563. @item s
  2564. slope
  2565. @item k
  2566. kHz
  2567. @end table
  2568. @item width, w
  2569. Specify the band-width of a filter in width_type units.
  2570. @item gain, g
  2571. Set the required gain or attenuation in dB.
  2572. Beware of clipping when using a positive gain.
  2573. @item mix, m
  2574. How much to use filtered signal in output. Default is 1.
  2575. Range is between 0 and 1.
  2576. @item channels, c
  2577. Specify which channels to filter, by default all available are filtered.
  2578. @end table
  2579. @subsection Examples
  2580. @itemize
  2581. @item
  2582. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2583. @example
  2584. equalizer=f=1000:t=h:width=200:g=-10
  2585. @end example
  2586. @item
  2587. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2588. @example
  2589. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2590. @end example
  2591. @end itemize
  2592. @subsection Commands
  2593. This filter supports the following commands:
  2594. @table @option
  2595. @item frequency, f
  2596. Change equalizer frequency.
  2597. Syntax for the command is : "@var{frequency}"
  2598. @item width_type, t
  2599. Change equalizer width_type.
  2600. Syntax for the command is : "@var{width_type}"
  2601. @item width, w
  2602. Change equalizer width.
  2603. Syntax for the command is : "@var{width}"
  2604. @item gain, g
  2605. Change equalizer gain.
  2606. Syntax for the command is : "@var{gain}"
  2607. @item mix, m
  2608. Change equalizer mix.
  2609. Syntax for the command is : "@var{mix}"
  2610. @end table
  2611. @section extrastereo
  2612. Linearly increases the difference between left and right channels which
  2613. adds some sort of "live" effect to playback.
  2614. The filter accepts the following options:
  2615. @table @option
  2616. @item m
  2617. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2618. (average of both channels), with 1.0 sound will be unchanged, with
  2619. -1.0 left and right channels will be swapped.
  2620. @item c
  2621. Enable clipping. By default is enabled.
  2622. @end table
  2623. @section firequalizer
  2624. Apply FIR Equalization using arbitrary frequency response.
  2625. The filter accepts the following option:
  2626. @table @option
  2627. @item gain
  2628. Set gain curve equation (in dB). The expression can contain variables:
  2629. @table @option
  2630. @item f
  2631. the evaluated frequency
  2632. @item sr
  2633. sample rate
  2634. @item ch
  2635. channel number, set to 0 when multichannels evaluation is disabled
  2636. @item chid
  2637. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2638. multichannels evaluation is disabled
  2639. @item chs
  2640. number of channels
  2641. @item chlayout
  2642. channel_layout, see libavutil/channel_layout.h
  2643. @end table
  2644. and functions:
  2645. @table @option
  2646. @item gain_interpolate(f)
  2647. interpolate gain on frequency f based on gain_entry
  2648. @item cubic_interpolate(f)
  2649. same as gain_interpolate, but smoother
  2650. @end table
  2651. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2652. @item gain_entry
  2653. Set gain entry for gain_interpolate function. The expression can
  2654. contain functions:
  2655. @table @option
  2656. @item entry(f, g)
  2657. store gain entry at frequency f with value g
  2658. @end table
  2659. This option is also available as command.
  2660. @item delay
  2661. Set filter delay in seconds. Higher value means more accurate.
  2662. Default is @code{0.01}.
  2663. @item accuracy
  2664. Set filter accuracy in Hz. Lower value means more accurate.
  2665. Default is @code{5}.
  2666. @item wfunc
  2667. Set window function. Acceptable values are:
  2668. @table @option
  2669. @item rectangular
  2670. rectangular window, useful when gain curve is already smooth
  2671. @item hann
  2672. hann window (default)
  2673. @item hamming
  2674. hamming window
  2675. @item blackman
  2676. blackman window
  2677. @item nuttall3
  2678. 3-terms continuous 1st derivative nuttall window
  2679. @item mnuttall3
  2680. minimum 3-terms discontinuous nuttall window
  2681. @item nuttall
  2682. 4-terms continuous 1st derivative nuttall window
  2683. @item bnuttall
  2684. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2685. @item bharris
  2686. blackman-harris window
  2687. @item tukey
  2688. tukey window
  2689. @end table
  2690. @item fixed
  2691. If enabled, use fixed number of audio samples. This improves speed when
  2692. filtering with large delay. Default is disabled.
  2693. @item multi
  2694. Enable multichannels evaluation on gain. Default is disabled.
  2695. @item zero_phase
  2696. Enable zero phase mode by subtracting timestamp to compensate delay.
  2697. Default is disabled.
  2698. @item scale
  2699. Set scale used by gain. Acceptable values are:
  2700. @table @option
  2701. @item linlin
  2702. linear frequency, linear gain
  2703. @item linlog
  2704. linear frequency, logarithmic (in dB) gain (default)
  2705. @item loglin
  2706. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2707. @item loglog
  2708. logarithmic frequency, logarithmic gain
  2709. @end table
  2710. @item dumpfile
  2711. Set file for dumping, suitable for gnuplot.
  2712. @item dumpscale
  2713. Set scale for dumpfile. Acceptable values are same with scale option.
  2714. Default is linlog.
  2715. @item fft2
  2716. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2717. Default is disabled.
  2718. @item min_phase
  2719. Enable minimum phase impulse response. Default is disabled.
  2720. @end table
  2721. @subsection Examples
  2722. @itemize
  2723. @item
  2724. lowpass at 1000 Hz:
  2725. @example
  2726. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2727. @end example
  2728. @item
  2729. lowpass at 1000 Hz with gain_entry:
  2730. @example
  2731. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2732. @end example
  2733. @item
  2734. custom equalization:
  2735. @example
  2736. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2737. @end example
  2738. @item
  2739. higher delay with zero phase to compensate delay:
  2740. @example
  2741. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2742. @end example
  2743. @item
  2744. lowpass on left channel, highpass on right channel:
  2745. @example
  2746. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2747. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2748. @end example
  2749. @end itemize
  2750. @section flanger
  2751. Apply a flanging effect to the audio.
  2752. The filter accepts the following options:
  2753. @table @option
  2754. @item delay
  2755. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2756. @item depth
  2757. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2758. @item regen
  2759. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2760. Default value is 0.
  2761. @item width
  2762. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2763. Default value is 71.
  2764. @item speed
  2765. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2766. @item shape
  2767. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2768. Default value is @var{sinusoidal}.
  2769. @item phase
  2770. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2771. Default value is 25.
  2772. @item interp
  2773. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2774. Default is @var{linear}.
  2775. @end table
  2776. @section haas
  2777. Apply Haas effect to audio.
  2778. Note that this makes most sense to apply on mono signals.
  2779. With this filter applied to mono signals it give some directionality and
  2780. stretches its stereo image.
  2781. The filter accepts the following options:
  2782. @table @option
  2783. @item level_in
  2784. Set input level. By default is @var{1}, or 0dB
  2785. @item level_out
  2786. Set output level. By default is @var{1}, or 0dB.
  2787. @item side_gain
  2788. Set gain applied to side part of signal. By default is @var{1}.
  2789. @item middle_source
  2790. Set kind of middle source. Can be one of the following:
  2791. @table @samp
  2792. @item left
  2793. Pick left channel.
  2794. @item right
  2795. Pick right channel.
  2796. @item mid
  2797. Pick middle part signal of stereo image.
  2798. @item side
  2799. Pick side part signal of stereo image.
  2800. @end table
  2801. @item middle_phase
  2802. Change middle phase. By default is disabled.
  2803. @item left_delay
  2804. Set left channel delay. By default is @var{2.05} milliseconds.
  2805. @item left_balance
  2806. Set left channel balance. By default is @var{-1}.
  2807. @item left_gain
  2808. Set left channel gain. By default is @var{1}.
  2809. @item left_phase
  2810. Change left phase. By default is disabled.
  2811. @item right_delay
  2812. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2813. @item right_balance
  2814. Set right channel balance. By default is @var{1}.
  2815. @item right_gain
  2816. Set right channel gain. By default is @var{1}.
  2817. @item right_phase
  2818. Change right phase. By default is enabled.
  2819. @end table
  2820. @section hdcd
  2821. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2822. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2823. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2824. of HDCD, and detects the Transient Filter flag.
  2825. @example
  2826. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2827. @end example
  2828. When using the filter with wav, note the default encoding for wav is 16-bit,
  2829. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2830. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2831. @example
  2832. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2833. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2834. @end example
  2835. The filter accepts the following options:
  2836. @table @option
  2837. @item disable_autoconvert
  2838. Disable any automatic format conversion or resampling in the filter graph.
  2839. @item process_stereo
  2840. Process the stereo channels together. If target_gain does not match between
  2841. channels, consider it invalid and use the last valid target_gain.
  2842. @item cdt_ms
  2843. Set the code detect timer period in ms.
  2844. @item force_pe
  2845. Always extend peaks above -3dBFS even if PE isn't signaled.
  2846. @item analyze_mode
  2847. Replace audio with a solid tone and adjust the amplitude to signal some
  2848. specific aspect of the decoding process. The output file can be loaded in
  2849. an audio editor alongside the original to aid analysis.
  2850. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2851. Modes are:
  2852. @table @samp
  2853. @item 0, off
  2854. Disabled
  2855. @item 1, lle
  2856. Gain adjustment level at each sample
  2857. @item 2, pe
  2858. Samples where peak extend occurs
  2859. @item 3, cdt
  2860. Samples where the code detect timer is active
  2861. @item 4, tgm
  2862. Samples where the target gain does not match between channels
  2863. @end table
  2864. @end table
  2865. @section headphone
  2866. Apply head-related transfer functions (HRTFs) to create virtual
  2867. loudspeakers around the user for binaural listening via headphones.
  2868. The HRIRs are provided via additional streams, for each channel
  2869. one stereo input stream is needed.
  2870. The filter accepts the following options:
  2871. @table @option
  2872. @item map
  2873. Set mapping of input streams for convolution.
  2874. The argument is a '|'-separated list of channel names in order as they
  2875. are given as additional stream inputs for filter.
  2876. This also specify number of input streams. Number of input streams
  2877. must be not less than number of channels in first stream plus one.
  2878. @item gain
  2879. Set gain applied to audio. Value is in dB. Default is 0.
  2880. @item type
  2881. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2882. processing audio in time domain which is slow.
  2883. @var{freq} is processing audio in frequency domain which is fast.
  2884. Default is @var{freq}.
  2885. @item lfe
  2886. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2887. @item size
  2888. Set size of frame in number of samples which will be processed at once.
  2889. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2890. @item hrir
  2891. Set format of hrir stream.
  2892. Default value is @var{stereo}. Alternative value is @var{multich}.
  2893. If value is set to @var{stereo}, number of additional streams should
  2894. be greater or equal to number of input channels in first input stream.
  2895. Also each additional stream should have stereo number of channels.
  2896. If value is set to @var{multich}, number of additional streams should
  2897. be exactly one. Also number of input channels of additional stream
  2898. should be equal or greater than twice number of channels of first input
  2899. stream.
  2900. @end table
  2901. @subsection Examples
  2902. @itemize
  2903. @item
  2904. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2905. each amovie filter use stereo file with IR coefficients as input.
  2906. The files give coefficients for each position of virtual loudspeaker:
  2907. @example
  2908. ffmpeg -i input.wav
  2909. -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"
  2910. output.wav
  2911. @end example
  2912. @item
  2913. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2914. but now in @var{multich} @var{hrir} format.
  2915. @example
  2916. 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"
  2917. output.wav
  2918. @end example
  2919. @end itemize
  2920. @section highpass
  2921. Apply a high-pass filter with 3dB point frequency.
  2922. The filter can be either single-pole, or double-pole (the default).
  2923. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2924. The filter accepts the following options:
  2925. @table @option
  2926. @item frequency, f
  2927. Set frequency in Hz. Default is 3000.
  2928. @item poles, p
  2929. Set number of poles. Default is 2.
  2930. @item width_type, t
  2931. Set method to specify band-width of filter.
  2932. @table @option
  2933. @item h
  2934. Hz
  2935. @item q
  2936. Q-Factor
  2937. @item o
  2938. octave
  2939. @item s
  2940. slope
  2941. @item k
  2942. kHz
  2943. @end table
  2944. @item width, w
  2945. Specify the band-width of a filter in width_type units.
  2946. Applies only to double-pole filter.
  2947. The default is 0.707q and gives a Butterworth response.
  2948. @item mix, m
  2949. How much to use filtered signal in output. Default is 1.
  2950. Range is between 0 and 1.
  2951. @item channels, c
  2952. Specify which channels to filter, by default all available are filtered.
  2953. @end table
  2954. @subsection Commands
  2955. This filter supports the following commands:
  2956. @table @option
  2957. @item frequency, f
  2958. Change highpass frequency.
  2959. Syntax for the command is : "@var{frequency}"
  2960. @item width_type, t
  2961. Change highpass width_type.
  2962. Syntax for the command is : "@var{width_type}"
  2963. @item width, w
  2964. Change highpass width.
  2965. Syntax for the command is : "@var{width}"
  2966. @item mix, m
  2967. Change highpass mix.
  2968. Syntax for the command is : "@var{mix}"
  2969. @end table
  2970. @section join
  2971. Join multiple input streams into one multi-channel stream.
  2972. It accepts the following parameters:
  2973. @table @option
  2974. @item inputs
  2975. The number of input streams. It defaults to 2.
  2976. @item channel_layout
  2977. The desired output channel layout. It defaults to stereo.
  2978. @item map
  2979. Map channels from inputs to output. The argument is a '|'-separated list of
  2980. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2981. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2982. can be either the name of the input channel (e.g. FL for front left) or its
  2983. index in the specified input stream. @var{out_channel} is the name of the output
  2984. channel.
  2985. @end table
  2986. The filter will attempt to guess the mappings when they are not specified
  2987. explicitly. It does so by first trying to find an unused matching input channel
  2988. and if that fails it picks the first unused input channel.
  2989. Join 3 inputs (with properly set channel layouts):
  2990. @example
  2991. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2992. @end example
  2993. Build a 5.1 output from 6 single-channel streams:
  2994. @example
  2995. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2996. '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'
  2997. out
  2998. @end example
  2999. @section ladspa
  3000. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3001. To enable compilation of this filter you need to configure FFmpeg with
  3002. @code{--enable-ladspa}.
  3003. @table @option
  3004. @item file, f
  3005. Specifies the name of LADSPA plugin library to load. If the environment
  3006. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3007. each one of the directories specified by the colon separated list in
  3008. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3009. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3010. @file{/usr/lib/ladspa/}.
  3011. @item plugin, p
  3012. Specifies the plugin within the library. Some libraries contain only
  3013. one plugin, but others contain many of them. If this is not set filter
  3014. will list all available plugins within the specified library.
  3015. @item controls, c
  3016. Set the '|' separated list of controls which are zero or more floating point
  3017. values that determine the behavior of the loaded plugin (for example delay,
  3018. threshold or gain).
  3019. Controls need to be defined using the following syntax:
  3020. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3021. @var{valuei} is the value set on the @var{i}-th control.
  3022. Alternatively they can be also defined using the following syntax:
  3023. @var{value0}|@var{value1}|@var{value2}|..., where
  3024. @var{valuei} is the value set on the @var{i}-th control.
  3025. If @option{controls} is set to @code{help}, all available controls and
  3026. their valid ranges are printed.
  3027. @item sample_rate, s
  3028. Specify the sample rate, default to 44100. Only used if plugin have
  3029. zero inputs.
  3030. @item nb_samples, n
  3031. Set the number of samples per channel per each output frame, default
  3032. is 1024. Only used if plugin have zero inputs.
  3033. @item duration, d
  3034. Set the minimum duration of the sourced audio. See
  3035. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3036. for the accepted syntax.
  3037. Note that the resulting duration may be greater than the specified duration,
  3038. as the generated audio is always cut at the end of a complete frame.
  3039. If not specified, or the expressed duration is negative, the audio is
  3040. supposed to be generated forever.
  3041. Only used if plugin have zero inputs.
  3042. @end table
  3043. @subsection Examples
  3044. @itemize
  3045. @item
  3046. List all available plugins within amp (LADSPA example plugin) library:
  3047. @example
  3048. ladspa=file=amp
  3049. @end example
  3050. @item
  3051. List all available controls and their valid ranges for @code{vcf_notch}
  3052. plugin from @code{VCF} library:
  3053. @example
  3054. ladspa=f=vcf:p=vcf_notch:c=help
  3055. @end example
  3056. @item
  3057. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3058. plugin library:
  3059. @example
  3060. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3061. @end example
  3062. @item
  3063. Add reverberation to the audio using TAP-plugins
  3064. (Tom's Audio Processing plugins):
  3065. @example
  3066. ladspa=file=tap_reverb:tap_reverb
  3067. @end example
  3068. @item
  3069. Generate white noise, with 0.2 amplitude:
  3070. @example
  3071. ladspa=file=cmt:noise_source_white:c=c0=.2
  3072. @end example
  3073. @item
  3074. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3075. @code{C* Audio Plugin Suite} (CAPS) library:
  3076. @example
  3077. ladspa=file=caps:Click:c=c1=20'
  3078. @end example
  3079. @item
  3080. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3081. @example
  3082. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3083. @end example
  3084. @item
  3085. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3086. @code{SWH Plugins} collection:
  3087. @example
  3088. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3089. @end example
  3090. @item
  3091. Attenuate low frequencies using Multiband EQ from Steve Harris
  3092. @code{SWH Plugins} collection:
  3093. @example
  3094. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3095. @end example
  3096. @item
  3097. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3098. (CAPS) library:
  3099. @example
  3100. ladspa=caps:Narrower
  3101. @end example
  3102. @item
  3103. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3104. @example
  3105. ladspa=caps:White:.2
  3106. @end example
  3107. @item
  3108. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3109. @example
  3110. ladspa=caps:Fractal:c=c1=1
  3111. @end example
  3112. @item
  3113. Dynamic volume normalization using @code{VLevel} plugin:
  3114. @example
  3115. ladspa=vlevel-ladspa:vlevel_mono
  3116. @end example
  3117. @end itemize
  3118. @subsection Commands
  3119. This filter supports the following commands:
  3120. @table @option
  3121. @item cN
  3122. Modify the @var{N}-th control value.
  3123. If the specified value is not valid, it is ignored and prior one is kept.
  3124. @end table
  3125. @section loudnorm
  3126. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3127. Support for both single pass (livestreams, files) and double pass (files) modes.
  3128. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3129. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3130. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3131. The filter accepts the following options:
  3132. @table @option
  3133. @item I, i
  3134. Set integrated loudness target.
  3135. Range is -70.0 - -5.0. Default value is -24.0.
  3136. @item LRA, lra
  3137. Set loudness range target.
  3138. Range is 1.0 - 20.0. Default value is 7.0.
  3139. @item TP, tp
  3140. Set maximum true peak.
  3141. Range is -9.0 - +0.0. Default value is -2.0.
  3142. @item measured_I, measured_i
  3143. Measured IL of input file.
  3144. Range is -99.0 - +0.0.
  3145. @item measured_LRA, measured_lra
  3146. Measured LRA of input file.
  3147. Range is 0.0 - 99.0.
  3148. @item measured_TP, measured_tp
  3149. Measured true peak of input file.
  3150. Range is -99.0 - +99.0.
  3151. @item measured_thresh
  3152. Measured threshold of input file.
  3153. Range is -99.0 - +0.0.
  3154. @item offset
  3155. Set offset gain. Gain is applied before the true-peak limiter.
  3156. Range is -99.0 - +99.0. Default is +0.0.
  3157. @item linear
  3158. Normalize linearly if possible.
  3159. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3160. to be specified in order to use this mode.
  3161. Options are true or false. Default is true.
  3162. @item dual_mono
  3163. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3164. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3165. If set to @code{true}, this option will compensate for this effect.
  3166. Multi-channel input files are not affected by this option.
  3167. Options are true or false. Default is false.
  3168. @item print_format
  3169. Set print format for stats. Options are summary, json, or none.
  3170. Default value is none.
  3171. @end table
  3172. @section lowpass
  3173. Apply a low-pass filter with 3dB point frequency.
  3174. The filter can be either single-pole or double-pole (the default).
  3175. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3176. The filter accepts the following options:
  3177. @table @option
  3178. @item frequency, f
  3179. Set frequency in Hz. Default is 500.
  3180. @item poles, p
  3181. Set number of poles. Default is 2.
  3182. @item width_type, t
  3183. Set method to specify band-width of filter.
  3184. @table @option
  3185. @item h
  3186. Hz
  3187. @item q
  3188. Q-Factor
  3189. @item o
  3190. octave
  3191. @item s
  3192. slope
  3193. @item k
  3194. kHz
  3195. @end table
  3196. @item width, w
  3197. Specify the band-width of a filter in width_type units.
  3198. Applies only to double-pole filter.
  3199. The default is 0.707q and gives a Butterworth response.
  3200. @item mix, m
  3201. How much to use filtered signal in output. Default is 1.
  3202. Range is between 0 and 1.
  3203. @item channels, c
  3204. Specify which channels to filter, by default all available are filtered.
  3205. @end table
  3206. @subsection Examples
  3207. @itemize
  3208. @item
  3209. Lowpass only LFE channel, it LFE is not present it does nothing:
  3210. @example
  3211. lowpass=c=LFE
  3212. @end example
  3213. @end itemize
  3214. @subsection Commands
  3215. This filter supports the following commands:
  3216. @table @option
  3217. @item frequency, f
  3218. Change lowpass frequency.
  3219. Syntax for the command is : "@var{frequency}"
  3220. @item width_type, t
  3221. Change lowpass width_type.
  3222. Syntax for the command is : "@var{width_type}"
  3223. @item width, w
  3224. Change lowpass width.
  3225. Syntax for the command is : "@var{width}"
  3226. @item mix, m
  3227. Change lowpass mix.
  3228. Syntax for the command is : "@var{mix}"
  3229. @end table
  3230. @section lv2
  3231. Load a LV2 (LADSPA Version 2) plugin.
  3232. To enable compilation of this filter you need to configure FFmpeg with
  3233. @code{--enable-lv2}.
  3234. @table @option
  3235. @item plugin, p
  3236. Specifies the plugin URI. You may need to escape ':'.
  3237. @item controls, c
  3238. Set the '|' separated list of controls which are zero or more floating point
  3239. values that determine the behavior of the loaded plugin (for example delay,
  3240. threshold or gain).
  3241. If @option{controls} is set to @code{help}, all available controls and
  3242. their valid ranges are printed.
  3243. @item sample_rate, s
  3244. Specify the sample rate, default to 44100. Only used if plugin have
  3245. zero inputs.
  3246. @item nb_samples, n
  3247. Set the number of samples per channel per each output frame, default
  3248. is 1024. Only used if plugin have zero inputs.
  3249. @item duration, d
  3250. Set the minimum duration of the sourced audio. See
  3251. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3252. for the accepted syntax.
  3253. Note that the resulting duration may be greater than the specified duration,
  3254. as the generated audio is always cut at the end of a complete frame.
  3255. If not specified, or the expressed duration is negative, the audio is
  3256. supposed to be generated forever.
  3257. Only used if plugin have zero inputs.
  3258. @end table
  3259. @subsection Examples
  3260. @itemize
  3261. @item
  3262. Apply bass enhancer plugin from Calf:
  3263. @example
  3264. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3265. @end example
  3266. @item
  3267. Apply vinyl plugin from Calf:
  3268. @example
  3269. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3270. @end example
  3271. @item
  3272. Apply bit crusher plugin from ArtyFX:
  3273. @example
  3274. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3275. @end example
  3276. @end itemize
  3277. @section mcompand
  3278. Multiband Compress or expand the audio's dynamic range.
  3279. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3280. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3281. response when absent compander action.
  3282. It accepts the following parameters:
  3283. @table @option
  3284. @item args
  3285. This option syntax is:
  3286. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3287. For explanation of each item refer to compand filter documentation.
  3288. @end table
  3289. @anchor{pan}
  3290. @section pan
  3291. Mix channels with specific gain levels. The filter accepts the output
  3292. channel layout followed by a set of channels definitions.
  3293. This filter is also designed to efficiently remap the channels of an audio
  3294. stream.
  3295. The filter accepts parameters of the form:
  3296. "@var{l}|@var{outdef}|@var{outdef}|..."
  3297. @table @option
  3298. @item l
  3299. output channel layout or number of channels
  3300. @item outdef
  3301. output channel specification, of the form:
  3302. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3303. @item out_name
  3304. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3305. number (c0, c1, etc.)
  3306. @item gain
  3307. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3308. @item in_name
  3309. input channel to use, see out_name for details; it is not possible to mix
  3310. named and numbered input channels
  3311. @end table
  3312. If the `=' in a channel specification is replaced by `<', then the gains for
  3313. that specification will be renormalized so that the total is 1, thus
  3314. avoiding clipping noise.
  3315. @subsection Mixing examples
  3316. For example, if you want to down-mix from stereo to mono, but with a bigger
  3317. factor for the left channel:
  3318. @example
  3319. pan=1c|c0=0.9*c0+0.1*c1
  3320. @end example
  3321. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3322. 7-channels surround:
  3323. @example
  3324. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3325. @end example
  3326. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3327. that should be preferred (see "-ac" option) unless you have very specific
  3328. needs.
  3329. @subsection Remapping examples
  3330. The channel remapping will be effective if, and only if:
  3331. @itemize
  3332. @item gain coefficients are zeroes or ones,
  3333. @item only one input per channel output,
  3334. @end itemize
  3335. If all these conditions are satisfied, the filter will notify the user ("Pure
  3336. channel mapping detected"), and use an optimized and lossless method to do the
  3337. remapping.
  3338. For example, if you have a 5.1 source and want a stereo audio stream by
  3339. dropping the extra channels:
  3340. @example
  3341. pan="stereo| c0=FL | c1=FR"
  3342. @end example
  3343. Given the same source, you can also switch front left and front right channels
  3344. and keep the input channel layout:
  3345. @example
  3346. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3347. @end example
  3348. If the input is a stereo audio stream, you can mute the front left channel (and
  3349. still keep the stereo channel layout) with:
  3350. @example
  3351. pan="stereo|c1=c1"
  3352. @end example
  3353. Still with a stereo audio stream input, you can copy the right channel in both
  3354. front left and right:
  3355. @example
  3356. pan="stereo| c0=FR | c1=FR"
  3357. @end example
  3358. @section replaygain
  3359. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3360. outputs it unchanged.
  3361. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3362. @section resample
  3363. Convert the audio sample format, sample rate and channel layout. It is
  3364. not meant to be used directly.
  3365. @section rubberband
  3366. Apply time-stretching and pitch-shifting with librubberband.
  3367. To enable compilation of this filter, you need to configure FFmpeg with
  3368. @code{--enable-librubberband}.
  3369. The filter accepts the following options:
  3370. @table @option
  3371. @item tempo
  3372. Set tempo scale factor.
  3373. @item pitch
  3374. Set pitch scale factor.
  3375. @item transients
  3376. Set transients detector.
  3377. Possible values are:
  3378. @table @var
  3379. @item crisp
  3380. @item mixed
  3381. @item smooth
  3382. @end table
  3383. @item detector
  3384. Set detector.
  3385. Possible values are:
  3386. @table @var
  3387. @item compound
  3388. @item percussive
  3389. @item soft
  3390. @end table
  3391. @item phase
  3392. Set phase.
  3393. Possible values are:
  3394. @table @var
  3395. @item laminar
  3396. @item independent
  3397. @end table
  3398. @item window
  3399. Set processing window size.
  3400. Possible values are:
  3401. @table @var
  3402. @item standard
  3403. @item short
  3404. @item long
  3405. @end table
  3406. @item smoothing
  3407. Set smoothing.
  3408. Possible values are:
  3409. @table @var
  3410. @item off
  3411. @item on
  3412. @end table
  3413. @item formant
  3414. Enable formant preservation when shift pitching.
  3415. Possible values are:
  3416. @table @var
  3417. @item shifted
  3418. @item preserved
  3419. @end table
  3420. @item pitchq
  3421. Set pitch quality.
  3422. Possible values are:
  3423. @table @var
  3424. @item quality
  3425. @item speed
  3426. @item consistency
  3427. @end table
  3428. @item channels
  3429. Set channels.
  3430. Possible values are:
  3431. @table @var
  3432. @item apart
  3433. @item together
  3434. @end table
  3435. @end table
  3436. @section sidechaincompress
  3437. This filter acts like normal compressor but has the ability to compress
  3438. detected signal using second input signal.
  3439. It needs two input streams and returns one output stream.
  3440. First input stream will be processed depending on second stream signal.
  3441. The filtered signal then can be filtered with other filters in later stages of
  3442. processing. See @ref{pan} and @ref{amerge} filter.
  3443. The filter accepts the following options:
  3444. @table @option
  3445. @item level_in
  3446. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3447. @item mode
  3448. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3449. Default is @code{downward}.
  3450. @item threshold
  3451. If a signal of second stream raises above this level it will affect the gain
  3452. reduction of first stream.
  3453. By default is 0.125. Range is between 0.00097563 and 1.
  3454. @item ratio
  3455. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3456. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3457. Default is 2. Range is between 1 and 20.
  3458. @item attack
  3459. Amount of milliseconds the signal has to rise above the threshold before gain
  3460. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3461. @item release
  3462. Amount of milliseconds the signal has to fall below the threshold before
  3463. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3464. @item makeup
  3465. Set the amount by how much signal will be amplified after processing.
  3466. Default is 1. 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.82843. Range is between 1 and 8.
  3470. @item link
  3471. Choose if the @code{average} level between all channels of side-chain stream
  3472. or the louder(@code{maximum}) channel of side-chain stream affects the
  3473. reduction. Default is @code{average}.
  3474. @item detection
  3475. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3476. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3477. @item level_sc
  3478. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3479. @item mix
  3480. How much to use compressed signal in output. Default is 1.
  3481. Range is between 0 and 1.
  3482. @end table
  3483. @subsection Examples
  3484. @itemize
  3485. @item
  3486. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3487. depending on the signal of 2nd input and later compressed signal to be
  3488. merged with 2nd input:
  3489. @example
  3490. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3491. @end example
  3492. @end itemize
  3493. @section sidechaingate
  3494. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3495. filter the detected signal before sending it to the gain reduction stage.
  3496. Normally a gate uses the full range signal to detect a level above the
  3497. threshold.
  3498. For example: If you cut all lower frequencies from your sidechain signal
  3499. the gate will decrease the volume of your track only if not enough highs
  3500. appear. With this technique you are able to reduce the resonation of a
  3501. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3502. guitar.
  3503. It needs two input streams and returns one output stream.
  3504. First input stream will be processed depending on second stream signal.
  3505. The filter accepts the following options:
  3506. @table @option
  3507. @item level_in
  3508. Set input level before filtering.
  3509. Default is 1. Allowed range is from 0.015625 to 64.
  3510. @item mode
  3511. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3512. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3513. will be amplified, expanding dynamic range in upward direction.
  3514. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3515. @item range
  3516. Set the level of gain reduction when the signal is below the threshold.
  3517. Default is 0.06125. Allowed range is from 0 to 1.
  3518. Setting this to 0 disables reduction and then filter behaves like expander.
  3519. @item threshold
  3520. If a signal rises above this level the gain reduction is released.
  3521. Default is 0.125. Allowed range is from 0 to 1.
  3522. @item ratio
  3523. Set a ratio about which the signal is reduced.
  3524. Default is 2. Allowed range is from 1 to 9000.
  3525. @item attack
  3526. Amount of milliseconds the signal has to rise above the threshold before gain
  3527. reduction stops.
  3528. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3529. @item release
  3530. Amount of milliseconds the signal has to fall below the threshold before the
  3531. reduction is increased again. Default is 250 milliseconds.
  3532. Allowed range is from 0.01 to 9000.
  3533. @item makeup
  3534. Set amount of amplification of signal after processing.
  3535. Default is 1. Allowed range is from 1 to 64.
  3536. @item knee
  3537. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3538. Default is 2.828427125. Allowed range is from 1 to 8.
  3539. @item detection
  3540. Choose if exact signal should be taken for detection or an RMS like one.
  3541. Default is rms. Can be peak or rms.
  3542. @item link
  3543. Choose if the average level between all channels or the louder channel affects
  3544. the reduction.
  3545. Default is average. Can be average or maximum.
  3546. @item level_sc
  3547. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3548. @end table
  3549. @section silencedetect
  3550. Detect silence in an audio stream.
  3551. This filter logs a message when it detects that the input audio volume is less
  3552. or equal to a noise tolerance value for a duration greater or equal to the
  3553. minimum detected noise duration.
  3554. The printed times and duration are expressed in seconds.
  3555. The filter accepts the following options:
  3556. @table @option
  3557. @item noise, n
  3558. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3559. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3560. @item duration, d
  3561. Set silence duration until notification (default is 2 seconds).
  3562. @item mono, m
  3563. Process each channel separately, instead of combined. By default is disabled.
  3564. @end table
  3565. @subsection Examples
  3566. @itemize
  3567. @item
  3568. Detect 5 seconds of silence with -50dB noise tolerance:
  3569. @example
  3570. silencedetect=n=-50dB:d=5
  3571. @end example
  3572. @item
  3573. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3574. tolerance in @file{silence.mp3}:
  3575. @example
  3576. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3577. @end example
  3578. @end itemize
  3579. @section silenceremove
  3580. Remove silence from the beginning, middle or end of the audio.
  3581. The filter accepts the following options:
  3582. @table @option
  3583. @item start_periods
  3584. This value is used to indicate if audio should be trimmed at beginning of
  3585. the audio. A value of zero indicates no silence should be trimmed from the
  3586. beginning. When specifying a non-zero value, it trims audio up until it
  3587. finds non-silence. Normally, when trimming silence from beginning of audio
  3588. the @var{start_periods} will be @code{1} but it can be increased to higher
  3589. values to trim all audio up to specific count of non-silence periods.
  3590. Default value is @code{0}.
  3591. @item start_duration
  3592. Specify the amount of time that non-silence must be detected before it stops
  3593. trimming audio. By increasing the duration, bursts of noises can be treated
  3594. as silence and trimmed off. Default value is @code{0}.
  3595. @item start_threshold
  3596. This indicates what sample value should be treated as silence. For digital
  3597. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3598. you may wish to increase the value to account for background noise.
  3599. Can be specified in dB (in case "dB" is appended to the specified value)
  3600. or amplitude ratio. Default value is @code{0}.
  3601. @item start_silence
  3602. Specify max duration of silence at beginning that will be kept after
  3603. trimming. Default is 0, which is equal to trimming all samples detected
  3604. as silence.
  3605. @item start_mode
  3606. Specify mode of detection of silence end in start of multi-channel audio.
  3607. Can be @var{any} or @var{all}. Default is @var{any}.
  3608. With @var{any}, any sample that is detected as non-silence will cause
  3609. stopped trimming of silence.
  3610. With @var{all}, only if all channels are detected as non-silence will cause
  3611. stopped trimming of silence.
  3612. @item stop_periods
  3613. Set the count for trimming silence from the end of audio.
  3614. To remove silence from the middle of a file, specify a @var{stop_periods}
  3615. that is negative. This value is then treated as a positive value and is
  3616. used to indicate the effect should restart processing as specified by
  3617. @var{start_periods}, making it suitable for removing periods of silence
  3618. in the middle of the audio.
  3619. Default value is @code{0}.
  3620. @item stop_duration
  3621. Specify a duration of silence that must exist before audio is not copied any
  3622. more. By specifying a higher duration, silence that is wanted can be left in
  3623. the audio.
  3624. Default value is @code{0}.
  3625. @item stop_threshold
  3626. This is the same as @option{start_threshold} but for trimming silence from
  3627. the end of audio.
  3628. Can be specified in dB (in case "dB" is appended to the specified value)
  3629. or amplitude ratio. Default value is @code{0}.
  3630. @item stop_silence
  3631. Specify max duration of silence at end that will be kept after
  3632. trimming. Default is 0, which is equal to trimming all samples detected
  3633. as silence.
  3634. @item stop_mode
  3635. Specify mode of detection of silence start in end of multi-channel audio.
  3636. Can be @var{any} or @var{all}. Default is @var{any}.
  3637. With @var{any}, any sample that is detected as non-silence will cause
  3638. stopped trimming of silence.
  3639. With @var{all}, only if all channels are detected as non-silence will cause
  3640. stopped trimming of silence.
  3641. @item detection
  3642. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3643. and works better with digital silence which is exactly 0.
  3644. Default value is @code{rms}.
  3645. @item window
  3646. Set duration in number of seconds used to calculate size of window in number
  3647. of samples for detecting silence.
  3648. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3649. @end table
  3650. @subsection Examples
  3651. @itemize
  3652. @item
  3653. The following example shows how this filter can be used to start a recording
  3654. that does not contain the delay at the start which usually occurs between
  3655. pressing the record button and the start of the performance:
  3656. @example
  3657. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3658. @end example
  3659. @item
  3660. Trim all silence encountered from beginning to end where there is more than 1
  3661. second of silence in audio:
  3662. @example
  3663. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3664. @end example
  3665. @end itemize
  3666. @section sofalizer
  3667. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3668. loudspeakers around the user for binaural listening via headphones (audio
  3669. formats up to 9 channels supported).
  3670. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3671. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3672. Austrian Academy of Sciences.
  3673. To enable compilation of this filter you need to configure FFmpeg with
  3674. @code{--enable-libmysofa}.
  3675. The filter accepts the following options:
  3676. @table @option
  3677. @item sofa
  3678. Set the SOFA file used for rendering.
  3679. @item gain
  3680. Set gain applied to audio. Value is in dB. Default is 0.
  3681. @item rotation
  3682. Set rotation of virtual loudspeakers in deg. Default is 0.
  3683. @item elevation
  3684. Set elevation of virtual speakers in deg. Default is 0.
  3685. @item radius
  3686. Set distance in meters between loudspeakers and the listener with near-field
  3687. HRTFs. Default is 1.
  3688. @item type
  3689. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3690. processing audio in time domain which is slow.
  3691. @var{freq} is processing audio in frequency domain which is fast.
  3692. Default is @var{freq}.
  3693. @item speakers
  3694. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3695. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3696. Each virtual loudspeaker is described with short channel name following with
  3697. azimuth and elevation in degrees.
  3698. Each virtual loudspeaker description is separated by '|'.
  3699. For example to override front left and front right channel positions use:
  3700. 'speakers=FL 45 15|FR 345 15'.
  3701. Descriptions with unrecognised channel names are ignored.
  3702. @item lfegain
  3703. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3704. @item framesize
  3705. Set custom frame size in number of samples. Default is 1024.
  3706. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3707. is set to @var{freq}.
  3708. @item normalize
  3709. Should all IRs be normalized upon importing SOFA file.
  3710. By default is enabled.
  3711. @item interpolate
  3712. Should nearest IRs be interpolated with neighbor IRs if exact position
  3713. does not match. By default is disabled.
  3714. @item minphase
  3715. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3716. @item anglestep
  3717. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3718. @item radstep
  3719. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3720. @end table
  3721. @subsection Examples
  3722. @itemize
  3723. @item
  3724. Using ClubFritz6 sofa file:
  3725. @example
  3726. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3727. @end example
  3728. @item
  3729. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3730. @example
  3731. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3732. @end example
  3733. @item
  3734. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3735. and also with custom gain:
  3736. @example
  3737. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3738. @end example
  3739. @end itemize
  3740. @section stereotools
  3741. This filter has some handy utilities to manage stereo signals, for converting
  3742. M/S stereo recordings to L/R signal while having control over the parameters
  3743. or spreading the stereo image of master track.
  3744. The filter accepts the following options:
  3745. @table @option
  3746. @item level_in
  3747. Set input level before filtering for both channels. Defaults is 1.
  3748. Allowed range is from 0.015625 to 64.
  3749. @item level_out
  3750. Set output level after filtering for both channels. Defaults is 1.
  3751. Allowed range is from 0.015625 to 64.
  3752. @item balance_in
  3753. Set input balance between both channels. Default is 0.
  3754. Allowed range is from -1 to 1.
  3755. @item balance_out
  3756. Set output balance between both channels. Default is 0.
  3757. Allowed range is from -1 to 1.
  3758. @item softclip
  3759. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3760. clipping. Disabled by default.
  3761. @item mutel
  3762. Mute the left channel. Disabled by default.
  3763. @item muter
  3764. Mute the right channel. Disabled by default.
  3765. @item phasel
  3766. Change the phase of the left channel. Disabled by default.
  3767. @item phaser
  3768. Change the phase of the right channel. Disabled by default.
  3769. @item mode
  3770. Set stereo mode. Available values are:
  3771. @table @samp
  3772. @item lr>lr
  3773. Left/Right to Left/Right, this is default.
  3774. @item lr>ms
  3775. Left/Right to Mid/Side.
  3776. @item ms>lr
  3777. Mid/Side to Left/Right.
  3778. @item lr>ll
  3779. Left/Right to Left/Left.
  3780. @item lr>rr
  3781. Left/Right to Right/Right.
  3782. @item lr>l+r
  3783. Left/Right to Left + Right.
  3784. @item lr>rl
  3785. Left/Right to Right/Left.
  3786. @item ms>ll
  3787. Mid/Side to Left/Left.
  3788. @item ms>rr
  3789. Mid/Side to Right/Right.
  3790. @end table
  3791. @item slev
  3792. Set level of side signal. Default is 1.
  3793. Allowed range is from 0.015625 to 64.
  3794. @item sbal
  3795. Set balance of side signal. Default is 0.
  3796. Allowed range is from -1 to 1.
  3797. @item mlev
  3798. Set level of the middle signal. Default is 1.
  3799. Allowed range is from 0.015625 to 64.
  3800. @item mpan
  3801. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3802. @item base
  3803. Set stereo base between mono and inversed channels. Default is 0.
  3804. Allowed range is from -1 to 1.
  3805. @item delay
  3806. Set delay in milliseconds how much to delay left from right channel and
  3807. vice versa. Default is 0. Allowed range is from -20 to 20.
  3808. @item sclevel
  3809. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3810. @item phase
  3811. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3812. @item bmode_in, bmode_out
  3813. Set balance mode for balance_in/balance_out option.
  3814. Can be one of the following:
  3815. @table @samp
  3816. @item balance
  3817. Classic balance mode. Attenuate one channel at time.
  3818. Gain is raised up to 1.
  3819. @item amplitude
  3820. Similar as classic mode above but gain is raised up to 2.
  3821. @item power
  3822. Equal power distribution, from -6dB to +6dB range.
  3823. @end table
  3824. @end table
  3825. @subsection Examples
  3826. @itemize
  3827. @item
  3828. Apply karaoke like effect:
  3829. @example
  3830. stereotools=mlev=0.015625
  3831. @end example
  3832. @item
  3833. Convert M/S signal to L/R:
  3834. @example
  3835. "stereotools=mode=ms>lr"
  3836. @end example
  3837. @end itemize
  3838. @section stereowiden
  3839. This filter enhance the stereo effect by suppressing signal common to both
  3840. channels and by delaying the signal of left into right and vice versa,
  3841. thereby widening the stereo effect.
  3842. The filter accepts the following options:
  3843. @table @option
  3844. @item delay
  3845. Time in milliseconds of the delay of left signal into right and vice versa.
  3846. Default is 20 milliseconds.
  3847. @item feedback
  3848. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3849. effect of left signal in right output and vice versa which gives widening
  3850. effect. Default is 0.3.
  3851. @item crossfeed
  3852. Cross feed of left into right with inverted phase. This helps in suppressing
  3853. the mono. If the value is 1 it will cancel all the signal common to both
  3854. channels. Default is 0.3.
  3855. @item drymix
  3856. Set level of input signal of original channel. Default is 0.8.
  3857. @end table
  3858. @section superequalizer
  3859. Apply 18 band equalizer.
  3860. The filter accepts the following options:
  3861. @table @option
  3862. @item 1b
  3863. Set 65Hz band gain.
  3864. @item 2b
  3865. Set 92Hz band gain.
  3866. @item 3b
  3867. Set 131Hz band gain.
  3868. @item 4b
  3869. Set 185Hz band gain.
  3870. @item 5b
  3871. Set 262Hz band gain.
  3872. @item 6b
  3873. Set 370Hz band gain.
  3874. @item 7b
  3875. Set 523Hz band gain.
  3876. @item 8b
  3877. Set 740Hz band gain.
  3878. @item 9b
  3879. Set 1047Hz band gain.
  3880. @item 10b
  3881. Set 1480Hz band gain.
  3882. @item 11b
  3883. Set 2093Hz band gain.
  3884. @item 12b
  3885. Set 2960Hz band gain.
  3886. @item 13b
  3887. Set 4186Hz band gain.
  3888. @item 14b
  3889. Set 5920Hz band gain.
  3890. @item 15b
  3891. Set 8372Hz band gain.
  3892. @item 16b
  3893. Set 11840Hz band gain.
  3894. @item 17b
  3895. Set 16744Hz band gain.
  3896. @item 18b
  3897. Set 20000Hz band gain.
  3898. @end table
  3899. @section surround
  3900. Apply audio surround upmix filter.
  3901. This filter allows to produce multichannel output from audio stream.
  3902. The filter accepts the following options:
  3903. @table @option
  3904. @item chl_out
  3905. Set output channel layout. By default, this is @var{5.1}.
  3906. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3907. for the required syntax.
  3908. @item chl_in
  3909. Set input channel layout. By default, this is @var{stereo}.
  3910. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3911. for the required syntax.
  3912. @item level_in
  3913. Set input volume level. By default, this is @var{1}.
  3914. @item level_out
  3915. Set output volume level. By default, this is @var{1}.
  3916. @item lfe
  3917. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3918. @item lfe_low
  3919. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3920. @item lfe_high
  3921. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3922. @item lfe_mode
  3923. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3924. In @var{add} mode, LFE channel is created from input audio and added to output.
  3925. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3926. also all non-LFE output channels are subtracted with output LFE channel.
  3927. @item angle
  3928. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3929. Default is @var{90}.
  3930. @item fc_in
  3931. Set front center input volume. By default, this is @var{1}.
  3932. @item fc_out
  3933. Set front center output volume. By default, this is @var{1}.
  3934. @item fl_in
  3935. Set front left input volume. By default, this is @var{1}.
  3936. @item fl_out
  3937. Set front left output volume. By default, this is @var{1}.
  3938. @item fr_in
  3939. Set front right input volume. By default, this is @var{1}.
  3940. @item fr_out
  3941. Set front right output volume. By default, this is @var{1}.
  3942. @item sl_in
  3943. Set side left input volume. By default, this is @var{1}.
  3944. @item sl_out
  3945. Set side left output volume. By default, this is @var{1}.
  3946. @item sr_in
  3947. Set side right input volume. By default, this is @var{1}.
  3948. @item sr_out
  3949. Set side right output volume. By default, this is @var{1}.
  3950. @item bl_in
  3951. Set back left input volume. By default, this is @var{1}.
  3952. @item bl_out
  3953. Set back left output volume. By default, this is @var{1}.
  3954. @item br_in
  3955. Set back right input volume. By default, this is @var{1}.
  3956. @item br_out
  3957. Set back right output volume. By default, this is @var{1}.
  3958. @item bc_in
  3959. Set back center input volume. By default, this is @var{1}.
  3960. @item bc_out
  3961. Set back center output volume. By default, this is @var{1}.
  3962. @item lfe_in
  3963. Set LFE input volume. By default, this is @var{1}.
  3964. @item lfe_out
  3965. Set LFE output volume. By default, this is @var{1}.
  3966. @item allx
  3967. Set spread usage of stereo image across X axis for all channels.
  3968. @item ally
  3969. Set spread usage of stereo image across Y axis for all channels.
  3970. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3971. Set spread usage of stereo image across X axis for each channel.
  3972. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3973. Set spread usage of stereo image across Y axis for each channel.
  3974. @item win_size
  3975. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3976. @item win_func
  3977. Set window function.
  3978. It accepts the following values:
  3979. @table @samp
  3980. @item rect
  3981. @item bartlett
  3982. @item hann, hanning
  3983. @item hamming
  3984. @item blackman
  3985. @item welch
  3986. @item flattop
  3987. @item bharris
  3988. @item bnuttall
  3989. @item bhann
  3990. @item sine
  3991. @item nuttall
  3992. @item lanczos
  3993. @item gauss
  3994. @item tukey
  3995. @item dolph
  3996. @item cauchy
  3997. @item parzen
  3998. @item poisson
  3999. @item bohman
  4000. @end table
  4001. Default is @code{hann}.
  4002. @item overlap
  4003. Set window overlap. If set to 1, the recommended overlap for selected
  4004. window function will be picked. Default is @code{0.5}.
  4005. @end table
  4006. @section treble, highshelf
  4007. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4008. shelving filter with a response similar to that of a standard
  4009. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4010. The filter accepts the following options:
  4011. @table @option
  4012. @item gain, g
  4013. Give the gain at whichever is the lower of ~22 kHz and the
  4014. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4015. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4016. @item frequency, f
  4017. Set the filter's central frequency and so can be used
  4018. to extend or reduce the frequency range to be boosted or cut.
  4019. The default value is @code{3000} Hz.
  4020. @item width_type, t
  4021. Set method to specify band-width of filter.
  4022. @table @option
  4023. @item h
  4024. Hz
  4025. @item q
  4026. Q-Factor
  4027. @item o
  4028. octave
  4029. @item s
  4030. slope
  4031. @item k
  4032. kHz
  4033. @end table
  4034. @item width, w
  4035. Determine how steep is the filter's shelf transition.
  4036. @item mix, m
  4037. How much to use filtered signal in output. Default is 1.
  4038. Range is between 0 and 1.
  4039. @item channels, c
  4040. Specify which channels to filter, by default all available are filtered.
  4041. @end table
  4042. @subsection Commands
  4043. This filter supports the following commands:
  4044. @table @option
  4045. @item frequency, f
  4046. Change treble frequency.
  4047. Syntax for the command is : "@var{frequency}"
  4048. @item width_type, t
  4049. Change treble width_type.
  4050. Syntax for the command is : "@var{width_type}"
  4051. @item width, w
  4052. Change treble width.
  4053. Syntax for the command is : "@var{width}"
  4054. @item gain, g
  4055. Change treble gain.
  4056. Syntax for the command is : "@var{gain}"
  4057. @item mix, m
  4058. Change treble mix.
  4059. Syntax for the command is : "@var{mix}"
  4060. @end table
  4061. @section tremolo
  4062. Sinusoidal amplitude modulation.
  4063. The filter accepts the following options:
  4064. @table @option
  4065. @item f
  4066. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4067. (20 Hz or lower) will result in a tremolo effect.
  4068. This filter may also be used as a ring modulator by specifying
  4069. a modulation frequency higher than 20 Hz.
  4070. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4071. @item d
  4072. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4073. Default value is 0.5.
  4074. @end table
  4075. @section vibrato
  4076. Sinusoidal phase modulation.
  4077. The filter accepts the following options:
  4078. @table @option
  4079. @item f
  4080. Modulation frequency in Hertz.
  4081. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4082. @item d
  4083. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4084. Default value is 0.5.
  4085. @end table
  4086. @section volume
  4087. Adjust the input audio volume.
  4088. It accepts the following parameters:
  4089. @table @option
  4090. @item volume
  4091. Set audio volume expression.
  4092. Output values are clipped to the maximum value.
  4093. The output audio volume is given by the relation:
  4094. @example
  4095. @var{output_volume} = @var{volume} * @var{input_volume}
  4096. @end example
  4097. The default value for @var{volume} is "1.0".
  4098. @item precision
  4099. This parameter represents the mathematical precision.
  4100. It determines which input sample formats will be allowed, which affects the
  4101. precision of the volume scaling.
  4102. @table @option
  4103. @item fixed
  4104. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4105. @item float
  4106. 32-bit floating-point; this limits input sample format to FLT. (default)
  4107. @item double
  4108. 64-bit floating-point; this limits input sample format to DBL.
  4109. @end table
  4110. @item replaygain
  4111. Choose the behaviour on encountering ReplayGain side data in input frames.
  4112. @table @option
  4113. @item drop
  4114. Remove ReplayGain side data, ignoring its contents (the default).
  4115. @item ignore
  4116. Ignore ReplayGain side data, but leave it in the frame.
  4117. @item track
  4118. Prefer the track gain, if present.
  4119. @item album
  4120. Prefer the album gain, if present.
  4121. @end table
  4122. @item replaygain_preamp
  4123. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4124. Default value for @var{replaygain_preamp} is 0.0.
  4125. @item eval
  4126. Set when the volume expression is evaluated.
  4127. It accepts the following values:
  4128. @table @samp
  4129. @item once
  4130. only evaluate expression once during the filter initialization, or
  4131. when the @samp{volume} command is sent
  4132. @item frame
  4133. evaluate expression for each incoming frame
  4134. @end table
  4135. Default value is @samp{once}.
  4136. @end table
  4137. The volume expression can contain the following parameters.
  4138. @table @option
  4139. @item n
  4140. frame number (starting at zero)
  4141. @item nb_channels
  4142. number of channels
  4143. @item nb_consumed_samples
  4144. number of samples consumed by the filter
  4145. @item nb_samples
  4146. number of samples in the current frame
  4147. @item pos
  4148. original frame position in the file
  4149. @item pts
  4150. frame PTS
  4151. @item sample_rate
  4152. sample rate
  4153. @item startpts
  4154. PTS at start of stream
  4155. @item startt
  4156. time at start of stream
  4157. @item t
  4158. frame time
  4159. @item tb
  4160. timestamp timebase
  4161. @item volume
  4162. last set volume value
  4163. @end table
  4164. Note that when @option{eval} is set to @samp{once} only the
  4165. @var{sample_rate} and @var{tb} variables are available, all other
  4166. variables will evaluate to NAN.
  4167. @subsection Commands
  4168. This filter supports the following commands:
  4169. @table @option
  4170. @item volume
  4171. Modify the volume expression.
  4172. The command accepts the same syntax of the corresponding option.
  4173. If the specified expression is not valid, it is kept at its current
  4174. value.
  4175. @item replaygain_noclip
  4176. Prevent clipping by limiting the gain applied.
  4177. Default value for @var{replaygain_noclip} is 1.
  4178. @end table
  4179. @subsection Examples
  4180. @itemize
  4181. @item
  4182. Halve the input audio volume:
  4183. @example
  4184. volume=volume=0.5
  4185. volume=volume=1/2
  4186. volume=volume=-6.0206dB
  4187. @end example
  4188. In all the above example the named key for @option{volume} can be
  4189. omitted, for example like in:
  4190. @example
  4191. volume=0.5
  4192. @end example
  4193. @item
  4194. Increase input audio power by 6 decibels using fixed-point precision:
  4195. @example
  4196. volume=volume=6dB:precision=fixed
  4197. @end example
  4198. @item
  4199. Fade volume after time 10 with an annihilation period of 5 seconds:
  4200. @example
  4201. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4202. @end example
  4203. @end itemize
  4204. @section volumedetect
  4205. Detect the volume of the input video.
  4206. The filter has no parameters. The input is not modified. Statistics about
  4207. the volume will be printed in the log when the input stream end is reached.
  4208. In particular it will show the mean volume (root mean square), maximum
  4209. volume (on a per-sample basis), and the beginning of a histogram of the
  4210. registered volume values (from the maximum value to a cumulated 1/1000 of
  4211. the samples).
  4212. All volumes are in decibels relative to the maximum PCM value.
  4213. @subsection Examples
  4214. Here is an excerpt of the output:
  4215. @example
  4216. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4217. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4218. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4219. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4220. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4221. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4222. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4223. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4224. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4225. @end example
  4226. It means that:
  4227. @itemize
  4228. @item
  4229. The mean square energy is approximately -27 dB, or 10^-2.7.
  4230. @item
  4231. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4232. @item
  4233. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4234. @end itemize
  4235. In other words, raising the volume by +4 dB does not cause any clipping,
  4236. raising it by +5 dB causes clipping for 6 samples, etc.
  4237. @c man end AUDIO FILTERS
  4238. @chapter Audio Sources
  4239. @c man begin AUDIO SOURCES
  4240. Below is a description of the currently available audio sources.
  4241. @section abuffer
  4242. Buffer audio frames, and make them available to the filter chain.
  4243. This source is mainly intended for a programmatic use, in particular
  4244. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4245. It accepts the following parameters:
  4246. @table @option
  4247. @item time_base
  4248. The timebase which will be used for timestamps of submitted frames. It must be
  4249. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4250. @item sample_rate
  4251. The sample rate of the incoming audio buffers.
  4252. @item sample_fmt
  4253. The sample format of the incoming audio buffers.
  4254. Either a sample format name or its corresponding integer representation from
  4255. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4256. @item channel_layout
  4257. The channel layout of the incoming audio buffers.
  4258. Either a channel layout name from channel_layout_map in
  4259. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4260. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4261. @item channels
  4262. The number of channels of the incoming audio buffers.
  4263. If both @var{channels} and @var{channel_layout} are specified, then they
  4264. must be consistent.
  4265. @end table
  4266. @subsection Examples
  4267. @example
  4268. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4269. @end example
  4270. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4271. Since the sample format with name "s16p" corresponds to the number
  4272. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4273. equivalent to:
  4274. @example
  4275. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4276. @end example
  4277. @section aevalsrc
  4278. Generate an audio signal specified by an expression.
  4279. This source accepts in input one or more expressions (one for each
  4280. channel), which are evaluated and used to generate a corresponding
  4281. audio signal.
  4282. This source accepts the following options:
  4283. @table @option
  4284. @item exprs
  4285. Set the '|'-separated expressions list for each separate channel. In case the
  4286. @option{channel_layout} option is not specified, the selected channel layout
  4287. depends on the number of provided expressions. Otherwise the last
  4288. specified expression is applied to the remaining output channels.
  4289. @item channel_layout, c
  4290. Set the channel layout. The number of channels in the specified layout
  4291. must be equal to the number of specified expressions.
  4292. @item duration, d
  4293. Set the minimum duration of the sourced audio. See
  4294. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4295. for the accepted syntax.
  4296. Note that the resulting duration may be greater than the specified
  4297. duration, as the generated audio is always cut at the end of a
  4298. complete frame.
  4299. If not specified, or the expressed duration is negative, the audio is
  4300. supposed to be generated forever.
  4301. @item nb_samples, n
  4302. Set the number of samples per channel per each output frame,
  4303. default to 1024.
  4304. @item sample_rate, s
  4305. Specify the sample rate, default to 44100.
  4306. @end table
  4307. Each expression in @var{exprs} can contain the following constants:
  4308. @table @option
  4309. @item n
  4310. number of the evaluated sample, starting from 0
  4311. @item t
  4312. time of the evaluated sample expressed in seconds, starting from 0
  4313. @item s
  4314. sample rate
  4315. @end table
  4316. @subsection Examples
  4317. @itemize
  4318. @item
  4319. Generate silence:
  4320. @example
  4321. aevalsrc=0
  4322. @end example
  4323. @item
  4324. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4325. 8000 Hz:
  4326. @example
  4327. aevalsrc="sin(440*2*PI*t):s=8000"
  4328. @end example
  4329. @item
  4330. Generate a two channels signal, specify the channel layout (Front
  4331. Center + Back Center) explicitly:
  4332. @example
  4333. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4334. @end example
  4335. @item
  4336. Generate white noise:
  4337. @example
  4338. aevalsrc="-2+random(0)"
  4339. @end example
  4340. @item
  4341. Generate an amplitude modulated signal:
  4342. @example
  4343. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4344. @end example
  4345. @item
  4346. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4347. @example
  4348. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4349. @end example
  4350. @end itemize
  4351. @section anullsrc
  4352. The null audio source, return unprocessed audio frames. It is mainly useful
  4353. as a template and to be employed in analysis / debugging tools, or as
  4354. the source for filters which ignore the input data (for example the sox
  4355. synth filter).
  4356. This source accepts the following options:
  4357. @table @option
  4358. @item channel_layout, cl
  4359. Specifies the channel layout, and can be either an integer or a string
  4360. representing a channel layout. The default value of @var{channel_layout}
  4361. is "stereo".
  4362. Check the channel_layout_map definition in
  4363. @file{libavutil/channel_layout.c} for the mapping between strings and
  4364. channel layout values.
  4365. @item sample_rate, r
  4366. Specifies the sample rate, and defaults to 44100.
  4367. @item nb_samples, n
  4368. Set the number of samples per requested frames.
  4369. @end table
  4370. @subsection Examples
  4371. @itemize
  4372. @item
  4373. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4374. @example
  4375. anullsrc=r=48000:cl=4
  4376. @end example
  4377. @item
  4378. Do the same operation with a more obvious syntax:
  4379. @example
  4380. anullsrc=r=48000:cl=mono
  4381. @end example
  4382. @end itemize
  4383. All the parameters need to be explicitly defined.
  4384. @section flite
  4385. Synthesize a voice utterance using the libflite library.
  4386. To enable compilation of this filter you need to configure FFmpeg with
  4387. @code{--enable-libflite}.
  4388. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4389. The filter accepts the following options:
  4390. @table @option
  4391. @item list_voices
  4392. If set to 1, list the names of the available voices and exit
  4393. immediately. Default value is 0.
  4394. @item nb_samples, n
  4395. Set the maximum number of samples per frame. Default value is 512.
  4396. @item textfile
  4397. Set the filename containing the text to speak.
  4398. @item text
  4399. Set the text to speak.
  4400. @item voice, v
  4401. Set the voice to use for the speech synthesis. Default value is
  4402. @code{kal}. See also the @var{list_voices} option.
  4403. @end table
  4404. @subsection Examples
  4405. @itemize
  4406. @item
  4407. Read from file @file{speech.txt}, and synthesize the text using the
  4408. standard flite voice:
  4409. @example
  4410. flite=textfile=speech.txt
  4411. @end example
  4412. @item
  4413. Read the specified text selecting the @code{slt} voice:
  4414. @example
  4415. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4416. @end example
  4417. @item
  4418. Input text to ffmpeg:
  4419. @example
  4420. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4421. @end example
  4422. @item
  4423. Make @file{ffplay} speak the specified text, using @code{flite} and
  4424. the @code{lavfi} device:
  4425. @example
  4426. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4427. @end example
  4428. @end itemize
  4429. For more information about libflite, check:
  4430. @url{http://www.festvox.org/flite/}
  4431. @section anoisesrc
  4432. Generate a noise audio signal.
  4433. The filter accepts the following options:
  4434. @table @option
  4435. @item sample_rate, r
  4436. Specify the sample rate. Default value is 48000 Hz.
  4437. @item amplitude, a
  4438. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4439. is 1.0.
  4440. @item duration, d
  4441. Specify the duration of the generated audio stream. Not specifying this option
  4442. results in noise with an infinite length.
  4443. @item color, colour, c
  4444. Specify the color of noise. Available noise colors are white, pink, brown,
  4445. blue and violet. Default color is white.
  4446. @item seed, s
  4447. Specify a value used to seed the PRNG.
  4448. @item nb_samples, n
  4449. Set the number of samples per each output frame, default is 1024.
  4450. @end table
  4451. @subsection Examples
  4452. @itemize
  4453. @item
  4454. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4455. @example
  4456. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4457. @end example
  4458. @end itemize
  4459. @section hilbert
  4460. Generate odd-tap Hilbert transform FIR coefficients.
  4461. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4462. the signal by 90 degrees.
  4463. This is used in many matrix coding schemes and for analytic signal generation.
  4464. The process is often written as a multiplication by i (or j), the imaginary unit.
  4465. The filter accepts the following options:
  4466. @table @option
  4467. @item sample_rate, s
  4468. Set sample rate, default is 44100.
  4469. @item taps, t
  4470. Set length of FIR filter, default is 22051.
  4471. @item nb_samples, n
  4472. Set number of samples per each frame.
  4473. @item win_func, w
  4474. Set window function to be used when generating FIR coefficients.
  4475. @end table
  4476. @section sinc
  4477. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4478. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4479. The filter accepts the following options:
  4480. @table @option
  4481. @item sample_rate, r
  4482. Set sample rate, default is 44100.
  4483. @item nb_samples, n
  4484. Set number of samples per each frame. Default is 1024.
  4485. @item hp
  4486. Set high-pass frequency. Default is 0.
  4487. @item lp
  4488. Set low-pass frequency. Default is 0.
  4489. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4490. is higher than 0 then filter will create band-pass filter coefficients,
  4491. otherwise band-reject filter coefficients.
  4492. @item phase
  4493. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4494. @item beta
  4495. Set Kaiser window beta.
  4496. @item att
  4497. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4498. @item round
  4499. Enable rounding, by default is disabled.
  4500. @item hptaps
  4501. Set number of taps for high-pass filter.
  4502. @item lptaps
  4503. Set number of taps for low-pass filter.
  4504. @end table
  4505. @section sine
  4506. Generate an audio signal made of a sine wave with amplitude 1/8.
  4507. The audio signal is bit-exact.
  4508. The filter accepts the following options:
  4509. @table @option
  4510. @item frequency, f
  4511. Set the carrier frequency. Default is 440 Hz.
  4512. @item beep_factor, b
  4513. Enable a periodic beep every second with frequency @var{beep_factor} times
  4514. the carrier frequency. Default is 0, meaning the beep is disabled.
  4515. @item sample_rate, r
  4516. Specify the sample rate, default is 44100.
  4517. @item duration, d
  4518. Specify the duration of the generated audio stream.
  4519. @item samples_per_frame
  4520. Set the number of samples per output frame.
  4521. The expression can contain the following constants:
  4522. @table @option
  4523. @item n
  4524. The (sequential) number of the output audio frame, starting from 0.
  4525. @item pts
  4526. The PTS (Presentation TimeStamp) of the output audio frame,
  4527. expressed in @var{TB} units.
  4528. @item t
  4529. The PTS of the output audio frame, expressed in seconds.
  4530. @item TB
  4531. The timebase of the output audio frames.
  4532. @end table
  4533. Default is @code{1024}.
  4534. @end table
  4535. @subsection Examples
  4536. @itemize
  4537. @item
  4538. Generate a simple 440 Hz sine wave:
  4539. @example
  4540. sine
  4541. @end example
  4542. @item
  4543. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4544. @example
  4545. sine=220:4:d=5
  4546. sine=f=220:b=4:d=5
  4547. sine=frequency=220:beep_factor=4:duration=5
  4548. @end example
  4549. @item
  4550. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4551. pattern:
  4552. @example
  4553. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4554. @end example
  4555. @end itemize
  4556. @c man end AUDIO SOURCES
  4557. @chapter Audio Sinks
  4558. @c man begin AUDIO SINKS
  4559. Below is a description of the currently available audio sinks.
  4560. @section abuffersink
  4561. Buffer audio frames, and make them available to the end of filter chain.
  4562. This sink is mainly intended for programmatic use, in particular
  4563. through the interface defined in @file{libavfilter/buffersink.h}
  4564. or the options system.
  4565. It accepts a pointer to an AVABufferSinkContext structure, which
  4566. defines the incoming buffers' formats, to be passed as the opaque
  4567. parameter to @code{avfilter_init_filter} for initialization.
  4568. @section anullsink
  4569. Null audio sink; do absolutely nothing with the input audio. It is
  4570. mainly useful as a template and for use in analysis / debugging
  4571. tools.
  4572. @c man end AUDIO SINKS
  4573. @chapter Video Filters
  4574. @c man begin VIDEO FILTERS
  4575. When you configure your FFmpeg build, you can disable any of the
  4576. existing filters using @code{--disable-filters}.
  4577. The configure output will show the video filters included in your
  4578. build.
  4579. Below is a description of the currently available video filters.
  4580. @section addroi
  4581. Mark a region of interest in a video frame.
  4582. The frame data is passed through unchanged, but metadata is attached
  4583. to the frame indicating regions of interest which can affect the
  4584. behaviour of later encoding. Multiple regions can be marked by
  4585. applying the filter multiple times.
  4586. @table @option
  4587. @item x
  4588. Region distance in pixels from the left edge of the frame.
  4589. @item y
  4590. Region distance in pixels from the top edge of the frame.
  4591. @item w
  4592. Region width in pixels.
  4593. @item h
  4594. Region height in pixels.
  4595. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4596. and may contain the following variables:
  4597. @table @option
  4598. @item iw
  4599. Width of the input frame.
  4600. @item ih
  4601. Height of the input frame.
  4602. @end table
  4603. @item qoffset
  4604. Quantisation offset to apply within the region.
  4605. This must be a real value in the range -1 to +1. A value of zero
  4606. indicates no quality change. A negative value asks for better quality
  4607. (less quantisation), while a positive value asks for worse quality
  4608. (greater quantisation).
  4609. The range is calibrated so that the extreme values indicate the
  4610. largest possible offset - if the rest of the frame is encoded with the
  4611. worst possible quality, an offset of -1 indicates that this region
  4612. should be encoded with the best possible quality anyway. Intermediate
  4613. values are then interpolated in some codec-dependent way.
  4614. For example, in 10-bit H.264 the quantisation parameter varies between
  4615. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4616. this region should be encoded with a QP around one-tenth of the full
  4617. range better than the rest of the frame. So, if most of the frame
  4618. were to be encoded with a QP of around 30, this region would get a QP
  4619. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4620. An extreme value of -1 would indicate that this region should be
  4621. encoded with the best possible quality regardless of the treatment of
  4622. the rest of the frame - that is, should be encoded at a QP of -12.
  4623. @item clear
  4624. If set to true, remove any existing regions of interest marked on the
  4625. frame before adding the new one.
  4626. @end table
  4627. @subsection Examples
  4628. @itemize
  4629. @item
  4630. Mark the centre quarter of the frame as interesting.
  4631. @example
  4632. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4633. @end example
  4634. @item
  4635. Mark the 100-pixel-wide region on the left edge of the frame as very
  4636. uninteresting (to be encoded at much lower quality than the rest of
  4637. the frame).
  4638. @example
  4639. addroi=0:0:100:ih:+1/5
  4640. @end example
  4641. @end itemize
  4642. @section alphaextract
  4643. Extract the alpha component from the input as a grayscale video. This
  4644. is especially useful with the @var{alphamerge} filter.
  4645. @section alphamerge
  4646. Add or replace the alpha component of the primary input with the
  4647. grayscale value of a second input. This is intended for use with
  4648. @var{alphaextract} to allow the transmission or storage of frame
  4649. sequences that have alpha in a format that doesn't support an alpha
  4650. channel.
  4651. For example, to reconstruct full frames from a normal YUV-encoded video
  4652. and a separate video created with @var{alphaextract}, you might use:
  4653. @example
  4654. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4655. @end example
  4656. Since this filter is designed for reconstruction, it operates on frame
  4657. sequences without considering timestamps, and terminates when either
  4658. input reaches end of stream. This will cause problems if your encoding
  4659. pipeline drops frames. If you're trying to apply an image as an
  4660. overlay to a video stream, consider the @var{overlay} filter instead.
  4661. @section amplify
  4662. Amplify differences between current pixel and pixels of adjacent frames in
  4663. same pixel location.
  4664. This filter accepts the following options:
  4665. @table @option
  4666. @item radius
  4667. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4668. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4669. @item factor
  4670. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4671. @item threshold
  4672. Set threshold for difference amplification. Any difference greater or equal to
  4673. this value will not alter source pixel. Default is 10.
  4674. Allowed range is from 0 to 65535.
  4675. @item tolerance
  4676. Set tolerance for difference amplification. Any difference lower to
  4677. this value will not alter source pixel. Default is 0.
  4678. Allowed range is from 0 to 65535.
  4679. @item low
  4680. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4681. This option controls maximum possible value that will decrease source pixel value.
  4682. @item high
  4683. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4684. This option controls maximum possible value that will increase source pixel value.
  4685. @item planes
  4686. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4687. @end table
  4688. @section ass
  4689. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4690. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4691. Substation Alpha) subtitles files.
  4692. This filter accepts the following option in addition to the common options from
  4693. the @ref{subtitles} filter:
  4694. @table @option
  4695. @item shaping
  4696. Set the shaping engine
  4697. Available values are:
  4698. @table @samp
  4699. @item auto
  4700. The default libass shaping engine, which is the best available.
  4701. @item simple
  4702. Fast, font-agnostic shaper that can do only substitutions
  4703. @item complex
  4704. Slower shaper using OpenType for substitutions and positioning
  4705. @end table
  4706. The default is @code{auto}.
  4707. @end table
  4708. @section atadenoise
  4709. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4710. The filter accepts the following options:
  4711. @table @option
  4712. @item 0a
  4713. Set threshold A for 1st plane. Default is 0.02.
  4714. Valid range is 0 to 0.3.
  4715. @item 0b
  4716. Set threshold B for 1st plane. Default is 0.04.
  4717. Valid range is 0 to 5.
  4718. @item 1a
  4719. Set threshold A for 2nd plane. Default is 0.02.
  4720. Valid range is 0 to 0.3.
  4721. @item 1b
  4722. Set threshold B for 2nd plane. Default is 0.04.
  4723. Valid range is 0 to 5.
  4724. @item 2a
  4725. Set threshold A for 3rd plane. Default is 0.02.
  4726. Valid range is 0 to 0.3.
  4727. @item 2b
  4728. Set threshold B for 3rd plane. Default is 0.04.
  4729. Valid range is 0 to 5.
  4730. Threshold A is designed to react on abrupt changes in the input signal and
  4731. threshold B is designed to react on continuous changes in the input signal.
  4732. @item s
  4733. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4734. number in range [5, 129].
  4735. @item p
  4736. Set what planes of frame filter will use for averaging. Default is all.
  4737. @end table
  4738. @section avgblur
  4739. Apply average blur filter.
  4740. The filter accepts the following options:
  4741. @table @option
  4742. @item sizeX
  4743. Set horizontal radius size.
  4744. @item planes
  4745. Set which planes to filter. By default all planes are filtered.
  4746. @item sizeY
  4747. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4748. Default is @code{0}.
  4749. @end table
  4750. @section bbox
  4751. Compute the bounding box for the non-black pixels in the input frame
  4752. luminance plane.
  4753. This filter computes the bounding box containing all the pixels with a
  4754. luminance value greater than the minimum allowed value.
  4755. The parameters describing the bounding box are printed on the filter
  4756. log.
  4757. The filter accepts the following option:
  4758. @table @option
  4759. @item min_val
  4760. Set the minimal luminance value. Default is @code{16}.
  4761. @end table
  4762. @section bitplanenoise
  4763. Show and measure bit plane noise.
  4764. The filter accepts the following options:
  4765. @table @option
  4766. @item bitplane
  4767. Set which plane to analyze. Default is @code{1}.
  4768. @item filter
  4769. Filter out noisy pixels from @code{bitplane} set above.
  4770. Default is disabled.
  4771. @end table
  4772. @section blackdetect
  4773. Detect video intervals that are (almost) completely black. Can be
  4774. useful to detect chapter transitions, commercials, or invalid
  4775. recordings. Output lines contains the time for the start, end and
  4776. duration of the detected black interval expressed in seconds.
  4777. In order to display the output lines, you need to set the loglevel at
  4778. least to the AV_LOG_INFO value.
  4779. The filter accepts the following options:
  4780. @table @option
  4781. @item black_min_duration, d
  4782. Set the minimum detected black duration expressed in seconds. It must
  4783. be a non-negative floating point number.
  4784. Default value is 2.0.
  4785. @item picture_black_ratio_th, pic_th
  4786. Set the threshold for considering a picture "black".
  4787. Express the minimum value for the ratio:
  4788. @example
  4789. @var{nb_black_pixels} / @var{nb_pixels}
  4790. @end example
  4791. for which a picture is considered black.
  4792. Default value is 0.98.
  4793. @item pixel_black_th, pix_th
  4794. Set the threshold for considering a pixel "black".
  4795. The threshold expresses the maximum pixel luminance value for which a
  4796. pixel is considered "black". The provided value is scaled according to
  4797. the following equation:
  4798. @example
  4799. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4800. @end example
  4801. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4802. the input video format, the range is [0-255] for YUV full-range
  4803. formats and [16-235] for YUV non full-range formats.
  4804. Default value is 0.10.
  4805. @end table
  4806. The following example sets the maximum pixel threshold to the minimum
  4807. value, and detects only black intervals of 2 or more seconds:
  4808. @example
  4809. blackdetect=d=2:pix_th=0.00
  4810. @end example
  4811. @section blackframe
  4812. Detect frames that are (almost) completely black. Can be useful to
  4813. detect chapter transitions or commercials. Output lines consist of
  4814. the frame number of the detected frame, the percentage of blackness,
  4815. the position in the file if known or -1 and the timestamp in seconds.
  4816. In order to display the output lines, you need to set the loglevel at
  4817. least to the AV_LOG_INFO value.
  4818. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4819. The value represents the percentage of pixels in the picture that
  4820. are below the threshold value.
  4821. It accepts the following parameters:
  4822. @table @option
  4823. @item amount
  4824. The percentage of the pixels that have to be below the threshold; it defaults to
  4825. @code{98}.
  4826. @item threshold, thresh
  4827. The threshold below which a pixel value is considered black; it defaults to
  4828. @code{32}.
  4829. @end table
  4830. @section blend, tblend
  4831. Blend two video frames into each other.
  4832. The @code{blend} filter takes two input streams and outputs one
  4833. stream, the first input is the "top" layer and second input is
  4834. "bottom" layer. By default, the output terminates when the longest input terminates.
  4835. The @code{tblend} (time blend) filter takes two consecutive frames
  4836. from one single stream, and outputs the result obtained by blending
  4837. the new frame on top of the old frame.
  4838. A description of the accepted options follows.
  4839. @table @option
  4840. @item c0_mode
  4841. @item c1_mode
  4842. @item c2_mode
  4843. @item c3_mode
  4844. @item all_mode
  4845. Set blend mode for specific pixel component or all pixel components in case
  4846. of @var{all_mode}. Default value is @code{normal}.
  4847. Available values for component modes are:
  4848. @table @samp
  4849. @item addition
  4850. @item grainmerge
  4851. @item and
  4852. @item average
  4853. @item burn
  4854. @item darken
  4855. @item difference
  4856. @item grainextract
  4857. @item divide
  4858. @item dodge
  4859. @item freeze
  4860. @item exclusion
  4861. @item extremity
  4862. @item glow
  4863. @item hardlight
  4864. @item hardmix
  4865. @item heat
  4866. @item lighten
  4867. @item linearlight
  4868. @item multiply
  4869. @item multiply128
  4870. @item negation
  4871. @item normal
  4872. @item or
  4873. @item overlay
  4874. @item phoenix
  4875. @item pinlight
  4876. @item reflect
  4877. @item screen
  4878. @item softlight
  4879. @item subtract
  4880. @item vividlight
  4881. @item xor
  4882. @end table
  4883. @item c0_opacity
  4884. @item c1_opacity
  4885. @item c2_opacity
  4886. @item c3_opacity
  4887. @item all_opacity
  4888. Set blend opacity for specific pixel component or all pixel components in case
  4889. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4890. @item c0_expr
  4891. @item c1_expr
  4892. @item c2_expr
  4893. @item c3_expr
  4894. @item all_expr
  4895. Set blend expression for specific pixel component or all pixel components in case
  4896. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4897. The expressions can use the following variables:
  4898. @table @option
  4899. @item N
  4900. The sequential number of the filtered frame, starting from @code{0}.
  4901. @item X
  4902. @item Y
  4903. the coordinates of the current sample
  4904. @item W
  4905. @item H
  4906. the width and height of currently filtered plane
  4907. @item SW
  4908. @item SH
  4909. Width and height scale for the plane being filtered. It is the
  4910. ratio between the dimensions of the current plane to the luma plane,
  4911. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4912. the luma plane and @code{0.5,0.5} for the chroma planes.
  4913. @item T
  4914. Time of the current frame, expressed in seconds.
  4915. @item TOP, A
  4916. Value of pixel component at current location for first video frame (top layer).
  4917. @item BOTTOM, B
  4918. Value of pixel component at current location for second video frame (bottom layer).
  4919. @end table
  4920. @end table
  4921. The @code{blend} filter also supports the @ref{framesync} options.
  4922. @subsection Examples
  4923. @itemize
  4924. @item
  4925. Apply transition from bottom layer to top layer in first 10 seconds:
  4926. @example
  4927. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4928. @end example
  4929. @item
  4930. Apply linear horizontal transition from top layer to bottom layer:
  4931. @example
  4932. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4933. @end example
  4934. @item
  4935. Apply 1x1 checkerboard effect:
  4936. @example
  4937. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4938. @end example
  4939. @item
  4940. Apply uncover left effect:
  4941. @example
  4942. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4943. @end example
  4944. @item
  4945. Apply uncover down effect:
  4946. @example
  4947. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4948. @end example
  4949. @item
  4950. Apply uncover up-left effect:
  4951. @example
  4952. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4953. @end example
  4954. @item
  4955. Split diagonally video and shows top and bottom layer on each side:
  4956. @example
  4957. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4958. @end example
  4959. @item
  4960. Display differences between the current and the previous frame:
  4961. @example
  4962. tblend=all_mode=grainextract
  4963. @end example
  4964. @end itemize
  4965. @section bm3d
  4966. Denoise frames using Block-Matching 3D algorithm.
  4967. The filter accepts the following options.
  4968. @table @option
  4969. @item sigma
  4970. Set denoising strength. Default value is 1.
  4971. Allowed range is from 0 to 999.9.
  4972. The denoising algorithm is very sensitive to sigma, so adjust it
  4973. according to the source.
  4974. @item block
  4975. Set local patch size. This sets dimensions in 2D.
  4976. @item bstep
  4977. Set sliding step for processing blocks. Default value is 4.
  4978. Allowed range is from 1 to 64.
  4979. Smaller values allows processing more reference blocks and is slower.
  4980. @item group
  4981. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4982. When set to 1, no block matching is done. Larger values allows more blocks
  4983. in single group.
  4984. Allowed range is from 1 to 256.
  4985. @item range
  4986. Set radius for search block matching. Default is 9.
  4987. Allowed range is from 1 to INT32_MAX.
  4988. @item mstep
  4989. Set step between two search locations for block matching. Default is 1.
  4990. Allowed range is from 1 to 64. Smaller is slower.
  4991. @item thmse
  4992. Set threshold of mean square error for block matching. Valid range is 0 to
  4993. INT32_MAX.
  4994. @item hdthr
  4995. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4996. Larger values results in stronger hard-thresholding filtering in frequency
  4997. domain.
  4998. @item estim
  4999. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5000. Default is @code{basic}.
  5001. @item ref
  5002. If enabled, filter will use 2nd stream for block matching.
  5003. Default is disabled for @code{basic} value of @var{estim} option,
  5004. and always enabled if value of @var{estim} is @code{final}.
  5005. @item planes
  5006. Set planes to filter. Default is all available except alpha.
  5007. @end table
  5008. @subsection Examples
  5009. @itemize
  5010. @item
  5011. Basic filtering with bm3d:
  5012. @example
  5013. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5014. @end example
  5015. @item
  5016. Same as above, but filtering only luma:
  5017. @example
  5018. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5019. @end example
  5020. @item
  5021. Same as above, but with both estimation modes:
  5022. @example
  5023. 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
  5024. @end example
  5025. @item
  5026. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5027. @example
  5028. 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
  5029. @end example
  5030. @end itemize
  5031. @section boxblur
  5032. Apply a boxblur algorithm to the input video.
  5033. It accepts the following parameters:
  5034. @table @option
  5035. @item luma_radius, lr
  5036. @item luma_power, lp
  5037. @item chroma_radius, cr
  5038. @item chroma_power, cp
  5039. @item alpha_radius, ar
  5040. @item alpha_power, ap
  5041. @end table
  5042. A description of the accepted options follows.
  5043. @table @option
  5044. @item luma_radius, lr
  5045. @item chroma_radius, cr
  5046. @item alpha_radius, ar
  5047. Set an expression for the box radius in pixels used for blurring the
  5048. corresponding input plane.
  5049. The radius value must be a non-negative number, and must not be
  5050. greater than the value of the expression @code{min(w,h)/2} for the
  5051. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5052. planes.
  5053. Default value for @option{luma_radius} is "2". If not specified,
  5054. @option{chroma_radius} and @option{alpha_radius} default to the
  5055. corresponding value set for @option{luma_radius}.
  5056. The expressions can contain the following constants:
  5057. @table @option
  5058. @item w
  5059. @item h
  5060. The input width and height in pixels.
  5061. @item cw
  5062. @item ch
  5063. The input chroma image width and height in pixels.
  5064. @item hsub
  5065. @item vsub
  5066. The horizontal and vertical chroma subsample values. For example, for the
  5067. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5068. @end table
  5069. @item luma_power, lp
  5070. @item chroma_power, cp
  5071. @item alpha_power, ap
  5072. Specify how many times the boxblur filter is applied to the
  5073. corresponding plane.
  5074. Default value for @option{luma_power} is 2. If not specified,
  5075. @option{chroma_power} and @option{alpha_power} default to the
  5076. corresponding value set for @option{luma_power}.
  5077. A value of 0 will disable the effect.
  5078. @end table
  5079. @subsection Examples
  5080. @itemize
  5081. @item
  5082. Apply a boxblur filter with the luma, chroma, and alpha radii
  5083. set to 2:
  5084. @example
  5085. boxblur=luma_radius=2:luma_power=1
  5086. boxblur=2:1
  5087. @end example
  5088. @item
  5089. Set the luma radius to 2, and alpha and chroma radius to 0:
  5090. @example
  5091. boxblur=2:1:cr=0:ar=0
  5092. @end example
  5093. @item
  5094. Set the luma and chroma radii to a fraction of the video dimension:
  5095. @example
  5096. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5097. @end example
  5098. @end itemize
  5099. @section bwdif
  5100. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5101. Deinterlacing Filter").
  5102. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5103. interpolation algorithms.
  5104. It accepts the following parameters:
  5105. @table @option
  5106. @item mode
  5107. The interlacing mode to adopt. It accepts one of the following values:
  5108. @table @option
  5109. @item 0, send_frame
  5110. Output one frame for each frame.
  5111. @item 1, send_field
  5112. Output one frame for each field.
  5113. @end table
  5114. The default value is @code{send_field}.
  5115. @item parity
  5116. The picture field parity assumed for the input interlaced video. It accepts one
  5117. of the following values:
  5118. @table @option
  5119. @item 0, tff
  5120. Assume the top field is first.
  5121. @item 1, bff
  5122. Assume the bottom field is first.
  5123. @item -1, auto
  5124. Enable automatic detection of field parity.
  5125. @end table
  5126. The default value is @code{auto}.
  5127. If the interlacing is unknown or the decoder does not export this information,
  5128. top field first will be assumed.
  5129. @item deint
  5130. Specify which frames to deinterlace. Accept one of the following
  5131. values:
  5132. @table @option
  5133. @item 0, all
  5134. Deinterlace all frames.
  5135. @item 1, interlaced
  5136. Only deinterlace frames marked as interlaced.
  5137. @end table
  5138. The default value is @code{all}.
  5139. @end table
  5140. @section chromahold
  5141. Remove all color information for all colors except for certain one.
  5142. The filter accepts the following options:
  5143. @table @option
  5144. @item color
  5145. The color which will not be replaced with neutral chroma.
  5146. @item similarity
  5147. Similarity percentage with the above color.
  5148. 0.01 matches only the exact key color, while 1.0 matches everything.
  5149. @item blend
  5150. Blend percentage.
  5151. 0.0 makes pixels either fully gray, or not gray at all.
  5152. Higher values result in more preserved color.
  5153. @item yuv
  5154. Signals that the color passed is already in YUV instead of RGB.
  5155. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5156. This can be used to pass exact YUV values as hexadecimal numbers.
  5157. @end table
  5158. @section chromakey
  5159. YUV colorspace color/chroma keying.
  5160. The filter accepts the following options:
  5161. @table @option
  5162. @item color
  5163. The color which will be replaced with transparency.
  5164. @item similarity
  5165. Similarity percentage with the key color.
  5166. 0.01 matches only the exact key color, while 1.0 matches everything.
  5167. @item blend
  5168. Blend percentage.
  5169. 0.0 makes pixels either fully transparent, or not transparent at all.
  5170. Higher values result in semi-transparent pixels, with a higher transparency
  5171. the more similar the pixels color is to the key color.
  5172. @item yuv
  5173. Signals that the color passed is already in YUV instead of RGB.
  5174. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5175. This can be used to pass exact YUV values as hexadecimal numbers.
  5176. @end table
  5177. @subsection Examples
  5178. @itemize
  5179. @item
  5180. Make every green pixel in the input image transparent:
  5181. @example
  5182. ffmpeg -i input.png -vf chromakey=green out.png
  5183. @end example
  5184. @item
  5185. Overlay a greenscreen-video on top of a static black background.
  5186. @example
  5187. 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
  5188. @end example
  5189. @end itemize
  5190. @section chromashift
  5191. Shift chroma pixels horizontally and/or vertically.
  5192. The filter accepts the following options:
  5193. @table @option
  5194. @item cbh
  5195. Set amount to shift chroma-blue horizontally.
  5196. @item cbv
  5197. Set amount to shift chroma-blue vertically.
  5198. @item crh
  5199. Set amount to shift chroma-red horizontally.
  5200. @item crv
  5201. Set amount to shift chroma-red vertically.
  5202. @item edge
  5203. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5204. @end table
  5205. @section ciescope
  5206. Display CIE color diagram with pixels overlaid onto it.
  5207. The filter accepts the following options:
  5208. @table @option
  5209. @item system
  5210. Set color system.
  5211. @table @samp
  5212. @item ntsc, 470m
  5213. @item ebu, 470bg
  5214. @item smpte
  5215. @item 240m
  5216. @item apple
  5217. @item widergb
  5218. @item cie1931
  5219. @item rec709, hdtv
  5220. @item uhdtv, rec2020
  5221. @item dcip3
  5222. @end table
  5223. @item cie
  5224. Set CIE system.
  5225. @table @samp
  5226. @item xyy
  5227. @item ucs
  5228. @item luv
  5229. @end table
  5230. @item gamuts
  5231. Set what gamuts to draw.
  5232. See @code{system} option for available values.
  5233. @item size, s
  5234. Set ciescope size, by default set to 512.
  5235. @item intensity, i
  5236. Set intensity used to map input pixel values to CIE diagram.
  5237. @item contrast
  5238. Set contrast used to draw tongue colors that are out of active color system gamut.
  5239. @item corrgamma
  5240. Correct gamma displayed on scope, by default enabled.
  5241. @item showwhite
  5242. Show white point on CIE diagram, by default disabled.
  5243. @item gamma
  5244. Set input gamma. Used only with XYZ input color space.
  5245. @end table
  5246. @section codecview
  5247. Visualize information exported by some codecs.
  5248. Some codecs can export information through frames using side-data or other
  5249. means. For example, some MPEG based codecs export motion vectors through the
  5250. @var{export_mvs} flag in the codec @option{flags2} option.
  5251. The filter accepts the following option:
  5252. @table @option
  5253. @item mv
  5254. Set motion vectors to visualize.
  5255. Available flags for @var{mv} are:
  5256. @table @samp
  5257. @item pf
  5258. forward predicted MVs of P-frames
  5259. @item bf
  5260. forward predicted MVs of B-frames
  5261. @item bb
  5262. backward predicted MVs of B-frames
  5263. @end table
  5264. @item qp
  5265. Display quantization parameters using the chroma planes.
  5266. @item mv_type, mvt
  5267. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5268. Available flags for @var{mv_type} are:
  5269. @table @samp
  5270. @item fp
  5271. forward predicted MVs
  5272. @item bp
  5273. backward predicted MVs
  5274. @end table
  5275. @item frame_type, ft
  5276. Set frame type to visualize motion vectors of.
  5277. Available flags for @var{frame_type} are:
  5278. @table @samp
  5279. @item if
  5280. intra-coded frames (I-frames)
  5281. @item pf
  5282. predicted frames (P-frames)
  5283. @item bf
  5284. bi-directionally predicted frames (B-frames)
  5285. @end table
  5286. @end table
  5287. @subsection Examples
  5288. @itemize
  5289. @item
  5290. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5291. @example
  5292. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5293. @end example
  5294. @item
  5295. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5296. @example
  5297. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5298. @end example
  5299. @end itemize
  5300. @section colorbalance
  5301. Modify intensity of primary colors (red, green and blue) of input frames.
  5302. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5303. regions for the red-cyan, green-magenta or blue-yellow balance.
  5304. A positive adjustment value shifts the balance towards the primary color, a negative
  5305. value towards the complementary color.
  5306. The filter accepts the following options:
  5307. @table @option
  5308. @item rs
  5309. @item gs
  5310. @item bs
  5311. Adjust red, green and blue shadows (darkest pixels).
  5312. @item rm
  5313. @item gm
  5314. @item bm
  5315. Adjust red, green and blue midtones (medium pixels).
  5316. @item rh
  5317. @item gh
  5318. @item bh
  5319. Adjust red, green and blue highlights (brightest pixels).
  5320. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5321. @end table
  5322. @subsection Examples
  5323. @itemize
  5324. @item
  5325. Add red color cast to shadows:
  5326. @example
  5327. colorbalance=rs=.3
  5328. @end example
  5329. @end itemize
  5330. @section colorkey
  5331. RGB colorspace color keying.
  5332. The filter accepts the following options:
  5333. @table @option
  5334. @item color
  5335. The color which will be replaced with transparency.
  5336. @item similarity
  5337. Similarity percentage with the key color.
  5338. 0.01 matches only the exact key color, while 1.0 matches everything.
  5339. @item blend
  5340. Blend percentage.
  5341. 0.0 makes pixels either fully transparent, or not transparent at all.
  5342. Higher values result in semi-transparent pixels, with a higher transparency
  5343. the more similar the pixels color is to the key color.
  5344. @end table
  5345. @subsection Examples
  5346. @itemize
  5347. @item
  5348. Make every green pixel in the input image transparent:
  5349. @example
  5350. ffmpeg -i input.png -vf colorkey=green out.png
  5351. @end example
  5352. @item
  5353. Overlay a greenscreen-video on top of a static background image.
  5354. @example
  5355. 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
  5356. @end example
  5357. @end itemize
  5358. @section colorhold
  5359. Remove all color information for all RGB colors except for certain one.
  5360. The filter accepts the following options:
  5361. @table @option
  5362. @item color
  5363. The color which will not be replaced with neutral gray.
  5364. @item similarity
  5365. Similarity percentage with the above color.
  5366. 0.01 matches only the exact key color, while 1.0 matches everything.
  5367. @item blend
  5368. Blend percentage. 0.0 makes pixels fully gray.
  5369. Higher values result in more preserved color.
  5370. @end table
  5371. @section colorlevels
  5372. Adjust video input frames using levels.
  5373. The filter accepts the following options:
  5374. @table @option
  5375. @item rimin
  5376. @item gimin
  5377. @item bimin
  5378. @item aimin
  5379. Adjust red, green, blue and alpha input black point.
  5380. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5381. @item rimax
  5382. @item gimax
  5383. @item bimax
  5384. @item aimax
  5385. Adjust red, green, blue and alpha input white point.
  5386. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5387. Input levels are used to lighten highlights (bright tones), darken shadows
  5388. (dark tones), change the balance of bright and dark tones.
  5389. @item romin
  5390. @item gomin
  5391. @item bomin
  5392. @item aomin
  5393. Adjust red, green, blue and alpha output black point.
  5394. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5395. @item romax
  5396. @item gomax
  5397. @item bomax
  5398. @item aomax
  5399. Adjust red, green, blue and alpha output white point.
  5400. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5401. Output levels allows manual selection of a constrained output level range.
  5402. @end table
  5403. @subsection Examples
  5404. @itemize
  5405. @item
  5406. Make video output darker:
  5407. @example
  5408. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5409. @end example
  5410. @item
  5411. Increase contrast:
  5412. @example
  5413. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5414. @end example
  5415. @item
  5416. Make video output lighter:
  5417. @example
  5418. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5419. @end example
  5420. @item
  5421. Increase brightness:
  5422. @example
  5423. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5424. @end example
  5425. @end itemize
  5426. @section colorchannelmixer
  5427. Adjust video input frames by re-mixing color channels.
  5428. This filter modifies a color channel by adding the values associated to
  5429. the other channels of the same pixels. For example if the value to
  5430. modify is red, the output value will be:
  5431. @example
  5432. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5433. @end example
  5434. The filter accepts the following options:
  5435. @table @option
  5436. @item rr
  5437. @item rg
  5438. @item rb
  5439. @item ra
  5440. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5441. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5442. @item gr
  5443. @item gg
  5444. @item gb
  5445. @item ga
  5446. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5447. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5448. @item br
  5449. @item bg
  5450. @item bb
  5451. @item ba
  5452. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5453. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5454. @item ar
  5455. @item ag
  5456. @item ab
  5457. @item aa
  5458. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5459. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5460. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5461. @end table
  5462. @subsection Examples
  5463. @itemize
  5464. @item
  5465. Convert source to grayscale:
  5466. @example
  5467. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5468. @end example
  5469. @item
  5470. Simulate sepia tones:
  5471. @example
  5472. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5473. @end example
  5474. @end itemize
  5475. @section colormatrix
  5476. Convert color matrix.
  5477. The filter accepts the following options:
  5478. @table @option
  5479. @item src
  5480. @item dst
  5481. Specify the source and destination color matrix. Both values must be
  5482. specified.
  5483. The accepted values are:
  5484. @table @samp
  5485. @item bt709
  5486. BT.709
  5487. @item fcc
  5488. FCC
  5489. @item bt601
  5490. BT.601
  5491. @item bt470
  5492. BT.470
  5493. @item bt470bg
  5494. BT.470BG
  5495. @item smpte170m
  5496. SMPTE-170M
  5497. @item smpte240m
  5498. SMPTE-240M
  5499. @item bt2020
  5500. BT.2020
  5501. @end table
  5502. @end table
  5503. For example to convert from BT.601 to SMPTE-240M, use the command:
  5504. @example
  5505. colormatrix=bt601:smpte240m
  5506. @end example
  5507. @section colorspace
  5508. Convert colorspace, transfer characteristics or color primaries.
  5509. Input video needs to have an even size.
  5510. The filter accepts the following options:
  5511. @table @option
  5512. @anchor{all}
  5513. @item all
  5514. Specify all color properties at once.
  5515. The accepted values are:
  5516. @table @samp
  5517. @item bt470m
  5518. BT.470M
  5519. @item bt470bg
  5520. BT.470BG
  5521. @item bt601-6-525
  5522. BT.601-6 525
  5523. @item bt601-6-625
  5524. BT.601-6 625
  5525. @item bt709
  5526. BT.709
  5527. @item smpte170m
  5528. SMPTE-170M
  5529. @item smpte240m
  5530. SMPTE-240M
  5531. @item bt2020
  5532. BT.2020
  5533. @end table
  5534. @anchor{space}
  5535. @item space
  5536. Specify output colorspace.
  5537. The accepted values are:
  5538. @table @samp
  5539. @item bt709
  5540. BT.709
  5541. @item fcc
  5542. FCC
  5543. @item bt470bg
  5544. BT.470BG or BT.601-6 625
  5545. @item smpte170m
  5546. SMPTE-170M or BT.601-6 525
  5547. @item smpte240m
  5548. SMPTE-240M
  5549. @item ycgco
  5550. YCgCo
  5551. @item bt2020ncl
  5552. BT.2020 with non-constant luminance
  5553. @end table
  5554. @anchor{trc}
  5555. @item trc
  5556. Specify output transfer characteristics.
  5557. The accepted values are:
  5558. @table @samp
  5559. @item bt709
  5560. BT.709
  5561. @item bt470m
  5562. BT.470M
  5563. @item bt470bg
  5564. BT.470BG
  5565. @item gamma22
  5566. Constant gamma of 2.2
  5567. @item gamma28
  5568. Constant gamma of 2.8
  5569. @item smpte170m
  5570. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5571. @item smpte240m
  5572. SMPTE-240M
  5573. @item srgb
  5574. SRGB
  5575. @item iec61966-2-1
  5576. iec61966-2-1
  5577. @item iec61966-2-4
  5578. iec61966-2-4
  5579. @item xvycc
  5580. xvycc
  5581. @item bt2020-10
  5582. BT.2020 for 10-bits content
  5583. @item bt2020-12
  5584. BT.2020 for 12-bits content
  5585. @end table
  5586. @anchor{primaries}
  5587. @item primaries
  5588. Specify output color primaries.
  5589. The accepted values are:
  5590. @table @samp
  5591. @item bt709
  5592. BT.709
  5593. @item bt470m
  5594. BT.470M
  5595. @item bt470bg
  5596. BT.470BG or BT.601-6 625
  5597. @item smpte170m
  5598. SMPTE-170M or BT.601-6 525
  5599. @item smpte240m
  5600. SMPTE-240M
  5601. @item film
  5602. film
  5603. @item smpte431
  5604. SMPTE-431
  5605. @item smpte432
  5606. SMPTE-432
  5607. @item bt2020
  5608. BT.2020
  5609. @item jedec-p22
  5610. JEDEC P22 phosphors
  5611. @end table
  5612. @anchor{range}
  5613. @item range
  5614. Specify output color range.
  5615. The accepted values are:
  5616. @table @samp
  5617. @item tv
  5618. TV (restricted) range
  5619. @item mpeg
  5620. MPEG (restricted) range
  5621. @item pc
  5622. PC (full) range
  5623. @item jpeg
  5624. JPEG (full) range
  5625. @end table
  5626. @item format
  5627. Specify output color format.
  5628. The accepted values are:
  5629. @table @samp
  5630. @item yuv420p
  5631. YUV 4:2:0 planar 8-bits
  5632. @item yuv420p10
  5633. YUV 4:2:0 planar 10-bits
  5634. @item yuv420p12
  5635. YUV 4:2:0 planar 12-bits
  5636. @item yuv422p
  5637. YUV 4:2:2 planar 8-bits
  5638. @item yuv422p10
  5639. YUV 4:2:2 planar 10-bits
  5640. @item yuv422p12
  5641. YUV 4:2:2 planar 12-bits
  5642. @item yuv444p
  5643. YUV 4:4:4 planar 8-bits
  5644. @item yuv444p10
  5645. YUV 4:4:4 planar 10-bits
  5646. @item yuv444p12
  5647. YUV 4:4:4 planar 12-bits
  5648. @end table
  5649. @item fast
  5650. Do a fast conversion, which skips gamma/primary correction. This will take
  5651. significantly less CPU, but will be mathematically incorrect. To get output
  5652. compatible with that produced by the colormatrix filter, use fast=1.
  5653. @item dither
  5654. Specify dithering mode.
  5655. The accepted values are:
  5656. @table @samp
  5657. @item none
  5658. No dithering
  5659. @item fsb
  5660. Floyd-Steinberg dithering
  5661. @end table
  5662. @item wpadapt
  5663. Whitepoint adaptation mode.
  5664. The accepted values are:
  5665. @table @samp
  5666. @item bradford
  5667. Bradford whitepoint adaptation
  5668. @item vonkries
  5669. von Kries whitepoint adaptation
  5670. @item identity
  5671. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5672. @end table
  5673. @item iall
  5674. Override all input properties at once. Same accepted values as @ref{all}.
  5675. @item ispace
  5676. Override input colorspace. Same accepted values as @ref{space}.
  5677. @item iprimaries
  5678. Override input color primaries. Same accepted values as @ref{primaries}.
  5679. @item itrc
  5680. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5681. @item irange
  5682. Override input color range. Same accepted values as @ref{range}.
  5683. @end table
  5684. The filter converts the transfer characteristics, color space and color
  5685. primaries to the specified user values. The output value, if not specified,
  5686. is set to a default value based on the "all" property. If that property is
  5687. also not specified, the filter will log an error. The output color range and
  5688. format default to the same value as the input color range and format. The
  5689. input transfer characteristics, color space, color primaries and color range
  5690. should be set on the input data. If any of these are missing, the filter will
  5691. log an error and no conversion will take place.
  5692. For example to convert the input to SMPTE-240M, use the command:
  5693. @example
  5694. colorspace=smpte240m
  5695. @end example
  5696. @section convolution
  5697. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5698. The filter accepts the following options:
  5699. @table @option
  5700. @item 0m
  5701. @item 1m
  5702. @item 2m
  5703. @item 3m
  5704. Set matrix for each plane.
  5705. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5706. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5707. @item 0rdiv
  5708. @item 1rdiv
  5709. @item 2rdiv
  5710. @item 3rdiv
  5711. Set multiplier for calculated value for each plane.
  5712. If unset or 0, it will be sum of all matrix elements.
  5713. @item 0bias
  5714. @item 1bias
  5715. @item 2bias
  5716. @item 3bias
  5717. Set bias for each plane. This value is added to the result of the multiplication.
  5718. Useful for making the overall image brighter or darker. Default is 0.0.
  5719. @item 0mode
  5720. @item 1mode
  5721. @item 2mode
  5722. @item 3mode
  5723. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5724. Default is @var{square}.
  5725. @end table
  5726. @subsection Examples
  5727. @itemize
  5728. @item
  5729. Apply sharpen:
  5730. @example
  5731. 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"
  5732. @end example
  5733. @item
  5734. Apply blur:
  5735. @example
  5736. 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"
  5737. @end example
  5738. @item
  5739. Apply edge enhance:
  5740. @example
  5741. 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"
  5742. @end example
  5743. @item
  5744. Apply edge detect:
  5745. @example
  5746. 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"
  5747. @end example
  5748. @item
  5749. Apply laplacian edge detector which includes diagonals:
  5750. @example
  5751. 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"
  5752. @end example
  5753. @item
  5754. Apply emboss:
  5755. @example
  5756. 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"
  5757. @end example
  5758. @end itemize
  5759. @section convolve
  5760. Apply 2D convolution of video stream in frequency domain using second stream
  5761. as impulse.
  5762. The filter accepts the following options:
  5763. @table @option
  5764. @item planes
  5765. Set which planes to process.
  5766. @item impulse
  5767. Set which impulse video frames will be processed, can be @var{first}
  5768. or @var{all}. Default is @var{all}.
  5769. @end table
  5770. The @code{convolve} filter also supports the @ref{framesync} options.
  5771. @section copy
  5772. Copy the input video source unchanged to the output. This is mainly useful for
  5773. testing purposes.
  5774. @anchor{coreimage}
  5775. @section coreimage
  5776. Video filtering on GPU using Apple's CoreImage API on OSX.
  5777. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5778. processed by video hardware. However, software-based OpenGL implementations
  5779. exist which means there is no guarantee for hardware processing. It depends on
  5780. the respective OSX.
  5781. There are many filters and image generators provided by Apple that come with a
  5782. large variety of options. The filter has to be referenced by its name along
  5783. with its options.
  5784. The coreimage filter accepts the following options:
  5785. @table @option
  5786. @item list_filters
  5787. List all available filters and generators along with all their respective
  5788. options as well as possible minimum and maximum values along with the default
  5789. values.
  5790. @example
  5791. list_filters=true
  5792. @end example
  5793. @item filter
  5794. Specify all filters by their respective name and options.
  5795. Use @var{list_filters} to determine all valid filter names and options.
  5796. Numerical options are specified by a float value and are automatically clamped
  5797. to their respective value range. Vector and color options have to be specified
  5798. by a list of space separated float values. Character escaping has to be done.
  5799. A special option name @code{default} is available to use default options for a
  5800. filter.
  5801. It is required to specify either @code{default} or at least one of the filter options.
  5802. All omitted options are used with their default values.
  5803. The syntax of the filter string is as follows:
  5804. @example
  5805. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5806. @end example
  5807. @item output_rect
  5808. Specify a rectangle where the output of the filter chain is copied into the
  5809. input image. It is given by a list of space separated float values:
  5810. @example
  5811. output_rect=x\ y\ width\ height
  5812. @end example
  5813. If not given, the output rectangle equals the dimensions of the input image.
  5814. The output rectangle is automatically cropped at the borders of the input
  5815. image. Negative values are valid for each component.
  5816. @example
  5817. output_rect=25\ 25\ 100\ 100
  5818. @end example
  5819. @end table
  5820. Several filters can be chained for successive processing without GPU-HOST
  5821. transfers allowing for fast processing of complex filter chains.
  5822. Currently, only filters with zero (generators) or exactly one (filters) input
  5823. image and one output image are supported. Also, transition filters are not yet
  5824. usable as intended.
  5825. Some filters generate output images with additional padding depending on the
  5826. respective filter kernel. The padding is automatically removed to ensure the
  5827. filter output has the same size as the input image.
  5828. For image generators, the size of the output image is determined by the
  5829. previous output image of the filter chain or the input image of the whole
  5830. filterchain, respectively. The generators do not use the pixel information of
  5831. this image to generate their output. However, the generated output is
  5832. blended onto this image, resulting in partial or complete coverage of the
  5833. output image.
  5834. The @ref{coreimagesrc} video source can be used for generating input images
  5835. which are directly fed into the filter chain. By using it, providing input
  5836. images by another video source or an input video is not required.
  5837. @subsection Examples
  5838. @itemize
  5839. @item
  5840. List all filters available:
  5841. @example
  5842. coreimage=list_filters=true
  5843. @end example
  5844. @item
  5845. Use the CIBoxBlur filter with default options to blur an image:
  5846. @example
  5847. coreimage=filter=CIBoxBlur@@default
  5848. @end example
  5849. @item
  5850. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5851. its center at 100x100 and a radius of 50 pixels:
  5852. @example
  5853. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5854. @end example
  5855. @item
  5856. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5857. given as complete and escaped command-line for Apple's standard bash shell:
  5858. @example
  5859. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5860. @end example
  5861. @end itemize
  5862. @section crop
  5863. Crop the input video to given dimensions.
  5864. It accepts the following parameters:
  5865. @table @option
  5866. @item w, out_w
  5867. The width of the output video. It defaults to @code{iw}.
  5868. This expression is evaluated only once during the filter
  5869. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5870. @item h, out_h
  5871. The height of the output video. It defaults to @code{ih}.
  5872. This expression is evaluated only once during the filter
  5873. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5874. @item x
  5875. The horizontal position, in the input video, of the left edge of the output
  5876. video. It defaults to @code{(in_w-out_w)/2}.
  5877. This expression is evaluated per-frame.
  5878. @item y
  5879. The vertical position, in the input video, of the top edge of the output video.
  5880. It defaults to @code{(in_h-out_h)/2}.
  5881. This expression is evaluated per-frame.
  5882. @item keep_aspect
  5883. If set to 1 will force the output display aspect ratio
  5884. to be the same of the input, by changing the output sample aspect
  5885. ratio. It defaults to 0.
  5886. @item exact
  5887. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5888. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5889. It defaults to 0.
  5890. @end table
  5891. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5892. expressions containing the following constants:
  5893. @table @option
  5894. @item x
  5895. @item y
  5896. The computed values for @var{x} and @var{y}. They are evaluated for
  5897. each new frame.
  5898. @item in_w
  5899. @item in_h
  5900. The input width and height.
  5901. @item iw
  5902. @item ih
  5903. These are the same as @var{in_w} and @var{in_h}.
  5904. @item out_w
  5905. @item out_h
  5906. The output (cropped) width and height.
  5907. @item ow
  5908. @item oh
  5909. These are the same as @var{out_w} and @var{out_h}.
  5910. @item a
  5911. same as @var{iw} / @var{ih}
  5912. @item sar
  5913. input sample aspect ratio
  5914. @item dar
  5915. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5916. @item hsub
  5917. @item vsub
  5918. horizontal and vertical chroma subsample values. For example for the
  5919. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5920. @item n
  5921. The number of the input frame, starting from 0.
  5922. @item pos
  5923. the position in the file of the input frame, NAN if unknown
  5924. @item t
  5925. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5926. @end table
  5927. The expression for @var{out_w} may depend on the value of @var{out_h},
  5928. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5929. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5930. evaluated after @var{out_w} and @var{out_h}.
  5931. The @var{x} and @var{y} parameters specify the expressions for the
  5932. position of the top-left corner of the output (non-cropped) area. They
  5933. are evaluated for each frame. If the evaluated value is not valid, it
  5934. is approximated to the nearest valid value.
  5935. The expression for @var{x} may depend on @var{y}, and the expression
  5936. for @var{y} may depend on @var{x}.
  5937. @subsection Examples
  5938. @itemize
  5939. @item
  5940. Crop area with size 100x100 at position (12,34).
  5941. @example
  5942. crop=100:100:12:34
  5943. @end example
  5944. Using named options, the example above becomes:
  5945. @example
  5946. crop=w=100:h=100:x=12:y=34
  5947. @end example
  5948. @item
  5949. Crop the central input area with size 100x100:
  5950. @example
  5951. crop=100:100
  5952. @end example
  5953. @item
  5954. Crop the central input area with size 2/3 of the input video:
  5955. @example
  5956. crop=2/3*in_w:2/3*in_h
  5957. @end example
  5958. @item
  5959. Crop the input video central square:
  5960. @example
  5961. crop=out_w=in_h
  5962. crop=in_h
  5963. @end example
  5964. @item
  5965. Delimit the rectangle with the top-left corner placed at position
  5966. 100:100 and the right-bottom corner corresponding to the right-bottom
  5967. corner of the input image.
  5968. @example
  5969. crop=in_w-100:in_h-100:100:100
  5970. @end example
  5971. @item
  5972. Crop 10 pixels from the left and right borders, and 20 pixels from
  5973. the top and bottom borders
  5974. @example
  5975. crop=in_w-2*10:in_h-2*20
  5976. @end example
  5977. @item
  5978. Keep only the bottom right quarter of the input image:
  5979. @example
  5980. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5981. @end example
  5982. @item
  5983. Crop height for getting Greek harmony:
  5984. @example
  5985. crop=in_w:1/PHI*in_w
  5986. @end example
  5987. @item
  5988. Apply trembling effect:
  5989. @example
  5990. 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)
  5991. @end example
  5992. @item
  5993. Apply erratic camera effect depending on timestamp:
  5994. @example
  5995. 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)"
  5996. @end example
  5997. @item
  5998. Set x depending on the value of y:
  5999. @example
  6000. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6001. @end example
  6002. @end itemize
  6003. @subsection Commands
  6004. This filter supports the following commands:
  6005. @table @option
  6006. @item w, out_w
  6007. @item h, out_h
  6008. @item x
  6009. @item y
  6010. Set width/height of the output video and the horizontal/vertical position
  6011. in the input video.
  6012. The command accepts the same syntax of the corresponding option.
  6013. If the specified expression is not valid, it is kept at its current
  6014. value.
  6015. @end table
  6016. @section cropdetect
  6017. Auto-detect the crop size.
  6018. It calculates the necessary cropping parameters and prints the
  6019. recommended parameters via the logging system. The detected dimensions
  6020. correspond to the non-black area of the input video.
  6021. It accepts the following parameters:
  6022. @table @option
  6023. @item limit
  6024. Set higher black value threshold, which can be optionally specified
  6025. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6026. value greater to the set value is considered non-black. It defaults to 24.
  6027. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6028. on the bitdepth of the pixel format.
  6029. @item round
  6030. The value which the width/height should be divisible by. It defaults to
  6031. 16. The offset is automatically adjusted to center the video. Use 2 to
  6032. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6033. encoding to most video codecs.
  6034. @item reset_count, reset
  6035. Set the counter that determines after how many frames cropdetect will
  6036. reset the previously detected largest video area and start over to
  6037. detect the current optimal crop area. Default value is 0.
  6038. This can be useful when channel logos distort the video area. 0
  6039. indicates 'never reset', and returns the largest area encountered during
  6040. playback.
  6041. @end table
  6042. @anchor{cue}
  6043. @section cue
  6044. Delay video filtering until a given wallclock timestamp. The filter first
  6045. passes on @option{preroll} amount of frames, then it buffers at most
  6046. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6047. it forwards the buffered frames and also any subsequent frames coming in its
  6048. input.
  6049. The filter can be used synchronize the output of multiple ffmpeg processes for
  6050. realtime output devices like decklink. By putting the delay in the filtering
  6051. chain and pre-buffering frames the process can pass on data to output almost
  6052. immediately after the target wallclock timestamp is reached.
  6053. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6054. some use cases.
  6055. @table @option
  6056. @item cue
  6057. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6058. @item preroll
  6059. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6060. @item buffer
  6061. The maximum duration of content to buffer before waiting for the cue expressed
  6062. in seconds. Default is 0.
  6063. @end table
  6064. @anchor{curves}
  6065. @section curves
  6066. Apply color adjustments using curves.
  6067. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6068. component (red, green and blue) has its values defined by @var{N} key points
  6069. tied from each other using a smooth curve. The x-axis represents the pixel
  6070. values from the input frame, and the y-axis the new pixel values to be set for
  6071. the output frame.
  6072. By default, a component curve is defined by the two points @var{(0;0)} and
  6073. @var{(1;1)}. This creates a straight line where each original pixel value is
  6074. "adjusted" to its own value, which means no change to the image.
  6075. The filter allows you to redefine these two points and add some more. A new
  6076. curve (using a natural cubic spline interpolation) will be define to pass
  6077. smoothly through all these new coordinates. The new defined points needs to be
  6078. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6079. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6080. the vector spaces, the values will be clipped accordingly.
  6081. The filter accepts the following options:
  6082. @table @option
  6083. @item preset
  6084. Select one of the available color presets. This option can be used in addition
  6085. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6086. options takes priority on the preset values.
  6087. Available presets are:
  6088. @table @samp
  6089. @item none
  6090. @item color_negative
  6091. @item cross_process
  6092. @item darker
  6093. @item increase_contrast
  6094. @item lighter
  6095. @item linear_contrast
  6096. @item medium_contrast
  6097. @item negative
  6098. @item strong_contrast
  6099. @item vintage
  6100. @end table
  6101. Default is @code{none}.
  6102. @item master, m
  6103. Set the master key points. These points will define a second pass mapping. It
  6104. is sometimes called a "luminance" or "value" mapping. It can be used with
  6105. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6106. post-processing LUT.
  6107. @item red, r
  6108. Set the key points for the red component.
  6109. @item green, g
  6110. Set the key points for the green component.
  6111. @item blue, b
  6112. Set the key points for the blue component.
  6113. @item all
  6114. Set the key points for all components (not including master).
  6115. Can be used in addition to the other key points component
  6116. options. In this case, the unset component(s) will fallback on this
  6117. @option{all} setting.
  6118. @item psfile
  6119. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6120. @item plot
  6121. Save Gnuplot script of the curves in specified file.
  6122. @end table
  6123. To avoid some filtergraph syntax conflicts, each key points list need to be
  6124. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6125. @subsection Examples
  6126. @itemize
  6127. @item
  6128. Increase slightly the middle level of blue:
  6129. @example
  6130. curves=blue='0/0 0.5/0.58 1/1'
  6131. @end example
  6132. @item
  6133. Vintage effect:
  6134. @example
  6135. 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'
  6136. @end example
  6137. Here we obtain the following coordinates for each components:
  6138. @table @var
  6139. @item red
  6140. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6141. @item green
  6142. @code{(0;0) (0.50;0.48) (1;1)}
  6143. @item blue
  6144. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6145. @end table
  6146. @item
  6147. The previous example can also be achieved with the associated built-in preset:
  6148. @example
  6149. curves=preset=vintage
  6150. @end example
  6151. @item
  6152. Or simply:
  6153. @example
  6154. curves=vintage
  6155. @end example
  6156. @item
  6157. Use a Photoshop preset and redefine the points of the green component:
  6158. @example
  6159. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6160. @end example
  6161. @item
  6162. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6163. and @command{gnuplot}:
  6164. @example
  6165. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6166. gnuplot -p /tmp/curves.plt
  6167. @end example
  6168. @end itemize
  6169. @section datascope
  6170. Video data analysis filter.
  6171. This filter shows hexadecimal pixel values of part of video.
  6172. The filter accepts the following options:
  6173. @table @option
  6174. @item size, s
  6175. Set output video size.
  6176. @item x
  6177. Set x offset from where to pick pixels.
  6178. @item y
  6179. Set y offset from where to pick pixels.
  6180. @item mode
  6181. Set scope mode, can be one of the following:
  6182. @table @samp
  6183. @item mono
  6184. Draw hexadecimal pixel values with white color on black background.
  6185. @item color
  6186. Draw hexadecimal pixel values with input video pixel color on black
  6187. background.
  6188. @item color2
  6189. Draw hexadecimal pixel values on color background picked from input video,
  6190. the text color is picked in such way so its always visible.
  6191. @end table
  6192. @item axis
  6193. Draw rows and columns numbers on left and top of video.
  6194. @item opacity
  6195. Set background opacity.
  6196. @end table
  6197. @section dctdnoiz
  6198. Denoise frames using 2D DCT (frequency domain filtering).
  6199. This filter is not designed for real time.
  6200. The filter accepts the following options:
  6201. @table @option
  6202. @item sigma, s
  6203. Set the noise sigma constant.
  6204. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6205. coefficient (absolute value) below this threshold with be dropped.
  6206. If you need a more advanced filtering, see @option{expr}.
  6207. Default is @code{0}.
  6208. @item overlap
  6209. Set number overlapping pixels for each block. Since the filter can be slow, you
  6210. may want to reduce this value, at the cost of a less effective filter and the
  6211. risk of various artefacts.
  6212. If the overlapping value doesn't permit processing the whole input width or
  6213. height, a warning will be displayed and according borders won't be denoised.
  6214. Default value is @var{blocksize}-1, which is the best possible setting.
  6215. @item expr, e
  6216. Set the coefficient factor expression.
  6217. For each coefficient of a DCT block, this expression will be evaluated as a
  6218. multiplier value for the coefficient.
  6219. If this is option is set, the @option{sigma} option will be ignored.
  6220. The absolute value of the coefficient can be accessed through the @var{c}
  6221. variable.
  6222. @item n
  6223. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6224. @var{blocksize}, which is the width and height of the processed blocks.
  6225. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6226. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6227. on the speed processing. Also, a larger block size does not necessarily means a
  6228. better de-noising.
  6229. @end table
  6230. @subsection Examples
  6231. Apply a denoise with a @option{sigma} of @code{4.5}:
  6232. @example
  6233. dctdnoiz=4.5
  6234. @end example
  6235. The same operation can be achieved using the expression system:
  6236. @example
  6237. dctdnoiz=e='gte(c, 4.5*3)'
  6238. @end example
  6239. Violent denoise using a block size of @code{16x16}:
  6240. @example
  6241. dctdnoiz=15:n=4
  6242. @end example
  6243. @section deband
  6244. Remove banding artifacts from input video.
  6245. It works by replacing banded pixels with average value of referenced pixels.
  6246. The filter accepts the following options:
  6247. @table @option
  6248. @item 1thr
  6249. @item 2thr
  6250. @item 3thr
  6251. @item 4thr
  6252. Set banding detection threshold for each plane. Default is 0.02.
  6253. Valid range is 0.00003 to 0.5.
  6254. If difference between current pixel and reference pixel is less than threshold,
  6255. it will be considered as banded.
  6256. @item range, r
  6257. Banding detection range in pixels. Default is 16. If positive, random number
  6258. in range 0 to set value will be used. If negative, exact absolute value
  6259. will be used.
  6260. The range defines square of four pixels around current pixel.
  6261. @item direction, d
  6262. Set direction in radians from which four pixel will be compared. If positive,
  6263. random direction from 0 to set direction will be picked. If negative, exact of
  6264. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6265. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6266. column.
  6267. @item blur, b
  6268. If enabled, current pixel is compared with average value of all four
  6269. surrounding pixels. The default is enabled. If disabled current pixel is
  6270. compared with all four surrounding pixels. The pixel is considered banded
  6271. if only all four differences with surrounding pixels are less than threshold.
  6272. @item coupling, c
  6273. If enabled, current pixel is changed if and only if all pixel components are banded,
  6274. e.g. banding detection threshold is triggered for all color components.
  6275. The default is disabled.
  6276. @end table
  6277. @section deblock
  6278. Remove blocking artifacts from input video.
  6279. The filter accepts the following options:
  6280. @table @option
  6281. @item filter
  6282. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6283. This controls what kind of deblocking is applied.
  6284. @item block
  6285. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6286. @item alpha
  6287. @item beta
  6288. @item gamma
  6289. @item delta
  6290. Set blocking detection thresholds. Allowed range is 0 to 1.
  6291. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6292. Using higher threshold gives more deblocking strength.
  6293. Setting @var{alpha} controls threshold detection at exact edge of block.
  6294. Remaining options controls threshold detection near the edge. Each one for
  6295. below/above or left/right. Setting any of those to @var{0} disables
  6296. deblocking.
  6297. @item planes
  6298. Set planes to filter. Default is to filter all available planes.
  6299. @end table
  6300. @subsection Examples
  6301. @itemize
  6302. @item
  6303. Deblock using weak filter and block size of 4 pixels.
  6304. @example
  6305. deblock=filter=weak:block=4
  6306. @end example
  6307. @item
  6308. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6309. deblocking more edges.
  6310. @example
  6311. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6312. @end example
  6313. @item
  6314. Similar as above, but filter only first plane.
  6315. @example
  6316. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6317. @end example
  6318. @item
  6319. Similar as above, but filter only second and third plane.
  6320. @example
  6321. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6322. @end example
  6323. @end itemize
  6324. @anchor{decimate}
  6325. @section decimate
  6326. Drop duplicated frames at regular intervals.
  6327. The filter accepts the following options:
  6328. @table @option
  6329. @item cycle
  6330. Set the number of frames from which one will be dropped. Setting this to
  6331. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6332. Default is @code{5}.
  6333. @item dupthresh
  6334. Set the threshold for duplicate detection. If the difference metric for a frame
  6335. is less than or equal to this value, then it is declared as duplicate. Default
  6336. is @code{1.1}
  6337. @item scthresh
  6338. Set scene change threshold. Default is @code{15}.
  6339. @item blockx
  6340. @item blocky
  6341. Set the size of the x and y-axis blocks used during metric calculations.
  6342. Larger blocks give better noise suppression, but also give worse detection of
  6343. small movements. Must be a power of two. Default is @code{32}.
  6344. @item ppsrc
  6345. Mark main input as a pre-processed input and activate clean source input
  6346. stream. This allows the input to be pre-processed with various filters to help
  6347. the metrics calculation while keeping the frame selection lossless. When set to
  6348. @code{1}, the first stream is for the pre-processed input, and the second
  6349. stream is the clean source from where the kept frames are chosen. Default is
  6350. @code{0}.
  6351. @item chroma
  6352. Set whether or not chroma is considered in the metric calculations. Default is
  6353. @code{1}.
  6354. @end table
  6355. @section deconvolve
  6356. Apply 2D deconvolution of video stream in frequency domain using second stream
  6357. as impulse.
  6358. The filter accepts the following options:
  6359. @table @option
  6360. @item planes
  6361. Set which planes to process.
  6362. @item impulse
  6363. Set which impulse video frames will be processed, can be @var{first}
  6364. or @var{all}. Default is @var{all}.
  6365. @item noise
  6366. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6367. and height are not same and not power of 2 or if stream prior to convolving
  6368. had noise.
  6369. @end table
  6370. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6371. @section dedot
  6372. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6373. It accepts the following options:
  6374. @table @option
  6375. @item m
  6376. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6377. @var{rainbows} for cross-color reduction.
  6378. @item lt
  6379. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6380. @item tl
  6381. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6382. @item tc
  6383. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6384. @item ct
  6385. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6386. @end table
  6387. @section deflate
  6388. Apply deflate effect to the video.
  6389. This filter replaces the pixel by the local(3x3) average by taking into account
  6390. only values lower than the pixel.
  6391. It accepts the following options:
  6392. @table @option
  6393. @item threshold0
  6394. @item threshold1
  6395. @item threshold2
  6396. @item threshold3
  6397. Limit the maximum change for each plane, default is 65535.
  6398. If 0, plane will remain unchanged.
  6399. @end table
  6400. @section deflicker
  6401. Remove temporal frame luminance variations.
  6402. It accepts the following options:
  6403. @table @option
  6404. @item size, s
  6405. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6406. @item mode, m
  6407. Set averaging mode to smooth temporal luminance variations.
  6408. Available values are:
  6409. @table @samp
  6410. @item am
  6411. Arithmetic mean
  6412. @item gm
  6413. Geometric mean
  6414. @item hm
  6415. Harmonic mean
  6416. @item qm
  6417. Quadratic mean
  6418. @item cm
  6419. Cubic mean
  6420. @item pm
  6421. Power mean
  6422. @item median
  6423. Median
  6424. @end table
  6425. @item bypass
  6426. Do not actually modify frame. Useful when one only wants metadata.
  6427. @end table
  6428. @section dejudder
  6429. Remove judder produced by partially interlaced telecined content.
  6430. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6431. source was partially telecined content then the output of @code{pullup,dejudder}
  6432. will have a variable frame rate. May change the recorded frame rate of the
  6433. container. Aside from that change, this filter will not affect constant frame
  6434. rate video.
  6435. The option available in this filter is:
  6436. @table @option
  6437. @item cycle
  6438. Specify the length of the window over which the judder repeats.
  6439. Accepts any integer greater than 1. Useful values are:
  6440. @table @samp
  6441. @item 4
  6442. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6443. @item 5
  6444. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6445. @item 20
  6446. If a mixture of the two.
  6447. @end table
  6448. The default is @samp{4}.
  6449. @end table
  6450. @section delogo
  6451. Suppress a TV station logo by a simple interpolation of the surrounding
  6452. pixels. Just set a rectangle covering the logo and watch it disappear
  6453. (and sometimes something even uglier appear - your mileage may vary).
  6454. It accepts the following parameters:
  6455. @table @option
  6456. @item x
  6457. @item y
  6458. Specify the top left corner coordinates of the logo. They must be
  6459. specified.
  6460. @item w
  6461. @item h
  6462. Specify the width and height of the logo to clear. They must be
  6463. specified.
  6464. @item band, t
  6465. Specify the thickness of the fuzzy edge of the rectangle (added to
  6466. @var{w} and @var{h}). The default value is 1. This option is
  6467. deprecated, setting higher values should no longer be necessary and
  6468. is not recommended.
  6469. @item show
  6470. When set to 1, a green rectangle is drawn on the screen to simplify
  6471. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6472. The default value is 0.
  6473. The rectangle is drawn on the outermost pixels which will be (partly)
  6474. replaced with interpolated values. The values of the next pixels
  6475. immediately outside this rectangle in each direction will be used to
  6476. compute the interpolated pixel values inside the rectangle.
  6477. @end table
  6478. @subsection Examples
  6479. @itemize
  6480. @item
  6481. Set a rectangle covering the area with top left corner coordinates 0,0
  6482. and size 100x77, and a band of size 10:
  6483. @example
  6484. delogo=x=0:y=0:w=100:h=77:band=10
  6485. @end example
  6486. @end itemize
  6487. @section derain
  6488. Remove the rain in the input image/video by applying the derain methods based on
  6489. convolutional neural networks. Supported models:
  6490. @itemize
  6491. @item
  6492. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6493. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6494. @end itemize
  6495. Training as well as model generation scripts are provided in
  6496. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6497. Native model files (.model) can be generated from TensorFlow model
  6498. files (.pb) by using tools/python/convert.py
  6499. The filter accepts the following options:
  6500. @table @option
  6501. @item filter_type
  6502. Specify which filter to use. This option accepts the following values:
  6503. @table @samp
  6504. @item derain
  6505. Derain filter. To conduct derain filter, you need to use a derain model.
  6506. @item dehaze
  6507. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6508. @end table
  6509. Default value is @samp{derain}.
  6510. @item dnn_backend
  6511. Specify which DNN backend to use for model loading and execution. This option accepts
  6512. the following values:
  6513. @table @samp
  6514. @item native
  6515. Native implementation of DNN loading and execution.
  6516. @item tensorflow
  6517. TensorFlow backend. To enable this backend you
  6518. need to install the TensorFlow for C library (see
  6519. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6520. @code{--enable-libtensorflow}
  6521. @end table
  6522. Default value is @samp{native}.
  6523. @item model
  6524. Set path to model file specifying network architecture and its parameters.
  6525. Note that different backends use different file formats. TensorFlow and native
  6526. backend can load files for only its format.
  6527. @end table
  6528. @section deshake
  6529. Attempt to fix small changes in horizontal and/or vertical shift. This
  6530. filter helps remove camera shake from hand-holding a camera, bumping a
  6531. tripod, moving on a vehicle, etc.
  6532. The filter accepts the following options:
  6533. @table @option
  6534. @item x
  6535. @item y
  6536. @item w
  6537. @item h
  6538. Specify a rectangular area where to limit the search for motion
  6539. vectors.
  6540. If desired the search for motion vectors can be limited to a
  6541. rectangular area of the frame defined by its top left corner, width
  6542. and height. These parameters have the same meaning as the drawbox
  6543. filter which can be used to visualise the position of the bounding
  6544. box.
  6545. This is useful when simultaneous movement of subjects within the frame
  6546. might be confused for camera motion by the motion vector search.
  6547. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6548. then the full frame is used. This allows later options to be set
  6549. without specifying the bounding box for the motion vector search.
  6550. Default - search the whole frame.
  6551. @item rx
  6552. @item ry
  6553. Specify the maximum extent of movement in x and y directions in the
  6554. range 0-64 pixels. Default 16.
  6555. @item edge
  6556. Specify how to generate pixels to fill blanks at the edge of the
  6557. frame. Available values are:
  6558. @table @samp
  6559. @item blank, 0
  6560. Fill zeroes at blank locations
  6561. @item original, 1
  6562. Original image at blank locations
  6563. @item clamp, 2
  6564. Extruded edge value at blank locations
  6565. @item mirror, 3
  6566. Mirrored edge at blank locations
  6567. @end table
  6568. Default value is @samp{mirror}.
  6569. @item blocksize
  6570. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6571. default 8.
  6572. @item contrast
  6573. Specify the contrast threshold for blocks. Only blocks with more than
  6574. the specified contrast (difference between darkest and lightest
  6575. pixels) will be considered. Range 1-255, default 125.
  6576. @item search
  6577. Specify the search strategy. Available values are:
  6578. @table @samp
  6579. @item exhaustive, 0
  6580. Set exhaustive search
  6581. @item less, 1
  6582. Set less exhaustive search.
  6583. @end table
  6584. Default value is @samp{exhaustive}.
  6585. @item filename
  6586. If set then a detailed log of the motion search is written to the
  6587. specified file.
  6588. @end table
  6589. @section despill
  6590. Remove unwanted contamination of foreground colors, caused by reflected color of
  6591. greenscreen or bluescreen.
  6592. This filter accepts the following options:
  6593. @table @option
  6594. @item type
  6595. Set what type of despill to use.
  6596. @item mix
  6597. Set how spillmap will be generated.
  6598. @item expand
  6599. Set how much to get rid of still remaining spill.
  6600. @item red
  6601. Controls amount of red in spill area.
  6602. @item green
  6603. Controls amount of green in spill area.
  6604. Should be -1 for greenscreen.
  6605. @item blue
  6606. Controls amount of blue in spill area.
  6607. Should be -1 for bluescreen.
  6608. @item brightness
  6609. Controls brightness of spill area, preserving colors.
  6610. @item alpha
  6611. Modify alpha from generated spillmap.
  6612. @end table
  6613. @section detelecine
  6614. Apply an exact inverse of the telecine operation. It requires a predefined
  6615. pattern specified using the pattern option which must be the same as that passed
  6616. to the telecine filter.
  6617. This filter accepts the following options:
  6618. @table @option
  6619. @item first_field
  6620. @table @samp
  6621. @item top, t
  6622. top field first
  6623. @item bottom, b
  6624. bottom field first
  6625. The default value is @code{top}.
  6626. @end table
  6627. @item pattern
  6628. A string of numbers representing the pulldown pattern you wish to apply.
  6629. The default value is @code{23}.
  6630. @item start_frame
  6631. A number representing position of the first frame with respect to the telecine
  6632. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6633. @end table
  6634. @section dilation
  6635. Apply dilation effect to the video.
  6636. This filter replaces the pixel by the local(3x3) maximum.
  6637. It accepts the following options:
  6638. @table @option
  6639. @item threshold0
  6640. @item threshold1
  6641. @item threshold2
  6642. @item threshold3
  6643. Limit the maximum change for each plane, default is 65535.
  6644. If 0, plane will remain unchanged.
  6645. @item coordinates
  6646. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6647. pixels are used.
  6648. Flags to local 3x3 coordinates maps like this:
  6649. 1 2 3
  6650. 4 5
  6651. 6 7 8
  6652. @end table
  6653. @section displace
  6654. Displace pixels as indicated by second and third input stream.
  6655. It takes three input streams and outputs one stream, the first input is the
  6656. source, and second and third input are displacement maps.
  6657. The second input specifies how much to displace pixels along the
  6658. x-axis, while the third input specifies how much to displace pixels
  6659. along the y-axis.
  6660. If one of displacement map streams terminates, last frame from that
  6661. displacement map will be used.
  6662. Note that once generated, displacements maps can be reused over and over again.
  6663. A description of the accepted options follows.
  6664. @table @option
  6665. @item edge
  6666. Set displace behavior for pixels that are out of range.
  6667. Available values are:
  6668. @table @samp
  6669. @item blank
  6670. Missing pixels are replaced by black pixels.
  6671. @item smear
  6672. Adjacent pixels will spread out to replace missing pixels.
  6673. @item wrap
  6674. Out of range pixels are wrapped so they point to pixels of other side.
  6675. @item mirror
  6676. Out of range pixels will be replaced with mirrored pixels.
  6677. @end table
  6678. Default is @samp{smear}.
  6679. @end table
  6680. @subsection Examples
  6681. @itemize
  6682. @item
  6683. Add ripple effect to rgb input of video size hd720:
  6684. @example
  6685. 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
  6686. @end example
  6687. @item
  6688. Add wave effect to rgb input of video size hd720:
  6689. @example
  6690. 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
  6691. @end example
  6692. @end itemize
  6693. @section drawbox
  6694. Draw a colored box on the input image.
  6695. It accepts the following parameters:
  6696. @table @option
  6697. @item x
  6698. @item y
  6699. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6700. @item width, w
  6701. @item height, h
  6702. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6703. the input width and height. It defaults to 0.
  6704. @item color, c
  6705. Specify the color of the box to write. For the general syntax of this option,
  6706. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6707. value @code{invert} is used, the box edge color is the same as the
  6708. video with inverted luma.
  6709. @item thickness, t
  6710. The expression which sets the thickness of the box edge.
  6711. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6712. See below for the list of accepted constants.
  6713. @item replace
  6714. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6715. will overwrite the video's color and alpha pixels.
  6716. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6717. @end table
  6718. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6719. following constants:
  6720. @table @option
  6721. @item dar
  6722. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6723. @item hsub
  6724. @item vsub
  6725. horizontal and vertical chroma subsample values. For example for the
  6726. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6727. @item in_h, ih
  6728. @item in_w, iw
  6729. The input width and height.
  6730. @item sar
  6731. The input sample aspect ratio.
  6732. @item x
  6733. @item y
  6734. The x and y offset coordinates where the box is drawn.
  6735. @item w
  6736. @item h
  6737. The width and height of the drawn box.
  6738. @item t
  6739. The thickness of the drawn box.
  6740. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6741. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6742. @end table
  6743. @subsection Examples
  6744. @itemize
  6745. @item
  6746. Draw a black box around the edge of the input image:
  6747. @example
  6748. drawbox
  6749. @end example
  6750. @item
  6751. Draw a box with color red and an opacity of 50%:
  6752. @example
  6753. drawbox=10:20:200:60:red@@0.5
  6754. @end example
  6755. The previous example can be specified as:
  6756. @example
  6757. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6758. @end example
  6759. @item
  6760. Fill the box with pink color:
  6761. @example
  6762. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6763. @end example
  6764. @item
  6765. Draw a 2-pixel red 2.40:1 mask:
  6766. @example
  6767. 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
  6768. @end example
  6769. @end itemize
  6770. @section drawgrid
  6771. Draw a grid on the input image.
  6772. It accepts the following parameters:
  6773. @table @option
  6774. @item x
  6775. @item y
  6776. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6777. @item width, w
  6778. @item height, h
  6779. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6780. input width and height, respectively, minus @code{thickness}, so image gets
  6781. framed. Default to 0.
  6782. @item color, c
  6783. Specify the color of the grid. For the general syntax of this option,
  6784. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6785. value @code{invert} is used, the grid color is the same as the
  6786. video with inverted luma.
  6787. @item thickness, t
  6788. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6789. See below for the list of accepted constants.
  6790. @item replace
  6791. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6792. will overwrite the video's color and alpha pixels.
  6793. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6794. @end table
  6795. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6796. following constants:
  6797. @table @option
  6798. @item dar
  6799. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6800. @item hsub
  6801. @item vsub
  6802. horizontal and vertical chroma subsample values. For example for the
  6803. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6804. @item in_h, ih
  6805. @item in_w, iw
  6806. The input grid cell width and height.
  6807. @item sar
  6808. The input sample aspect ratio.
  6809. @item x
  6810. @item y
  6811. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6812. @item w
  6813. @item h
  6814. The width and height of the drawn cell.
  6815. @item t
  6816. The thickness of the drawn cell.
  6817. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6818. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6819. @end table
  6820. @subsection Examples
  6821. @itemize
  6822. @item
  6823. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6824. @example
  6825. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6826. @end example
  6827. @item
  6828. Draw a white 3x3 grid with an opacity of 50%:
  6829. @example
  6830. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6831. @end example
  6832. @end itemize
  6833. @anchor{drawtext}
  6834. @section drawtext
  6835. Draw a text string or text from a specified file on top of a video, using the
  6836. libfreetype library.
  6837. To enable compilation of this filter, you need to configure FFmpeg with
  6838. @code{--enable-libfreetype}.
  6839. To enable default font fallback and the @var{font} option you need to
  6840. configure FFmpeg with @code{--enable-libfontconfig}.
  6841. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6842. @code{--enable-libfribidi}.
  6843. @subsection Syntax
  6844. It accepts the following parameters:
  6845. @table @option
  6846. @item box
  6847. Used to draw a box around text using the background color.
  6848. The value must be either 1 (enable) or 0 (disable).
  6849. The default value of @var{box} is 0.
  6850. @item boxborderw
  6851. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6852. The default value of @var{boxborderw} is 0.
  6853. @item boxcolor
  6854. The color to be used for drawing box around text. For the syntax of this
  6855. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6856. The default value of @var{boxcolor} is "white".
  6857. @item line_spacing
  6858. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6859. The default value of @var{line_spacing} is 0.
  6860. @item borderw
  6861. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6862. The default value of @var{borderw} is 0.
  6863. @item bordercolor
  6864. Set the color to be used for drawing border around text. For the syntax of this
  6865. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6866. The default value of @var{bordercolor} is "black".
  6867. @item expansion
  6868. Select how the @var{text} is expanded. Can be either @code{none},
  6869. @code{strftime} (deprecated) or
  6870. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6871. below for details.
  6872. @item basetime
  6873. Set a start time for the count. Value is in microseconds. Only applied
  6874. in the deprecated strftime expansion mode. To emulate in normal expansion
  6875. mode use the @code{pts} function, supplying the start time (in seconds)
  6876. as the second argument.
  6877. @item fix_bounds
  6878. If true, check and fix text coords to avoid clipping.
  6879. @item fontcolor
  6880. The color to be used for drawing fonts. For the syntax of this option, check
  6881. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6882. The default value of @var{fontcolor} is "black".
  6883. @item fontcolor_expr
  6884. String which is expanded the same way as @var{text} to obtain dynamic
  6885. @var{fontcolor} value. By default this option has empty value and is not
  6886. processed. When this option is set, it overrides @var{fontcolor} option.
  6887. @item font
  6888. The font family to be used for drawing text. By default Sans.
  6889. @item fontfile
  6890. The font file to be used for drawing text. The path must be included.
  6891. This parameter is mandatory if the fontconfig support is disabled.
  6892. @item alpha
  6893. Draw the text applying alpha blending. The value can
  6894. be a number between 0.0 and 1.0.
  6895. The expression accepts the same variables @var{x, y} as well.
  6896. The default value is 1.
  6897. Please see @var{fontcolor_expr}.
  6898. @item fontsize
  6899. The font size to be used for drawing text.
  6900. The default value of @var{fontsize} is 16.
  6901. @item text_shaping
  6902. If set to 1, attempt to shape the text (for example, reverse the order of
  6903. right-to-left text and join Arabic characters) before drawing it.
  6904. Otherwise, just draw the text exactly as given.
  6905. By default 1 (if supported).
  6906. @item ft_load_flags
  6907. The flags to be used for loading the fonts.
  6908. The flags map the corresponding flags supported by libfreetype, and are
  6909. a combination of the following values:
  6910. @table @var
  6911. @item default
  6912. @item no_scale
  6913. @item no_hinting
  6914. @item render
  6915. @item no_bitmap
  6916. @item vertical_layout
  6917. @item force_autohint
  6918. @item crop_bitmap
  6919. @item pedantic
  6920. @item ignore_global_advance_width
  6921. @item no_recurse
  6922. @item ignore_transform
  6923. @item monochrome
  6924. @item linear_design
  6925. @item no_autohint
  6926. @end table
  6927. Default value is "default".
  6928. For more information consult the documentation for the FT_LOAD_*
  6929. libfreetype flags.
  6930. @item shadowcolor
  6931. The color to be used for drawing a shadow behind the drawn text. For the
  6932. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6933. ffmpeg-utils manual,ffmpeg-utils}.
  6934. The default value of @var{shadowcolor} is "black".
  6935. @item shadowx
  6936. @item shadowy
  6937. The x and y offsets for the text shadow position with respect to the
  6938. position of the text. They can be either positive or negative
  6939. values. The default value for both is "0".
  6940. @item start_number
  6941. The starting frame number for the n/frame_num variable. The default value
  6942. is "0".
  6943. @item tabsize
  6944. The size in number of spaces to use for rendering the tab.
  6945. Default value is 4.
  6946. @item timecode
  6947. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6948. format. It can be used with or without text parameter. @var{timecode_rate}
  6949. option must be specified.
  6950. @item timecode_rate, rate, r
  6951. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6952. integer. Minimum value is "1".
  6953. Drop-frame timecode is supported for frame rates 30 & 60.
  6954. @item tc24hmax
  6955. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6956. Default is 0 (disabled).
  6957. @item text
  6958. The text string to be drawn. The text must be a sequence of UTF-8
  6959. encoded characters.
  6960. This parameter is mandatory if no file is specified with the parameter
  6961. @var{textfile}.
  6962. @item textfile
  6963. A text file containing text to be drawn. The text must be a sequence
  6964. of UTF-8 encoded characters.
  6965. This parameter is mandatory if no text string is specified with the
  6966. parameter @var{text}.
  6967. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6968. @item reload
  6969. If set to 1, the @var{textfile} will be reloaded before each frame.
  6970. Be sure to update it atomically, or it may be read partially, or even fail.
  6971. @item x
  6972. @item y
  6973. The expressions which specify the offsets where text will be drawn
  6974. within the video frame. They are relative to the top/left border of the
  6975. output image.
  6976. The default value of @var{x} and @var{y} is "0".
  6977. See below for the list of accepted constants and functions.
  6978. @end table
  6979. The parameters for @var{x} and @var{y} are expressions containing the
  6980. following constants and functions:
  6981. @table @option
  6982. @item dar
  6983. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6984. @item hsub
  6985. @item vsub
  6986. horizontal and vertical chroma subsample values. For example for the
  6987. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6988. @item line_h, lh
  6989. the height of each text line
  6990. @item main_h, h, H
  6991. the input height
  6992. @item main_w, w, W
  6993. the input width
  6994. @item max_glyph_a, ascent
  6995. the maximum distance from the baseline to the highest/upper grid
  6996. coordinate used to place a glyph outline point, for all the rendered
  6997. glyphs.
  6998. It is a positive value, due to the grid's orientation with the Y axis
  6999. upwards.
  7000. @item max_glyph_d, descent
  7001. the maximum distance from the baseline to the lowest grid coordinate
  7002. used to place a glyph outline point, for all the rendered glyphs.
  7003. This is a negative value, due to the grid's orientation, with the Y axis
  7004. upwards.
  7005. @item max_glyph_h
  7006. maximum glyph height, that is the maximum height for all the glyphs
  7007. contained in the rendered text, it is equivalent to @var{ascent} -
  7008. @var{descent}.
  7009. @item max_glyph_w
  7010. maximum glyph width, that is the maximum width for all the glyphs
  7011. contained in the rendered text
  7012. @item n
  7013. the number of input frame, starting from 0
  7014. @item rand(min, max)
  7015. return a random number included between @var{min} and @var{max}
  7016. @item sar
  7017. The input sample aspect ratio.
  7018. @item t
  7019. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7020. @item text_h, th
  7021. the height of the rendered text
  7022. @item text_w, tw
  7023. the width of the rendered text
  7024. @item x
  7025. @item y
  7026. the x and y offset coordinates where the text is drawn.
  7027. These parameters allow the @var{x} and @var{y} expressions to refer
  7028. to each other, so you can for example specify @code{y=x/dar}.
  7029. @item pict_type
  7030. A one character description of the current frame's picture type.
  7031. @item pkt_pos
  7032. The current packet's position in the input file or stream
  7033. (in bytes, from the start of the input). A value of -1 indicates
  7034. this info is not available.
  7035. @item pkt_duration
  7036. The current packet's duration, in seconds.
  7037. @item pkt_size
  7038. The current packet's size (in bytes).
  7039. @end table
  7040. @anchor{drawtext_expansion}
  7041. @subsection Text expansion
  7042. If @option{expansion} is set to @code{strftime},
  7043. the filter recognizes strftime() sequences in the provided text and
  7044. expands them accordingly. Check the documentation of strftime(). This
  7045. feature is deprecated.
  7046. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7047. If @option{expansion} is set to @code{normal} (which is the default),
  7048. the following expansion mechanism is used.
  7049. The backslash character @samp{\}, followed by any character, always expands to
  7050. the second character.
  7051. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7052. braces is a function name, possibly followed by arguments separated by ':'.
  7053. If the arguments contain special characters or delimiters (':' or '@}'),
  7054. they should be escaped.
  7055. Note that they probably must also be escaped as the value for the
  7056. @option{text} option in the filter argument string and as the filter
  7057. argument in the filtergraph description, and possibly also for the shell,
  7058. that makes up to four levels of escaping; using a text file avoids these
  7059. problems.
  7060. The following functions are available:
  7061. @table @command
  7062. @item expr, e
  7063. The expression evaluation result.
  7064. It must take one argument specifying the expression to be evaluated,
  7065. which accepts the same constants and functions as the @var{x} and
  7066. @var{y} values. Note that not all constants should be used, for
  7067. example the text size is not known when evaluating the expression, so
  7068. the constants @var{text_w} and @var{text_h} will have an undefined
  7069. value.
  7070. @item expr_int_format, eif
  7071. Evaluate the expression's value and output as formatted integer.
  7072. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7073. The second argument specifies the output format. Allowed values are @samp{x},
  7074. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7075. @code{printf} function.
  7076. The third parameter is optional and sets the number of positions taken by the output.
  7077. It can be used to add padding with zeros from the left.
  7078. @item gmtime
  7079. The time at which the filter is running, expressed in UTC.
  7080. It can accept an argument: a strftime() format string.
  7081. @item localtime
  7082. The time at which the filter is running, expressed in the local time zone.
  7083. It can accept an argument: a strftime() format string.
  7084. @item metadata
  7085. Frame metadata. Takes one or two arguments.
  7086. The first argument is mandatory and specifies the metadata key.
  7087. The second argument is optional and specifies a default value, used when the
  7088. metadata key is not found or empty.
  7089. Available metadata can be identified by inspecting entries
  7090. starting with TAG included within each frame section
  7091. printed by running @code{ffprobe -show_frames}.
  7092. String metadata generated in filters leading to
  7093. the drawtext filter are also available.
  7094. @item n, frame_num
  7095. The frame number, starting from 0.
  7096. @item pict_type
  7097. A one character description of the current picture type.
  7098. @item pts
  7099. The timestamp of the current frame.
  7100. It can take up to three arguments.
  7101. The first argument is the format of the timestamp; it defaults to @code{flt}
  7102. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7103. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7104. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7105. @code{localtime} stands for the timestamp of the frame formatted as
  7106. local time zone time.
  7107. The second argument is an offset added to the timestamp.
  7108. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7109. supplied to present the hour part of the formatted timestamp in 24h format
  7110. (00-23).
  7111. If the format is set to @code{localtime} or @code{gmtime},
  7112. a third argument may be supplied: a strftime() format string.
  7113. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7114. @end table
  7115. @subsection Commands
  7116. This filter supports altering parameters via commands:
  7117. @table @option
  7118. @item reinit
  7119. Alter existing filter parameters.
  7120. Syntax for the argument is the same as for filter invocation, e.g.
  7121. @example
  7122. fontsize=56:fontcolor=green:text='Hello World'
  7123. @end example
  7124. Full filter invocation with sendcmd would look like this:
  7125. @example
  7126. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7127. @end example
  7128. @end table
  7129. If the entire argument can't be parsed or applied as valid values then the filter will
  7130. continue with its existing parameters.
  7131. @subsection Examples
  7132. @itemize
  7133. @item
  7134. Draw "Test Text" with font FreeSerif, using the default values for the
  7135. optional parameters.
  7136. @example
  7137. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7138. @end example
  7139. @item
  7140. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7141. and y=50 (counting from the top-left corner of the screen), text is
  7142. yellow with a red box around it. Both the text and the box have an
  7143. opacity of 20%.
  7144. @example
  7145. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7146. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7147. @end example
  7148. Note that the double quotes are not necessary if spaces are not used
  7149. within the parameter list.
  7150. @item
  7151. Show the text at the center of the video frame:
  7152. @example
  7153. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7154. @end example
  7155. @item
  7156. Show the text at a random position, switching to a new position every 30 seconds:
  7157. @example
  7158. 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)"
  7159. @end example
  7160. @item
  7161. Show a text line sliding from right to left in the last row of the video
  7162. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7163. with no newlines.
  7164. @example
  7165. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7166. @end example
  7167. @item
  7168. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7169. @example
  7170. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7171. @end example
  7172. @item
  7173. Draw a single green letter "g", at the center of the input video.
  7174. The glyph baseline is placed at half screen height.
  7175. @example
  7176. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7177. @end example
  7178. @item
  7179. Show text for 1 second every 3 seconds:
  7180. @example
  7181. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7182. @end example
  7183. @item
  7184. Use fontconfig to set the font. Note that the colons need to be escaped.
  7185. @example
  7186. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7187. @end example
  7188. @item
  7189. Print the date of a real-time encoding (see strftime(3)):
  7190. @example
  7191. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7192. @end example
  7193. @item
  7194. Show text fading in and out (appearing/disappearing):
  7195. @example
  7196. #!/bin/sh
  7197. DS=1.0 # display start
  7198. DE=10.0 # display end
  7199. FID=1.5 # fade in duration
  7200. FOD=5 # fade out duration
  7201. 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 @}"
  7202. @end example
  7203. @item
  7204. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7205. and the @option{fontsize} value are included in the @option{y} offset.
  7206. @example
  7207. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7208. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7209. @end example
  7210. @end itemize
  7211. For more information about libfreetype, check:
  7212. @url{http://www.freetype.org/}.
  7213. For more information about fontconfig, check:
  7214. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7215. For more information about libfribidi, check:
  7216. @url{http://fribidi.org/}.
  7217. @section edgedetect
  7218. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7219. The filter accepts the following options:
  7220. @table @option
  7221. @item low
  7222. @item high
  7223. Set low and high threshold values used by the Canny thresholding
  7224. algorithm.
  7225. The high threshold selects the "strong" edge pixels, which are then
  7226. connected through 8-connectivity with the "weak" edge pixels selected
  7227. by the low threshold.
  7228. @var{low} and @var{high} threshold values must be chosen in the range
  7229. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7230. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7231. is @code{50/255}.
  7232. @item mode
  7233. Define the drawing mode.
  7234. @table @samp
  7235. @item wires
  7236. Draw white/gray wires on black background.
  7237. @item colormix
  7238. Mix the colors to create a paint/cartoon effect.
  7239. @item canny
  7240. Apply Canny edge detector on all selected planes.
  7241. @end table
  7242. Default value is @var{wires}.
  7243. @item planes
  7244. Select planes for filtering. By default all available planes are filtered.
  7245. @end table
  7246. @subsection Examples
  7247. @itemize
  7248. @item
  7249. Standard edge detection with custom values for the hysteresis thresholding:
  7250. @example
  7251. edgedetect=low=0.1:high=0.4
  7252. @end example
  7253. @item
  7254. Painting effect without thresholding:
  7255. @example
  7256. edgedetect=mode=colormix:high=0
  7257. @end example
  7258. @end itemize
  7259. @section eq
  7260. Set brightness, contrast, saturation and approximate gamma adjustment.
  7261. The filter accepts the following options:
  7262. @table @option
  7263. @item contrast
  7264. Set the contrast expression. The value must be a float value in range
  7265. @code{-2.0} to @code{2.0}. The default value is "1".
  7266. @item brightness
  7267. Set the brightness expression. The value must be a float value in
  7268. range @code{-1.0} to @code{1.0}. The default value is "0".
  7269. @item saturation
  7270. Set the saturation expression. The value must be a float in
  7271. range @code{0.0} to @code{3.0}. The default value is "1".
  7272. @item gamma
  7273. Set the gamma expression. The value must be a float in range
  7274. @code{0.1} to @code{10.0}. The default value is "1".
  7275. @item gamma_r
  7276. Set the gamma expression for red. The value must be a float in
  7277. range @code{0.1} to @code{10.0}. The default value is "1".
  7278. @item gamma_g
  7279. Set the gamma expression for green. The value must be a float in range
  7280. @code{0.1} to @code{10.0}. The default value is "1".
  7281. @item gamma_b
  7282. Set the gamma expression for blue. The value must be a float in range
  7283. @code{0.1} to @code{10.0}. The default value is "1".
  7284. @item gamma_weight
  7285. Set the gamma weight expression. It can be used to reduce the effect
  7286. of a high gamma value on bright image areas, e.g. keep them from
  7287. getting overamplified and just plain white. The value must be a float
  7288. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7289. gamma correction all the way down while @code{1.0} leaves it at its
  7290. full strength. Default is "1".
  7291. @item eval
  7292. Set when the expressions for brightness, contrast, saturation and
  7293. gamma expressions are evaluated.
  7294. It accepts the following values:
  7295. @table @samp
  7296. @item init
  7297. only evaluate expressions once during the filter initialization or
  7298. when a command is processed
  7299. @item frame
  7300. evaluate expressions for each incoming frame
  7301. @end table
  7302. Default value is @samp{init}.
  7303. @end table
  7304. The expressions accept the following parameters:
  7305. @table @option
  7306. @item n
  7307. frame count of the input frame starting from 0
  7308. @item pos
  7309. byte position of the corresponding packet in the input file, NAN if
  7310. unspecified
  7311. @item r
  7312. frame rate of the input video, NAN if the input frame rate is unknown
  7313. @item t
  7314. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7315. @end table
  7316. @subsection Commands
  7317. The filter supports the following commands:
  7318. @table @option
  7319. @item contrast
  7320. Set the contrast expression.
  7321. @item brightness
  7322. Set the brightness expression.
  7323. @item saturation
  7324. Set the saturation expression.
  7325. @item gamma
  7326. Set the gamma expression.
  7327. @item gamma_r
  7328. Set the gamma_r expression.
  7329. @item gamma_g
  7330. Set gamma_g expression.
  7331. @item gamma_b
  7332. Set gamma_b expression.
  7333. @item gamma_weight
  7334. Set gamma_weight expression.
  7335. The command accepts the same syntax of the corresponding option.
  7336. If the specified expression is not valid, it is kept at its current
  7337. value.
  7338. @end table
  7339. @section erosion
  7340. Apply erosion effect to the video.
  7341. This filter replaces the pixel by the local(3x3) minimum.
  7342. It accepts the following options:
  7343. @table @option
  7344. @item threshold0
  7345. @item threshold1
  7346. @item threshold2
  7347. @item threshold3
  7348. Limit the maximum change for each plane, default is 65535.
  7349. If 0, plane will remain unchanged.
  7350. @item coordinates
  7351. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7352. pixels are used.
  7353. Flags to local 3x3 coordinates maps like this:
  7354. 1 2 3
  7355. 4 5
  7356. 6 7 8
  7357. @end table
  7358. @section extractplanes
  7359. Extract color channel components from input video stream into
  7360. separate grayscale video streams.
  7361. The filter accepts the following option:
  7362. @table @option
  7363. @item planes
  7364. Set plane(s) to extract.
  7365. Available values for planes are:
  7366. @table @samp
  7367. @item y
  7368. @item u
  7369. @item v
  7370. @item a
  7371. @item r
  7372. @item g
  7373. @item b
  7374. @end table
  7375. Choosing planes not available in the input will result in an error.
  7376. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7377. with @code{y}, @code{u}, @code{v} planes at same time.
  7378. @end table
  7379. @subsection Examples
  7380. @itemize
  7381. @item
  7382. Extract luma, u and v color channel component from input video frame
  7383. into 3 grayscale outputs:
  7384. @example
  7385. 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
  7386. @end example
  7387. @end itemize
  7388. @section elbg
  7389. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7390. For each input image, the filter will compute the optimal mapping from
  7391. the input to the output given the codebook length, that is the number
  7392. of distinct output colors.
  7393. This filter accepts the following options.
  7394. @table @option
  7395. @item codebook_length, l
  7396. Set codebook length. The value must be a positive integer, and
  7397. represents the number of distinct output colors. Default value is 256.
  7398. @item nb_steps, n
  7399. Set the maximum number of iterations to apply for computing the optimal
  7400. mapping. The higher the value the better the result and the higher the
  7401. computation time. Default value is 1.
  7402. @item seed, s
  7403. Set a random seed, must be an integer included between 0 and
  7404. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7405. will try to use a good random seed on a best effort basis.
  7406. @item pal8
  7407. Set pal8 output pixel format. This option does not work with codebook
  7408. length greater than 256.
  7409. @end table
  7410. @section entropy
  7411. Measure graylevel entropy in histogram of color channels of video frames.
  7412. It accepts the following parameters:
  7413. @table @option
  7414. @item mode
  7415. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7416. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7417. between neighbour histogram values.
  7418. @end table
  7419. @section fade
  7420. Apply a fade-in/out effect to the input video.
  7421. It accepts the following parameters:
  7422. @table @option
  7423. @item type, t
  7424. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7425. effect.
  7426. Default is @code{in}.
  7427. @item start_frame, s
  7428. Specify the number of the frame to start applying the fade
  7429. effect at. Default is 0.
  7430. @item nb_frames, n
  7431. The number of frames that the fade effect lasts. At the end of the
  7432. fade-in effect, the output video will have the same intensity as the input video.
  7433. At the end of the fade-out transition, the output video will be filled with the
  7434. selected @option{color}.
  7435. Default is 25.
  7436. @item alpha
  7437. If set to 1, fade only alpha channel, if one exists on the input.
  7438. Default value is 0.
  7439. @item start_time, st
  7440. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7441. effect. If both start_frame and start_time are specified, the fade will start at
  7442. whichever comes last. Default is 0.
  7443. @item duration, d
  7444. The number of seconds for which the fade effect has to last. At the end of the
  7445. fade-in effect the output video will have the same intensity as the input video,
  7446. at the end of the fade-out transition the output video will be filled with the
  7447. selected @option{color}.
  7448. If both duration and nb_frames are specified, duration is used. Default is 0
  7449. (nb_frames is used by default).
  7450. @item color, c
  7451. Specify the color of the fade. Default is "black".
  7452. @end table
  7453. @subsection Examples
  7454. @itemize
  7455. @item
  7456. Fade in the first 30 frames of video:
  7457. @example
  7458. fade=in:0:30
  7459. @end example
  7460. The command above is equivalent to:
  7461. @example
  7462. fade=t=in:s=0:n=30
  7463. @end example
  7464. @item
  7465. Fade out the last 45 frames of a 200-frame video:
  7466. @example
  7467. fade=out:155:45
  7468. fade=type=out:start_frame=155:nb_frames=45
  7469. @end example
  7470. @item
  7471. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7472. @example
  7473. fade=in:0:25, fade=out:975:25
  7474. @end example
  7475. @item
  7476. Make the first 5 frames yellow, then fade in from frame 5-24:
  7477. @example
  7478. fade=in:5:20:color=yellow
  7479. @end example
  7480. @item
  7481. Fade in alpha over first 25 frames of video:
  7482. @example
  7483. fade=in:0:25:alpha=1
  7484. @end example
  7485. @item
  7486. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7487. @example
  7488. fade=t=in:st=5.5:d=0.5
  7489. @end example
  7490. @end itemize
  7491. @section fftfilt
  7492. Apply arbitrary expressions to samples in frequency domain
  7493. @table @option
  7494. @item dc_Y
  7495. Adjust the dc value (gain) of the luma plane of the image. The filter
  7496. accepts an integer value in range @code{0} to @code{1000}. The default
  7497. value is set to @code{0}.
  7498. @item dc_U
  7499. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7500. filter accepts an integer value in range @code{0} to @code{1000}. The
  7501. default value is set to @code{0}.
  7502. @item dc_V
  7503. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7504. filter accepts an integer value in range @code{0} to @code{1000}. The
  7505. default value is set to @code{0}.
  7506. @item weight_Y
  7507. Set the frequency domain weight expression for the luma plane.
  7508. @item weight_U
  7509. Set the frequency domain weight expression for the 1st chroma plane.
  7510. @item weight_V
  7511. Set the frequency domain weight expression for the 2nd chroma plane.
  7512. @item eval
  7513. Set when the expressions are evaluated.
  7514. It accepts the following values:
  7515. @table @samp
  7516. @item init
  7517. Only evaluate expressions once during the filter initialization.
  7518. @item frame
  7519. Evaluate expressions for each incoming frame.
  7520. @end table
  7521. Default value is @samp{init}.
  7522. The filter accepts the following variables:
  7523. @item X
  7524. @item Y
  7525. The coordinates of the current sample.
  7526. @item W
  7527. @item H
  7528. The width and height of the image.
  7529. @item N
  7530. The number of input frame, starting from 0.
  7531. @end table
  7532. @subsection Examples
  7533. @itemize
  7534. @item
  7535. High-pass:
  7536. @example
  7537. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7538. @end example
  7539. @item
  7540. Low-pass:
  7541. @example
  7542. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7543. @end example
  7544. @item
  7545. Sharpen:
  7546. @example
  7547. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7548. @end example
  7549. @item
  7550. Blur:
  7551. @example
  7552. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7553. @end example
  7554. @end itemize
  7555. @section fftdnoiz
  7556. Denoise frames using 3D FFT (frequency domain filtering).
  7557. The filter accepts the following options:
  7558. @table @option
  7559. @item sigma
  7560. Set the noise sigma constant. This sets denoising strength.
  7561. Default value is 1. Allowed range is from 0 to 30.
  7562. Using very high sigma with low overlap may give blocking artifacts.
  7563. @item amount
  7564. Set amount of denoising. By default all detected noise is reduced.
  7565. Default value is 1. Allowed range is from 0 to 1.
  7566. @item block
  7567. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7568. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7569. block size in pixels is 2^4 which is 16.
  7570. @item overlap
  7571. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7572. @item prev
  7573. Set number of previous frames to use for denoising. By default is set to 0.
  7574. @item next
  7575. Set number of next frames to to use for denoising. By default is set to 0.
  7576. @item planes
  7577. Set planes which will be filtered, by default are all available filtered
  7578. except alpha.
  7579. @end table
  7580. @section field
  7581. Extract a single field from an interlaced image using stride
  7582. arithmetic to avoid wasting CPU time. The output frames are marked as
  7583. non-interlaced.
  7584. The filter accepts the following options:
  7585. @table @option
  7586. @item type
  7587. Specify whether to extract the top (if the value is @code{0} or
  7588. @code{top}) or the bottom field (if the value is @code{1} or
  7589. @code{bottom}).
  7590. @end table
  7591. @section fieldhint
  7592. Create new frames by copying the top and bottom fields from surrounding frames
  7593. supplied as numbers by the hint file.
  7594. @table @option
  7595. @item hint
  7596. Set file containing hints: absolute/relative frame numbers.
  7597. There must be one line for each frame in a clip. Each line must contain two
  7598. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7599. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7600. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7601. for @code{relative} mode. First number tells from which frame to pick up top
  7602. field and second number tells from which frame to pick up bottom field.
  7603. If optionally followed by @code{+} output frame will be marked as interlaced,
  7604. else if followed by @code{-} output frame will be marked as progressive, else
  7605. it will be marked same as input frame.
  7606. If line starts with @code{#} or @code{;} that line is skipped.
  7607. @item mode
  7608. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7609. @end table
  7610. Example of first several lines of @code{hint} file for @code{relative} mode:
  7611. @example
  7612. 0,0 - # first frame
  7613. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7614. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7615. 1,0 -
  7616. 0,0 -
  7617. 0,0 -
  7618. 1,0 -
  7619. 1,0 -
  7620. 1,0 -
  7621. 0,0 -
  7622. 0,0 -
  7623. 1,0 -
  7624. 1,0 -
  7625. 1,0 -
  7626. 0,0 -
  7627. @end example
  7628. @section fieldmatch
  7629. Field matching filter for inverse telecine. It is meant to reconstruct the
  7630. progressive frames from a telecined stream. The filter does not drop duplicated
  7631. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7632. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7633. The separation of the field matching and the decimation is notably motivated by
  7634. the possibility of inserting a de-interlacing filter fallback between the two.
  7635. If the source has mixed telecined and real interlaced content,
  7636. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7637. But these remaining combed frames will be marked as interlaced, and thus can be
  7638. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7639. In addition to the various configuration options, @code{fieldmatch} can take an
  7640. optional second stream, activated through the @option{ppsrc} option. If
  7641. enabled, the frames reconstruction will be based on the fields and frames from
  7642. this second stream. This allows the first input to be pre-processed in order to
  7643. help the various algorithms of the filter, while keeping the output lossless
  7644. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7645. or brightness/contrast adjustments can help.
  7646. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7647. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7648. which @code{fieldmatch} is based on. While the semantic and usage are very
  7649. close, some behaviour and options names can differ.
  7650. The @ref{decimate} filter currently only works for constant frame rate input.
  7651. If your input has mixed telecined (30fps) and progressive content with a lower
  7652. framerate like 24fps use the following filterchain to produce the necessary cfr
  7653. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7654. The filter accepts the following options:
  7655. @table @option
  7656. @item order
  7657. Specify the assumed field order of the input stream. Available values are:
  7658. @table @samp
  7659. @item auto
  7660. Auto detect parity (use FFmpeg's internal parity value).
  7661. @item bff
  7662. Assume bottom field first.
  7663. @item tff
  7664. Assume top field first.
  7665. @end table
  7666. Note that it is sometimes recommended not to trust the parity announced by the
  7667. stream.
  7668. Default value is @var{auto}.
  7669. @item mode
  7670. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7671. sense that it won't risk creating jerkiness due to duplicate frames when
  7672. possible, but if there are bad edits or blended fields it will end up
  7673. outputting combed frames when a good match might actually exist. On the other
  7674. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7675. but will almost always find a good frame if there is one. The other values are
  7676. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7677. jerkiness and creating duplicate frames versus finding good matches in sections
  7678. with bad edits, orphaned fields, blended fields, etc.
  7679. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7680. Available values are:
  7681. @table @samp
  7682. @item pc
  7683. 2-way matching (p/c)
  7684. @item pc_n
  7685. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7686. @item pc_u
  7687. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7688. @item pc_n_ub
  7689. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7690. still combed (p/c + n + u/b)
  7691. @item pcn
  7692. 3-way matching (p/c/n)
  7693. @item pcn_ub
  7694. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7695. detected as combed (p/c/n + u/b)
  7696. @end table
  7697. The parenthesis at the end indicate the matches that would be used for that
  7698. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7699. @var{top}).
  7700. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7701. the slowest.
  7702. Default value is @var{pc_n}.
  7703. @item ppsrc
  7704. Mark the main input stream as a pre-processed input, and enable the secondary
  7705. input stream as the clean source to pick the fields from. See the filter
  7706. introduction for more details. It is similar to the @option{clip2} feature from
  7707. VFM/TFM.
  7708. Default value is @code{0} (disabled).
  7709. @item field
  7710. Set the field to match from. It is recommended to set this to the same value as
  7711. @option{order} unless you experience matching failures with that setting. In
  7712. certain circumstances changing the field that is used to match from can have a
  7713. large impact on matching performance. Available values are:
  7714. @table @samp
  7715. @item auto
  7716. Automatic (same value as @option{order}).
  7717. @item bottom
  7718. Match from the bottom field.
  7719. @item top
  7720. Match from the top field.
  7721. @end table
  7722. Default value is @var{auto}.
  7723. @item mchroma
  7724. Set whether or not chroma is included during the match comparisons. In most
  7725. cases it is recommended to leave this enabled. You should set this to @code{0}
  7726. only if your clip has bad chroma problems such as heavy rainbowing or other
  7727. artifacts. Setting this to @code{0} could also be used to speed things up at
  7728. the cost of some accuracy.
  7729. Default value is @code{1}.
  7730. @item y0
  7731. @item y1
  7732. These define an exclusion band which excludes the lines between @option{y0} and
  7733. @option{y1} from being included in the field matching decision. An exclusion
  7734. band can be used to ignore subtitles, a logo, or other things that may
  7735. interfere with the matching. @option{y0} sets the starting scan line and
  7736. @option{y1} sets the ending line; all lines in between @option{y0} and
  7737. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7738. @option{y0} and @option{y1} to the same value will disable the feature.
  7739. @option{y0} and @option{y1} defaults to @code{0}.
  7740. @item scthresh
  7741. Set the scene change detection threshold as a percentage of maximum change on
  7742. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7743. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7744. @option{scthresh} is @code{[0.0, 100.0]}.
  7745. Default value is @code{12.0}.
  7746. @item combmatch
  7747. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7748. account the combed scores of matches when deciding what match to use as the
  7749. final match. Available values are:
  7750. @table @samp
  7751. @item none
  7752. No final matching based on combed scores.
  7753. @item sc
  7754. Combed scores are only used when a scene change is detected.
  7755. @item full
  7756. Use combed scores all the time.
  7757. @end table
  7758. Default is @var{sc}.
  7759. @item combdbg
  7760. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7761. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7762. Available values are:
  7763. @table @samp
  7764. @item none
  7765. No forced calculation.
  7766. @item pcn
  7767. Force p/c/n calculations.
  7768. @item pcnub
  7769. Force p/c/n/u/b calculations.
  7770. @end table
  7771. Default value is @var{none}.
  7772. @item cthresh
  7773. This is the area combing threshold used for combed frame detection. This
  7774. essentially controls how "strong" or "visible" combing must be to be detected.
  7775. Larger values mean combing must be more visible and smaller values mean combing
  7776. can be less visible or strong and still be detected. Valid settings are from
  7777. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7778. be detected as combed). This is basically a pixel difference value. A good
  7779. range is @code{[8, 12]}.
  7780. Default value is @code{9}.
  7781. @item chroma
  7782. Sets whether or not chroma is considered in the combed frame decision. Only
  7783. disable this if your source has chroma problems (rainbowing, etc.) that are
  7784. causing problems for the combed frame detection with chroma enabled. Actually,
  7785. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7786. where there is chroma only combing in the source.
  7787. Default value is @code{0}.
  7788. @item blockx
  7789. @item blocky
  7790. Respectively set the x-axis and y-axis size of the window used during combed
  7791. frame detection. This has to do with the size of the area in which
  7792. @option{combpel} pixels are required to be detected as combed for a frame to be
  7793. declared combed. See the @option{combpel} parameter description for more info.
  7794. Possible values are any number that is a power of 2 starting at 4 and going up
  7795. to 512.
  7796. Default value is @code{16}.
  7797. @item combpel
  7798. The number of combed pixels inside any of the @option{blocky} by
  7799. @option{blockx} size blocks on the frame for the frame to be detected as
  7800. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7801. setting controls "how much" combing there must be in any localized area (a
  7802. window defined by the @option{blockx} and @option{blocky} settings) on the
  7803. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7804. which point no frames will ever be detected as combed). This setting is known
  7805. as @option{MI} in TFM/VFM vocabulary.
  7806. Default value is @code{80}.
  7807. @end table
  7808. @anchor{p/c/n/u/b meaning}
  7809. @subsection p/c/n/u/b meaning
  7810. @subsubsection p/c/n
  7811. We assume the following telecined stream:
  7812. @example
  7813. Top fields: 1 2 2 3 4
  7814. Bottom fields: 1 2 3 4 4
  7815. @end example
  7816. The numbers correspond to the progressive frame the fields relate to. Here, the
  7817. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7818. When @code{fieldmatch} is configured to run a matching from bottom
  7819. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7820. @example
  7821. Input stream:
  7822. T 1 2 2 3 4
  7823. B 1 2 3 4 4 <-- matching reference
  7824. Matches: c c n n c
  7825. Output stream:
  7826. T 1 2 3 4 4
  7827. B 1 2 3 4 4
  7828. @end example
  7829. As a result of the field matching, we can see that some frames get duplicated.
  7830. To perform a complete inverse telecine, you need to rely on a decimation filter
  7831. after this operation. See for instance the @ref{decimate} filter.
  7832. The same operation now matching from top fields (@option{field}=@var{top})
  7833. looks like this:
  7834. @example
  7835. Input stream:
  7836. T 1 2 2 3 4 <-- matching reference
  7837. B 1 2 3 4 4
  7838. Matches: c c p p c
  7839. Output stream:
  7840. T 1 2 2 3 4
  7841. B 1 2 2 3 4
  7842. @end example
  7843. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7844. basically, they refer to the frame and field of the opposite parity:
  7845. @itemize
  7846. @item @var{p} matches the field of the opposite parity in the previous frame
  7847. @item @var{c} matches the field of the opposite parity in the current frame
  7848. @item @var{n} matches the field of the opposite parity in the next frame
  7849. @end itemize
  7850. @subsubsection u/b
  7851. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7852. from the opposite parity flag. In the following examples, we assume that we are
  7853. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7854. 'x' is placed above and below each matched fields.
  7855. With bottom matching (@option{field}=@var{bottom}):
  7856. @example
  7857. Match: c p n b u
  7858. x x x x x
  7859. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7860. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7861. x x x x x
  7862. Output frames:
  7863. 2 1 2 2 2
  7864. 2 2 2 1 3
  7865. @end example
  7866. With top matching (@option{field}=@var{top}):
  7867. @example
  7868. Match: c p n b u
  7869. x x x x x
  7870. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7871. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7872. x x x x x
  7873. Output frames:
  7874. 2 2 2 1 2
  7875. 2 1 3 2 2
  7876. @end example
  7877. @subsection Examples
  7878. Simple IVTC of a top field first telecined stream:
  7879. @example
  7880. fieldmatch=order=tff:combmatch=none, decimate
  7881. @end example
  7882. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7883. @example
  7884. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7885. @end example
  7886. @section fieldorder
  7887. Transform the field order of the input video.
  7888. It accepts the following parameters:
  7889. @table @option
  7890. @item order
  7891. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7892. for bottom field first.
  7893. @end table
  7894. The default value is @samp{tff}.
  7895. The transformation is done by shifting the picture content up or down
  7896. by one line, and filling the remaining line with appropriate picture content.
  7897. This method is consistent with most broadcast field order converters.
  7898. If the input video is not flagged as being interlaced, or it is already
  7899. flagged as being of the required output field order, then this filter does
  7900. not alter the incoming video.
  7901. It is very useful when converting to or from PAL DV material,
  7902. which is bottom field first.
  7903. For example:
  7904. @example
  7905. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7906. @end example
  7907. @section fifo, afifo
  7908. Buffer input images and send them when they are requested.
  7909. It is mainly useful when auto-inserted by the libavfilter
  7910. framework.
  7911. It does not take parameters.
  7912. @section fillborders
  7913. Fill borders of the input video, without changing video stream dimensions.
  7914. Sometimes video can have garbage at the four edges and you may not want to
  7915. crop video input to keep size multiple of some number.
  7916. This filter accepts the following options:
  7917. @table @option
  7918. @item left
  7919. Number of pixels to fill from left border.
  7920. @item right
  7921. Number of pixels to fill from right border.
  7922. @item top
  7923. Number of pixels to fill from top border.
  7924. @item bottom
  7925. Number of pixels to fill from bottom border.
  7926. @item mode
  7927. Set fill mode.
  7928. It accepts the following values:
  7929. @table @samp
  7930. @item smear
  7931. fill pixels using outermost pixels
  7932. @item mirror
  7933. fill pixels using mirroring
  7934. @item fixed
  7935. fill pixels with constant value
  7936. @end table
  7937. Default is @var{smear}.
  7938. @item color
  7939. Set color for pixels in fixed mode. Default is @var{black}.
  7940. @end table
  7941. @section find_rect
  7942. Find a rectangular object
  7943. It accepts the following options:
  7944. @table @option
  7945. @item object
  7946. Filepath of the object image, needs to be in gray8.
  7947. @item threshold
  7948. Detection threshold, default is 0.5.
  7949. @item mipmaps
  7950. Number of mipmaps, default is 3.
  7951. @item xmin, ymin, xmax, ymax
  7952. Specifies the rectangle in which to search.
  7953. @end table
  7954. @subsection Examples
  7955. @itemize
  7956. @item
  7957. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7958. @example
  7959. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7960. @end example
  7961. @end itemize
  7962. @section cover_rect
  7963. Cover a rectangular object
  7964. It accepts the following options:
  7965. @table @option
  7966. @item cover
  7967. Filepath of the optional cover image, needs to be in yuv420.
  7968. @item mode
  7969. Set covering mode.
  7970. It accepts the following values:
  7971. @table @samp
  7972. @item cover
  7973. cover it by the supplied image
  7974. @item blur
  7975. cover it by interpolating the surrounding pixels
  7976. @end table
  7977. Default value is @var{blur}.
  7978. @end table
  7979. @subsection Examples
  7980. @itemize
  7981. @item
  7982. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7983. @example
  7984. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7985. @end example
  7986. @end itemize
  7987. @section floodfill
  7988. Flood area with values of same pixel components with another values.
  7989. It accepts the following options:
  7990. @table @option
  7991. @item x
  7992. Set pixel x coordinate.
  7993. @item y
  7994. Set pixel y coordinate.
  7995. @item s0
  7996. Set source #0 component value.
  7997. @item s1
  7998. Set source #1 component value.
  7999. @item s2
  8000. Set source #2 component value.
  8001. @item s3
  8002. Set source #3 component value.
  8003. @item d0
  8004. Set destination #0 component value.
  8005. @item d1
  8006. Set destination #1 component value.
  8007. @item d2
  8008. Set destination #2 component value.
  8009. @item d3
  8010. Set destination #3 component value.
  8011. @end table
  8012. @anchor{format}
  8013. @section format
  8014. Convert the input video to one of the specified pixel formats.
  8015. Libavfilter will try to pick one that is suitable as input to
  8016. the next filter.
  8017. It accepts the following parameters:
  8018. @table @option
  8019. @item pix_fmts
  8020. A '|'-separated list of pixel format names, such as
  8021. "pix_fmts=yuv420p|monow|rgb24".
  8022. @end table
  8023. @subsection Examples
  8024. @itemize
  8025. @item
  8026. Convert the input video to the @var{yuv420p} format
  8027. @example
  8028. format=pix_fmts=yuv420p
  8029. @end example
  8030. Convert the input video to any of the formats in the list
  8031. @example
  8032. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8033. @end example
  8034. @end itemize
  8035. @anchor{fps}
  8036. @section fps
  8037. Convert the video to specified constant frame rate by duplicating or dropping
  8038. frames as necessary.
  8039. It accepts the following parameters:
  8040. @table @option
  8041. @item fps
  8042. The desired output frame rate. The default is @code{25}.
  8043. @item start_time
  8044. Assume the first PTS should be the given value, in seconds. This allows for
  8045. padding/trimming at the start of stream. By default, no assumption is made
  8046. about the first frame's expected PTS, so no padding or trimming is done.
  8047. For example, this could be set to 0 to pad the beginning with duplicates of
  8048. the first frame if a video stream starts after the audio stream or to trim any
  8049. frames with a negative PTS.
  8050. @item round
  8051. Timestamp (PTS) rounding method.
  8052. Possible values are:
  8053. @table @option
  8054. @item zero
  8055. round towards 0
  8056. @item inf
  8057. round away from 0
  8058. @item down
  8059. round towards -infinity
  8060. @item up
  8061. round towards +infinity
  8062. @item near
  8063. round to nearest
  8064. @end table
  8065. The default is @code{near}.
  8066. @item eof_action
  8067. Action performed when reading the last frame.
  8068. Possible values are:
  8069. @table @option
  8070. @item round
  8071. Use same timestamp rounding method as used for other frames.
  8072. @item pass
  8073. Pass through last frame if input duration has not been reached yet.
  8074. @end table
  8075. The default is @code{round}.
  8076. @end table
  8077. Alternatively, the options can be specified as a flat string:
  8078. @var{fps}[:@var{start_time}[:@var{round}]].
  8079. See also the @ref{setpts} filter.
  8080. @subsection Examples
  8081. @itemize
  8082. @item
  8083. A typical usage in order to set the fps to 25:
  8084. @example
  8085. fps=fps=25
  8086. @end example
  8087. @item
  8088. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8089. @example
  8090. fps=fps=film:round=near
  8091. @end example
  8092. @end itemize
  8093. @section framepack
  8094. Pack two different video streams into a stereoscopic video, setting proper
  8095. metadata on supported codecs. The two views should have the same size and
  8096. framerate and processing will stop when the shorter video ends. Please note
  8097. that you may conveniently adjust view properties with the @ref{scale} and
  8098. @ref{fps} filters.
  8099. It accepts the following parameters:
  8100. @table @option
  8101. @item format
  8102. The desired packing format. Supported values are:
  8103. @table @option
  8104. @item sbs
  8105. The views are next to each other (default).
  8106. @item tab
  8107. The views are on top of each other.
  8108. @item lines
  8109. The views are packed by line.
  8110. @item columns
  8111. The views are packed by column.
  8112. @item frameseq
  8113. The views are temporally interleaved.
  8114. @end table
  8115. @end table
  8116. Some examples:
  8117. @example
  8118. # Convert left and right views into a frame-sequential video
  8119. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8120. # Convert views into a side-by-side video with the same output resolution as the input
  8121. 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
  8122. @end example
  8123. @section framerate
  8124. Change the frame rate by interpolating new video output frames from the source
  8125. frames.
  8126. This filter is not designed to function correctly with interlaced media. If
  8127. you wish to change the frame rate of interlaced media then you are required
  8128. to deinterlace before this filter and re-interlace after this filter.
  8129. A description of the accepted options follows.
  8130. @table @option
  8131. @item fps
  8132. Specify the output frames per second. This option can also be specified
  8133. as a value alone. The default is @code{50}.
  8134. @item interp_start
  8135. Specify the start of a range where the output frame will be created as a
  8136. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8137. the default is @code{15}.
  8138. @item interp_end
  8139. Specify the end of a range where the output frame will be created as a
  8140. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8141. the default is @code{240}.
  8142. @item scene
  8143. Specify the level at which a scene change is detected as a value between
  8144. 0 and 100 to indicate a new scene; a low value reflects a low
  8145. probability for the current frame to introduce a new scene, while a higher
  8146. value means the current frame is more likely to be one.
  8147. The default is @code{8.2}.
  8148. @item flags
  8149. Specify flags influencing the filter process.
  8150. Available value for @var{flags} is:
  8151. @table @option
  8152. @item scene_change_detect, scd
  8153. Enable scene change detection using the value of the option @var{scene}.
  8154. This flag is enabled by default.
  8155. @end table
  8156. @end table
  8157. @section framestep
  8158. Select one frame every N-th frame.
  8159. This filter accepts the following option:
  8160. @table @option
  8161. @item step
  8162. Select frame after every @code{step} frames.
  8163. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8164. @end table
  8165. @section freezedetect
  8166. Detect frozen video.
  8167. This filter logs a message and sets frame metadata when it detects that the
  8168. input video has no significant change in content during a specified duration.
  8169. Video freeze detection calculates the mean average absolute difference of all
  8170. the components of video frames and compares it to a noise floor.
  8171. The printed times and duration are expressed in seconds. The
  8172. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8173. whose timestamp equals or exceeds the detection duration and it contains the
  8174. timestamp of the first frame of the freeze. The
  8175. @code{lavfi.freezedetect.freeze_duration} and
  8176. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8177. after the freeze.
  8178. The filter accepts the following options:
  8179. @table @option
  8180. @item noise, n
  8181. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8182. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8183. 0.001.
  8184. @item duration, d
  8185. Set freeze duration until notification (default is 2 seconds).
  8186. @end table
  8187. @anchor{frei0r}
  8188. @section frei0r
  8189. Apply a frei0r effect to the input video.
  8190. To enable the compilation of this filter, you need to install the frei0r
  8191. header and configure FFmpeg with @code{--enable-frei0r}.
  8192. It accepts the following parameters:
  8193. @table @option
  8194. @item filter_name
  8195. The name of the frei0r effect to load. If the environment variable
  8196. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8197. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8198. Otherwise, the standard frei0r paths are searched, in this order:
  8199. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8200. @file{/usr/lib/frei0r-1/}.
  8201. @item filter_params
  8202. A '|'-separated list of parameters to pass to the frei0r effect.
  8203. @end table
  8204. A frei0r effect parameter can be a boolean (its value is either
  8205. "y" or "n"), a double, a color (specified as
  8206. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8207. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8208. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8209. a position (specified as @var{X}/@var{Y}, where
  8210. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8211. The number and types of parameters depend on the loaded effect. If an
  8212. effect parameter is not specified, the default value is set.
  8213. @subsection Examples
  8214. @itemize
  8215. @item
  8216. Apply the distort0r effect, setting the first two double parameters:
  8217. @example
  8218. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8219. @end example
  8220. @item
  8221. Apply the colordistance effect, taking a color as the first parameter:
  8222. @example
  8223. frei0r=colordistance:0.2/0.3/0.4
  8224. frei0r=colordistance:violet
  8225. frei0r=colordistance:0x112233
  8226. @end example
  8227. @item
  8228. Apply the perspective effect, specifying the top left and top right image
  8229. positions:
  8230. @example
  8231. frei0r=perspective:0.2/0.2|0.8/0.2
  8232. @end example
  8233. @end itemize
  8234. For more information, see
  8235. @url{http://frei0r.dyne.org}
  8236. @section fspp
  8237. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8238. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8239. processing filter, one of them is performed once per block, not per pixel.
  8240. This allows for much higher speed.
  8241. The filter accepts the following options:
  8242. @table @option
  8243. @item quality
  8244. Set quality. This option defines the number of levels for averaging. It accepts
  8245. an integer in the range 4-5. Default value is @code{4}.
  8246. @item qp
  8247. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8248. If not set, the filter will use the QP from the video stream (if available).
  8249. @item strength
  8250. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8251. more details but also more artifacts, while higher values make the image smoother
  8252. but also blurrier. Default value is @code{0} − PSNR optimal.
  8253. @item use_bframe_qp
  8254. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8255. option may cause flicker since the B-Frames have often larger QP. Default is
  8256. @code{0} (not enabled).
  8257. @end table
  8258. @section gblur
  8259. Apply Gaussian blur filter.
  8260. The filter accepts the following options:
  8261. @table @option
  8262. @item sigma
  8263. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8264. @item steps
  8265. Set number of steps for Gaussian approximation. Default is @code{1}.
  8266. @item planes
  8267. Set which planes to filter. By default all planes are filtered.
  8268. @item sigmaV
  8269. Set vertical sigma, if negative it will be same as @code{sigma}.
  8270. Default is @code{-1}.
  8271. @end table
  8272. @section geq
  8273. Apply generic equation to each pixel.
  8274. The filter accepts the following options:
  8275. @table @option
  8276. @item lum_expr, lum
  8277. Set the luminance expression.
  8278. @item cb_expr, cb
  8279. Set the chrominance blue expression.
  8280. @item cr_expr, cr
  8281. Set the chrominance red expression.
  8282. @item alpha_expr, a
  8283. Set the alpha expression.
  8284. @item red_expr, r
  8285. Set the red expression.
  8286. @item green_expr, g
  8287. Set the green expression.
  8288. @item blue_expr, b
  8289. Set the blue expression.
  8290. @end table
  8291. The colorspace is selected according to the specified options. If one
  8292. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8293. options is specified, the filter will automatically select a YCbCr
  8294. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8295. @option{blue_expr} options is specified, it will select an RGB
  8296. colorspace.
  8297. If one of the chrominance expression is not defined, it falls back on the other
  8298. one. If no alpha expression is specified it will evaluate to opaque value.
  8299. If none of chrominance expressions are specified, they will evaluate
  8300. to the luminance expression.
  8301. The expressions can use the following variables and functions:
  8302. @table @option
  8303. @item N
  8304. The sequential number of the filtered frame, starting from @code{0}.
  8305. @item X
  8306. @item Y
  8307. The coordinates of the current sample.
  8308. @item W
  8309. @item H
  8310. The width and height of the image.
  8311. @item SW
  8312. @item SH
  8313. Width and height scale depending on the currently filtered plane. It is the
  8314. ratio between the corresponding luma plane number of pixels and the current
  8315. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8316. @code{0.5,0.5} for chroma planes.
  8317. @item T
  8318. Time of the current frame, expressed in seconds.
  8319. @item p(x, y)
  8320. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8321. plane.
  8322. @item lum(x, y)
  8323. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8324. plane.
  8325. @item cb(x, y)
  8326. Return the value of the pixel at location (@var{x},@var{y}) of the
  8327. blue-difference chroma plane. Return 0 if there is no such plane.
  8328. @item cr(x, y)
  8329. Return the value of the pixel at location (@var{x},@var{y}) of the
  8330. red-difference chroma plane. Return 0 if there is no such plane.
  8331. @item r(x, y)
  8332. @item g(x, y)
  8333. @item b(x, y)
  8334. Return the value of the pixel at location (@var{x},@var{y}) of the
  8335. red/green/blue component. Return 0 if there is no such component.
  8336. @item alpha(x, y)
  8337. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8338. plane. Return 0 if there is no such plane.
  8339. @end table
  8340. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8341. automatically clipped to the closer edge.
  8342. @subsection Examples
  8343. @itemize
  8344. @item
  8345. Flip the image horizontally:
  8346. @example
  8347. geq=p(W-X\,Y)
  8348. @end example
  8349. @item
  8350. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8351. wavelength of 100 pixels:
  8352. @example
  8353. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8354. @end example
  8355. @item
  8356. Generate a fancy enigmatic moving light:
  8357. @example
  8358. 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
  8359. @end example
  8360. @item
  8361. Generate a quick emboss effect:
  8362. @example
  8363. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8364. @end example
  8365. @item
  8366. Modify RGB components depending on pixel position:
  8367. @example
  8368. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8369. @end example
  8370. @item
  8371. Create a radial gradient that is the same size as the input (also see
  8372. the @ref{vignette} filter):
  8373. @example
  8374. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8375. @end example
  8376. @end itemize
  8377. @section gradfun
  8378. Fix the banding artifacts that are sometimes introduced into nearly flat
  8379. regions by truncation to 8-bit color depth.
  8380. Interpolate the gradients that should go where the bands are, and
  8381. dither them.
  8382. It is designed for playback only. Do not use it prior to
  8383. lossy compression, because compression tends to lose the dither and
  8384. bring back the bands.
  8385. It accepts the following parameters:
  8386. @table @option
  8387. @item strength
  8388. The maximum amount by which the filter will change any one pixel. This is also
  8389. the threshold for detecting nearly flat regions. Acceptable values range from
  8390. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8391. valid range.
  8392. @item radius
  8393. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8394. gradients, but also prevents the filter from modifying the pixels near detailed
  8395. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8396. values will be clipped to the valid range.
  8397. @end table
  8398. Alternatively, the options can be specified as a flat string:
  8399. @var{strength}[:@var{radius}]
  8400. @subsection Examples
  8401. @itemize
  8402. @item
  8403. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8404. @example
  8405. gradfun=3.5:8
  8406. @end example
  8407. @item
  8408. Specify radius, omitting the strength (which will fall-back to the default
  8409. value):
  8410. @example
  8411. gradfun=radius=8
  8412. @end example
  8413. @end itemize
  8414. @section graphmonitor, agraphmonitor
  8415. Show various filtergraph stats.
  8416. With this filter one can debug complete filtergraph.
  8417. Especially issues with links filling with queued frames.
  8418. The filter accepts the following options:
  8419. @table @option
  8420. @item size, s
  8421. Set video output size. Default is @var{hd720}.
  8422. @item opacity, o
  8423. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8424. @item mode, m
  8425. Set output mode, can be @var{fulll} or @var{compact}.
  8426. In @var{compact} mode only filters with some queued frames have displayed stats.
  8427. @item flags, f
  8428. Set flags which enable which stats are shown in video.
  8429. Available values for flags are:
  8430. @table @samp
  8431. @item queue
  8432. Display number of queued frames in each link.
  8433. @item frame_count_in
  8434. Display number of frames taken from filter.
  8435. @item frame_count_out
  8436. Display number of frames given out from filter.
  8437. @item pts
  8438. Display current filtered frame pts.
  8439. @item time
  8440. Display current filtered frame time.
  8441. @item timebase
  8442. Display time base for filter link.
  8443. @item format
  8444. Display used format for filter link.
  8445. @item size
  8446. Display video size or number of audio channels in case of audio used by filter link.
  8447. @item rate
  8448. Display video frame rate or sample rate in case of audio used by filter link.
  8449. @end table
  8450. @item rate, r
  8451. Set upper limit for video rate of output stream, Default value is @var{25}.
  8452. This guarantee that output video frame rate will not be higher than this value.
  8453. @end table
  8454. @section greyedge
  8455. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8456. and corrects the scene colors accordingly.
  8457. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8458. The filter accepts the following options:
  8459. @table @option
  8460. @item difford
  8461. The order of differentiation to be applied on the scene. Must be chosen in the range
  8462. [0,2] and default value is 1.
  8463. @item minknorm
  8464. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8465. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8466. max value instead of calculating Minkowski distance.
  8467. @item sigma
  8468. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8469. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8470. can't be equal to 0 if @var{difford} is greater than 0.
  8471. @end table
  8472. @subsection Examples
  8473. @itemize
  8474. @item
  8475. Grey Edge:
  8476. @example
  8477. greyedge=difford=1:minknorm=5:sigma=2
  8478. @end example
  8479. @item
  8480. Max Edge:
  8481. @example
  8482. greyedge=difford=1:minknorm=0:sigma=2
  8483. @end example
  8484. @end itemize
  8485. @anchor{haldclut}
  8486. @section haldclut
  8487. Apply a Hald CLUT to a video stream.
  8488. First input is the video stream to process, and second one is the Hald CLUT.
  8489. The Hald CLUT input can be a simple picture or a complete video stream.
  8490. The filter accepts the following options:
  8491. @table @option
  8492. @item shortest
  8493. Force termination when the shortest input terminates. Default is @code{0}.
  8494. @item repeatlast
  8495. Continue applying the last CLUT after the end of the stream. A value of
  8496. @code{0} disable the filter after the last frame of the CLUT is reached.
  8497. Default is @code{1}.
  8498. @end table
  8499. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8500. filters share the same internals).
  8501. This filter also supports the @ref{framesync} options.
  8502. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8503. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8504. @subsection Workflow examples
  8505. @subsubsection Hald CLUT video stream
  8506. Generate an identity Hald CLUT stream altered with various effects:
  8507. @example
  8508. 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
  8509. @end example
  8510. Note: make sure you use a lossless codec.
  8511. Then use it with @code{haldclut} to apply it on some random stream:
  8512. @example
  8513. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8514. @end example
  8515. The Hald CLUT will be applied to the 10 first seconds (duration of
  8516. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8517. to the remaining frames of the @code{mandelbrot} stream.
  8518. @subsubsection Hald CLUT with preview
  8519. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8520. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8521. biggest possible square starting at the top left of the picture. The remaining
  8522. padding pixels (bottom or right) will be ignored. This area can be used to add
  8523. a preview of the Hald CLUT.
  8524. Typically, the following generated Hald CLUT will be supported by the
  8525. @code{haldclut} filter:
  8526. @example
  8527. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8528. pad=iw+320 [padded_clut];
  8529. smptebars=s=320x256, split [a][b];
  8530. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8531. [main][b] overlay=W-320" -frames:v 1 clut.png
  8532. @end example
  8533. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8534. bars are displayed on the right-top, and below the same color bars processed by
  8535. the color changes.
  8536. Then, the effect of this Hald CLUT can be visualized with:
  8537. @example
  8538. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8539. @end example
  8540. @section hflip
  8541. Flip the input video horizontally.
  8542. For example, to horizontally flip the input video with @command{ffmpeg}:
  8543. @example
  8544. ffmpeg -i in.avi -vf "hflip" out.avi
  8545. @end example
  8546. @section histeq
  8547. This filter applies a global color histogram equalization on a
  8548. per-frame basis.
  8549. It can be used to correct video that has a compressed range of pixel
  8550. intensities. The filter redistributes the pixel intensities to
  8551. equalize their distribution across the intensity range. It may be
  8552. viewed as an "automatically adjusting contrast filter". This filter is
  8553. useful only for correcting degraded or poorly captured source
  8554. video.
  8555. The filter accepts the following options:
  8556. @table @option
  8557. @item strength
  8558. Determine the amount of equalization to be applied. As the strength
  8559. is reduced, the distribution of pixel intensities more-and-more
  8560. approaches that of the input frame. The value must be a float number
  8561. in the range [0,1] and defaults to 0.200.
  8562. @item intensity
  8563. Set the maximum intensity that can generated and scale the output
  8564. values appropriately. The strength should be set as desired and then
  8565. the intensity can be limited if needed to avoid washing-out. The value
  8566. must be a float number in the range [0,1] and defaults to 0.210.
  8567. @item antibanding
  8568. Set the antibanding level. If enabled the filter will randomly vary
  8569. the luminance of output pixels by a small amount to avoid banding of
  8570. the histogram. Possible values are @code{none}, @code{weak} or
  8571. @code{strong}. It defaults to @code{none}.
  8572. @end table
  8573. @section histogram
  8574. Compute and draw a color distribution histogram for the input video.
  8575. The computed histogram is a representation of the color component
  8576. distribution in an image.
  8577. Standard histogram displays the color components distribution in an image.
  8578. Displays color graph for each color component. Shows distribution of
  8579. the Y, U, V, A or R, G, B components, depending on input format, in the
  8580. current frame. Below each graph a color component scale meter is shown.
  8581. The filter accepts the following options:
  8582. @table @option
  8583. @item level_height
  8584. Set height of level. Default value is @code{200}.
  8585. Allowed range is [50, 2048].
  8586. @item scale_height
  8587. Set height of color scale. Default value is @code{12}.
  8588. Allowed range is [0, 40].
  8589. @item display_mode
  8590. Set display mode.
  8591. It accepts the following values:
  8592. @table @samp
  8593. @item stack
  8594. Per color component graphs are placed below each other.
  8595. @item parade
  8596. Per color component graphs are placed side by side.
  8597. @item overlay
  8598. Presents information identical to that in the @code{parade}, except
  8599. that the graphs representing color components are superimposed directly
  8600. over one another.
  8601. @end table
  8602. Default is @code{stack}.
  8603. @item levels_mode
  8604. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8605. Default is @code{linear}.
  8606. @item components
  8607. Set what color components to display.
  8608. Default is @code{7}.
  8609. @item fgopacity
  8610. Set foreground opacity. Default is @code{0.7}.
  8611. @item bgopacity
  8612. Set background opacity. Default is @code{0.5}.
  8613. @end table
  8614. @subsection Examples
  8615. @itemize
  8616. @item
  8617. Calculate and draw histogram:
  8618. @example
  8619. ffplay -i input -vf histogram
  8620. @end example
  8621. @end itemize
  8622. @anchor{hqdn3d}
  8623. @section hqdn3d
  8624. This is a high precision/quality 3d denoise filter. It aims to reduce
  8625. image noise, producing smooth images and making still images really
  8626. still. It should enhance compressibility.
  8627. It accepts the following optional parameters:
  8628. @table @option
  8629. @item luma_spatial
  8630. A non-negative floating point number which specifies spatial luma strength.
  8631. It defaults to 4.0.
  8632. @item chroma_spatial
  8633. A non-negative floating point number which specifies spatial chroma strength.
  8634. It defaults to 3.0*@var{luma_spatial}/4.0.
  8635. @item luma_tmp
  8636. A floating point number which specifies luma temporal strength. It defaults to
  8637. 6.0*@var{luma_spatial}/4.0.
  8638. @item chroma_tmp
  8639. A floating point number which specifies chroma temporal strength. It defaults to
  8640. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8641. @end table
  8642. @anchor{hwdownload}
  8643. @section hwdownload
  8644. Download hardware frames to system memory.
  8645. The input must be in hardware frames, and the output a non-hardware format.
  8646. Not all formats will be supported on the output - it may be necessary to insert
  8647. an additional @option{format} filter immediately following in the graph to get
  8648. the output in a supported format.
  8649. @section hwmap
  8650. Map hardware frames to system memory or to another device.
  8651. This filter has several different modes of operation; which one is used depends
  8652. on the input and output formats:
  8653. @itemize
  8654. @item
  8655. Hardware frame input, normal frame output
  8656. Map the input frames to system memory and pass them to the output. If the
  8657. original hardware frame is later required (for example, after overlaying
  8658. something else on part of it), the @option{hwmap} filter can be used again
  8659. in the next mode to retrieve it.
  8660. @item
  8661. Normal frame input, hardware frame output
  8662. If the input is actually a software-mapped hardware frame, then unmap it -
  8663. that is, return the original hardware frame.
  8664. Otherwise, a device must be provided. Create new hardware surfaces on that
  8665. device for the output, then map them back to the software format at the input
  8666. and give those frames to the preceding filter. This will then act like the
  8667. @option{hwupload} filter, but may be able to avoid an additional copy when
  8668. the input is already in a compatible format.
  8669. @item
  8670. Hardware frame input and output
  8671. A device must be supplied for the output, either directly or with the
  8672. @option{derive_device} option. The input and output devices must be of
  8673. different types and compatible - the exact meaning of this is
  8674. system-dependent, but typically it means that they must refer to the same
  8675. underlying hardware context (for example, refer to the same graphics card).
  8676. If the input frames were originally created on the output device, then unmap
  8677. to retrieve the original frames.
  8678. Otherwise, map the frames to the output device - create new hardware frames
  8679. on the output corresponding to the frames on the input.
  8680. @end itemize
  8681. The following additional parameters are accepted:
  8682. @table @option
  8683. @item mode
  8684. Set the frame mapping mode. Some combination of:
  8685. @table @var
  8686. @item read
  8687. The mapped frame should be readable.
  8688. @item write
  8689. The mapped frame should be writeable.
  8690. @item overwrite
  8691. The mapping will always overwrite the entire frame.
  8692. This may improve performance in some cases, as the original contents of the
  8693. frame need not be loaded.
  8694. @item direct
  8695. The mapping must not involve any copying.
  8696. Indirect mappings to copies of frames are created in some cases where either
  8697. direct mapping is not possible or it would have unexpected properties.
  8698. Setting this flag ensures that the mapping is direct and will fail if that is
  8699. not possible.
  8700. @end table
  8701. Defaults to @var{read+write} if not specified.
  8702. @item derive_device @var{type}
  8703. Rather than using the device supplied at initialisation, instead derive a new
  8704. device of type @var{type} from the device the input frames exist on.
  8705. @item reverse
  8706. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8707. and map them back to the source. This may be necessary in some cases where
  8708. a mapping in one direction is required but only the opposite direction is
  8709. supported by the devices being used.
  8710. This option is dangerous - it may break the preceding filter in undefined
  8711. ways if there are any additional constraints on that filter's output.
  8712. Do not use it without fully understanding the implications of its use.
  8713. @end table
  8714. @anchor{hwupload}
  8715. @section hwupload
  8716. Upload system memory frames to hardware surfaces.
  8717. The device to upload to must be supplied when the filter is initialised. If
  8718. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8719. option.
  8720. @anchor{hwupload_cuda}
  8721. @section hwupload_cuda
  8722. Upload system memory frames to a CUDA device.
  8723. It accepts the following optional parameters:
  8724. @table @option
  8725. @item device
  8726. The number of the CUDA device to use
  8727. @end table
  8728. @section hqx
  8729. Apply a high-quality magnification filter designed for pixel art. This filter
  8730. was originally created by Maxim Stepin.
  8731. It accepts the following option:
  8732. @table @option
  8733. @item n
  8734. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8735. @code{hq3x} and @code{4} for @code{hq4x}.
  8736. Default is @code{3}.
  8737. @end table
  8738. @section hstack
  8739. Stack input videos horizontally.
  8740. All streams must be of same pixel format and of same height.
  8741. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8742. to create same output.
  8743. The filter accept the following option:
  8744. @table @option
  8745. @item inputs
  8746. Set number of input streams. Default is 2.
  8747. @item shortest
  8748. If set to 1, force the output to terminate when the shortest input
  8749. terminates. Default value is 0.
  8750. @end table
  8751. @section hue
  8752. Modify the hue and/or the saturation of the input.
  8753. It accepts the following parameters:
  8754. @table @option
  8755. @item h
  8756. Specify the hue angle as a number of degrees. It accepts an expression,
  8757. and defaults to "0".
  8758. @item s
  8759. Specify the saturation in the [-10,10] range. It accepts an expression and
  8760. defaults to "1".
  8761. @item H
  8762. Specify the hue angle as a number of radians. It accepts an
  8763. expression, and defaults to "0".
  8764. @item b
  8765. Specify the brightness in the [-10,10] range. It accepts an expression and
  8766. defaults to "0".
  8767. @end table
  8768. @option{h} and @option{H} are mutually exclusive, and can't be
  8769. specified at the same time.
  8770. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8771. expressions containing the following constants:
  8772. @table @option
  8773. @item n
  8774. frame count of the input frame starting from 0
  8775. @item pts
  8776. presentation timestamp of the input frame expressed in time base units
  8777. @item r
  8778. frame rate of the input video, NAN if the input frame rate is unknown
  8779. @item t
  8780. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8781. @item tb
  8782. time base of the input video
  8783. @end table
  8784. @subsection Examples
  8785. @itemize
  8786. @item
  8787. Set the hue to 90 degrees and the saturation to 1.0:
  8788. @example
  8789. hue=h=90:s=1
  8790. @end example
  8791. @item
  8792. Same command but expressing the hue in radians:
  8793. @example
  8794. hue=H=PI/2:s=1
  8795. @end example
  8796. @item
  8797. Rotate hue and make the saturation swing between 0
  8798. and 2 over a period of 1 second:
  8799. @example
  8800. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8801. @end example
  8802. @item
  8803. Apply a 3 seconds saturation fade-in effect starting at 0:
  8804. @example
  8805. hue="s=min(t/3\,1)"
  8806. @end example
  8807. The general fade-in expression can be written as:
  8808. @example
  8809. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8810. @end example
  8811. @item
  8812. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8813. @example
  8814. hue="s=max(0\, min(1\, (8-t)/3))"
  8815. @end example
  8816. The general fade-out expression can be written as:
  8817. @example
  8818. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8819. @end example
  8820. @end itemize
  8821. @subsection Commands
  8822. This filter supports the following commands:
  8823. @table @option
  8824. @item b
  8825. @item s
  8826. @item h
  8827. @item H
  8828. Modify the hue and/or the saturation and/or brightness of the input video.
  8829. The command accepts the same syntax of the corresponding option.
  8830. If the specified expression is not valid, it is kept at its current
  8831. value.
  8832. @end table
  8833. @section hysteresis
  8834. Grow first stream into second stream by connecting components.
  8835. This makes it possible to build more robust edge masks.
  8836. This filter accepts the following options:
  8837. @table @option
  8838. @item planes
  8839. Set which planes will be processed as bitmap, unprocessed planes will be
  8840. copied from first stream.
  8841. By default value 0xf, all planes will be processed.
  8842. @item threshold
  8843. Set threshold which is used in filtering. If pixel component value is higher than
  8844. this value filter algorithm for connecting components is activated.
  8845. By default value is 0.
  8846. @end table
  8847. @section idet
  8848. Detect video interlacing type.
  8849. This filter tries to detect if the input frames are interlaced, progressive,
  8850. top or bottom field first. It will also try to detect fields that are
  8851. repeated between adjacent frames (a sign of telecine).
  8852. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8853. Multiple frame detection incorporates the classification history of previous frames.
  8854. The filter will log these metadata values:
  8855. @table @option
  8856. @item single.current_frame
  8857. Detected type of current frame using single-frame detection. One of:
  8858. ``tff'' (top field first), ``bff'' (bottom field first),
  8859. ``progressive'', or ``undetermined''
  8860. @item single.tff
  8861. Cumulative number of frames detected as top field first using single-frame detection.
  8862. @item multiple.tff
  8863. Cumulative number of frames detected as top field first using multiple-frame detection.
  8864. @item single.bff
  8865. Cumulative number of frames detected as bottom field first using single-frame detection.
  8866. @item multiple.current_frame
  8867. Detected type of current frame using multiple-frame detection. One of:
  8868. ``tff'' (top field first), ``bff'' (bottom field first),
  8869. ``progressive'', or ``undetermined''
  8870. @item multiple.bff
  8871. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8872. @item single.progressive
  8873. Cumulative number of frames detected as progressive using single-frame detection.
  8874. @item multiple.progressive
  8875. Cumulative number of frames detected as progressive using multiple-frame detection.
  8876. @item single.undetermined
  8877. Cumulative number of frames that could not be classified using single-frame detection.
  8878. @item multiple.undetermined
  8879. Cumulative number of frames that could not be classified using multiple-frame detection.
  8880. @item repeated.current_frame
  8881. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8882. @item repeated.neither
  8883. Cumulative number of frames with no repeated field.
  8884. @item repeated.top
  8885. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8886. @item repeated.bottom
  8887. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8888. @end table
  8889. The filter accepts the following options:
  8890. @table @option
  8891. @item intl_thres
  8892. Set interlacing threshold.
  8893. @item prog_thres
  8894. Set progressive threshold.
  8895. @item rep_thres
  8896. Threshold for repeated field detection.
  8897. @item half_life
  8898. Number of frames after which a given frame's contribution to the
  8899. statistics is halved (i.e., it contributes only 0.5 to its
  8900. classification). The default of 0 means that all frames seen are given
  8901. full weight of 1.0 forever.
  8902. @item analyze_interlaced_flag
  8903. When this is not 0 then idet will use the specified number of frames to determine
  8904. if the interlaced flag is accurate, it will not count undetermined frames.
  8905. If the flag is found to be accurate it will be used without any further
  8906. computations, if it is found to be inaccurate it will be cleared without any
  8907. further computations. This allows inserting the idet filter as a low computational
  8908. method to clean up the interlaced flag
  8909. @end table
  8910. @section il
  8911. Deinterleave or interleave fields.
  8912. This filter allows one to process interlaced images fields without
  8913. deinterlacing them. Deinterleaving splits the input frame into 2
  8914. fields (so called half pictures). Odd lines are moved to the top
  8915. half of the output image, even lines to the bottom half.
  8916. You can process (filter) them independently and then re-interleave them.
  8917. The filter accepts the following options:
  8918. @table @option
  8919. @item luma_mode, l
  8920. @item chroma_mode, c
  8921. @item alpha_mode, a
  8922. Available values for @var{luma_mode}, @var{chroma_mode} and
  8923. @var{alpha_mode} are:
  8924. @table @samp
  8925. @item none
  8926. Do nothing.
  8927. @item deinterleave, d
  8928. Deinterleave fields, placing one above the other.
  8929. @item interleave, i
  8930. Interleave fields. Reverse the effect of deinterleaving.
  8931. @end table
  8932. Default value is @code{none}.
  8933. @item luma_swap, ls
  8934. @item chroma_swap, cs
  8935. @item alpha_swap, as
  8936. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8937. @end table
  8938. @section inflate
  8939. Apply inflate effect to the video.
  8940. This filter replaces the pixel by the local(3x3) average by taking into account
  8941. only values higher than the pixel.
  8942. It accepts the following options:
  8943. @table @option
  8944. @item threshold0
  8945. @item threshold1
  8946. @item threshold2
  8947. @item threshold3
  8948. Limit the maximum change for each plane, default is 65535.
  8949. If 0, plane will remain unchanged.
  8950. @end table
  8951. @section interlace
  8952. Simple interlacing filter from progressive contents. This interleaves upper (or
  8953. lower) lines from odd frames with lower (or upper) lines from even frames,
  8954. halving the frame rate and preserving image height.
  8955. @example
  8956. Original Original New Frame
  8957. Frame 'j' Frame 'j+1' (tff)
  8958. ========== =========== ==================
  8959. Line 0 --------------------> Frame 'j' Line 0
  8960. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8961. Line 2 ---------------------> Frame 'j' Line 2
  8962. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8963. ... ... ...
  8964. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8965. @end example
  8966. It accepts the following optional parameters:
  8967. @table @option
  8968. @item scan
  8969. This determines whether the interlaced frame is taken from the even
  8970. (tff - default) or odd (bff) lines of the progressive frame.
  8971. @item lowpass
  8972. Vertical lowpass filter to avoid twitter interlacing and
  8973. reduce moire patterns.
  8974. @table @samp
  8975. @item 0, off
  8976. Disable vertical lowpass filter
  8977. @item 1, linear
  8978. Enable linear filter (default)
  8979. @item 2, complex
  8980. Enable complex filter. This will slightly less reduce twitter and moire
  8981. but better retain detail and subjective sharpness impression.
  8982. @end table
  8983. @end table
  8984. @section kerndeint
  8985. Deinterlace input video by applying Donald Graft's adaptive kernel
  8986. deinterling. Work on interlaced parts of a video to produce
  8987. progressive frames.
  8988. The description of the accepted parameters follows.
  8989. @table @option
  8990. @item thresh
  8991. Set the threshold which affects the filter's tolerance when
  8992. determining if a pixel line must be processed. It must be an integer
  8993. in the range [0,255] and defaults to 10. A value of 0 will result in
  8994. applying the process on every pixels.
  8995. @item map
  8996. Paint pixels exceeding the threshold value to white if set to 1.
  8997. Default is 0.
  8998. @item order
  8999. Set the fields order. Swap fields if set to 1, leave fields alone if
  9000. 0. Default is 0.
  9001. @item sharp
  9002. Enable additional sharpening if set to 1. Default is 0.
  9003. @item twoway
  9004. Enable twoway sharpening if set to 1. Default is 0.
  9005. @end table
  9006. @subsection Examples
  9007. @itemize
  9008. @item
  9009. Apply default values:
  9010. @example
  9011. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9012. @end example
  9013. @item
  9014. Enable additional sharpening:
  9015. @example
  9016. kerndeint=sharp=1
  9017. @end example
  9018. @item
  9019. Paint processed pixels in white:
  9020. @example
  9021. kerndeint=map=1
  9022. @end example
  9023. @end itemize
  9024. @section lagfun
  9025. Slowly update darker pixels.
  9026. This filter makes short flashes of light appear longer.
  9027. This filter accepts the following options:
  9028. @table @option
  9029. @item decay
  9030. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9031. @item planes
  9032. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9033. @end table
  9034. @section lenscorrection
  9035. Correct radial lens distortion
  9036. This filter can be used to correct for radial distortion as can result from the use
  9037. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9038. one can use tools available for example as part of opencv or simply trial-and-error.
  9039. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9040. and extract the k1 and k2 coefficients from the resulting matrix.
  9041. Note that effectively the same filter is available in the open-source tools Krita and
  9042. Digikam from the KDE project.
  9043. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9044. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9045. brightness distribution, so you may want to use both filters together in certain
  9046. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9047. be applied before or after lens correction.
  9048. @subsection Options
  9049. The filter accepts the following options:
  9050. @table @option
  9051. @item cx
  9052. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9053. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9054. width. Default is 0.5.
  9055. @item cy
  9056. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9057. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9058. height. Default is 0.5.
  9059. @item k1
  9060. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9061. no correction. Default is 0.
  9062. @item k2
  9063. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9064. 0 means no correction. Default is 0.
  9065. @end table
  9066. The formula that generates the correction is:
  9067. @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)
  9068. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9069. distances from the focal point in the source and target images, respectively.
  9070. @section lensfun
  9071. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9072. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9073. to apply the lens correction. The filter will load the lensfun database and
  9074. query it to find the corresponding camera and lens entries in the database. As
  9075. long as these entries can be found with the given options, the filter can
  9076. perform corrections on frames. Note that incomplete strings will result in the
  9077. filter choosing the best match with the given options, and the filter will
  9078. output the chosen camera and lens models (logged with level "info"). You must
  9079. provide the make, camera model, and lens model as they are required.
  9080. The filter accepts the following options:
  9081. @table @option
  9082. @item make
  9083. The make of the camera (for example, "Canon"). This option is required.
  9084. @item model
  9085. The model of the camera (for example, "Canon EOS 100D"). This option is
  9086. required.
  9087. @item lens_model
  9088. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9089. option is required.
  9090. @item mode
  9091. The type of correction to apply. The following values are valid options:
  9092. @table @samp
  9093. @item vignetting
  9094. Enables fixing lens vignetting.
  9095. @item geometry
  9096. Enables fixing lens geometry. This is the default.
  9097. @item subpixel
  9098. Enables fixing chromatic aberrations.
  9099. @item vig_geo
  9100. Enables fixing lens vignetting and lens geometry.
  9101. @item vig_subpixel
  9102. Enables fixing lens vignetting and chromatic aberrations.
  9103. @item distortion
  9104. Enables fixing both lens geometry and chromatic aberrations.
  9105. @item all
  9106. Enables all possible corrections.
  9107. @end table
  9108. @item focal_length
  9109. The focal length of the image/video (zoom; expected constant for video). For
  9110. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9111. range should be chosen when using that lens. Default 18.
  9112. @item aperture
  9113. The aperture of the image/video (expected constant for video). Note that
  9114. aperture is only used for vignetting correction. Default 3.5.
  9115. @item focus_distance
  9116. The focus distance of the image/video (expected constant for video). Note that
  9117. focus distance is only used for vignetting and only slightly affects the
  9118. vignetting correction process. If unknown, leave it at the default value (which
  9119. is 1000).
  9120. @item scale
  9121. The scale factor which is applied after transformation. After correction the
  9122. video is no longer necessarily rectangular. This parameter controls how much of
  9123. the resulting image is visible. The value 0 means that a value will be chosen
  9124. automatically such that there is little or no unmapped area in the output
  9125. image. 1.0 means that no additional scaling is done. Lower values may result
  9126. in more of the corrected image being visible, while higher values may avoid
  9127. unmapped areas in the output.
  9128. @item target_geometry
  9129. The target geometry of the output image/video. The following values are valid
  9130. options:
  9131. @table @samp
  9132. @item rectilinear (default)
  9133. @item fisheye
  9134. @item panoramic
  9135. @item equirectangular
  9136. @item fisheye_orthographic
  9137. @item fisheye_stereographic
  9138. @item fisheye_equisolid
  9139. @item fisheye_thoby
  9140. @end table
  9141. @item reverse
  9142. Apply the reverse of image correction (instead of correcting distortion, apply
  9143. it).
  9144. @item interpolation
  9145. The type of interpolation used when correcting distortion. The following values
  9146. are valid options:
  9147. @table @samp
  9148. @item nearest
  9149. @item linear (default)
  9150. @item lanczos
  9151. @end table
  9152. @end table
  9153. @subsection Examples
  9154. @itemize
  9155. @item
  9156. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9157. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9158. aperture of "8.0".
  9159. @example
  9160. 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
  9161. @end example
  9162. @item
  9163. Apply the same as before, but only for the first 5 seconds of video.
  9164. @example
  9165. 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
  9166. @end example
  9167. @end itemize
  9168. @section libvmaf
  9169. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9170. score between two input videos.
  9171. The obtained VMAF score is printed through the logging system.
  9172. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9173. After installing the library it can be enabled using:
  9174. @code{./configure --enable-libvmaf --enable-version3}.
  9175. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9176. The filter has following options:
  9177. @table @option
  9178. @item model_path
  9179. Set the model path which is to be used for SVM.
  9180. Default value: @code{"vmaf_v0.6.1.pkl"}
  9181. @item log_path
  9182. Set the file path to be used to store logs.
  9183. @item log_fmt
  9184. Set the format of the log file (xml or json).
  9185. @item enable_transform
  9186. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9187. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9188. Default value: @code{false}
  9189. @item phone_model
  9190. Invokes the phone model which will generate VMAF scores higher than in the
  9191. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9192. @item psnr
  9193. Enables computing psnr along with vmaf.
  9194. @item ssim
  9195. Enables computing ssim along with vmaf.
  9196. @item ms_ssim
  9197. Enables computing ms_ssim along with vmaf.
  9198. @item pool
  9199. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9200. @item n_threads
  9201. Set number of threads to be used when computing vmaf.
  9202. @item n_subsample
  9203. Set interval for frame subsampling used when computing vmaf.
  9204. @item enable_conf_interval
  9205. Enables confidence interval.
  9206. @end table
  9207. This filter also supports the @ref{framesync} options.
  9208. On the below examples the input file @file{main.mpg} being processed is
  9209. compared with the reference file @file{ref.mpg}.
  9210. @example
  9211. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9212. @end example
  9213. Example with options:
  9214. @example
  9215. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9216. @end example
  9217. @section limiter
  9218. Limits the pixel components values to the specified range [min, max].
  9219. The filter accepts the following options:
  9220. @table @option
  9221. @item min
  9222. Lower bound. Defaults to the lowest allowed value for the input.
  9223. @item max
  9224. Upper bound. Defaults to the highest allowed value for the input.
  9225. @item planes
  9226. Specify which planes will be processed. Defaults to all available.
  9227. @end table
  9228. @section loop
  9229. Loop video frames.
  9230. The filter accepts the following options:
  9231. @table @option
  9232. @item loop
  9233. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9234. Default is 0.
  9235. @item size
  9236. Set maximal size in number of frames. Default is 0.
  9237. @item start
  9238. Set first frame of loop. Default is 0.
  9239. @end table
  9240. @subsection Examples
  9241. @itemize
  9242. @item
  9243. Loop single first frame infinitely:
  9244. @example
  9245. loop=loop=-1:size=1:start=0
  9246. @end example
  9247. @item
  9248. Loop single first frame 10 times:
  9249. @example
  9250. loop=loop=10:size=1:start=0
  9251. @end example
  9252. @item
  9253. Loop 10 first frames 5 times:
  9254. @example
  9255. loop=loop=5:size=10:start=0
  9256. @end example
  9257. @end itemize
  9258. @section lut1d
  9259. Apply a 1D LUT to an input video.
  9260. The filter accepts the following options:
  9261. @table @option
  9262. @item file
  9263. Set the 1D LUT file name.
  9264. Currently supported formats:
  9265. @table @samp
  9266. @item cube
  9267. Iridas
  9268. @item csp
  9269. cineSpace
  9270. @end table
  9271. @item interp
  9272. Select interpolation mode.
  9273. Available values are:
  9274. @table @samp
  9275. @item nearest
  9276. Use values from the nearest defined point.
  9277. @item linear
  9278. Interpolate values using the linear interpolation.
  9279. @item cosine
  9280. Interpolate values using the cosine interpolation.
  9281. @item cubic
  9282. Interpolate values using the cubic interpolation.
  9283. @item spline
  9284. Interpolate values using the spline interpolation.
  9285. @end table
  9286. @end table
  9287. @anchor{lut3d}
  9288. @section lut3d
  9289. Apply a 3D LUT to an input video.
  9290. The filter accepts the following options:
  9291. @table @option
  9292. @item file
  9293. Set the 3D LUT file name.
  9294. Currently supported formats:
  9295. @table @samp
  9296. @item 3dl
  9297. AfterEffects
  9298. @item cube
  9299. Iridas
  9300. @item dat
  9301. DaVinci
  9302. @item m3d
  9303. Pandora
  9304. @item csp
  9305. cineSpace
  9306. @end table
  9307. @item interp
  9308. Select interpolation mode.
  9309. Available values are:
  9310. @table @samp
  9311. @item nearest
  9312. Use values from the nearest defined point.
  9313. @item trilinear
  9314. Interpolate values using the 8 points defining a cube.
  9315. @item tetrahedral
  9316. Interpolate values using a tetrahedron.
  9317. @end table
  9318. @end table
  9319. @section lumakey
  9320. Turn certain luma values into transparency.
  9321. The filter accepts the following options:
  9322. @table @option
  9323. @item threshold
  9324. Set the luma which will be used as base for transparency.
  9325. Default value is @code{0}.
  9326. @item tolerance
  9327. Set the range of luma values to be keyed out.
  9328. Default value is @code{0}.
  9329. @item softness
  9330. Set the range of softness. Default value is @code{0}.
  9331. Use this to control gradual transition from zero to full transparency.
  9332. @end table
  9333. @section lut, lutrgb, lutyuv
  9334. Compute a look-up table for binding each pixel component input value
  9335. to an output value, and apply it to the input video.
  9336. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9337. to an RGB input video.
  9338. These filters accept the following parameters:
  9339. @table @option
  9340. @item c0
  9341. set first pixel component expression
  9342. @item c1
  9343. set second pixel component expression
  9344. @item c2
  9345. set third pixel component expression
  9346. @item c3
  9347. set fourth pixel component expression, corresponds to the alpha component
  9348. @item r
  9349. set red component expression
  9350. @item g
  9351. set green component expression
  9352. @item b
  9353. set blue component expression
  9354. @item a
  9355. alpha component expression
  9356. @item y
  9357. set Y/luminance component expression
  9358. @item u
  9359. set U/Cb component expression
  9360. @item v
  9361. set V/Cr component expression
  9362. @end table
  9363. Each of them specifies the expression to use for computing the lookup table for
  9364. the corresponding pixel component values.
  9365. The exact component associated to each of the @var{c*} options depends on the
  9366. format in input.
  9367. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9368. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9369. The expressions can contain the following constants and functions:
  9370. @table @option
  9371. @item w
  9372. @item h
  9373. The input width and height.
  9374. @item val
  9375. The input value for the pixel component.
  9376. @item clipval
  9377. The input value, clipped to the @var{minval}-@var{maxval} range.
  9378. @item maxval
  9379. The maximum value for the pixel component.
  9380. @item minval
  9381. The minimum value for the pixel component.
  9382. @item negval
  9383. The negated value for the pixel component value, clipped to the
  9384. @var{minval}-@var{maxval} range; it corresponds to the expression
  9385. "maxval-clipval+minval".
  9386. @item clip(val)
  9387. The computed value in @var{val}, clipped to the
  9388. @var{minval}-@var{maxval} range.
  9389. @item gammaval(gamma)
  9390. The computed gamma correction value of the pixel component value,
  9391. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9392. expression
  9393. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9394. @end table
  9395. All expressions default to "val".
  9396. @subsection Examples
  9397. @itemize
  9398. @item
  9399. Negate input video:
  9400. @example
  9401. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9402. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9403. @end example
  9404. The above is the same as:
  9405. @example
  9406. lutrgb="r=negval:g=negval:b=negval"
  9407. lutyuv="y=negval:u=negval:v=negval"
  9408. @end example
  9409. @item
  9410. Negate luminance:
  9411. @example
  9412. lutyuv=y=negval
  9413. @end example
  9414. @item
  9415. Remove chroma components, turning the video into a graytone image:
  9416. @example
  9417. lutyuv="u=128:v=128"
  9418. @end example
  9419. @item
  9420. Apply a luma burning effect:
  9421. @example
  9422. lutyuv="y=2*val"
  9423. @end example
  9424. @item
  9425. Remove green and blue components:
  9426. @example
  9427. lutrgb="g=0:b=0"
  9428. @end example
  9429. @item
  9430. Set a constant alpha channel value on input:
  9431. @example
  9432. format=rgba,lutrgb=a="maxval-minval/2"
  9433. @end example
  9434. @item
  9435. Correct luminance gamma by a factor of 0.5:
  9436. @example
  9437. lutyuv=y=gammaval(0.5)
  9438. @end example
  9439. @item
  9440. Discard least significant bits of luma:
  9441. @example
  9442. lutyuv=y='bitand(val, 128+64+32)'
  9443. @end example
  9444. @item
  9445. Technicolor like effect:
  9446. @example
  9447. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9448. @end example
  9449. @end itemize
  9450. @section lut2, tlut2
  9451. The @code{lut2} filter takes two input streams and outputs one
  9452. stream.
  9453. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9454. from one single stream.
  9455. This filter accepts the following parameters:
  9456. @table @option
  9457. @item c0
  9458. set first pixel component expression
  9459. @item c1
  9460. set second pixel component expression
  9461. @item c2
  9462. set third pixel component expression
  9463. @item c3
  9464. set fourth pixel component expression, corresponds to the alpha component
  9465. @item d
  9466. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9467. which means bit depth is automatically picked from first input format.
  9468. @end table
  9469. Each of them specifies the expression to use for computing the lookup table for
  9470. the corresponding pixel component values.
  9471. The exact component associated to each of the @var{c*} options depends on the
  9472. format in inputs.
  9473. The expressions can contain the following constants:
  9474. @table @option
  9475. @item w
  9476. @item h
  9477. The input width and height.
  9478. @item x
  9479. The first input value for the pixel component.
  9480. @item y
  9481. The second input value for the pixel component.
  9482. @item bdx
  9483. The first input video bit depth.
  9484. @item bdy
  9485. The second input video bit depth.
  9486. @end table
  9487. All expressions default to "x".
  9488. @subsection Examples
  9489. @itemize
  9490. @item
  9491. Highlight differences between two RGB video streams:
  9492. @example
  9493. 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)'
  9494. @end example
  9495. @item
  9496. Highlight differences between two YUV video streams:
  9497. @example
  9498. 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)'
  9499. @end example
  9500. @item
  9501. Show max difference between two video streams:
  9502. @example
  9503. 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)))'
  9504. @end example
  9505. @end itemize
  9506. @section maskedclamp
  9507. Clamp the first input stream with the second input and third input stream.
  9508. Returns the value of first stream to be between second input
  9509. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9510. This filter accepts the following options:
  9511. @table @option
  9512. @item undershoot
  9513. Default value is @code{0}.
  9514. @item overshoot
  9515. Default value is @code{0}.
  9516. @item planes
  9517. Set which planes will be processed as bitmap, unprocessed planes will be
  9518. copied from first stream.
  9519. By default value 0xf, all planes will be processed.
  9520. @end table
  9521. @section maskedmerge
  9522. Merge the first input stream with the second input stream using per pixel
  9523. weights in the third input stream.
  9524. A value of 0 in the third stream pixel component means that pixel component
  9525. from first stream is returned unchanged, while maximum value (eg. 255 for
  9526. 8-bit videos) means that pixel component from second stream is returned
  9527. unchanged. Intermediate values define the amount of merging between both
  9528. input stream's pixel components.
  9529. This filter accepts the following options:
  9530. @table @option
  9531. @item planes
  9532. Set which planes will be processed as bitmap, unprocessed planes will be
  9533. copied from first stream.
  9534. By default value 0xf, all planes will be processed.
  9535. @end table
  9536. @section maskfun
  9537. Create mask from input video.
  9538. For example it is useful to create motion masks after @code{tblend} filter.
  9539. This filter accepts the following options:
  9540. @table @option
  9541. @item low
  9542. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9543. @item high
  9544. Set high threshold. Any pixel component higher than this value will be set to max value
  9545. allowed for current pixel format.
  9546. @item planes
  9547. Set planes to filter, by default all available planes are filtered.
  9548. @item fill
  9549. Fill all frame pixels with this value.
  9550. @item sum
  9551. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9552. average, output frame will be completely filled with value set by @var{fill} option.
  9553. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9554. @end table
  9555. @section mcdeint
  9556. Apply motion-compensation deinterlacing.
  9557. It needs one field per frame as input and must thus be used together
  9558. with yadif=1/3 or equivalent.
  9559. This filter accepts the following options:
  9560. @table @option
  9561. @item mode
  9562. Set the deinterlacing mode.
  9563. It accepts one of the following values:
  9564. @table @samp
  9565. @item fast
  9566. @item medium
  9567. @item slow
  9568. use iterative motion estimation
  9569. @item extra_slow
  9570. like @samp{slow}, but use multiple reference frames.
  9571. @end table
  9572. Default value is @samp{fast}.
  9573. @item parity
  9574. Set the picture field parity assumed for the input video. It must be
  9575. one of the following values:
  9576. @table @samp
  9577. @item 0, tff
  9578. assume top field first
  9579. @item 1, bff
  9580. assume bottom field first
  9581. @end table
  9582. Default value is @samp{bff}.
  9583. @item qp
  9584. Set per-block quantization parameter (QP) used by the internal
  9585. encoder.
  9586. Higher values should result in a smoother motion vector field but less
  9587. optimal individual vectors. Default value is 1.
  9588. @end table
  9589. @section mergeplanes
  9590. Merge color channel components from several video streams.
  9591. The filter accepts up to 4 input streams, and merge selected input
  9592. planes to the output video.
  9593. This filter accepts the following options:
  9594. @table @option
  9595. @item mapping
  9596. Set input to output plane mapping. Default is @code{0}.
  9597. The mappings is specified as a bitmap. It should be specified as a
  9598. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9599. mapping for the first plane of the output stream. 'A' sets the number of
  9600. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9601. corresponding input to use (from 0 to 3). The rest of the mappings is
  9602. similar, 'Bb' describes the mapping for the output stream second
  9603. plane, 'Cc' describes the mapping for the output stream third plane and
  9604. 'Dd' describes the mapping for the output stream fourth plane.
  9605. @item format
  9606. Set output pixel format. Default is @code{yuva444p}.
  9607. @end table
  9608. @subsection Examples
  9609. @itemize
  9610. @item
  9611. Merge three gray video streams of same width and height into single video stream:
  9612. @example
  9613. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9614. @end example
  9615. @item
  9616. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9617. @example
  9618. [a0][a1]mergeplanes=0x00010210:yuva444p
  9619. @end example
  9620. @item
  9621. Swap Y and A plane in yuva444p stream:
  9622. @example
  9623. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9624. @end example
  9625. @item
  9626. Swap U and V plane in yuv420p stream:
  9627. @example
  9628. format=yuv420p,mergeplanes=0x000201:yuv420p
  9629. @end example
  9630. @item
  9631. Cast a rgb24 clip to yuv444p:
  9632. @example
  9633. format=rgb24,mergeplanes=0x000102:yuv444p
  9634. @end example
  9635. @end itemize
  9636. @section mestimate
  9637. Estimate and export motion vectors using block matching algorithms.
  9638. Motion vectors are stored in frame side data to be used by other filters.
  9639. This filter accepts the following options:
  9640. @table @option
  9641. @item method
  9642. Specify the motion estimation method. Accepts one of the following values:
  9643. @table @samp
  9644. @item esa
  9645. Exhaustive search algorithm.
  9646. @item tss
  9647. Three step search algorithm.
  9648. @item tdls
  9649. Two dimensional logarithmic search algorithm.
  9650. @item ntss
  9651. New three step search algorithm.
  9652. @item fss
  9653. Four step search algorithm.
  9654. @item ds
  9655. Diamond search algorithm.
  9656. @item hexbs
  9657. Hexagon-based search algorithm.
  9658. @item epzs
  9659. Enhanced predictive zonal search algorithm.
  9660. @item umh
  9661. Uneven multi-hexagon search algorithm.
  9662. @end table
  9663. Default value is @samp{esa}.
  9664. @item mb_size
  9665. Macroblock size. Default @code{16}.
  9666. @item search_param
  9667. Search parameter. Default @code{7}.
  9668. @end table
  9669. @section midequalizer
  9670. Apply Midway Image Equalization effect using two video streams.
  9671. Midway Image Equalization adjusts a pair of images to have the same
  9672. histogram, while maintaining their dynamics as much as possible. It's
  9673. useful for e.g. matching exposures from a pair of stereo cameras.
  9674. This filter has two inputs and one output, which must be of same pixel format, but
  9675. may be of different sizes. The output of filter is first input adjusted with
  9676. midway histogram of both inputs.
  9677. This filter accepts the following option:
  9678. @table @option
  9679. @item planes
  9680. Set which planes to process. Default is @code{15}, which is all available planes.
  9681. @end table
  9682. @section minterpolate
  9683. Convert the video to specified frame rate using motion interpolation.
  9684. This filter accepts the following options:
  9685. @table @option
  9686. @item fps
  9687. 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}.
  9688. @item mi_mode
  9689. Motion interpolation mode. Following values are accepted:
  9690. @table @samp
  9691. @item dup
  9692. Duplicate previous or next frame for interpolating new ones.
  9693. @item blend
  9694. Blend source frames. Interpolated frame is mean of previous and next frames.
  9695. @item mci
  9696. Motion compensated interpolation. Following options are effective when this mode is selected:
  9697. @table @samp
  9698. @item mc_mode
  9699. Motion compensation mode. Following values are accepted:
  9700. @table @samp
  9701. @item obmc
  9702. Overlapped block motion compensation.
  9703. @item aobmc
  9704. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9705. @end table
  9706. Default mode is @samp{obmc}.
  9707. @item me_mode
  9708. Motion estimation mode. Following values are accepted:
  9709. @table @samp
  9710. @item bidir
  9711. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9712. @item bilat
  9713. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9714. @end table
  9715. Default mode is @samp{bilat}.
  9716. @item me
  9717. The algorithm to be used for motion estimation. Following values are accepted:
  9718. @table @samp
  9719. @item esa
  9720. Exhaustive search algorithm.
  9721. @item tss
  9722. Three step search algorithm.
  9723. @item tdls
  9724. Two dimensional logarithmic search algorithm.
  9725. @item ntss
  9726. New three step search algorithm.
  9727. @item fss
  9728. Four step search algorithm.
  9729. @item ds
  9730. Diamond search algorithm.
  9731. @item hexbs
  9732. Hexagon-based search algorithm.
  9733. @item epzs
  9734. Enhanced predictive zonal search algorithm.
  9735. @item umh
  9736. Uneven multi-hexagon search algorithm.
  9737. @end table
  9738. Default algorithm is @samp{epzs}.
  9739. @item mb_size
  9740. Macroblock size. Default @code{16}.
  9741. @item search_param
  9742. Motion estimation search parameter. Default @code{32}.
  9743. @item vsbmc
  9744. 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).
  9745. @end table
  9746. @end table
  9747. @item scd
  9748. 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:
  9749. @table @samp
  9750. @item none
  9751. Disable scene change detection.
  9752. @item fdiff
  9753. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9754. @end table
  9755. Default method is @samp{fdiff}.
  9756. @item scd_threshold
  9757. Scene change detection threshold. Default is @code{5.0}.
  9758. @end table
  9759. @section mix
  9760. Mix several video input streams into one video stream.
  9761. A description of the accepted options follows.
  9762. @table @option
  9763. @item nb_inputs
  9764. The number of inputs. If unspecified, it defaults to 2.
  9765. @item weights
  9766. Specify weight of each input video stream as sequence.
  9767. Each weight is separated by space. If number of weights
  9768. is smaller than number of @var{frames} last specified
  9769. weight will be used for all remaining unset weights.
  9770. @item scale
  9771. Specify scale, if it is set it will be multiplied with sum
  9772. of each weight multiplied with pixel values to give final destination
  9773. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9774. @item duration
  9775. Specify how end of stream is determined.
  9776. @table @samp
  9777. @item longest
  9778. The duration of the longest input. (default)
  9779. @item shortest
  9780. The duration of the shortest input.
  9781. @item first
  9782. The duration of the first input.
  9783. @end table
  9784. @end table
  9785. @section mpdecimate
  9786. Drop frames that do not differ greatly from the previous frame in
  9787. order to reduce frame rate.
  9788. The main use of this filter is for very-low-bitrate encoding
  9789. (e.g. streaming over dialup modem), but it could in theory be used for
  9790. fixing movies that were inverse-telecined incorrectly.
  9791. A description of the accepted options follows.
  9792. @table @option
  9793. @item max
  9794. Set the maximum number of consecutive frames which can be dropped (if
  9795. positive), or the minimum interval between dropped frames (if
  9796. negative). If the value is 0, the frame is dropped disregarding the
  9797. number of previous sequentially dropped frames.
  9798. Default value is 0.
  9799. @item hi
  9800. @item lo
  9801. @item frac
  9802. Set the dropping threshold values.
  9803. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9804. represent actual pixel value differences, so a threshold of 64
  9805. corresponds to 1 unit of difference for each pixel, or the same spread
  9806. out differently over the block.
  9807. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9808. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9809. meaning the whole image) differ by more than a threshold of @option{lo}.
  9810. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9811. 64*5, and default value for @option{frac} is 0.33.
  9812. @end table
  9813. @section negate
  9814. Negate (invert) the input video.
  9815. It accepts the following option:
  9816. @table @option
  9817. @item negate_alpha
  9818. With value 1, it negates the alpha component, if present. Default value is 0.
  9819. @end table
  9820. @anchor{nlmeans}
  9821. @section nlmeans
  9822. Denoise frames using Non-Local Means algorithm.
  9823. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9824. context similarity is defined by comparing their surrounding patches of size
  9825. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9826. around the pixel.
  9827. Note that the research area defines centers for patches, which means some
  9828. patches will be made of pixels outside that research area.
  9829. The filter accepts the following options.
  9830. @table @option
  9831. @item s
  9832. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9833. @item p
  9834. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9835. @item pc
  9836. Same as @option{p} but for chroma planes.
  9837. The default value is @var{0} and means automatic.
  9838. @item r
  9839. Set research size. Default is 15. Must be odd number in range [0, 99].
  9840. @item rc
  9841. Same as @option{r} but for chroma planes.
  9842. The default value is @var{0} and means automatic.
  9843. @end table
  9844. @section nnedi
  9845. Deinterlace video using neural network edge directed interpolation.
  9846. This filter accepts the following options:
  9847. @table @option
  9848. @item weights
  9849. Mandatory option, without binary file filter can not work.
  9850. Currently file can be found here:
  9851. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9852. @item deint
  9853. Set which frames to deinterlace, by default it is @code{all}.
  9854. Can be @code{all} or @code{interlaced}.
  9855. @item field
  9856. Set mode of operation.
  9857. Can be one of the following:
  9858. @table @samp
  9859. @item af
  9860. Use frame flags, both fields.
  9861. @item a
  9862. Use frame flags, single field.
  9863. @item t
  9864. Use top field only.
  9865. @item b
  9866. Use bottom field only.
  9867. @item tf
  9868. Use both fields, top first.
  9869. @item bf
  9870. Use both fields, bottom first.
  9871. @end table
  9872. @item planes
  9873. Set which planes to process, by default filter process all frames.
  9874. @item nsize
  9875. Set size of local neighborhood around each pixel, used by the predictor neural
  9876. network.
  9877. Can be one of the following:
  9878. @table @samp
  9879. @item s8x6
  9880. @item s16x6
  9881. @item s32x6
  9882. @item s48x6
  9883. @item s8x4
  9884. @item s16x4
  9885. @item s32x4
  9886. @end table
  9887. @item nns
  9888. Set the number of neurons in predictor neural network.
  9889. Can be one of the following:
  9890. @table @samp
  9891. @item n16
  9892. @item n32
  9893. @item n64
  9894. @item n128
  9895. @item n256
  9896. @end table
  9897. @item qual
  9898. Controls the number of different neural network predictions that are blended
  9899. together to compute the final output value. Can be @code{fast}, default or
  9900. @code{slow}.
  9901. @item etype
  9902. Set which set of weights to use in the predictor.
  9903. Can be one of the following:
  9904. @table @samp
  9905. @item a
  9906. weights trained to minimize absolute error
  9907. @item s
  9908. weights trained to minimize squared error
  9909. @end table
  9910. @item pscrn
  9911. Controls whether or not the prescreener neural network is used to decide
  9912. which pixels should be processed by the predictor neural network and which
  9913. can be handled by simple cubic interpolation.
  9914. The prescreener is trained to know whether cubic interpolation will be
  9915. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9916. The computational complexity of the prescreener nn is much less than that of
  9917. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9918. using the prescreener generally results in much faster processing.
  9919. The prescreener is pretty accurate, so the difference between using it and not
  9920. using it is almost always unnoticeable.
  9921. Can be one of the following:
  9922. @table @samp
  9923. @item none
  9924. @item original
  9925. @item new
  9926. @end table
  9927. Default is @code{new}.
  9928. @item fapprox
  9929. Set various debugging flags.
  9930. @end table
  9931. @section noformat
  9932. Force libavfilter not to use any of the specified pixel formats for the
  9933. input to the next filter.
  9934. It accepts the following parameters:
  9935. @table @option
  9936. @item pix_fmts
  9937. A '|'-separated list of pixel format names, such as
  9938. pix_fmts=yuv420p|monow|rgb24".
  9939. @end table
  9940. @subsection Examples
  9941. @itemize
  9942. @item
  9943. Force libavfilter to use a format different from @var{yuv420p} for the
  9944. input to the vflip filter:
  9945. @example
  9946. noformat=pix_fmts=yuv420p,vflip
  9947. @end example
  9948. @item
  9949. Convert the input video to any of the formats not contained in the list:
  9950. @example
  9951. noformat=yuv420p|yuv444p|yuv410p
  9952. @end example
  9953. @end itemize
  9954. @section noise
  9955. Add noise on video input frame.
  9956. The filter accepts the following options:
  9957. @table @option
  9958. @item all_seed
  9959. @item c0_seed
  9960. @item c1_seed
  9961. @item c2_seed
  9962. @item c3_seed
  9963. Set noise seed for specific pixel component or all pixel components in case
  9964. of @var{all_seed}. Default value is @code{123457}.
  9965. @item all_strength, alls
  9966. @item c0_strength, c0s
  9967. @item c1_strength, c1s
  9968. @item c2_strength, c2s
  9969. @item c3_strength, c3s
  9970. Set noise strength for specific pixel component or all pixel components in case
  9971. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9972. @item all_flags, allf
  9973. @item c0_flags, c0f
  9974. @item c1_flags, c1f
  9975. @item c2_flags, c2f
  9976. @item c3_flags, c3f
  9977. Set pixel component flags or set flags for all components if @var{all_flags}.
  9978. Available values for component flags are:
  9979. @table @samp
  9980. @item a
  9981. averaged temporal noise (smoother)
  9982. @item p
  9983. mix random noise with a (semi)regular pattern
  9984. @item t
  9985. temporal noise (noise pattern changes between frames)
  9986. @item u
  9987. uniform noise (gaussian otherwise)
  9988. @end table
  9989. @end table
  9990. @subsection Examples
  9991. Add temporal and uniform noise to input video:
  9992. @example
  9993. noise=alls=20:allf=t+u
  9994. @end example
  9995. @section normalize
  9996. Normalize RGB video (aka histogram stretching, contrast stretching).
  9997. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9998. For each channel of each frame, the filter computes the input range and maps
  9999. it linearly to the user-specified output range. The output range defaults
  10000. to the full dynamic range from pure black to pure white.
  10001. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10002. changes in brightness) caused when small dark or bright objects enter or leave
  10003. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10004. video camera, and, like a video camera, it may cause a period of over- or
  10005. under-exposure of the video.
  10006. The R,G,B channels can be normalized independently, which may cause some
  10007. color shifting, or linked together as a single channel, which prevents
  10008. color shifting. Linked normalization preserves hue. Independent normalization
  10009. does not, so it can be used to remove some color casts. Independent and linked
  10010. normalization can be combined in any ratio.
  10011. The normalize filter accepts the following options:
  10012. @table @option
  10013. @item blackpt
  10014. @item whitept
  10015. Colors which define the output range. The minimum input value is mapped to
  10016. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10017. The defaults are black and white respectively. Specifying white for
  10018. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10019. normalized video. Shades of grey can be used to reduce the dynamic range
  10020. (contrast). Specifying saturated colors here can create some interesting
  10021. effects.
  10022. @item smoothing
  10023. The number of previous frames to use for temporal smoothing. The input range
  10024. of each channel is smoothed using a rolling average over the current frame
  10025. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10026. smoothing).
  10027. @item independence
  10028. Controls the ratio of independent (color shifting) channel normalization to
  10029. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10030. independent. Defaults to 1.0 (fully independent).
  10031. @item strength
  10032. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10033. expensive no-op. Defaults to 1.0 (full strength).
  10034. @end table
  10035. @subsection Examples
  10036. Stretch video contrast to use the full dynamic range, with no temporal
  10037. smoothing; may flicker depending on the source content:
  10038. @example
  10039. normalize=blackpt=black:whitept=white:smoothing=0
  10040. @end example
  10041. As above, but with 50 frames of temporal smoothing; flicker should be
  10042. reduced, depending on the source content:
  10043. @example
  10044. normalize=blackpt=black:whitept=white:smoothing=50
  10045. @end example
  10046. As above, but with hue-preserving linked channel normalization:
  10047. @example
  10048. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10049. @end example
  10050. As above, but with half strength:
  10051. @example
  10052. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10053. @end example
  10054. Map the darkest input color to red, the brightest input color to cyan:
  10055. @example
  10056. normalize=blackpt=red:whitept=cyan
  10057. @end example
  10058. @section null
  10059. Pass the video source unchanged to the output.
  10060. @section ocr
  10061. Optical Character Recognition
  10062. This filter uses Tesseract for optical character recognition. To enable
  10063. compilation of this filter, you need to configure FFmpeg with
  10064. @code{--enable-libtesseract}.
  10065. It accepts the following options:
  10066. @table @option
  10067. @item datapath
  10068. Set datapath to tesseract data. Default is to use whatever was
  10069. set at installation.
  10070. @item language
  10071. Set language, default is "eng".
  10072. @item whitelist
  10073. Set character whitelist.
  10074. @item blacklist
  10075. Set character blacklist.
  10076. @end table
  10077. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10078. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10079. @section ocv
  10080. Apply a video transform using libopencv.
  10081. To enable this filter, install the libopencv library and headers and
  10082. configure FFmpeg with @code{--enable-libopencv}.
  10083. It accepts the following parameters:
  10084. @table @option
  10085. @item filter_name
  10086. The name of the libopencv filter to apply.
  10087. @item filter_params
  10088. The parameters to pass to the libopencv filter. If not specified, the default
  10089. values are assumed.
  10090. @end table
  10091. Refer to the official libopencv documentation for more precise
  10092. information:
  10093. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10094. Several libopencv filters are supported; see the following subsections.
  10095. @anchor{dilate}
  10096. @subsection dilate
  10097. Dilate an image by using a specific structuring element.
  10098. It corresponds to the libopencv function @code{cvDilate}.
  10099. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10100. @var{struct_el} represents a structuring element, and has the syntax:
  10101. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10102. @var{cols} and @var{rows} represent the number of columns and rows of
  10103. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10104. point, and @var{shape} the shape for the structuring element. @var{shape}
  10105. must be "rect", "cross", "ellipse", or "custom".
  10106. If the value for @var{shape} is "custom", it must be followed by a
  10107. string of the form "=@var{filename}". The file with name
  10108. @var{filename} is assumed to represent a binary image, with each
  10109. printable character corresponding to a bright pixel. When a custom
  10110. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10111. or columns and rows of the read file are assumed instead.
  10112. The default value for @var{struct_el} is "3x3+0x0/rect".
  10113. @var{nb_iterations} specifies the number of times the transform is
  10114. applied to the image, and defaults to 1.
  10115. Some examples:
  10116. @example
  10117. # Use the default values
  10118. ocv=dilate
  10119. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10120. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10121. # Read the shape from the file diamond.shape, iterating two times.
  10122. # The file diamond.shape may contain a pattern of characters like this
  10123. # *
  10124. # ***
  10125. # *****
  10126. # ***
  10127. # *
  10128. # The specified columns and rows are ignored
  10129. # but the anchor point coordinates are not
  10130. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10131. @end example
  10132. @subsection erode
  10133. Erode an image by using a specific structuring element.
  10134. It corresponds to the libopencv function @code{cvErode}.
  10135. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10136. with the same syntax and semantics as the @ref{dilate} filter.
  10137. @subsection smooth
  10138. Smooth the input video.
  10139. The filter takes the following parameters:
  10140. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10141. @var{type} is the type of smooth filter to apply, and must be one of
  10142. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10143. or "bilateral". The default value is "gaussian".
  10144. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10145. depend on the smooth type. @var{param1} and
  10146. @var{param2} accept integer positive values or 0. @var{param3} and
  10147. @var{param4} accept floating point values.
  10148. The default value for @var{param1} is 3. The default value for the
  10149. other parameters is 0.
  10150. These parameters correspond to the parameters assigned to the
  10151. libopencv function @code{cvSmooth}.
  10152. @section oscilloscope
  10153. 2D Video Oscilloscope.
  10154. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10155. It accepts the following parameters:
  10156. @table @option
  10157. @item x
  10158. Set scope center x position.
  10159. @item y
  10160. Set scope center y position.
  10161. @item s
  10162. Set scope size, relative to frame diagonal.
  10163. @item t
  10164. Set scope tilt/rotation.
  10165. @item o
  10166. Set trace opacity.
  10167. @item tx
  10168. Set trace center x position.
  10169. @item ty
  10170. Set trace center y position.
  10171. @item tw
  10172. Set trace width, relative to width of frame.
  10173. @item th
  10174. Set trace height, relative to height of frame.
  10175. @item c
  10176. Set which components to trace. By default it traces first three components.
  10177. @item g
  10178. Draw trace grid. By default is enabled.
  10179. @item st
  10180. Draw some statistics. By default is enabled.
  10181. @item sc
  10182. Draw scope. By default is enabled.
  10183. @end table
  10184. @subsection Examples
  10185. @itemize
  10186. @item
  10187. Inspect full first row of video frame.
  10188. @example
  10189. oscilloscope=x=0.5:y=0:s=1
  10190. @end example
  10191. @item
  10192. Inspect full last row of video frame.
  10193. @example
  10194. oscilloscope=x=0.5:y=1:s=1
  10195. @end example
  10196. @item
  10197. Inspect full 5th line of video frame of height 1080.
  10198. @example
  10199. oscilloscope=x=0.5:y=5/1080:s=1
  10200. @end example
  10201. @item
  10202. Inspect full last column of video frame.
  10203. @example
  10204. oscilloscope=x=1:y=0.5:s=1:t=1
  10205. @end example
  10206. @end itemize
  10207. @anchor{overlay}
  10208. @section overlay
  10209. Overlay one video on top of another.
  10210. It takes two inputs and has one output. The first input is the "main"
  10211. video on which the second input is overlaid.
  10212. It accepts the following parameters:
  10213. A description of the accepted options follows.
  10214. @table @option
  10215. @item x
  10216. @item y
  10217. Set the expression for the x and y coordinates of the overlaid video
  10218. on the main video. Default value is "0" for both expressions. In case
  10219. the expression is invalid, it is set to a huge value (meaning that the
  10220. overlay will not be displayed within the output visible area).
  10221. @item eof_action
  10222. See @ref{framesync}.
  10223. @item eval
  10224. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10225. It accepts the following values:
  10226. @table @samp
  10227. @item init
  10228. only evaluate expressions once during the filter initialization or
  10229. when a command is processed
  10230. @item frame
  10231. evaluate expressions for each incoming frame
  10232. @end table
  10233. Default value is @samp{frame}.
  10234. @item shortest
  10235. See @ref{framesync}.
  10236. @item format
  10237. Set the format for the output video.
  10238. It accepts the following values:
  10239. @table @samp
  10240. @item yuv420
  10241. force YUV420 output
  10242. @item yuv422
  10243. force YUV422 output
  10244. @item yuv444
  10245. force YUV444 output
  10246. @item rgb
  10247. force packed RGB output
  10248. @item gbrp
  10249. force planar RGB output
  10250. @item auto
  10251. automatically pick format
  10252. @end table
  10253. Default value is @samp{yuv420}.
  10254. @item repeatlast
  10255. See @ref{framesync}.
  10256. @item alpha
  10257. Set format of alpha of the overlaid video, it can be @var{straight} or
  10258. @var{premultiplied}. Default is @var{straight}.
  10259. @end table
  10260. The @option{x}, and @option{y} expressions can contain the following
  10261. parameters.
  10262. @table @option
  10263. @item main_w, W
  10264. @item main_h, H
  10265. The main input width and height.
  10266. @item overlay_w, w
  10267. @item overlay_h, h
  10268. The overlay input width and height.
  10269. @item x
  10270. @item y
  10271. The computed values for @var{x} and @var{y}. They are evaluated for
  10272. each new frame.
  10273. @item hsub
  10274. @item vsub
  10275. horizontal and vertical chroma subsample values of the output
  10276. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10277. @var{vsub} is 1.
  10278. @item n
  10279. the number of input frame, starting from 0
  10280. @item pos
  10281. the position in the file of the input frame, NAN if unknown
  10282. @item t
  10283. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10284. @end table
  10285. This filter also supports the @ref{framesync} options.
  10286. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10287. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10288. when @option{eval} is set to @samp{init}.
  10289. Be aware that frames are taken from each input video in timestamp
  10290. order, hence, if their initial timestamps differ, it is a good idea
  10291. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10292. have them begin in the same zero timestamp, as the example for
  10293. the @var{movie} filter does.
  10294. You can chain together more overlays but you should test the
  10295. efficiency of such approach.
  10296. @subsection Commands
  10297. This filter supports the following commands:
  10298. @table @option
  10299. @item x
  10300. @item y
  10301. Modify the x and y of the overlay input.
  10302. The command accepts the same syntax of the corresponding option.
  10303. If the specified expression is not valid, it is kept at its current
  10304. value.
  10305. @end table
  10306. @subsection Examples
  10307. @itemize
  10308. @item
  10309. Draw the overlay at 10 pixels from the bottom right corner of the main
  10310. video:
  10311. @example
  10312. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10313. @end example
  10314. Using named options the example above becomes:
  10315. @example
  10316. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10317. @end example
  10318. @item
  10319. Insert a transparent PNG logo in the bottom left corner of the input,
  10320. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10321. @example
  10322. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10323. @end example
  10324. @item
  10325. Insert 2 different transparent PNG logos (second logo on bottom
  10326. right corner) using the @command{ffmpeg} tool:
  10327. @example
  10328. 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
  10329. @end example
  10330. @item
  10331. Add a transparent color layer on top of the main video; @code{WxH}
  10332. must specify the size of the main input to the overlay filter:
  10333. @example
  10334. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10335. @end example
  10336. @item
  10337. Play an original video and a filtered version (here with the deshake
  10338. filter) side by side using the @command{ffplay} tool:
  10339. @example
  10340. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10341. @end example
  10342. The above command is the same as:
  10343. @example
  10344. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10345. @end example
  10346. @item
  10347. Make a sliding overlay appearing from the left to the right top part of the
  10348. screen starting since time 2:
  10349. @example
  10350. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10351. @end example
  10352. @item
  10353. Compose output by putting two input videos side to side:
  10354. @example
  10355. ffmpeg -i left.avi -i right.avi -filter_complex "
  10356. nullsrc=size=200x100 [background];
  10357. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10358. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10359. [background][left] overlay=shortest=1 [background+left];
  10360. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10361. "
  10362. @end example
  10363. @item
  10364. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10365. @example
  10366. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10367. -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]'
  10368. masked.avi
  10369. @end example
  10370. @item
  10371. Chain several overlays in cascade:
  10372. @example
  10373. nullsrc=s=200x200 [bg];
  10374. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10375. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10376. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10377. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10378. [in3] null, [mid2] overlay=100:100 [out0]
  10379. @end example
  10380. @end itemize
  10381. @section owdenoise
  10382. Apply Overcomplete Wavelet denoiser.
  10383. The filter accepts the following options:
  10384. @table @option
  10385. @item depth
  10386. Set depth.
  10387. Larger depth values will denoise lower frequency components more, but
  10388. slow down filtering.
  10389. Must be an int in the range 8-16, default is @code{8}.
  10390. @item luma_strength, ls
  10391. Set luma strength.
  10392. Must be a double value in the range 0-1000, default is @code{1.0}.
  10393. @item chroma_strength, cs
  10394. Set chroma strength.
  10395. Must be a double value in the range 0-1000, default is @code{1.0}.
  10396. @end table
  10397. @anchor{pad}
  10398. @section pad
  10399. Add paddings to the input image, and place the original input at the
  10400. provided @var{x}, @var{y} coordinates.
  10401. It accepts the following parameters:
  10402. @table @option
  10403. @item width, w
  10404. @item height, h
  10405. Specify an expression for the size of the output image with the
  10406. paddings added. If the value for @var{width} or @var{height} is 0, the
  10407. corresponding input size is used for the output.
  10408. The @var{width} expression can reference the value set by the
  10409. @var{height} expression, and vice versa.
  10410. The default value of @var{width} and @var{height} is 0.
  10411. @item x
  10412. @item y
  10413. Specify the offsets to place the input image at within the padded area,
  10414. with respect to the top/left border of the output image.
  10415. The @var{x} expression can reference the value set by the @var{y}
  10416. expression, and vice versa.
  10417. The default value of @var{x} and @var{y} is 0.
  10418. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10419. so the input image is centered on the padded area.
  10420. @item color
  10421. Specify the color of the padded area. For the syntax of this option,
  10422. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10423. manual,ffmpeg-utils}.
  10424. The default value of @var{color} is "black".
  10425. @item eval
  10426. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10427. It accepts the following values:
  10428. @table @samp
  10429. @item init
  10430. Only evaluate expressions once during the filter initialization or when
  10431. a command is processed.
  10432. @item frame
  10433. Evaluate expressions for each incoming frame.
  10434. @end table
  10435. Default value is @samp{init}.
  10436. @item aspect
  10437. Pad to aspect instead to a resolution.
  10438. @end table
  10439. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10440. options are expressions containing the following constants:
  10441. @table @option
  10442. @item in_w
  10443. @item in_h
  10444. The input video width and height.
  10445. @item iw
  10446. @item ih
  10447. These are the same as @var{in_w} and @var{in_h}.
  10448. @item out_w
  10449. @item out_h
  10450. The output width and height (the size of the padded area), as
  10451. specified by the @var{width} and @var{height} expressions.
  10452. @item ow
  10453. @item oh
  10454. These are the same as @var{out_w} and @var{out_h}.
  10455. @item x
  10456. @item y
  10457. The x and y offsets as specified by the @var{x} and @var{y}
  10458. expressions, or NAN if not yet specified.
  10459. @item a
  10460. same as @var{iw} / @var{ih}
  10461. @item sar
  10462. input sample aspect ratio
  10463. @item dar
  10464. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10465. @item hsub
  10466. @item vsub
  10467. The horizontal and vertical chroma subsample values. For example for the
  10468. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10469. @end table
  10470. @subsection Examples
  10471. @itemize
  10472. @item
  10473. Add paddings with the color "violet" to the input video. The output video
  10474. size is 640x480, and the top-left corner of the input video is placed at
  10475. column 0, row 40
  10476. @example
  10477. pad=640:480:0:40:violet
  10478. @end example
  10479. The example above is equivalent to the following command:
  10480. @example
  10481. pad=width=640:height=480:x=0:y=40:color=violet
  10482. @end example
  10483. @item
  10484. Pad the input to get an output with dimensions increased by 3/2,
  10485. and put the input video at the center of the padded area:
  10486. @example
  10487. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10488. @end example
  10489. @item
  10490. Pad the input to get a squared output with size equal to the maximum
  10491. value between the input width and height, and put the input video at
  10492. the center of the padded area:
  10493. @example
  10494. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10495. @end example
  10496. @item
  10497. Pad the input to get a final w/h ratio of 16:9:
  10498. @example
  10499. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10500. @end example
  10501. @item
  10502. In case of anamorphic video, in order to set the output display aspect
  10503. correctly, it is necessary to use @var{sar} in the expression,
  10504. according to the relation:
  10505. @example
  10506. (ih * X / ih) * sar = output_dar
  10507. X = output_dar / sar
  10508. @end example
  10509. Thus the previous example needs to be modified to:
  10510. @example
  10511. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10512. @end example
  10513. @item
  10514. Double the output size and put the input video in the bottom-right
  10515. corner of the output padded area:
  10516. @example
  10517. pad="2*iw:2*ih:ow-iw:oh-ih"
  10518. @end example
  10519. @end itemize
  10520. @anchor{palettegen}
  10521. @section palettegen
  10522. Generate one palette for a whole video stream.
  10523. It accepts the following options:
  10524. @table @option
  10525. @item max_colors
  10526. Set the maximum number of colors to quantize in the palette.
  10527. Note: the palette will still contain 256 colors; the unused palette entries
  10528. will be black.
  10529. @item reserve_transparent
  10530. Create a palette of 255 colors maximum and reserve the last one for
  10531. transparency. Reserving the transparency color is useful for GIF optimization.
  10532. If not set, the maximum of colors in the palette will be 256. You probably want
  10533. to disable this option for a standalone image.
  10534. Set by default.
  10535. @item transparency_color
  10536. Set the color that will be used as background for transparency.
  10537. @item stats_mode
  10538. Set statistics mode.
  10539. It accepts the following values:
  10540. @table @samp
  10541. @item full
  10542. Compute full frame histograms.
  10543. @item diff
  10544. Compute histograms only for the part that differs from previous frame. This
  10545. might be relevant to give more importance to the moving part of your input if
  10546. the background is static.
  10547. @item single
  10548. Compute new histogram for each frame.
  10549. @end table
  10550. Default value is @var{full}.
  10551. @end table
  10552. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10553. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10554. color quantization of the palette. This information is also visible at
  10555. @var{info} logging level.
  10556. @subsection Examples
  10557. @itemize
  10558. @item
  10559. Generate a representative palette of a given video using @command{ffmpeg}:
  10560. @example
  10561. ffmpeg -i input.mkv -vf palettegen palette.png
  10562. @end example
  10563. @end itemize
  10564. @section paletteuse
  10565. Use a palette to downsample an input video stream.
  10566. The filter takes two inputs: one video stream and a palette. The palette must
  10567. be a 256 pixels image.
  10568. It accepts the following options:
  10569. @table @option
  10570. @item dither
  10571. Select dithering mode. Available algorithms are:
  10572. @table @samp
  10573. @item bayer
  10574. Ordered 8x8 bayer dithering (deterministic)
  10575. @item heckbert
  10576. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10577. Note: this dithering is sometimes considered "wrong" and is included as a
  10578. reference.
  10579. @item floyd_steinberg
  10580. Floyd and Steingberg dithering (error diffusion)
  10581. @item sierra2
  10582. Frankie Sierra dithering v2 (error diffusion)
  10583. @item sierra2_4a
  10584. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10585. @end table
  10586. Default is @var{sierra2_4a}.
  10587. @item bayer_scale
  10588. When @var{bayer} dithering is selected, this option defines the scale of the
  10589. pattern (how much the crosshatch pattern is visible). A low value means more
  10590. visible pattern for less banding, and higher value means less visible pattern
  10591. at the cost of more banding.
  10592. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10593. @item diff_mode
  10594. If set, define the zone to process
  10595. @table @samp
  10596. @item rectangle
  10597. Only the changing rectangle will be reprocessed. This is similar to GIF
  10598. cropping/offsetting compression mechanism. This option can be useful for speed
  10599. if only a part of the image is changing, and has use cases such as limiting the
  10600. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10601. moving scene (it leads to more deterministic output if the scene doesn't change
  10602. much, and as a result less moving noise and better GIF compression).
  10603. @end table
  10604. Default is @var{none}.
  10605. @item new
  10606. Take new palette for each output frame.
  10607. @item alpha_threshold
  10608. Sets the alpha threshold for transparency. Alpha values above this threshold
  10609. will be treated as completely opaque, and values below this threshold will be
  10610. treated as completely transparent.
  10611. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10612. @end table
  10613. @subsection Examples
  10614. @itemize
  10615. @item
  10616. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10617. using @command{ffmpeg}:
  10618. @example
  10619. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10620. @end example
  10621. @end itemize
  10622. @section perspective
  10623. Correct perspective of video not recorded perpendicular to the screen.
  10624. A description of the accepted parameters follows.
  10625. @table @option
  10626. @item x0
  10627. @item y0
  10628. @item x1
  10629. @item y1
  10630. @item x2
  10631. @item y2
  10632. @item x3
  10633. @item y3
  10634. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10635. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10636. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10637. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10638. then the corners of the source will be sent to the specified coordinates.
  10639. The expressions can use the following variables:
  10640. @table @option
  10641. @item W
  10642. @item H
  10643. the width and height of video frame.
  10644. @item in
  10645. Input frame count.
  10646. @item on
  10647. Output frame count.
  10648. @end table
  10649. @item interpolation
  10650. Set interpolation for perspective correction.
  10651. It accepts the following values:
  10652. @table @samp
  10653. @item linear
  10654. @item cubic
  10655. @end table
  10656. Default value is @samp{linear}.
  10657. @item sense
  10658. Set interpretation of coordinate options.
  10659. It accepts the following values:
  10660. @table @samp
  10661. @item 0, source
  10662. Send point in the source specified by the given coordinates to
  10663. the corners of the destination.
  10664. @item 1, destination
  10665. Send the corners of the source to the point in the destination specified
  10666. by the given coordinates.
  10667. Default value is @samp{source}.
  10668. @end table
  10669. @item eval
  10670. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10671. It accepts the following values:
  10672. @table @samp
  10673. @item init
  10674. only evaluate expressions once during the filter initialization or
  10675. when a command is processed
  10676. @item frame
  10677. evaluate expressions for each incoming frame
  10678. @end table
  10679. Default value is @samp{init}.
  10680. @end table
  10681. @section phase
  10682. Delay interlaced video by one field time so that the field order changes.
  10683. The intended use is to fix PAL movies that have been captured with the
  10684. opposite field order to the film-to-video transfer.
  10685. A description of the accepted parameters follows.
  10686. @table @option
  10687. @item mode
  10688. Set phase mode.
  10689. It accepts the following values:
  10690. @table @samp
  10691. @item t
  10692. Capture field order top-first, transfer bottom-first.
  10693. Filter will delay the bottom field.
  10694. @item b
  10695. Capture field order bottom-first, transfer top-first.
  10696. Filter will delay the top field.
  10697. @item p
  10698. Capture and transfer with the same field order. This mode only exists
  10699. for the documentation of the other options to refer to, but if you
  10700. actually select it, the filter will faithfully do nothing.
  10701. @item a
  10702. Capture field order determined automatically by field flags, transfer
  10703. opposite.
  10704. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10705. basis using field flags. If no field information is available,
  10706. then this works just like @samp{u}.
  10707. @item u
  10708. Capture unknown or varying, transfer opposite.
  10709. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10710. analyzing the images and selecting the alternative that produces best
  10711. match between the fields.
  10712. @item T
  10713. Capture top-first, transfer unknown or varying.
  10714. Filter selects among @samp{t} and @samp{p} using image analysis.
  10715. @item B
  10716. Capture bottom-first, transfer unknown or varying.
  10717. Filter selects among @samp{b} and @samp{p} using image analysis.
  10718. @item A
  10719. Capture determined by field flags, transfer unknown or varying.
  10720. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10721. image analysis. If no field information is available, then this works just
  10722. like @samp{U}. This is the default mode.
  10723. @item U
  10724. Both capture and transfer unknown or varying.
  10725. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10726. @end table
  10727. @end table
  10728. @section pixdesctest
  10729. Pixel format descriptor test filter, mainly useful for internal
  10730. testing. The output video should be equal to the input video.
  10731. For example:
  10732. @example
  10733. format=monow, pixdesctest
  10734. @end example
  10735. can be used to test the monowhite pixel format descriptor definition.
  10736. @section pixscope
  10737. Display sample values of color channels. Mainly useful for checking color
  10738. and levels. Minimum supported resolution is 640x480.
  10739. The filters accept the following options:
  10740. @table @option
  10741. @item x
  10742. Set scope X position, relative offset on X axis.
  10743. @item y
  10744. Set scope Y position, relative offset on Y axis.
  10745. @item w
  10746. Set scope width.
  10747. @item h
  10748. Set scope height.
  10749. @item o
  10750. Set window opacity. This window also holds statistics about pixel area.
  10751. @item wx
  10752. Set window X position, relative offset on X axis.
  10753. @item wy
  10754. Set window Y position, relative offset on Y axis.
  10755. @end table
  10756. @section pp
  10757. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10758. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10759. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10760. Each subfilter and some options have a short and a long name that can be used
  10761. interchangeably, i.e. dr/dering are the same.
  10762. The filters accept the following options:
  10763. @table @option
  10764. @item subfilters
  10765. Set postprocessing subfilters string.
  10766. @end table
  10767. All subfilters share common options to determine their scope:
  10768. @table @option
  10769. @item a/autoq
  10770. Honor the quality commands for this subfilter.
  10771. @item c/chrom
  10772. Do chrominance filtering, too (default).
  10773. @item y/nochrom
  10774. Do luminance filtering only (no chrominance).
  10775. @item n/noluma
  10776. Do chrominance filtering only (no luminance).
  10777. @end table
  10778. These options can be appended after the subfilter name, separated by a '|'.
  10779. Available subfilters are:
  10780. @table @option
  10781. @item hb/hdeblock[|difference[|flatness]]
  10782. Horizontal deblocking filter
  10783. @table @option
  10784. @item difference
  10785. Difference factor where higher values mean more deblocking (default: @code{32}).
  10786. @item flatness
  10787. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10788. @end table
  10789. @item vb/vdeblock[|difference[|flatness]]
  10790. Vertical deblocking filter
  10791. @table @option
  10792. @item difference
  10793. Difference factor where higher values mean more deblocking (default: @code{32}).
  10794. @item flatness
  10795. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10796. @end table
  10797. @item ha/hadeblock[|difference[|flatness]]
  10798. Accurate horizontal deblocking filter
  10799. @table @option
  10800. @item difference
  10801. Difference factor where higher values mean more deblocking (default: @code{32}).
  10802. @item flatness
  10803. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10804. @end table
  10805. @item va/vadeblock[|difference[|flatness]]
  10806. Accurate vertical deblocking filter
  10807. @table @option
  10808. @item difference
  10809. Difference factor where higher values mean more deblocking (default: @code{32}).
  10810. @item flatness
  10811. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10812. @end table
  10813. @end table
  10814. The horizontal and vertical deblocking filters share the difference and
  10815. flatness values so you cannot set different horizontal and vertical
  10816. thresholds.
  10817. @table @option
  10818. @item h1/x1hdeblock
  10819. Experimental horizontal deblocking filter
  10820. @item v1/x1vdeblock
  10821. Experimental vertical deblocking filter
  10822. @item dr/dering
  10823. Deringing filter
  10824. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10825. @table @option
  10826. @item threshold1
  10827. larger -> stronger filtering
  10828. @item threshold2
  10829. larger -> stronger filtering
  10830. @item threshold3
  10831. larger -> stronger filtering
  10832. @end table
  10833. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10834. @table @option
  10835. @item f/fullyrange
  10836. Stretch luminance to @code{0-255}.
  10837. @end table
  10838. @item lb/linblenddeint
  10839. Linear blend deinterlacing filter that deinterlaces the given block by
  10840. filtering all lines with a @code{(1 2 1)} filter.
  10841. @item li/linipoldeint
  10842. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10843. linearly interpolating every second line.
  10844. @item ci/cubicipoldeint
  10845. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10846. cubically interpolating every second line.
  10847. @item md/mediandeint
  10848. Median deinterlacing filter that deinterlaces the given block by applying a
  10849. median filter to every second line.
  10850. @item fd/ffmpegdeint
  10851. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10852. second line with a @code{(-1 4 2 4 -1)} filter.
  10853. @item l5/lowpass5
  10854. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10855. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10856. @item fq/forceQuant[|quantizer]
  10857. Overrides the quantizer table from the input with the constant quantizer you
  10858. specify.
  10859. @table @option
  10860. @item quantizer
  10861. Quantizer to use
  10862. @end table
  10863. @item de/default
  10864. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10865. @item fa/fast
  10866. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10867. @item ac
  10868. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10869. @end table
  10870. @subsection Examples
  10871. @itemize
  10872. @item
  10873. Apply horizontal and vertical deblocking, deringing and automatic
  10874. brightness/contrast:
  10875. @example
  10876. pp=hb/vb/dr/al
  10877. @end example
  10878. @item
  10879. Apply default filters without brightness/contrast correction:
  10880. @example
  10881. pp=de/-al
  10882. @end example
  10883. @item
  10884. Apply default filters and temporal denoiser:
  10885. @example
  10886. pp=default/tmpnoise|1|2|3
  10887. @end example
  10888. @item
  10889. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10890. automatically depending on available CPU time:
  10891. @example
  10892. pp=hb|y/vb|a
  10893. @end example
  10894. @end itemize
  10895. @section pp7
  10896. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10897. similar to spp = 6 with 7 point DCT, where only the center sample is
  10898. used after IDCT.
  10899. The filter accepts the following options:
  10900. @table @option
  10901. @item qp
  10902. Force a constant quantization parameter. It accepts an integer in range
  10903. 0 to 63. If not set, the filter will use the QP from the video stream
  10904. (if available).
  10905. @item mode
  10906. Set thresholding mode. Available modes are:
  10907. @table @samp
  10908. @item hard
  10909. Set hard thresholding.
  10910. @item soft
  10911. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10912. @item medium
  10913. Set medium thresholding (good results, default).
  10914. @end table
  10915. @end table
  10916. @section premultiply
  10917. Apply alpha premultiply effect to input video stream using first plane
  10918. of second stream as alpha.
  10919. Both streams must have same dimensions and same pixel format.
  10920. The filter accepts the following option:
  10921. @table @option
  10922. @item planes
  10923. Set which planes will be processed, unprocessed planes will be copied.
  10924. By default value 0xf, all planes will be processed.
  10925. @item inplace
  10926. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10927. @end table
  10928. @section prewitt
  10929. Apply prewitt operator to input video stream.
  10930. The filter accepts the following option:
  10931. @table @option
  10932. @item planes
  10933. Set which planes will be processed, unprocessed planes will be copied.
  10934. By default value 0xf, all planes will be processed.
  10935. @item scale
  10936. Set value which will be multiplied with filtered result.
  10937. @item delta
  10938. Set value which will be added to filtered result.
  10939. @end table
  10940. @anchor{program_opencl}
  10941. @section program_opencl
  10942. Filter video using an OpenCL program.
  10943. @table @option
  10944. @item source
  10945. OpenCL program source file.
  10946. @item kernel
  10947. Kernel name in program.
  10948. @item inputs
  10949. Number of inputs to the filter. Defaults to 1.
  10950. @item size, s
  10951. Size of output frames. Defaults to the same as the first input.
  10952. @end table
  10953. The program source file must contain a kernel function with the given name,
  10954. which will be run once for each plane of the output. Each run on a plane
  10955. gets enqueued as a separate 2D global NDRange with one work-item for each
  10956. pixel to be generated. The global ID offset for each work-item is therefore
  10957. the coordinates of a pixel in the destination image.
  10958. The kernel function needs to take the following arguments:
  10959. @itemize
  10960. @item
  10961. Destination image, @var{__write_only image2d_t}.
  10962. This image will become the output; the kernel should write all of it.
  10963. @item
  10964. Frame index, @var{unsigned int}.
  10965. This is a counter starting from zero and increasing by one for each frame.
  10966. @item
  10967. Source images, @var{__read_only image2d_t}.
  10968. These are the most recent images on each input. The kernel may read from
  10969. them to generate the output, but they can't be written to.
  10970. @end itemize
  10971. Example programs:
  10972. @itemize
  10973. @item
  10974. Copy the input to the output (output must be the same size as the input).
  10975. @verbatim
  10976. __kernel void copy(__write_only image2d_t destination,
  10977. unsigned int index,
  10978. __read_only image2d_t source)
  10979. {
  10980. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10981. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10982. float4 value = read_imagef(source, sampler, location);
  10983. write_imagef(destination, location, value);
  10984. }
  10985. @end verbatim
  10986. @item
  10987. Apply a simple transformation, rotating the input by an amount increasing
  10988. with the index counter. Pixel values are linearly interpolated by the
  10989. sampler, and the output need not have the same dimensions as the input.
  10990. @verbatim
  10991. __kernel void rotate_image(__write_only image2d_t dst,
  10992. unsigned int index,
  10993. __read_only image2d_t src)
  10994. {
  10995. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10996. CLK_FILTER_LINEAR);
  10997. float angle = (float)index / 100.0f;
  10998. float2 dst_dim = convert_float2(get_image_dim(dst));
  10999. float2 src_dim = convert_float2(get_image_dim(src));
  11000. float2 dst_cen = dst_dim / 2.0f;
  11001. float2 src_cen = src_dim / 2.0f;
  11002. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11003. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11004. float2 src_pos = {
  11005. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11006. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11007. };
  11008. src_pos = src_pos * src_dim / dst_dim;
  11009. float2 src_loc = src_pos + src_cen;
  11010. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11011. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11012. write_imagef(dst, dst_loc, 0.5f);
  11013. else
  11014. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11015. }
  11016. @end verbatim
  11017. @item
  11018. Blend two inputs together, with the amount of each input used varying
  11019. with the index counter.
  11020. @verbatim
  11021. __kernel void blend_images(__write_only image2d_t dst,
  11022. unsigned int index,
  11023. __read_only image2d_t src1,
  11024. __read_only image2d_t src2)
  11025. {
  11026. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11027. CLK_FILTER_LINEAR);
  11028. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11029. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11030. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11031. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11032. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11033. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11034. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11035. }
  11036. @end verbatim
  11037. @end itemize
  11038. @section pseudocolor
  11039. Alter frame colors in video with pseudocolors.
  11040. This filter accept the following options:
  11041. @table @option
  11042. @item c0
  11043. set pixel first component expression
  11044. @item c1
  11045. set pixel second component expression
  11046. @item c2
  11047. set pixel third component expression
  11048. @item c3
  11049. set pixel fourth component expression, corresponds to the alpha component
  11050. @item i
  11051. set component to use as base for altering colors
  11052. @end table
  11053. Each of them specifies the expression to use for computing the lookup table for
  11054. the corresponding pixel component values.
  11055. The expressions can contain the following constants and functions:
  11056. @table @option
  11057. @item w
  11058. @item h
  11059. The input width and height.
  11060. @item val
  11061. The input value for the pixel component.
  11062. @item ymin, umin, vmin, amin
  11063. The minimum allowed component value.
  11064. @item ymax, umax, vmax, amax
  11065. The maximum allowed component value.
  11066. @end table
  11067. All expressions default to "val".
  11068. @subsection Examples
  11069. @itemize
  11070. @item
  11071. Change too high luma values to gradient:
  11072. @example
  11073. 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'"
  11074. @end example
  11075. @end itemize
  11076. @section psnr
  11077. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11078. Ratio) between two input videos.
  11079. This filter takes in input two input videos, the first input is
  11080. considered the "main" source and is passed unchanged to the
  11081. output. The second input is used as a "reference" video for computing
  11082. the PSNR.
  11083. Both video inputs must have the same resolution and pixel format for
  11084. this filter to work correctly. Also it assumes that both inputs
  11085. have the same number of frames, which are compared one by one.
  11086. The obtained average PSNR is printed through the logging system.
  11087. The filter stores the accumulated MSE (mean squared error) of each
  11088. frame, and at the end of the processing it is averaged across all frames
  11089. equally, and the following formula is applied to obtain the PSNR:
  11090. @example
  11091. PSNR = 10*log10(MAX^2/MSE)
  11092. @end example
  11093. Where MAX is the average of the maximum values of each component of the
  11094. image.
  11095. The description of the accepted parameters follows.
  11096. @table @option
  11097. @item stats_file, f
  11098. If specified the filter will use the named file to save the PSNR of
  11099. each individual frame. When filename equals "-" the data is sent to
  11100. standard output.
  11101. @item stats_version
  11102. Specifies which version of the stats file format to use. Details of
  11103. each format are written below.
  11104. Default value is 1.
  11105. @item stats_add_max
  11106. Determines whether the max value is output to the stats log.
  11107. Default value is 0.
  11108. Requires stats_version >= 2. If this is set and stats_version < 2,
  11109. the filter will return an error.
  11110. @end table
  11111. This filter also supports the @ref{framesync} options.
  11112. The file printed if @var{stats_file} is selected, contains a sequence of
  11113. key/value pairs of the form @var{key}:@var{value} for each compared
  11114. couple of frames.
  11115. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11116. the list of per-frame-pair stats, with key value pairs following the frame
  11117. format with the following parameters:
  11118. @table @option
  11119. @item psnr_log_version
  11120. The version of the log file format. Will match @var{stats_version}.
  11121. @item fields
  11122. A comma separated list of the per-frame-pair parameters included in
  11123. the log.
  11124. @end table
  11125. A description of each shown per-frame-pair parameter follows:
  11126. @table @option
  11127. @item n
  11128. sequential number of the input frame, starting from 1
  11129. @item mse_avg
  11130. Mean Square Error pixel-by-pixel average difference of the compared
  11131. frames, averaged over all the image components.
  11132. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11133. Mean Square Error pixel-by-pixel average difference of the compared
  11134. frames for the component specified by the suffix.
  11135. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11136. Peak Signal to Noise ratio of the compared frames for the component
  11137. specified by the suffix.
  11138. @item max_avg, max_y, max_u, max_v
  11139. Maximum allowed value for each channel, and average over all
  11140. channels.
  11141. @end table
  11142. For example:
  11143. @example
  11144. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11145. [main][ref] psnr="stats_file=stats.log" [out]
  11146. @end example
  11147. On this example the input file being processed is compared with the
  11148. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11149. is stored in @file{stats.log}.
  11150. @anchor{pullup}
  11151. @section pullup
  11152. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11153. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11154. content.
  11155. The pullup filter is designed to take advantage of future context in making
  11156. its decisions. This filter is stateless in the sense that it does not lock
  11157. onto a pattern to follow, but it instead looks forward to the following
  11158. fields in order to identify matches and rebuild progressive frames.
  11159. To produce content with an even framerate, insert the fps filter after
  11160. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11161. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11162. The filter accepts the following options:
  11163. @table @option
  11164. @item jl
  11165. @item jr
  11166. @item jt
  11167. @item jb
  11168. These options set the amount of "junk" to ignore at the left, right, top, and
  11169. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11170. while top and bottom are in units of 2 lines.
  11171. The default is 8 pixels on each side.
  11172. @item sb
  11173. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11174. filter generating an occasional mismatched frame, but it may also cause an
  11175. excessive number of frames to be dropped during high motion sequences.
  11176. Conversely, setting it to -1 will make filter match fields more easily.
  11177. This may help processing of video where there is slight blurring between
  11178. the fields, but may also cause there to be interlaced frames in the output.
  11179. Default value is @code{0}.
  11180. @item mp
  11181. Set the metric plane to use. It accepts the following values:
  11182. @table @samp
  11183. @item l
  11184. Use luma plane.
  11185. @item u
  11186. Use chroma blue plane.
  11187. @item v
  11188. Use chroma red plane.
  11189. @end table
  11190. This option may be set to use chroma plane instead of the default luma plane
  11191. for doing filter's computations. This may improve accuracy on very clean
  11192. source material, but more likely will decrease accuracy, especially if there
  11193. is chroma noise (rainbow effect) or any grayscale video.
  11194. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11195. load and make pullup usable in realtime on slow machines.
  11196. @end table
  11197. For best results (without duplicated frames in the output file) it is
  11198. necessary to change the output frame rate. For example, to inverse
  11199. telecine NTSC input:
  11200. @example
  11201. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11202. @end example
  11203. @section qp
  11204. Change video quantization parameters (QP).
  11205. The filter accepts the following option:
  11206. @table @option
  11207. @item qp
  11208. Set expression for quantization parameter.
  11209. @end table
  11210. The expression is evaluated through the eval API and can contain, among others,
  11211. the following constants:
  11212. @table @var
  11213. @item known
  11214. 1 if index is not 129, 0 otherwise.
  11215. @item qp
  11216. Sequential index starting from -129 to 128.
  11217. @end table
  11218. @subsection Examples
  11219. @itemize
  11220. @item
  11221. Some equation like:
  11222. @example
  11223. qp=2+2*sin(PI*qp)
  11224. @end example
  11225. @end itemize
  11226. @section random
  11227. Flush video frames from internal cache of frames into a random order.
  11228. No frame is discarded.
  11229. Inspired by @ref{frei0r} nervous filter.
  11230. @table @option
  11231. @item frames
  11232. Set size in number of frames of internal cache, in range from @code{2} to
  11233. @code{512}. Default is @code{30}.
  11234. @item seed
  11235. Set seed for random number generator, must be an integer included between
  11236. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11237. less than @code{0}, the filter will try to use a good random seed on a
  11238. best effort basis.
  11239. @end table
  11240. @section readeia608
  11241. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11242. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11243. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11244. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11245. @table @option
  11246. @item lavfi.readeia608.X.cc
  11247. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11248. @item lavfi.readeia608.X.line
  11249. The number of the line on which the EIA-608 data was identified and read.
  11250. @end table
  11251. This filter accepts the following options:
  11252. @table @option
  11253. @item scan_min
  11254. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11255. @item scan_max
  11256. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11257. @item mac
  11258. Set minimal acceptable amplitude change for sync codes detection.
  11259. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11260. @item spw
  11261. Set the ratio of width reserved for sync code detection.
  11262. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11263. @item mhd
  11264. Set the max peaks height difference for sync code detection.
  11265. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11266. @item mpd
  11267. Set max peaks period difference for sync code detection.
  11268. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11269. @item msd
  11270. Set the first two max start code bits differences.
  11271. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11272. @item bhd
  11273. Set the minimum ratio of bits height compared to 3rd start code bit.
  11274. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11275. @item th_w
  11276. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11277. @item th_b
  11278. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11279. @item chp
  11280. Enable checking the parity bit. In the event of a parity error, the filter will output
  11281. @code{0x00} for that character. Default is false.
  11282. @item lp
  11283. Lowpass lines prior further proccessing. Default is disabled.
  11284. @end table
  11285. @subsection Examples
  11286. @itemize
  11287. @item
  11288. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11289. @example
  11290. 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
  11291. @end example
  11292. @end itemize
  11293. @section readvitc
  11294. Read vertical interval timecode (VITC) information from the top lines of a
  11295. video frame.
  11296. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11297. timecode value, if a valid timecode has been detected. Further metadata key
  11298. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11299. timecode data has been found or not.
  11300. This filter accepts the following options:
  11301. @table @option
  11302. @item scan_max
  11303. Set the maximum number of lines to scan for VITC data. If the value is set to
  11304. @code{-1} the full video frame is scanned. Default is @code{45}.
  11305. @item thr_b
  11306. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11307. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11308. @item thr_w
  11309. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11310. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11311. @end table
  11312. @subsection Examples
  11313. @itemize
  11314. @item
  11315. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11316. draw @code{--:--:--:--} as a placeholder:
  11317. @example
  11318. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11319. @end example
  11320. @end itemize
  11321. @section remap
  11322. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11323. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11324. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11325. value for pixel will be used for destination pixel.
  11326. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11327. will have Xmap/Ymap video stream dimensions.
  11328. Xmap and Ymap input video streams are 16bit depth, single channel.
  11329. @table @option
  11330. @item format
  11331. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11332. Default is @code{color}.
  11333. @end table
  11334. @section removegrain
  11335. The removegrain filter is a spatial denoiser for progressive video.
  11336. @table @option
  11337. @item m0
  11338. Set mode for the first plane.
  11339. @item m1
  11340. Set mode for the second plane.
  11341. @item m2
  11342. Set mode for the third plane.
  11343. @item m3
  11344. Set mode for the fourth plane.
  11345. @end table
  11346. Range of mode is from 0 to 24. Description of each mode follows:
  11347. @table @var
  11348. @item 0
  11349. Leave input plane unchanged. Default.
  11350. @item 1
  11351. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11352. @item 2
  11353. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11354. @item 3
  11355. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11356. @item 4
  11357. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11358. This is equivalent to a median filter.
  11359. @item 5
  11360. Line-sensitive clipping giving the minimal change.
  11361. @item 6
  11362. Line-sensitive clipping, intermediate.
  11363. @item 7
  11364. Line-sensitive clipping, intermediate.
  11365. @item 8
  11366. Line-sensitive clipping, intermediate.
  11367. @item 9
  11368. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11369. @item 10
  11370. Replaces the target pixel with the closest neighbour.
  11371. @item 11
  11372. [1 2 1] horizontal and vertical kernel blur.
  11373. @item 12
  11374. Same as mode 11.
  11375. @item 13
  11376. Bob mode, interpolates top field from the line where the neighbours
  11377. pixels are the closest.
  11378. @item 14
  11379. Bob mode, interpolates bottom field from the line where the neighbours
  11380. pixels are the closest.
  11381. @item 15
  11382. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11383. interpolation formula.
  11384. @item 16
  11385. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11386. interpolation formula.
  11387. @item 17
  11388. Clips the pixel with the minimum and maximum of respectively the maximum and
  11389. minimum of each pair of opposite neighbour pixels.
  11390. @item 18
  11391. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11392. the current pixel is minimal.
  11393. @item 19
  11394. Replaces the pixel with the average of its 8 neighbours.
  11395. @item 20
  11396. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11397. @item 21
  11398. Clips pixels using the averages of opposite neighbour.
  11399. @item 22
  11400. Same as mode 21 but simpler and faster.
  11401. @item 23
  11402. Small edge and halo removal, but reputed useless.
  11403. @item 24
  11404. Similar as 23.
  11405. @end table
  11406. @section removelogo
  11407. Suppress a TV station logo, using an image file to determine which
  11408. pixels comprise the logo. It works by filling in the pixels that
  11409. comprise the logo with neighboring pixels.
  11410. The filter accepts the following options:
  11411. @table @option
  11412. @item filename, f
  11413. Set the filter bitmap file, which can be any image format supported by
  11414. libavformat. The width and height of the image file must match those of the
  11415. video stream being processed.
  11416. @end table
  11417. Pixels in the provided bitmap image with a value of zero are not
  11418. considered part of the logo, non-zero pixels are considered part of
  11419. the logo. If you use white (255) for the logo and black (0) for the
  11420. rest, you will be safe. For making the filter bitmap, it is
  11421. recommended to take a screen capture of a black frame with the logo
  11422. visible, and then using a threshold filter followed by the erode
  11423. filter once or twice.
  11424. If needed, little splotches can be fixed manually. Remember that if
  11425. logo pixels are not covered, the filter quality will be much
  11426. reduced. Marking too many pixels as part of the logo does not hurt as
  11427. much, but it will increase the amount of blurring needed to cover over
  11428. the image and will destroy more information than necessary, and extra
  11429. pixels will slow things down on a large logo.
  11430. @section repeatfields
  11431. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11432. fields based on its value.
  11433. @section reverse
  11434. Reverse a video clip.
  11435. Warning: This filter requires memory to buffer the entire clip, so trimming
  11436. is suggested.
  11437. @subsection Examples
  11438. @itemize
  11439. @item
  11440. Take the first 5 seconds of a clip, and reverse it.
  11441. @example
  11442. trim=end=5,reverse
  11443. @end example
  11444. @end itemize
  11445. @section rgbashift
  11446. Shift R/G/B/A pixels horizontally and/or vertically.
  11447. The filter accepts the following options:
  11448. @table @option
  11449. @item rh
  11450. Set amount to shift red horizontally.
  11451. @item rv
  11452. Set amount to shift red vertically.
  11453. @item gh
  11454. Set amount to shift green horizontally.
  11455. @item gv
  11456. Set amount to shift green vertically.
  11457. @item bh
  11458. Set amount to shift blue horizontally.
  11459. @item bv
  11460. Set amount to shift blue vertically.
  11461. @item ah
  11462. Set amount to shift alpha horizontally.
  11463. @item av
  11464. Set amount to shift alpha vertically.
  11465. @item edge
  11466. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11467. @end table
  11468. @section roberts
  11469. Apply roberts cross operator to input video stream.
  11470. The filter accepts the following option:
  11471. @table @option
  11472. @item planes
  11473. Set which planes will be processed, unprocessed planes will be copied.
  11474. By default value 0xf, all planes will be processed.
  11475. @item scale
  11476. Set value which will be multiplied with filtered result.
  11477. @item delta
  11478. Set value which will be added to filtered result.
  11479. @end table
  11480. @section rotate
  11481. Rotate video by an arbitrary angle expressed in radians.
  11482. The filter accepts the following options:
  11483. A description of the optional parameters follows.
  11484. @table @option
  11485. @item angle, a
  11486. Set an expression for the angle by which to rotate the input video
  11487. clockwise, expressed as a number of radians. A negative value will
  11488. result in a counter-clockwise rotation. By default it is set to "0".
  11489. This expression is evaluated for each frame.
  11490. @item out_w, ow
  11491. Set the output width expression, default value is "iw".
  11492. This expression is evaluated just once during configuration.
  11493. @item out_h, oh
  11494. Set the output height expression, default value is "ih".
  11495. This expression is evaluated just once during configuration.
  11496. @item bilinear
  11497. Enable bilinear interpolation if set to 1, a value of 0 disables
  11498. it. Default value is 1.
  11499. @item fillcolor, c
  11500. Set the color used to fill the output area not covered by the rotated
  11501. image. For the general syntax of this option, check the
  11502. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11503. If the special value "none" is selected then no
  11504. background is printed (useful for example if the background is never shown).
  11505. Default value is "black".
  11506. @end table
  11507. The expressions for the angle and the output size can contain the
  11508. following constants and functions:
  11509. @table @option
  11510. @item n
  11511. sequential number of the input frame, starting from 0. It is always NAN
  11512. before the first frame is filtered.
  11513. @item t
  11514. time in seconds of the input frame, it is set to 0 when the filter is
  11515. configured. It is always NAN before the first frame is filtered.
  11516. @item hsub
  11517. @item vsub
  11518. horizontal and vertical chroma subsample values. For example for the
  11519. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11520. @item in_w, iw
  11521. @item in_h, ih
  11522. the input video width and height
  11523. @item out_w, ow
  11524. @item out_h, oh
  11525. the output width and height, that is the size of the padded area as
  11526. specified by the @var{width} and @var{height} expressions
  11527. @item rotw(a)
  11528. @item roth(a)
  11529. the minimal width/height required for completely containing the input
  11530. video rotated by @var{a} radians.
  11531. These are only available when computing the @option{out_w} and
  11532. @option{out_h} expressions.
  11533. @end table
  11534. @subsection Examples
  11535. @itemize
  11536. @item
  11537. Rotate the input by PI/6 radians clockwise:
  11538. @example
  11539. rotate=PI/6
  11540. @end example
  11541. @item
  11542. Rotate the input by PI/6 radians counter-clockwise:
  11543. @example
  11544. rotate=-PI/6
  11545. @end example
  11546. @item
  11547. Rotate the input by 45 degrees clockwise:
  11548. @example
  11549. rotate=45*PI/180
  11550. @end example
  11551. @item
  11552. Apply a constant rotation with period T, starting from an angle of PI/3:
  11553. @example
  11554. rotate=PI/3+2*PI*t/T
  11555. @end example
  11556. @item
  11557. Make the input video rotation oscillating with a period of T
  11558. seconds and an amplitude of A radians:
  11559. @example
  11560. rotate=A*sin(2*PI/T*t)
  11561. @end example
  11562. @item
  11563. Rotate the video, output size is chosen so that the whole rotating
  11564. input video is always completely contained in the output:
  11565. @example
  11566. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11567. @end example
  11568. @item
  11569. Rotate the video, reduce the output size so that no background is ever
  11570. shown:
  11571. @example
  11572. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11573. @end example
  11574. @end itemize
  11575. @subsection Commands
  11576. The filter supports the following commands:
  11577. @table @option
  11578. @item a, angle
  11579. Set the angle expression.
  11580. The command accepts the same syntax of the corresponding option.
  11581. If the specified expression is not valid, it is kept at its current
  11582. value.
  11583. @end table
  11584. @section sab
  11585. Apply Shape Adaptive Blur.
  11586. The filter accepts the following options:
  11587. @table @option
  11588. @item luma_radius, lr
  11589. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11590. value is 1.0. A greater value will result in a more blurred image, and
  11591. in slower processing.
  11592. @item luma_pre_filter_radius, lpfr
  11593. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11594. value is 1.0.
  11595. @item luma_strength, ls
  11596. Set luma maximum difference between pixels to still be considered, must
  11597. be a value in the 0.1-100.0 range, default value is 1.0.
  11598. @item chroma_radius, cr
  11599. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11600. greater value will result in a more blurred image, and in slower
  11601. processing.
  11602. @item chroma_pre_filter_radius, cpfr
  11603. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11604. @item chroma_strength, cs
  11605. Set chroma maximum difference between pixels to still be considered,
  11606. must be a value in the -0.9-100.0 range.
  11607. @end table
  11608. Each chroma option value, if not explicitly specified, is set to the
  11609. corresponding luma option value.
  11610. @anchor{scale}
  11611. @section scale
  11612. Scale (resize) the input video, using the libswscale library.
  11613. The scale filter forces the output display aspect ratio to be the same
  11614. of the input, by changing the output sample aspect ratio.
  11615. If the input image format is different from the format requested by
  11616. the next filter, the scale filter will convert the input to the
  11617. requested format.
  11618. @subsection Options
  11619. The filter accepts the following options, or any of the options
  11620. supported by the libswscale scaler.
  11621. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11622. the complete list of scaler options.
  11623. @table @option
  11624. @item width, w
  11625. @item height, h
  11626. Set the output video dimension expression. Default value is the input
  11627. dimension.
  11628. If the @var{width} or @var{w} value is 0, the input width is used for
  11629. the output. If the @var{height} or @var{h} value is 0, the input height
  11630. is used for the output.
  11631. If one and only one of the values is -n with n >= 1, the scale filter
  11632. will use a value that maintains the aspect ratio of the input image,
  11633. calculated from the other specified dimension. After that it will,
  11634. however, make sure that the calculated dimension is divisible by n and
  11635. adjust the value if necessary.
  11636. If both values are -n with n >= 1, the behavior will be identical to
  11637. both values being set to 0 as previously detailed.
  11638. See below for the list of accepted constants for use in the dimension
  11639. expression.
  11640. @item eval
  11641. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11642. @table @samp
  11643. @item init
  11644. Only evaluate expressions once during the filter initialization or when a command is processed.
  11645. @item frame
  11646. Evaluate expressions for each incoming frame.
  11647. @end table
  11648. Default value is @samp{init}.
  11649. @item interl
  11650. Set the interlacing mode. It accepts the following values:
  11651. @table @samp
  11652. @item 1
  11653. Force interlaced aware scaling.
  11654. @item 0
  11655. Do not apply interlaced scaling.
  11656. @item -1
  11657. Select interlaced aware scaling depending on whether the source frames
  11658. are flagged as interlaced or not.
  11659. @end table
  11660. Default value is @samp{0}.
  11661. @item flags
  11662. Set libswscale scaling flags. See
  11663. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11664. complete list of values. If not explicitly specified the filter applies
  11665. the default flags.
  11666. @item param0, param1
  11667. Set libswscale input parameters for scaling algorithms that need them. See
  11668. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11669. complete documentation. If not explicitly specified the filter applies
  11670. empty parameters.
  11671. @item size, s
  11672. Set the video size. For the syntax of this option, check the
  11673. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11674. @item in_color_matrix
  11675. @item out_color_matrix
  11676. Set in/output YCbCr color space type.
  11677. This allows the autodetected value to be overridden as well as allows forcing
  11678. a specific value used for the output and encoder.
  11679. If not specified, the color space type depends on the pixel format.
  11680. Possible values:
  11681. @table @samp
  11682. @item auto
  11683. Choose automatically.
  11684. @item bt709
  11685. Format conforming to International Telecommunication Union (ITU)
  11686. Recommendation BT.709.
  11687. @item fcc
  11688. Set color space conforming to the United States Federal Communications
  11689. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11690. @item bt601
  11691. @item bt470
  11692. @item smpte170m
  11693. Set color space conforming to:
  11694. @itemize
  11695. @item
  11696. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11697. @item
  11698. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11699. @item
  11700. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11701. @end itemize
  11702. @item smpte240m
  11703. Set color space conforming to SMPTE ST 240:1999.
  11704. @item bt2020
  11705. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11706. @end table
  11707. @item in_range
  11708. @item out_range
  11709. Set in/output YCbCr sample range.
  11710. This allows the autodetected value to be overridden as well as allows forcing
  11711. a specific value used for the output and encoder. If not specified, the
  11712. range depends on the pixel format. Possible values:
  11713. @table @samp
  11714. @item auto/unknown
  11715. Choose automatically.
  11716. @item jpeg/full/pc
  11717. Set full range (0-255 in case of 8-bit luma).
  11718. @item mpeg/limited/tv
  11719. Set "MPEG" range (16-235 in case of 8-bit luma).
  11720. @end table
  11721. @item force_original_aspect_ratio
  11722. Enable decreasing or increasing output video width or height if necessary to
  11723. keep the original aspect ratio. Possible values:
  11724. @table @samp
  11725. @item disable
  11726. Scale the video as specified and disable this feature.
  11727. @item decrease
  11728. The output video dimensions will automatically be decreased if needed.
  11729. @item increase
  11730. The output video dimensions will automatically be increased if needed.
  11731. @end table
  11732. One useful instance of this option is that when you know a specific device's
  11733. maximum allowed resolution, you can use this to limit the output video to
  11734. that, while retaining the aspect ratio. For example, device A allows
  11735. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11736. decrease) and specifying 1280x720 to the command line makes the output
  11737. 1280x533.
  11738. Please note that this is a different thing than specifying -1 for @option{w}
  11739. or @option{h}, you still need to specify the output resolution for this option
  11740. to work.
  11741. @item force_divisible_by Ensures that the output resolution is divisible by the
  11742. given integer when used together with @option{force_original_aspect_ratio}. This
  11743. works similar to using -n in the @option{w} and @option{h} options.
  11744. This option respects the value set for @option{force_original_aspect_ratio},
  11745. increasing or decreasing the resolution accordingly. This may slightly modify
  11746. the video's aspect ration.
  11747. This can be handy, for example, if you want to have a video fit within a defined
  11748. resolution using the @option{force_original_aspect_ratio} option but have
  11749. encoder restrictions when it comes to width or height.
  11750. @end table
  11751. The values of the @option{w} and @option{h} options are expressions
  11752. containing the following constants:
  11753. @table @var
  11754. @item in_w
  11755. @item in_h
  11756. The input width and height
  11757. @item iw
  11758. @item ih
  11759. These are the same as @var{in_w} and @var{in_h}.
  11760. @item out_w
  11761. @item out_h
  11762. The output (scaled) width and height
  11763. @item ow
  11764. @item oh
  11765. These are the same as @var{out_w} and @var{out_h}
  11766. @item a
  11767. The same as @var{iw} / @var{ih}
  11768. @item sar
  11769. input sample aspect ratio
  11770. @item dar
  11771. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11772. @item hsub
  11773. @item vsub
  11774. horizontal and vertical input chroma subsample values. For example for the
  11775. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11776. @item ohsub
  11777. @item ovsub
  11778. horizontal and vertical output chroma subsample values. For example for the
  11779. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11780. @end table
  11781. @subsection Examples
  11782. @itemize
  11783. @item
  11784. Scale the input video to a size of 200x100
  11785. @example
  11786. scale=w=200:h=100
  11787. @end example
  11788. This is equivalent to:
  11789. @example
  11790. scale=200:100
  11791. @end example
  11792. or:
  11793. @example
  11794. scale=200x100
  11795. @end example
  11796. @item
  11797. Specify a size abbreviation for the output size:
  11798. @example
  11799. scale=qcif
  11800. @end example
  11801. which can also be written as:
  11802. @example
  11803. scale=size=qcif
  11804. @end example
  11805. @item
  11806. Scale the input to 2x:
  11807. @example
  11808. scale=w=2*iw:h=2*ih
  11809. @end example
  11810. @item
  11811. The above is the same as:
  11812. @example
  11813. scale=2*in_w:2*in_h
  11814. @end example
  11815. @item
  11816. Scale the input to 2x with forced interlaced scaling:
  11817. @example
  11818. scale=2*iw:2*ih:interl=1
  11819. @end example
  11820. @item
  11821. Scale the input to half size:
  11822. @example
  11823. scale=w=iw/2:h=ih/2
  11824. @end example
  11825. @item
  11826. Increase the width, and set the height to the same size:
  11827. @example
  11828. scale=3/2*iw:ow
  11829. @end example
  11830. @item
  11831. Seek Greek harmony:
  11832. @example
  11833. scale=iw:1/PHI*iw
  11834. scale=ih*PHI:ih
  11835. @end example
  11836. @item
  11837. Increase the height, and set the width to 3/2 of the height:
  11838. @example
  11839. scale=w=3/2*oh:h=3/5*ih
  11840. @end example
  11841. @item
  11842. Increase the size, making the size a multiple of the chroma
  11843. subsample values:
  11844. @example
  11845. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11846. @end example
  11847. @item
  11848. Increase the width to a maximum of 500 pixels,
  11849. keeping the same aspect ratio as the input:
  11850. @example
  11851. scale=w='min(500\, iw*3/2):h=-1'
  11852. @end example
  11853. @item
  11854. Make pixels square by combining scale and setsar:
  11855. @example
  11856. scale='trunc(ih*dar):ih',setsar=1/1
  11857. @end example
  11858. @item
  11859. Make pixels square by combining scale and setsar,
  11860. making sure the resulting resolution is even (required by some codecs):
  11861. @example
  11862. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11863. @end example
  11864. @end itemize
  11865. @subsection Commands
  11866. This filter supports the following commands:
  11867. @table @option
  11868. @item width, w
  11869. @item height, h
  11870. Set the output video dimension expression.
  11871. The command accepts the same syntax of the corresponding option.
  11872. If the specified expression is not valid, it is kept at its current
  11873. value.
  11874. @end table
  11875. @section scale_npp
  11876. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11877. format conversion on CUDA video frames. Setting the output width and height
  11878. works in the same way as for the @var{scale} filter.
  11879. The following additional options are accepted:
  11880. @table @option
  11881. @item format
  11882. The pixel format of the output CUDA frames. If set to the string "same" (the
  11883. default), the input format will be kept. Note that automatic format negotiation
  11884. and conversion is not yet supported for hardware frames
  11885. @item interp_algo
  11886. The interpolation algorithm used for resizing. One of the following:
  11887. @table @option
  11888. @item nn
  11889. Nearest neighbour.
  11890. @item linear
  11891. @item cubic
  11892. @item cubic2p_bspline
  11893. 2-parameter cubic (B=1, C=0)
  11894. @item cubic2p_catmullrom
  11895. 2-parameter cubic (B=0, C=1/2)
  11896. @item cubic2p_b05c03
  11897. 2-parameter cubic (B=1/2, C=3/10)
  11898. @item super
  11899. Supersampling
  11900. @item lanczos
  11901. @end table
  11902. @end table
  11903. @section scale2ref
  11904. Scale (resize) the input video, based on a reference video.
  11905. See the scale filter for available options, scale2ref supports the same but
  11906. uses the reference video instead of the main input as basis. scale2ref also
  11907. supports the following additional constants for the @option{w} and
  11908. @option{h} options:
  11909. @table @var
  11910. @item main_w
  11911. @item main_h
  11912. The main input video's width and height
  11913. @item main_a
  11914. The same as @var{main_w} / @var{main_h}
  11915. @item main_sar
  11916. The main input video's sample aspect ratio
  11917. @item main_dar, mdar
  11918. The main input video's display aspect ratio. Calculated from
  11919. @code{(main_w / main_h) * main_sar}.
  11920. @item main_hsub
  11921. @item main_vsub
  11922. The main input video's horizontal and vertical chroma subsample values.
  11923. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11924. is 1.
  11925. @end table
  11926. @subsection Examples
  11927. @itemize
  11928. @item
  11929. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11930. @example
  11931. 'scale2ref[b][a];[a][b]overlay'
  11932. @end example
  11933. @item
  11934. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  11935. @example
  11936. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  11937. @end example
  11938. @end itemize
  11939. @anchor{selectivecolor}
  11940. @section selectivecolor
  11941. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11942. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11943. by the "purity" of the color (that is, how saturated it already is).
  11944. This filter is similar to the Adobe Photoshop Selective Color tool.
  11945. The filter accepts the following options:
  11946. @table @option
  11947. @item correction_method
  11948. Select color correction method.
  11949. Available values are:
  11950. @table @samp
  11951. @item absolute
  11952. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11953. component value).
  11954. @item relative
  11955. Specified adjustments are relative to the original component value.
  11956. @end table
  11957. Default is @code{absolute}.
  11958. @item reds
  11959. Adjustments for red pixels (pixels where the red component is the maximum)
  11960. @item yellows
  11961. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11962. @item greens
  11963. Adjustments for green pixels (pixels where the green component is the maximum)
  11964. @item cyans
  11965. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11966. @item blues
  11967. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11968. @item magentas
  11969. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11970. @item whites
  11971. Adjustments for white pixels (pixels where all components are greater than 128)
  11972. @item neutrals
  11973. Adjustments for all pixels except pure black and pure white
  11974. @item blacks
  11975. Adjustments for black pixels (pixels where all components are lesser than 128)
  11976. @item psfile
  11977. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11978. @end table
  11979. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11980. 4 space separated floating point adjustment values in the [-1,1] range,
  11981. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11982. pixels of its range.
  11983. @subsection Examples
  11984. @itemize
  11985. @item
  11986. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11987. increase magenta by 27% in blue areas:
  11988. @example
  11989. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11990. @end example
  11991. @item
  11992. Use a Photoshop selective color preset:
  11993. @example
  11994. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11995. @end example
  11996. @end itemize
  11997. @anchor{separatefields}
  11998. @section separatefields
  11999. The @code{separatefields} takes a frame-based video input and splits
  12000. each frame into its components fields, producing a new half height clip
  12001. with twice the frame rate and twice the frame count.
  12002. This filter use field-dominance information in frame to decide which
  12003. of each pair of fields to place first in the output.
  12004. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12005. @section setdar, setsar
  12006. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12007. output video.
  12008. This is done by changing the specified Sample (aka Pixel) Aspect
  12009. Ratio, according to the following equation:
  12010. @example
  12011. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12012. @end example
  12013. Keep in mind that the @code{setdar} filter does not modify the pixel
  12014. dimensions of the video frame. Also, the display aspect ratio set by
  12015. this filter may be changed by later filters in the filterchain,
  12016. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12017. applied.
  12018. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12019. the filter output video.
  12020. Note that as a consequence of the application of this filter, the
  12021. output display aspect ratio will change according to the equation
  12022. above.
  12023. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12024. filter may be changed by later filters in the filterchain, e.g. if
  12025. another "setsar" or a "setdar" filter is applied.
  12026. It accepts the following parameters:
  12027. @table @option
  12028. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12029. Set the aspect ratio used by the filter.
  12030. The parameter can be a floating point number string, an expression, or
  12031. a string of the form @var{num}:@var{den}, where @var{num} and
  12032. @var{den} are the numerator and denominator of the aspect ratio. If
  12033. the parameter is not specified, it is assumed the value "0".
  12034. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12035. should be escaped.
  12036. @item max
  12037. Set the maximum integer value to use for expressing numerator and
  12038. denominator when reducing the expressed aspect ratio to a rational.
  12039. Default value is @code{100}.
  12040. @end table
  12041. The parameter @var{sar} is an expression containing
  12042. the following constants:
  12043. @table @option
  12044. @item E, PI, PHI
  12045. These are approximated values for the mathematical constants e
  12046. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12047. @item w, h
  12048. The input width and height.
  12049. @item a
  12050. These are the same as @var{w} / @var{h}.
  12051. @item sar
  12052. The input sample aspect ratio.
  12053. @item dar
  12054. The input display aspect ratio. It is the same as
  12055. (@var{w} / @var{h}) * @var{sar}.
  12056. @item hsub, vsub
  12057. Horizontal and vertical chroma subsample values. For example, for the
  12058. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12059. @end table
  12060. @subsection Examples
  12061. @itemize
  12062. @item
  12063. To change the display aspect ratio to 16:9, specify one of the following:
  12064. @example
  12065. setdar=dar=1.77777
  12066. setdar=dar=16/9
  12067. @end example
  12068. @item
  12069. To change the sample aspect ratio to 10:11, specify:
  12070. @example
  12071. setsar=sar=10/11
  12072. @end example
  12073. @item
  12074. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12075. 1000 in the aspect ratio reduction, use the command:
  12076. @example
  12077. setdar=ratio=16/9:max=1000
  12078. @end example
  12079. @end itemize
  12080. @anchor{setfield}
  12081. @section setfield
  12082. Force field for the output video frame.
  12083. The @code{setfield} filter marks the interlace type field for the
  12084. output frames. It does not change the input frame, but only sets the
  12085. corresponding property, which affects how the frame is treated by
  12086. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12087. The filter accepts the following options:
  12088. @table @option
  12089. @item mode
  12090. Available values are:
  12091. @table @samp
  12092. @item auto
  12093. Keep the same field property.
  12094. @item bff
  12095. Mark the frame as bottom-field-first.
  12096. @item tff
  12097. Mark the frame as top-field-first.
  12098. @item prog
  12099. Mark the frame as progressive.
  12100. @end table
  12101. @end table
  12102. @anchor{setparams}
  12103. @section setparams
  12104. Force frame parameter for the output video frame.
  12105. The @code{setparams} filter marks interlace and color range for the
  12106. output frames. It does not change the input frame, but only sets the
  12107. corresponding property, which affects how the frame is treated by
  12108. filters/encoders.
  12109. @table @option
  12110. @item field_mode
  12111. Available values are:
  12112. @table @samp
  12113. @item auto
  12114. Keep the same field property (default).
  12115. @item bff
  12116. Mark the frame as bottom-field-first.
  12117. @item tff
  12118. Mark the frame as top-field-first.
  12119. @item prog
  12120. Mark the frame as progressive.
  12121. @end table
  12122. @item range
  12123. Available values are:
  12124. @table @samp
  12125. @item auto
  12126. Keep the same color range property (default).
  12127. @item unspecified, unknown
  12128. Mark the frame as unspecified color range.
  12129. @item limited, tv, mpeg
  12130. Mark the frame as limited range.
  12131. @item full, pc, jpeg
  12132. Mark the frame as full range.
  12133. @end table
  12134. @item color_primaries
  12135. Set the color primaries.
  12136. Available values are:
  12137. @table @samp
  12138. @item auto
  12139. Keep the same color primaries property (default).
  12140. @item bt709
  12141. @item unknown
  12142. @item bt470m
  12143. @item bt470bg
  12144. @item smpte170m
  12145. @item smpte240m
  12146. @item film
  12147. @item bt2020
  12148. @item smpte428
  12149. @item smpte431
  12150. @item smpte432
  12151. @item jedec-p22
  12152. @end table
  12153. @item color_trc
  12154. Set the color transfer.
  12155. Available values are:
  12156. @table @samp
  12157. @item auto
  12158. Keep the same color trc property (default).
  12159. @item bt709
  12160. @item unknown
  12161. @item bt470m
  12162. @item bt470bg
  12163. @item smpte170m
  12164. @item smpte240m
  12165. @item linear
  12166. @item log100
  12167. @item log316
  12168. @item iec61966-2-4
  12169. @item bt1361e
  12170. @item iec61966-2-1
  12171. @item bt2020-10
  12172. @item bt2020-12
  12173. @item smpte2084
  12174. @item smpte428
  12175. @item arib-std-b67
  12176. @end table
  12177. @item colorspace
  12178. Set the colorspace.
  12179. Available values are:
  12180. @table @samp
  12181. @item auto
  12182. Keep the same colorspace property (default).
  12183. @item gbr
  12184. @item bt709
  12185. @item unknown
  12186. @item fcc
  12187. @item bt470bg
  12188. @item smpte170m
  12189. @item smpte240m
  12190. @item ycgco
  12191. @item bt2020nc
  12192. @item bt2020c
  12193. @item smpte2085
  12194. @item chroma-derived-nc
  12195. @item chroma-derived-c
  12196. @item ictcp
  12197. @end table
  12198. @end table
  12199. @section showinfo
  12200. Show a line containing various information for each input video frame.
  12201. The input video is not modified.
  12202. This filter supports the following options:
  12203. @table @option
  12204. @item checksum
  12205. Calculate checksums of each plane. By default enabled.
  12206. @end table
  12207. The shown line contains a sequence of key/value pairs of the form
  12208. @var{key}:@var{value}.
  12209. The following values are shown in the output:
  12210. @table @option
  12211. @item n
  12212. The (sequential) number of the input frame, starting from 0.
  12213. @item pts
  12214. The Presentation TimeStamp of the input frame, expressed as a number of
  12215. time base units. The time base unit depends on the filter input pad.
  12216. @item pts_time
  12217. The Presentation TimeStamp of the input frame, expressed as a number of
  12218. seconds.
  12219. @item pos
  12220. The position of the frame in the input stream, or -1 if this information is
  12221. unavailable and/or meaningless (for example in case of synthetic video).
  12222. @item fmt
  12223. The pixel format name.
  12224. @item sar
  12225. The sample aspect ratio of the input frame, expressed in the form
  12226. @var{num}/@var{den}.
  12227. @item s
  12228. The size of the input frame. For the syntax of this option, check the
  12229. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12230. @item i
  12231. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12232. for bottom field first).
  12233. @item iskey
  12234. This is 1 if the frame is a key frame, 0 otherwise.
  12235. @item type
  12236. The picture type of the input frame ("I" for an I-frame, "P" for a
  12237. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12238. Also refer to the documentation of the @code{AVPictureType} enum and of
  12239. the @code{av_get_picture_type_char} function defined in
  12240. @file{libavutil/avutil.h}.
  12241. @item checksum
  12242. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12243. @item plane_checksum
  12244. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12245. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12246. @end table
  12247. @section showpalette
  12248. Displays the 256 colors palette of each frame. This filter is only relevant for
  12249. @var{pal8} pixel format frames.
  12250. It accepts the following option:
  12251. @table @option
  12252. @item s
  12253. Set the size of the box used to represent one palette color entry. Default is
  12254. @code{30} (for a @code{30x30} pixel box).
  12255. @end table
  12256. @section shuffleframes
  12257. Reorder and/or duplicate and/or drop video frames.
  12258. It accepts the following parameters:
  12259. @table @option
  12260. @item mapping
  12261. Set the destination indexes of input frames.
  12262. This is space or '|' separated list of indexes that maps input frames to output
  12263. frames. Number of indexes also sets maximal value that each index may have.
  12264. '-1' index have special meaning and that is to drop frame.
  12265. @end table
  12266. The first frame has the index 0. The default is to keep the input unchanged.
  12267. @subsection Examples
  12268. @itemize
  12269. @item
  12270. Swap second and third frame of every three frames of the input:
  12271. @example
  12272. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12273. @end example
  12274. @item
  12275. Swap 10th and 1st frame of every ten frames of the input:
  12276. @example
  12277. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12278. @end example
  12279. @end itemize
  12280. @section shuffleplanes
  12281. Reorder and/or duplicate video planes.
  12282. It accepts the following parameters:
  12283. @table @option
  12284. @item map0
  12285. The index of the input plane to be used as the first output plane.
  12286. @item map1
  12287. The index of the input plane to be used as the second output plane.
  12288. @item map2
  12289. The index of the input plane to be used as the third output plane.
  12290. @item map3
  12291. The index of the input plane to be used as the fourth output plane.
  12292. @end table
  12293. The first plane has the index 0. The default is to keep the input unchanged.
  12294. @subsection Examples
  12295. @itemize
  12296. @item
  12297. Swap the second and third planes of the input:
  12298. @example
  12299. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12300. @end example
  12301. @end itemize
  12302. @anchor{signalstats}
  12303. @section signalstats
  12304. Evaluate various visual metrics that assist in determining issues associated
  12305. with the digitization of analog video media.
  12306. By default the filter will log these metadata values:
  12307. @table @option
  12308. @item YMIN
  12309. Display the minimal Y value contained within the input frame. Expressed in
  12310. range of [0-255].
  12311. @item YLOW
  12312. Display the Y value at the 10% percentile within the input frame. Expressed in
  12313. range of [0-255].
  12314. @item YAVG
  12315. Display the average Y value within the input frame. Expressed in range of
  12316. [0-255].
  12317. @item YHIGH
  12318. Display the Y value at the 90% percentile within the input frame. Expressed in
  12319. range of [0-255].
  12320. @item YMAX
  12321. Display the maximum Y value contained within the input frame. Expressed in
  12322. range of [0-255].
  12323. @item UMIN
  12324. Display the minimal U value contained within the input frame. Expressed in
  12325. range of [0-255].
  12326. @item ULOW
  12327. Display the U value at the 10% percentile within the input frame. Expressed in
  12328. range of [0-255].
  12329. @item UAVG
  12330. Display the average U value within the input frame. Expressed in range of
  12331. [0-255].
  12332. @item UHIGH
  12333. Display the U value at the 90% percentile within the input frame. Expressed in
  12334. range of [0-255].
  12335. @item UMAX
  12336. Display the maximum U value contained within the input frame. Expressed in
  12337. range of [0-255].
  12338. @item VMIN
  12339. Display the minimal V value contained within the input frame. Expressed in
  12340. range of [0-255].
  12341. @item VLOW
  12342. Display the V value at the 10% percentile within the input frame. Expressed in
  12343. range of [0-255].
  12344. @item VAVG
  12345. Display the average V value within the input frame. Expressed in range of
  12346. [0-255].
  12347. @item VHIGH
  12348. Display the V value at the 90% percentile within the input frame. Expressed in
  12349. range of [0-255].
  12350. @item VMAX
  12351. Display the maximum V value contained within the input frame. Expressed in
  12352. range of [0-255].
  12353. @item SATMIN
  12354. Display the minimal saturation value contained within the input frame.
  12355. Expressed in range of [0-~181.02].
  12356. @item SATLOW
  12357. Display the saturation value at the 10% percentile within the input frame.
  12358. Expressed in range of [0-~181.02].
  12359. @item SATAVG
  12360. Display the average saturation value within the input frame. Expressed in range
  12361. of [0-~181.02].
  12362. @item SATHIGH
  12363. Display the saturation value at the 90% percentile within the input frame.
  12364. Expressed in range of [0-~181.02].
  12365. @item SATMAX
  12366. Display the maximum saturation value contained within the input frame.
  12367. Expressed in range of [0-~181.02].
  12368. @item HUEMED
  12369. Display the median value for hue within the input frame. Expressed in range of
  12370. [0-360].
  12371. @item HUEAVG
  12372. Display the average value for hue within the input frame. Expressed in range of
  12373. [0-360].
  12374. @item YDIF
  12375. Display the average of sample value difference between all values of the Y
  12376. plane in the current frame and corresponding values of the previous input frame.
  12377. Expressed in range of [0-255].
  12378. @item UDIF
  12379. Display the average of sample value difference between all values of the U
  12380. plane in the current frame and corresponding values of the previous input frame.
  12381. Expressed in range of [0-255].
  12382. @item VDIF
  12383. Display the average of sample value difference between all values of the V
  12384. plane in the current frame and corresponding values of the previous input frame.
  12385. Expressed in range of [0-255].
  12386. @item YBITDEPTH
  12387. Display bit depth of Y plane in current frame.
  12388. Expressed in range of [0-16].
  12389. @item UBITDEPTH
  12390. Display bit depth of U plane in current frame.
  12391. Expressed in range of [0-16].
  12392. @item VBITDEPTH
  12393. Display bit depth of V plane in current frame.
  12394. Expressed in range of [0-16].
  12395. @end table
  12396. The filter accepts the following options:
  12397. @table @option
  12398. @item stat
  12399. @item out
  12400. @option{stat} specify an additional form of image analysis.
  12401. @option{out} output video with the specified type of pixel highlighted.
  12402. Both options accept the following values:
  12403. @table @samp
  12404. @item tout
  12405. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12406. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12407. include the results of video dropouts, head clogs, or tape tracking issues.
  12408. @item vrep
  12409. Identify @var{vertical line repetition}. Vertical line repetition includes
  12410. similar rows of pixels within a frame. In born-digital video vertical line
  12411. repetition is common, but this pattern is uncommon in video digitized from an
  12412. analog source. When it occurs in video that results from the digitization of an
  12413. analog source it can indicate concealment from a dropout compensator.
  12414. @item brng
  12415. Identify pixels that fall outside of legal broadcast range.
  12416. @end table
  12417. @item color, c
  12418. Set the highlight color for the @option{out} option. The default color is
  12419. yellow.
  12420. @end table
  12421. @subsection Examples
  12422. @itemize
  12423. @item
  12424. Output data of various video metrics:
  12425. @example
  12426. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12427. @end example
  12428. @item
  12429. Output specific data about the minimum and maximum values of the Y plane per frame:
  12430. @example
  12431. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12432. @end example
  12433. @item
  12434. Playback video while highlighting pixels that are outside of broadcast range in red.
  12435. @example
  12436. ffplay example.mov -vf signalstats="out=brng:color=red"
  12437. @end example
  12438. @item
  12439. Playback video with signalstats metadata drawn over the frame.
  12440. @example
  12441. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12442. @end example
  12443. The contents of signalstat_drawtext.txt used in the command are:
  12444. @example
  12445. time %@{pts:hms@}
  12446. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12447. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12448. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12449. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12450. @end example
  12451. @end itemize
  12452. @anchor{signature}
  12453. @section signature
  12454. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12455. input. In this case the matching between the inputs can be calculated additionally.
  12456. The filter always passes through the first input. The signature of each stream can
  12457. be written into a file.
  12458. It accepts the following options:
  12459. @table @option
  12460. @item detectmode
  12461. Enable or disable the matching process.
  12462. Available values are:
  12463. @table @samp
  12464. @item off
  12465. Disable the calculation of a matching (default).
  12466. @item full
  12467. Calculate the matching for the whole video and output whether the whole video
  12468. matches or only parts.
  12469. @item fast
  12470. Calculate only until a matching is found or the video ends. Should be faster in
  12471. some cases.
  12472. @end table
  12473. @item nb_inputs
  12474. Set the number of inputs. The option value must be a non negative integer.
  12475. Default value is 1.
  12476. @item filename
  12477. Set the path to which the output is written. If there is more than one input,
  12478. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12479. integer), that will be replaced with the input number. If no filename is
  12480. specified, no output will be written. This is the default.
  12481. @item format
  12482. Choose the output format.
  12483. Available values are:
  12484. @table @samp
  12485. @item binary
  12486. Use the specified binary representation (default).
  12487. @item xml
  12488. Use the specified xml representation.
  12489. @end table
  12490. @item th_d
  12491. Set threshold to detect one word as similar. The option value must be an integer
  12492. greater than zero. The default value is 9000.
  12493. @item th_dc
  12494. Set threshold to detect all words as similar. The option value must be an integer
  12495. greater than zero. The default value is 60000.
  12496. @item th_xh
  12497. Set threshold to detect frames as similar. The option value must be an integer
  12498. greater than zero. The default value is 116.
  12499. @item th_di
  12500. Set the minimum length of a sequence in frames to recognize it as matching
  12501. sequence. The option value must be a non negative integer value.
  12502. The default value is 0.
  12503. @item th_it
  12504. Set the minimum relation, that matching frames to all frames must have.
  12505. The option value must be a double value between 0 and 1. The default value is 0.5.
  12506. @end table
  12507. @subsection Examples
  12508. @itemize
  12509. @item
  12510. To calculate the signature of an input video and store it in signature.bin:
  12511. @example
  12512. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12513. @end example
  12514. @item
  12515. To detect whether two videos match and store the signatures in XML format in
  12516. signature0.xml and signature1.xml:
  12517. @example
  12518. 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 -
  12519. @end example
  12520. @end itemize
  12521. @anchor{smartblur}
  12522. @section smartblur
  12523. Blur the input video without impacting the outlines.
  12524. It accepts the following options:
  12525. @table @option
  12526. @item luma_radius, lr
  12527. Set the luma radius. The option value must be a float number in
  12528. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12529. used to blur the image (slower if larger). Default value is 1.0.
  12530. @item luma_strength, ls
  12531. Set the luma strength. The option value must be a float number
  12532. in the range [-1.0,1.0] that configures the blurring. A value included
  12533. in [0.0,1.0] will blur the image whereas a value included in
  12534. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12535. @item luma_threshold, lt
  12536. Set the luma threshold used as a coefficient to determine
  12537. whether a pixel should be blurred or not. The option value must be an
  12538. integer in the range [-30,30]. A value of 0 will filter all the image,
  12539. a value included in [0,30] will filter flat areas and a value included
  12540. in [-30,0] will filter edges. Default value is 0.
  12541. @item chroma_radius, cr
  12542. Set the chroma radius. The option value must be a float number in
  12543. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12544. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12545. @item chroma_strength, cs
  12546. Set the chroma strength. The option value must be a float number
  12547. in the range [-1.0,1.0] that configures the blurring. A value included
  12548. in [0.0,1.0] will blur the image whereas a value included in
  12549. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12550. @item chroma_threshold, ct
  12551. Set the chroma threshold used as a coefficient to determine
  12552. whether a pixel should be blurred or not. The option value must be an
  12553. integer in the range [-30,30]. A value of 0 will filter all the image,
  12554. a value included in [0,30] will filter flat areas and a value included
  12555. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12556. @end table
  12557. If a chroma option is not explicitly set, the corresponding luma value
  12558. is set.
  12559. @section ssim
  12560. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12561. This filter takes in input two input videos, the first input is
  12562. considered the "main" source and is passed unchanged to the
  12563. output. The second input is used as a "reference" video for computing
  12564. the SSIM.
  12565. Both video inputs must have the same resolution and pixel format for
  12566. this filter to work correctly. Also it assumes that both inputs
  12567. have the same number of frames, which are compared one by one.
  12568. The filter stores the calculated SSIM of each frame.
  12569. The description of the accepted parameters follows.
  12570. @table @option
  12571. @item stats_file, f
  12572. If specified the filter will use the named file to save the SSIM of
  12573. each individual frame. When filename equals "-" the data is sent to
  12574. standard output.
  12575. @end table
  12576. The file printed if @var{stats_file} is selected, contains a sequence of
  12577. key/value pairs of the form @var{key}:@var{value} for each compared
  12578. couple of frames.
  12579. A description of each shown parameter follows:
  12580. @table @option
  12581. @item n
  12582. sequential number of the input frame, starting from 1
  12583. @item Y, U, V, R, G, B
  12584. SSIM of the compared frames for the component specified by the suffix.
  12585. @item All
  12586. SSIM of the compared frames for the whole frame.
  12587. @item dB
  12588. Same as above but in dB representation.
  12589. @end table
  12590. This filter also supports the @ref{framesync} options.
  12591. For example:
  12592. @example
  12593. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12594. [main][ref] ssim="stats_file=stats.log" [out]
  12595. @end example
  12596. On this example the input file being processed is compared with the
  12597. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12598. is stored in @file{stats.log}.
  12599. Another example with both psnr and ssim at same time:
  12600. @example
  12601. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12602. @end example
  12603. @section stereo3d
  12604. Convert between different stereoscopic image formats.
  12605. The filters accept the following options:
  12606. @table @option
  12607. @item in
  12608. Set stereoscopic image format of input.
  12609. Available values for input image formats are:
  12610. @table @samp
  12611. @item sbsl
  12612. side by side parallel (left eye left, right eye right)
  12613. @item sbsr
  12614. side by side crosseye (right eye left, left eye right)
  12615. @item sbs2l
  12616. side by side parallel with half width resolution
  12617. (left eye left, right eye right)
  12618. @item sbs2r
  12619. side by side crosseye with half width resolution
  12620. (right eye left, left eye right)
  12621. @item abl
  12622. above-below (left eye above, right eye below)
  12623. @item abr
  12624. above-below (right eye above, left eye below)
  12625. @item ab2l
  12626. above-below with half height resolution
  12627. (left eye above, right eye below)
  12628. @item ab2r
  12629. above-below with half height resolution
  12630. (right eye above, left eye below)
  12631. @item al
  12632. alternating frames (left eye first, right eye second)
  12633. @item ar
  12634. alternating frames (right eye first, left eye second)
  12635. @item irl
  12636. interleaved rows (left eye has top row, right eye starts on next row)
  12637. @item irr
  12638. interleaved rows (right eye has top row, left eye starts on next row)
  12639. @item icl
  12640. interleaved columns, left eye first
  12641. @item icr
  12642. interleaved columns, right eye first
  12643. Default value is @samp{sbsl}.
  12644. @end table
  12645. @item out
  12646. Set stereoscopic image format of output.
  12647. @table @samp
  12648. @item sbsl
  12649. side by side parallel (left eye left, right eye right)
  12650. @item sbsr
  12651. side by side crosseye (right eye left, left eye right)
  12652. @item sbs2l
  12653. side by side parallel with half width resolution
  12654. (left eye left, right eye right)
  12655. @item sbs2r
  12656. side by side crosseye with half width resolution
  12657. (right eye left, left eye right)
  12658. @item abl
  12659. above-below (left eye above, right eye below)
  12660. @item abr
  12661. above-below (right eye above, left eye below)
  12662. @item ab2l
  12663. above-below with half height resolution
  12664. (left eye above, right eye below)
  12665. @item ab2r
  12666. above-below with half height resolution
  12667. (right eye above, left eye below)
  12668. @item al
  12669. alternating frames (left eye first, right eye second)
  12670. @item ar
  12671. alternating frames (right eye first, left eye second)
  12672. @item irl
  12673. interleaved rows (left eye has top row, right eye starts on next row)
  12674. @item irr
  12675. interleaved rows (right eye has top row, left eye starts on next row)
  12676. @item arbg
  12677. anaglyph red/blue gray
  12678. (red filter on left eye, blue filter on right eye)
  12679. @item argg
  12680. anaglyph red/green gray
  12681. (red filter on left eye, green filter on right eye)
  12682. @item arcg
  12683. anaglyph red/cyan gray
  12684. (red filter on left eye, cyan filter on right eye)
  12685. @item arch
  12686. anaglyph red/cyan half colored
  12687. (red filter on left eye, cyan filter on right eye)
  12688. @item arcc
  12689. anaglyph red/cyan color
  12690. (red filter on left eye, cyan filter on right eye)
  12691. @item arcd
  12692. anaglyph red/cyan color optimized with the least squares projection of dubois
  12693. (red filter on left eye, cyan filter on right eye)
  12694. @item agmg
  12695. anaglyph green/magenta gray
  12696. (green filter on left eye, magenta filter on right eye)
  12697. @item agmh
  12698. anaglyph green/magenta half colored
  12699. (green filter on left eye, magenta filter on right eye)
  12700. @item agmc
  12701. anaglyph green/magenta colored
  12702. (green filter on left eye, magenta filter on right eye)
  12703. @item agmd
  12704. anaglyph green/magenta color optimized with the least squares projection of dubois
  12705. (green filter on left eye, magenta filter on right eye)
  12706. @item aybg
  12707. anaglyph yellow/blue gray
  12708. (yellow filter on left eye, blue filter on right eye)
  12709. @item aybh
  12710. anaglyph yellow/blue half colored
  12711. (yellow filter on left eye, blue filter on right eye)
  12712. @item aybc
  12713. anaglyph yellow/blue colored
  12714. (yellow filter on left eye, blue filter on right eye)
  12715. @item aybd
  12716. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12717. (yellow filter on left eye, blue filter on right eye)
  12718. @item ml
  12719. mono output (left eye only)
  12720. @item mr
  12721. mono output (right eye only)
  12722. @item chl
  12723. checkerboard, left eye first
  12724. @item chr
  12725. checkerboard, right eye first
  12726. @item icl
  12727. interleaved columns, left eye first
  12728. @item icr
  12729. interleaved columns, right eye first
  12730. @item hdmi
  12731. HDMI frame pack
  12732. @end table
  12733. Default value is @samp{arcd}.
  12734. @end table
  12735. @subsection Examples
  12736. @itemize
  12737. @item
  12738. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12739. @example
  12740. stereo3d=sbsl:aybd
  12741. @end example
  12742. @item
  12743. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12744. @example
  12745. stereo3d=abl:sbsr
  12746. @end example
  12747. @end itemize
  12748. @section streamselect, astreamselect
  12749. Select video or audio streams.
  12750. The filter accepts the following options:
  12751. @table @option
  12752. @item inputs
  12753. Set number of inputs. Default is 2.
  12754. @item map
  12755. Set input indexes to remap to outputs.
  12756. @end table
  12757. @subsection Commands
  12758. The @code{streamselect} and @code{astreamselect} filter supports the following
  12759. commands:
  12760. @table @option
  12761. @item map
  12762. Set input indexes to remap to outputs.
  12763. @end table
  12764. @subsection Examples
  12765. @itemize
  12766. @item
  12767. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12768. @example
  12769. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12770. @end example
  12771. @item
  12772. Same as above, but for audio:
  12773. @example
  12774. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12775. @end example
  12776. @end itemize
  12777. @section sobel
  12778. Apply sobel operator to input video stream.
  12779. The filter accepts the following option:
  12780. @table @option
  12781. @item planes
  12782. Set which planes will be processed, unprocessed planes will be copied.
  12783. By default value 0xf, all planes will be processed.
  12784. @item scale
  12785. Set value which will be multiplied with filtered result.
  12786. @item delta
  12787. Set value which will be added to filtered result.
  12788. @end table
  12789. @anchor{spp}
  12790. @section spp
  12791. Apply a simple postprocessing filter that compresses and decompresses the image
  12792. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12793. and average the results.
  12794. The filter accepts the following options:
  12795. @table @option
  12796. @item quality
  12797. Set quality. This option defines the number of levels for averaging. It accepts
  12798. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12799. effect. A value of @code{6} means the higher quality. For each increment of
  12800. that value the speed drops by a factor of approximately 2. Default value is
  12801. @code{3}.
  12802. @item qp
  12803. Force a constant quantization parameter. If not set, the filter will use the QP
  12804. from the video stream (if available).
  12805. @item mode
  12806. Set thresholding mode. Available modes are:
  12807. @table @samp
  12808. @item hard
  12809. Set hard thresholding (default).
  12810. @item soft
  12811. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12812. @end table
  12813. @item use_bframe_qp
  12814. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12815. option may cause flicker since the B-Frames have often larger QP. Default is
  12816. @code{0} (not enabled).
  12817. @end table
  12818. @section sr
  12819. Scale the input by applying one of the super-resolution methods based on
  12820. convolutional neural networks. Supported models:
  12821. @itemize
  12822. @item
  12823. Super-Resolution Convolutional Neural Network model (SRCNN).
  12824. See @url{https://arxiv.org/abs/1501.00092}.
  12825. @item
  12826. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12827. See @url{https://arxiv.org/abs/1609.05158}.
  12828. @end itemize
  12829. Training scripts as well as scripts for model file (.pb) saving can be found at
  12830. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12831. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12832. Native model files (.model) can be generated from TensorFlow model
  12833. files (.pb) by using tools/python/convert.py
  12834. The filter accepts the following options:
  12835. @table @option
  12836. @item dnn_backend
  12837. Specify which DNN backend to use for model loading and execution. This option accepts
  12838. the following values:
  12839. @table @samp
  12840. @item native
  12841. Native implementation of DNN loading and execution.
  12842. @item tensorflow
  12843. TensorFlow backend. To enable this backend you
  12844. need to install the TensorFlow for C library (see
  12845. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12846. @code{--enable-libtensorflow}
  12847. @end table
  12848. Default value is @samp{native}.
  12849. @item model
  12850. Set path to model file specifying network architecture and its parameters.
  12851. Note that different backends use different file formats. TensorFlow backend
  12852. can load files for both formats, while native backend can load files for only
  12853. its format.
  12854. @item scale_factor
  12855. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12856. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12857. input upscaled using bicubic upscaling with proper scale factor.
  12858. @end table
  12859. @anchor{subtitles}
  12860. @section subtitles
  12861. Draw subtitles on top of input video using the libass library.
  12862. To enable compilation of this filter you need to configure FFmpeg with
  12863. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12864. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12865. Alpha) subtitles format.
  12866. The filter accepts the following options:
  12867. @table @option
  12868. @item filename, f
  12869. Set the filename of the subtitle file to read. It must be specified.
  12870. @item original_size
  12871. Specify the size of the original video, the video for which the ASS file
  12872. was composed. For the syntax of this option, check the
  12873. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12874. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12875. correctly scale the fonts if the aspect ratio has been changed.
  12876. @item fontsdir
  12877. Set a directory path containing fonts that can be used by the filter.
  12878. These fonts will be used in addition to whatever the font provider uses.
  12879. @item alpha
  12880. Process alpha channel, by default alpha channel is untouched.
  12881. @item charenc
  12882. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12883. useful if not UTF-8.
  12884. @item stream_index, si
  12885. Set subtitles stream index. @code{subtitles} filter only.
  12886. @item force_style
  12887. Override default style or script info parameters of the subtitles. It accepts a
  12888. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12889. @end table
  12890. If the first key is not specified, it is assumed that the first value
  12891. specifies the @option{filename}.
  12892. For example, to render the file @file{sub.srt} on top of the input
  12893. video, use the command:
  12894. @example
  12895. subtitles=sub.srt
  12896. @end example
  12897. which is equivalent to:
  12898. @example
  12899. subtitles=filename=sub.srt
  12900. @end example
  12901. To render the default subtitles stream from file @file{video.mkv}, use:
  12902. @example
  12903. subtitles=video.mkv
  12904. @end example
  12905. To render the second subtitles stream from that file, use:
  12906. @example
  12907. subtitles=video.mkv:si=1
  12908. @end example
  12909. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12910. @code{DejaVu Serif}, use:
  12911. @example
  12912. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12913. @end example
  12914. @section super2xsai
  12915. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12916. Interpolate) pixel art scaling algorithm.
  12917. Useful for enlarging pixel art images without reducing sharpness.
  12918. @section swaprect
  12919. Swap two rectangular objects in video.
  12920. This filter accepts the following options:
  12921. @table @option
  12922. @item w
  12923. Set object width.
  12924. @item h
  12925. Set object height.
  12926. @item x1
  12927. Set 1st rect x coordinate.
  12928. @item y1
  12929. Set 1st rect y coordinate.
  12930. @item x2
  12931. Set 2nd rect x coordinate.
  12932. @item y2
  12933. Set 2nd rect y coordinate.
  12934. All expressions are evaluated once for each frame.
  12935. @end table
  12936. The all options are expressions containing the following constants:
  12937. @table @option
  12938. @item w
  12939. @item h
  12940. The input width and height.
  12941. @item a
  12942. same as @var{w} / @var{h}
  12943. @item sar
  12944. input sample aspect ratio
  12945. @item dar
  12946. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12947. @item n
  12948. The number of the input frame, starting from 0.
  12949. @item t
  12950. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12951. @item pos
  12952. the position in the file of the input frame, NAN if unknown
  12953. @end table
  12954. @section swapuv
  12955. Swap U & V plane.
  12956. @section telecine
  12957. Apply telecine process to the video.
  12958. This filter accepts the following options:
  12959. @table @option
  12960. @item first_field
  12961. @table @samp
  12962. @item top, t
  12963. top field first
  12964. @item bottom, b
  12965. bottom field first
  12966. The default value is @code{top}.
  12967. @end table
  12968. @item pattern
  12969. A string of numbers representing the pulldown pattern you wish to apply.
  12970. The default value is @code{23}.
  12971. @end table
  12972. @example
  12973. Some typical patterns:
  12974. NTSC output (30i):
  12975. 27.5p: 32222
  12976. 24p: 23 (classic)
  12977. 24p: 2332 (preferred)
  12978. 20p: 33
  12979. 18p: 334
  12980. 16p: 3444
  12981. PAL output (25i):
  12982. 27.5p: 12222
  12983. 24p: 222222222223 ("Euro pulldown")
  12984. 16.67p: 33
  12985. 16p: 33333334
  12986. @end example
  12987. @section threshold
  12988. Apply threshold effect to video stream.
  12989. This filter needs four video streams to perform thresholding.
  12990. First stream is stream we are filtering.
  12991. Second stream is holding threshold values, third stream is holding min values,
  12992. and last, fourth stream is holding max values.
  12993. The filter accepts the following option:
  12994. @table @option
  12995. @item planes
  12996. Set which planes will be processed, unprocessed planes will be copied.
  12997. By default value 0xf, all planes will be processed.
  12998. @end table
  12999. For example if first stream pixel's component value is less then threshold value
  13000. of pixel component from 2nd threshold stream, third stream value will picked,
  13001. otherwise fourth stream pixel component value will be picked.
  13002. Using color source filter one can perform various types of thresholding:
  13003. @subsection Examples
  13004. @itemize
  13005. @item
  13006. Binary threshold, using gray color as threshold:
  13007. @example
  13008. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13009. @end example
  13010. @item
  13011. Inverted binary threshold, using gray color as threshold:
  13012. @example
  13013. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13014. @end example
  13015. @item
  13016. Truncate binary threshold, using gray color as threshold:
  13017. @example
  13018. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13019. @end example
  13020. @item
  13021. Threshold to zero, using gray color as threshold:
  13022. @example
  13023. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13024. @end example
  13025. @item
  13026. Inverted threshold to zero, using gray color as threshold:
  13027. @example
  13028. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13029. @end example
  13030. @end itemize
  13031. @section thumbnail
  13032. Select the most representative frame in a given sequence of consecutive frames.
  13033. The filter accepts the following options:
  13034. @table @option
  13035. @item n
  13036. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13037. will pick one of them, and then handle the next batch of @var{n} frames until
  13038. the end. Default is @code{100}.
  13039. @end table
  13040. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13041. value will result in a higher memory usage, so a high value is not recommended.
  13042. @subsection Examples
  13043. @itemize
  13044. @item
  13045. Extract one picture each 50 frames:
  13046. @example
  13047. thumbnail=50
  13048. @end example
  13049. @item
  13050. Complete example of a thumbnail creation with @command{ffmpeg}:
  13051. @example
  13052. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13053. @end example
  13054. @end itemize
  13055. @section tile
  13056. Tile several successive frames together.
  13057. The filter accepts the following options:
  13058. @table @option
  13059. @item layout
  13060. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13061. this option, check the
  13062. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13063. @item nb_frames
  13064. Set the maximum number of frames to render in the given area. It must be less
  13065. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13066. the area will be used.
  13067. @item margin
  13068. Set the outer border margin in pixels.
  13069. @item padding
  13070. Set the inner border thickness (i.e. the number of pixels between frames). For
  13071. more advanced padding options (such as having different values for the edges),
  13072. refer to the pad video filter.
  13073. @item color
  13074. Specify the color of the unused area. For the syntax of this option, check the
  13075. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13076. The default value of @var{color} is "black".
  13077. @item overlap
  13078. Set the number of frames to overlap when tiling several successive frames together.
  13079. The value must be between @code{0} and @var{nb_frames - 1}.
  13080. @item init_padding
  13081. Set the number of frames to initially be empty before displaying first output frame.
  13082. This controls how soon will one get first output frame.
  13083. The value must be between @code{0} and @var{nb_frames - 1}.
  13084. @end table
  13085. @subsection Examples
  13086. @itemize
  13087. @item
  13088. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13089. @example
  13090. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13091. @end example
  13092. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13093. duplicating each output frame to accommodate the originally detected frame
  13094. rate.
  13095. @item
  13096. Display @code{5} pictures in an area of @code{3x2} frames,
  13097. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13098. mixed flat and named options:
  13099. @example
  13100. tile=3x2:nb_frames=5:padding=7:margin=2
  13101. @end example
  13102. @end itemize
  13103. @section tinterlace
  13104. Perform various types of temporal field interlacing.
  13105. Frames are counted starting from 1, so the first input frame is
  13106. considered odd.
  13107. The filter accepts the following options:
  13108. @table @option
  13109. @item mode
  13110. Specify the mode of the interlacing. This option can also be specified
  13111. as a value alone. See below for a list of values for this option.
  13112. Available values are:
  13113. @table @samp
  13114. @item merge, 0
  13115. Move odd frames into the upper field, even into the lower field,
  13116. generating a double height frame at half frame rate.
  13117. @example
  13118. ------> time
  13119. Input:
  13120. Frame 1 Frame 2 Frame 3 Frame 4
  13121. 11111 22222 33333 44444
  13122. 11111 22222 33333 44444
  13123. 11111 22222 33333 44444
  13124. 11111 22222 33333 44444
  13125. Output:
  13126. 11111 33333
  13127. 22222 44444
  13128. 11111 33333
  13129. 22222 44444
  13130. 11111 33333
  13131. 22222 44444
  13132. 11111 33333
  13133. 22222 44444
  13134. @end example
  13135. @item drop_even, 1
  13136. Only output odd frames, even frames are dropped, generating a frame with
  13137. unchanged height at half frame rate.
  13138. @example
  13139. ------> time
  13140. Input:
  13141. Frame 1 Frame 2 Frame 3 Frame 4
  13142. 11111 22222 33333 44444
  13143. 11111 22222 33333 44444
  13144. 11111 22222 33333 44444
  13145. 11111 22222 33333 44444
  13146. Output:
  13147. 11111 33333
  13148. 11111 33333
  13149. 11111 33333
  13150. 11111 33333
  13151. @end example
  13152. @item drop_odd, 2
  13153. Only output even frames, odd frames are dropped, generating a frame with
  13154. unchanged height at half frame rate.
  13155. @example
  13156. ------> time
  13157. Input:
  13158. Frame 1 Frame 2 Frame 3 Frame 4
  13159. 11111 22222 33333 44444
  13160. 11111 22222 33333 44444
  13161. 11111 22222 33333 44444
  13162. 11111 22222 33333 44444
  13163. Output:
  13164. 22222 44444
  13165. 22222 44444
  13166. 22222 44444
  13167. 22222 44444
  13168. @end example
  13169. @item pad, 3
  13170. Expand each frame to full height, but pad alternate lines with black,
  13171. generating a frame with double height at the same input frame rate.
  13172. @example
  13173. ------> time
  13174. Input:
  13175. Frame 1 Frame 2 Frame 3 Frame 4
  13176. 11111 22222 33333 44444
  13177. 11111 22222 33333 44444
  13178. 11111 22222 33333 44444
  13179. 11111 22222 33333 44444
  13180. Output:
  13181. 11111 ..... 33333 .....
  13182. ..... 22222 ..... 44444
  13183. 11111 ..... 33333 .....
  13184. ..... 22222 ..... 44444
  13185. 11111 ..... 33333 .....
  13186. ..... 22222 ..... 44444
  13187. 11111 ..... 33333 .....
  13188. ..... 22222 ..... 44444
  13189. @end example
  13190. @item interleave_top, 4
  13191. Interleave the upper field from odd frames with the lower field from
  13192. even frames, generating a frame with unchanged height at half frame rate.
  13193. @example
  13194. ------> time
  13195. Input:
  13196. Frame 1 Frame 2 Frame 3 Frame 4
  13197. 11111<- 22222 33333<- 44444
  13198. 11111 22222<- 33333 44444<-
  13199. 11111<- 22222 33333<- 44444
  13200. 11111 22222<- 33333 44444<-
  13201. Output:
  13202. 11111 33333
  13203. 22222 44444
  13204. 11111 33333
  13205. 22222 44444
  13206. @end example
  13207. @item interleave_bottom, 5
  13208. Interleave the lower field from odd frames with the upper field from
  13209. even frames, generating a frame with unchanged height at half frame rate.
  13210. @example
  13211. ------> time
  13212. Input:
  13213. Frame 1 Frame 2 Frame 3 Frame 4
  13214. 11111 22222<- 33333 44444<-
  13215. 11111<- 22222 33333<- 44444
  13216. 11111 22222<- 33333 44444<-
  13217. 11111<- 22222 33333<- 44444
  13218. Output:
  13219. 22222 44444
  13220. 11111 33333
  13221. 22222 44444
  13222. 11111 33333
  13223. @end example
  13224. @item interlacex2, 6
  13225. Double frame rate with unchanged height. Frames are inserted each
  13226. containing the second temporal field from the previous input frame and
  13227. the first temporal field from the next input frame. This mode relies on
  13228. the top_field_first flag. Useful for interlaced video displays with no
  13229. field synchronisation.
  13230. @example
  13231. ------> time
  13232. Input:
  13233. Frame 1 Frame 2 Frame 3 Frame 4
  13234. 11111 22222 33333 44444
  13235. 11111 22222 33333 44444
  13236. 11111 22222 33333 44444
  13237. 11111 22222 33333 44444
  13238. Output:
  13239. 11111 22222 22222 33333 33333 44444 44444
  13240. 11111 11111 22222 22222 33333 33333 44444
  13241. 11111 22222 22222 33333 33333 44444 44444
  13242. 11111 11111 22222 22222 33333 33333 44444
  13243. @end example
  13244. @item mergex2, 7
  13245. Move odd frames into the upper field, even into the lower field,
  13246. generating a double height frame at same frame rate.
  13247. @example
  13248. ------> time
  13249. Input:
  13250. Frame 1 Frame 2 Frame 3 Frame 4
  13251. 11111 22222 33333 44444
  13252. 11111 22222 33333 44444
  13253. 11111 22222 33333 44444
  13254. 11111 22222 33333 44444
  13255. Output:
  13256. 11111 33333 33333 55555
  13257. 22222 22222 44444 44444
  13258. 11111 33333 33333 55555
  13259. 22222 22222 44444 44444
  13260. 11111 33333 33333 55555
  13261. 22222 22222 44444 44444
  13262. 11111 33333 33333 55555
  13263. 22222 22222 44444 44444
  13264. @end example
  13265. @end table
  13266. Numeric values are deprecated but are accepted for backward
  13267. compatibility reasons.
  13268. Default mode is @code{merge}.
  13269. @item flags
  13270. Specify flags influencing the filter process.
  13271. Available value for @var{flags} is:
  13272. @table @option
  13273. @item low_pass_filter, vlpf
  13274. Enable linear vertical low-pass filtering in the filter.
  13275. Vertical low-pass filtering is required when creating an interlaced
  13276. destination from a progressive source which contains high-frequency
  13277. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13278. patterning.
  13279. @item complex_filter, cvlpf
  13280. Enable complex vertical low-pass filtering.
  13281. This will slightly less reduce interlace 'twitter' and Moire
  13282. patterning but better retain detail and subjective sharpness impression.
  13283. @end table
  13284. Vertical low-pass filtering can only be enabled for @option{mode}
  13285. @var{interleave_top} and @var{interleave_bottom}.
  13286. @end table
  13287. @section tmix
  13288. Mix successive video frames.
  13289. A description of the accepted options follows.
  13290. @table @option
  13291. @item frames
  13292. The number of successive frames to mix. If unspecified, it defaults to 3.
  13293. @item weights
  13294. Specify weight of each input video frame.
  13295. Each weight is separated by space. If number of weights is smaller than
  13296. number of @var{frames} last specified weight will be used for all remaining
  13297. unset weights.
  13298. @item scale
  13299. Specify scale, if it is set it will be multiplied with sum
  13300. of each weight multiplied with pixel values to give final destination
  13301. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13302. @end table
  13303. @subsection Examples
  13304. @itemize
  13305. @item
  13306. Average 7 successive frames:
  13307. @example
  13308. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13309. @end example
  13310. @item
  13311. Apply simple temporal convolution:
  13312. @example
  13313. tmix=frames=3:weights="-1 3 -1"
  13314. @end example
  13315. @item
  13316. Similar as above but only showing temporal differences:
  13317. @example
  13318. tmix=frames=3:weights="-1 2 -1":scale=1
  13319. @end example
  13320. @end itemize
  13321. @anchor{tonemap}
  13322. @section tonemap
  13323. Tone map colors from different dynamic ranges.
  13324. This filter expects data in single precision floating point, as it needs to
  13325. operate on (and can output) out-of-range values. Another filter, such as
  13326. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13327. The tonemapping algorithms implemented only work on linear light, so input
  13328. data should be linearized beforehand (and possibly correctly tagged).
  13329. @example
  13330. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13331. @end example
  13332. @subsection Options
  13333. The filter accepts the following options.
  13334. @table @option
  13335. @item tonemap
  13336. Set the tone map algorithm to use.
  13337. Possible values are:
  13338. @table @var
  13339. @item none
  13340. Do not apply any tone map, only desaturate overbright pixels.
  13341. @item clip
  13342. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13343. in-range values, while distorting out-of-range values.
  13344. @item linear
  13345. Stretch the entire reference gamut to a linear multiple of the display.
  13346. @item gamma
  13347. Fit a logarithmic transfer between the tone curves.
  13348. @item reinhard
  13349. Preserve overall image brightness with a simple curve, using nonlinear
  13350. contrast, which results in flattening details and degrading color accuracy.
  13351. @item hable
  13352. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13353. of slightly darkening everything. Use it when detail preservation is more
  13354. important than color and brightness accuracy.
  13355. @item mobius
  13356. Smoothly map out-of-range values, while retaining contrast and colors for
  13357. in-range material as much as possible. Use it when color accuracy is more
  13358. important than detail preservation.
  13359. @end table
  13360. Default is none.
  13361. @item param
  13362. Tune the tone mapping algorithm.
  13363. This affects the following algorithms:
  13364. @table @var
  13365. @item none
  13366. Ignored.
  13367. @item linear
  13368. Specifies the scale factor to use while stretching.
  13369. Default to 1.0.
  13370. @item gamma
  13371. Specifies the exponent of the function.
  13372. Default to 1.8.
  13373. @item clip
  13374. Specify an extra linear coefficient to multiply into the signal before clipping.
  13375. Default to 1.0.
  13376. @item reinhard
  13377. Specify the local contrast coefficient at the display peak.
  13378. Default to 0.5, which means that in-gamut values will be about half as bright
  13379. as when clipping.
  13380. @item hable
  13381. Ignored.
  13382. @item mobius
  13383. Specify the transition point from linear to mobius transform. Every value
  13384. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13385. more accurate the result will be, at the cost of losing bright details.
  13386. Default to 0.3, which due to the steep initial slope still preserves in-range
  13387. colors fairly accurately.
  13388. @end table
  13389. @item desat
  13390. Apply desaturation for highlights that exceed this level of brightness. The
  13391. higher the parameter, the more color information will be preserved. This
  13392. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13393. (smoothly) turning into white instead. This makes images feel more natural,
  13394. at the cost of reducing information about out-of-range colors.
  13395. The default of 2.0 is somewhat conservative and will mostly just apply to
  13396. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13397. This option works only if the input frame has a supported color tag.
  13398. @item peak
  13399. Override signal/nominal/reference peak with this value. Useful when the
  13400. embedded peak information in display metadata is not reliable or when tone
  13401. mapping from a lower range to a higher range.
  13402. @end table
  13403. @section tpad
  13404. Temporarily pad video frames.
  13405. The filter accepts the following options:
  13406. @table @option
  13407. @item start
  13408. Specify number of delay frames before input video stream.
  13409. @item stop
  13410. Specify number of padding frames after input video stream.
  13411. Set to -1 to pad indefinitely.
  13412. @item start_mode
  13413. Set kind of frames added to beginning of stream.
  13414. Can be either @var{add} or @var{clone}.
  13415. With @var{add} frames of solid-color are added.
  13416. With @var{clone} frames are clones of first frame.
  13417. @item stop_mode
  13418. Set kind of frames added to end of stream.
  13419. Can be either @var{add} or @var{clone}.
  13420. With @var{add} frames of solid-color are added.
  13421. With @var{clone} frames are clones of last frame.
  13422. @item start_duration, stop_duration
  13423. Specify the duration of the start/stop delay. See
  13424. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13425. for the accepted syntax.
  13426. These options override @var{start} and @var{stop}.
  13427. @item color
  13428. Specify the color of the padded area. For the syntax of this option,
  13429. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13430. manual,ffmpeg-utils}.
  13431. The default value of @var{color} is "black".
  13432. @end table
  13433. @anchor{transpose}
  13434. @section transpose
  13435. Transpose rows with columns in the input video and optionally flip it.
  13436. It accepts the following parameters:
  13437. @table @option
  13438. @item dir
  13439. Specify the transposition direction.
  13440. Can assume the following values:
  13441. @table @samp
  13442. @item 0, 4, cclock_flip
  13443. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13444. @example
  13445. L.R L.l
  13446. . . -> . .
  13447. l.r R.r
  13448. @end example
  13449. @item 1, 5, clock
  13450. Rotate by 90 degrees clockwise, that is:
  13451. @example
  13452. L.R l.L
  13453. . . -> . .
  13454. l.r r.R
  13455. @end example
  13456. @item 2, 6, cclock
  13457. Rotate by 90 degrees counterclockwise, that is:
  13458. @example
  13459. L.R R.r
  13460. . . -> . .
  13461. l.r L.l
  13462. @end example
  13463. @item 3, 7, clock_flip
  13464. Rotate by 90 degrees clockwise and vertically flip, that is:
  13465. @example
  13466. L.R r.R
  13467. . . -> . .
  13468. l.r l.L
  13469. @end example
  13470. @end table
  13471. For values between 4-7, the transposition is only done if the input
  13472. video geometry is portrait and not landscape. These values are
  13473. deprecated, the @code{passthrough} option should be used instead.
  13474. Numerical values are deprecated, and should be dropped in favor of
  13475. symbolic constants.
  13476. @item passthrough
  13477. Do not apply the transposition if the input geometry matches the one
  13478. specified by the specified value. It accepts the following values:
  13479. @table @samp
  13480. @item none
  13481. Always apply transposition.
  13482. @item portrait
  13483. Preserve portrait geometry (when @var{height} >= @var{width}).
  13484. @item landscape
  13485. Preserve landscape geometry (when @var{width} >= @var{height}).
  13486. @end table
  13487. Default value is @code{none}.
  13488. @end table
  13489. For example to rotate by 90 degrees clockwise and preserve portrait
  13490. layout:
  13491. @example
  13492. transpose=dir=1:passthrough=portrait
  13493. @end example
  13494. The command above can also be specified as:
  13495. @example
  13496. transpose=1:portrait
  13497. @end example
  13498. @section transpose_npp
  13499. Transpose rows with columns in the input video and optionally flip it.
  13500. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13501. It accepts the following parameters:
  13502. @table @option
  13503. @item dir
  13504. Specify the transposition direction.
  13505. Can assume the following values:
  13506. @table @samp
  13507. @item cclock_flip
  13508. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13509. @item clock
  13510. Rotate by 90 degrees clockwise.
  13511. @item cclock
  13512. Rotate by 90 degrees counterclockwise.
  13513. @item clock_flip
  13514. Rotate by 90 degrees clockwise and vertically flip.
  13515. @end table
  13516. @item passthrough
  13517. Do not apply the transposition if the input geometry matches the one
  13518. specified by the specified value. It accepts the following values:
  13519. @table @samp
  13520. @item none
  13521. Always apply transposition. (default)
  13522. @item portrait
  13523. Preserve portrait geometry (when @var{height} >= @var{width}).
  13524. @item landscape
  13525. Preserve landscape geometry (when @var{width} >= @var{height}).
  13526. @end table
  13527. @end table
  13528. @section trim
  13529. Trim the input so that the output contains one continuous subpart of the input.
  13530. It accepts the following parameters:
  13531. @table @option
  13532. @item start
  13533. Specify the time of the start of the kept section, i.e. the frame with the
  13534. timestamp @var{start} will be the first frame in the output.
  13535. @item end
  13536. Specify the time of the first frame that will be dropped, i.e. the frame
  13537. immediately preceding the one with the timestamp @var{end} will be the last
  13538. frame in the output.
  13539. @item start_pts
  13540. This is the same as @var{start}, except this option sets the start timestamp
  13541. in timebase units instead of seconds.
  13542. @item end_pts
  13543. This is the same as @var{end}, except this option sets the end timestamp
  13544. in timebase units instead of seconds.
  13545. @item duration
  13546. The maximum duration of the output in seconds.
  13547. @item start_frame
  13548. The number of the first frame that should be passed to the output.
  13549. @item end_frame
  13550. The number of the first frame that should be dropped.
  13551. @end table
  13552. @option{start}, @option{end}, and @option{duration} are expressed as time
  13553. duration specifications; see
  13554. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13555. for the accepted syntax.
  13556. Note that the first two sets of the start/end options and the @option{duration}
  13557. option look at the frame timestamp, while the _frame variants simply count the
  13558. frames that pass through the filter. Also note that this filter does not modify
  13559. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13560. setpts filter after the trim filter.
  13561. If multiple start or end options are set, this filter tries to be greedy and
  13562. keep all the frames that match at least one of the specified constraints. To keep
  13563. only the part that matches all the constraints at once, chain multiple trim
  13564. filters.
  13565. The defaults are such that all the input is kept. So it is possible to set e.g.
  13566. just the end values to keep everything before the specified time.
  13567. Examples:
  13568. @itemize
  13569. @item
  13570. Drop everything except the second minute of input:
  13571. @example
  13572. ffmpeg -i INPUT -vf trim=60:120
  13573. @end example
  13574. @item
  13575. Keep only the first second:
  13576. @example
  13577. ffmpeg -i INPUT -vf trim=duration=1
  13578. @end example
  13579. @end itemize
  13580. @section unpremultiply
  13581. Apply alpha unpremultiply effect to input video stream using first plane
  13582. of second stream as alpha.
  13583. Both streams must have same dimensions and same pixel format.
  13584. The filter accepts the following option:
  13585. @table @option
  13586. @item planes
  13587. Set which planes will be processed, unprocessed planes will be copied.
  13588. By default value 0xf, all planes will be processed.
  13589. If the format has 1 or 2 components, then luma is bit 0.
  13590. If the format has 3 or 4 components:
  13591. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13592. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13593. If present, the alpha channel is always the last bit.
  13594. @item inplace
  13595. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13596. @end table
  13597. @anchor{unsharp}
  13598. @section unsharp
  13599. Sharpen or blur the input video.
  13600. It accepts the following parameters:
  13601. @table @option
  13602. @item luma_msize_x, lx
  13603. Set the luma matrix horizontal size. It must be an odd integer between
  13604. 3 and 23. The default value is 5.
  13605. @item luma_msize_y, ly
  13606. Set the luma matrix vertical size. It must be an odd integer between 3
  13607. and 23. The default value is 5.
  13608. @item luma_amount, la
  13609. Set the luma effect strength. It must be a floating point number, reasonable
  13610. values lay between -1.5 and 1.5.
  13611. Negative values will blur the input video, while positive values will
  13612. sharpen it, a value of zero will disable the effect.
  13613. Default value is 1.0.
  13614. @item chroma_msize_x, cx
  13615. Set the chroma matrix horizontal size. It must be an odd integer
  13616. between 3 and 23. The default value is 5.
  13617. @item chroma_msize_y, cy
  13618. Set the chroma matrix vertical size. It must be an odd integer
  13619. between 3 and 23. The default value is 5.
  13620. @item chroma_amount, ca
  13621. Set the chroma effect strength. It must be a floating point number, reasonable
  13622. values lay between -1.5 and 1.5.
  13623. Negative values will blur the input video, while positive values will
  13624. sharpen it, a value of zero will disable the effect.
  13625. Default value is 0.0.
  13626. @end table
  13627. All parameters are optional and default to the equivalent of the
  13628. string '5:5:1.0:5:5:0.0'.
  13629. @subsection Examples
  13630. @itemize
  13631. @item
  13632. Apply strong luma sharpen effect:
  13633. @example
  13634. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13635. @end example
  13636. @item
  13637. Apply a strong blur of both luma and chroma parameters:
  13638. @example
  13639. unsharp=7:7:-2:7:7:-2
  13640. @end example
  13641. @end itemize
  13642. @section uspp
  13643. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13644. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13645. shifts and average the results.
  13646. The way this differs from the behavior of spp is that uspp actually encodes &
  13647. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13648. DCT similar to MJPEG.
  13649. The filter accepts the following options:
  13650. @table @option
  13651. @item quality
  13652. Set quality. This option defines the number of levels for averaging. It accepts
  13653. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13654. effect. A value of @code{8} means the higher quality. For each increment of
  13655. that value the speed drops by a factor of approximately 2. Default value is
  13656. @code{3}.
  13657. @item qp
  13658. Force a constant quantization parameter. If not set, the filter will use the QP
  13659. from the video stream (if available).
  13660. @end table
  13661. @section v360
  13662. Convert 360 videos between various formats.
  13663. The filter accepts the following options:
  13664. @table @option
  13665. @item input
  13666. @item output
  13667. Set format of the input/output video.
  13668. Available formats:
  13669. @table @samp
  13670. @item e
  13671. Equirectangular projection.
  13672. @item c3x2
  13673. @item c6x1
  13674. @item c1x6
  13675. Cubemap with 3x2/6x1/1x6 layout.
  13676. Format specific options:
  13677. @table @option
  13678. @item in_pad
  13679. @item out_pad
  13680. Set padding proportion for the input/output cubemap. Values in decimals.
  13681. Example values:
  13682. @table @samp
  13683. @item 0
  13684. No padding.
  13685. @item 0.01
  13686. 1% of face is padding. For example, with 1920x1280 resolution face size would be 640x640 and padding would be 3 pixels from each side. (640 * 0.01 = 6 pixels)
  13687. @end table
  13688. Default value is @b{@samp{0}}.
  13689. @item in_forder
  13690. @item out_forder
  13691. Set order of faces for the input/output cubemap. Choose one direction for each position.
  13692. Designation of directions:
  13693. @table @samp
  13694. @item r
  13695. right
  13696. @item l
  13697. left
  13698. @item u
  13699. up
  13700. @item d
  13701. down
  13702. @item f
  13703. forward
  13704. @item b
  13705. back
  13706. @end table
  13707. Default value is @b{@samp{rludfb}}.
  13708. @item in_frot
  13709. @item out_frot
  13710. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  13711. Designation of angles:
  13712. @table @samp
  13713. @item 0
  13714. 0 degrees clockwise
  13715. @item 1
  13716. 90 degrees clockwise
  13717. @item 2
  13718. 180 degrees clockwise
  13719. @item 4
  13720. 270 degrees clockwise
  13721. @end table
  13722. Default value is @b{@samp{000000}}.
  13723. @end table
  13724. @item eac
  13725. Equi-Angular Cubemap.
  13726. @item flat
  13727. Regular video. @i{(output only)}
  13728. Format specific options:
  13729. @table @option
  13730. @item h_fov
  13731. @item v_fov
  13732. Set horizontal/vertical field of view. Values in degrees.
  13733. @end table
  13734. @item dfisheye
  13735. Dual fisheye. @i{(input only)}
  13736. Format specific options:
  13737. @table @option
  13738. @item in_pad
  13739. Set padding proportion. Values in decimals.
  13740. Example values:
  13741. @table @samp
  13742. @item 0
  13743. No padding.
  13744. @item 0.01
  13745. 1% padding.
  13746. @end table
  13747. Default value is @b{@samp{0}}.
  13748. @end table
  13749. @item barrel
  13750. @item fb
  13751. Facebook's 360 format.
  13752. @end table
  13753. @item interp
  13754. Set interpolation method.@*
  13755. @i{Note: more complex interpolation methods require much more memory to run.}
  13756. Available methods:
  13757. @table @samp
  13758. @item near
  13759. @item nearest
  13760. Nearest neighbour.
  13761. @item line
  13762. @item linear
  13763. Bilinear interpolation.
  13764. @item cube
  13765. @item cubic
  13766. Bicubic interpolation.
  13767. @item lanc
  13768. @item lanczos
  13769. Lanczos interpolation.
  13770. @end table
  13771. Default value is @b{@samp{line}}.
  13772. @item w
  13773. @item h
  13774. Set the output video resolution.
  13775. Default resolution depends on formats.
  13776. @item yaw
  13777. @item pitch
  13778. @item roll
  13779. Set rotation for the output video. Values in degrees.
  13780. @item h_flip
  13781. @item v_flip
  13782. @item d_flip
  13783. Flip the output video horizontally/vertically/in-depth. Boolean values.
  13784. @end table
  13785. @subsection Examples
  13786. @itemize
  13787. @item
  13788. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  13789. @example
  13790. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  13791. @end example
  13792. @item
  13793. Extract back view of Equi-Angular Cubemap:
  13794. @example
  13795. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  13796. @end example
  13797. @end itemize
  13798. @section vaguedenoiser
  13799. Apply a wavelet based denoiser.
  13800. It transforms each frame from the video input into the wavelet domain,
  13801. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13802. the obtained coefficients. It does an inverse wavelet transform after.
  13803. Due to wavelet properties, it should give a nice smoothed result, and
  13804. reduced noise, without blurring picture features.
  13805. This filter accepts the following options:
  13806. @table @option
  13807. @item threshold
  13808. The filtering strength. The higher, the more filtered the video will be.
  13809. Hard thresholding can use a higher threshold than soft thresholding
  13810. before the video looks overfiltered. Default value is 2.
  13811. @item method
  13812. The filtering method the filter will use.
  13813. It accepts the following values:
  13814. @table @samp
  13815. @item hard
  13816. All values under the threshold will be zeroed.
  13817. @item soft
  13818. All values under the threshold will be zeroed. All values above will be
  13819. reduced by the threshold.
  13820. @item garrote
  13821. Scales or nullifies coefficients - intermediary between (more) soft and
  13822. (less) hard thresholding.
  13823. @end table
  13824. Default is garrote.
  13825. @item nsteps
  13826. Number of times, the wavelet will decompose the picture. Picture can't
  13827. be decomposed beyond a particular point (typically, 8 for a 640x480
  13828. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13829. @item percent
  13830. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13831. @item planes
  13832. A list of the planes to process. By default all planes are processed.
  13833. @end table
  13834. @section vectorscope
  13835. Display 2 color component values in the two dimensional graph (which is called
  13836. a vectorscope).
  13837. This filter accepts the following options:
  13838. @table @option
  13839. @item mode, m
  13840. Set vectorscope mode.
  13841. It accepts the following values:
  13842. @table @samp
  13843. @item gray
  13844. Gray values are displayed on graph, higher brightness means more pixels have
  13845. same component color value on location in graph. This is the default mode.
  13846. @item color
  13847. Gray values are displayed on graph. Surrounding pixels values which are not
  13848. present in video frame are drawn in gradient of 2 color components which are
  13849. set by option @code{x} and @code{y}. The 3rd color component is static.
  13850. @item color2
  13851. Actual color components values present in video frame are displayed on graph.
  13852. @item color3
  13853. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13854. on graph increases value of another color component, which is luminance by
  13855. default values of @code{x} and @code{y}.
  13856. @item color4
  13857. Actual colors present in video frame are displayed on graph. If two different
  13858. colors map to same position on graph then color with higher value of component
  13859. not present in graph is picked.
  13860. @item color5
  13861. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13862. component picked from radial gradient.
  13863. @end table
  13864. @item x
  13865. Set which color component will be represented on X-axis. Default is @code{1}.
  13866. @item y
  13867. Set which color component will be represented on Y-axis. Default is @code{2}.
  13868. @item intensity, i
  13869. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13870. of color component which represents frequency of (X, Y) location in graph.
  13871. @item envelope, e
  13872. @table @samp
  13873. @item none
  13874. No envelope, this is default.
  13875. @item instant
  13876. Instant envelope, even darkest single pixel will be clearly highlighted.
  13877. @item peak
  13878. Hold maximum and minimum values presented in graph over time. This way you
  13879. can still spot out of range values without constantly looking at vectorscope.
  13880. @item peak+instant
  13881. Peak and instant envelope combined together.
  13882. @end table
  13883. @item graticule, g
  13884. Set what kind of graticule to draw.
  13885. @table @samp
  13886. @item none
  13887. @item green
  13888. @item color
  13889. @end table
  13890. @item opacity, o
  13891. Set graticule opacity.
  13892. @item flags, f
  13893. Set graticule flags.
  13894. @table @samp
  13895. @item white
  13896. Draw graticule for white point.
  13897. @item black
  13898. Draw graticule for black point.
  13899. @item name
  13900. Draw color points short names.
  13901. @end table
  13902. @item bgopacity, b
  13903. Set background opacity.
  13904. @item lthreshold, l
  13905. Set low threshold for color component not represented on X or Y axis.
  13906. Values lower than this value will be ignored. Default is 0.
  13907. Note this value is multiplied with actual max possible value one pixel component
  13908. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13909. is 0.1 * 255 = 25.
  13910. @item hthreshold, h
  13911. Set high threshold for color component not represented on X or Y axis.
  13912. Values higher than this value will be ignored. Default is 1.
  13913. Note this value is multiplied with actual max possible value one pixel component
  13914. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13915. is 0.9 * 255 = 230.
  13916. @item colorspace, c
  13917. Set what kind of colorspace to use when drawing graticule.
  13918. @table @samp
  13919. @item auto
  13920. @item 601
  13921. @item 709
  13922. @end table
  13923. Default is auto.
  13924. @end table
  13925. @anchor{vidstabdetect}
  13926. @section vidstabdetect
  13927. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13928. @ref{vidstabtransform} for pass 2.
  13929. This filter generates a file with relative translation and rotation
  13930. transform information about subsequent frames, which is then used by
  13931. the @ref{vidstabtransform} filter.
  13932. To enable compilation of this filter you need to configure FFmpeg with
  13933. @code{--enable-libvidstab}.
  13934. This filter accepts the following options:
  13935. @table @option
  13936. @item result
  13937. Set the path to the file used to write the transforms information.
  13938. Default value is @file{transforms.trf}.
  13939. @item shakiness
  13940. Set how shaky the video is and how quick the camera is. It accepts an
  13941. integer in the range 1-10, a value of 1 means little shakiness, a
  13942. value of 10 means strong shakiness. Default value is 5.
  13943. @item accuracy
  13944. Set the accuracy of the detection process. It must be a value in the
  13945. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13946. accuracy. Default value is 15.
  13947. @item stepsize
  13948. Set stepsize of the search process. The region around minimum is
  13949. scanned with 1 pixel resolution. Default value is 6.
  13950. @item mincontrast
  13951. Set minimum contrast. Below this value a local measurement field is
  13952. discarded. Must be a floating point value in the range 0-1. Default
  13953. value is 0.3.
  13954. @item tripod
  13955. Set reference frame number for tripod mode.
  13956. If enabled, the motion of the frames is compared to a reference frame
  13957. in the filtered stream, identified by the specified number. The idea
  13958. is to compensate all movements in a more-or-less static scene and keep
  13959. the camera view absolutely still.
  13960. If set to 0, it is disabled. The frames are counted starting from 1.
  13961. @item show
  13962. Show fields and transforms in the resulting frames. It accepts an
  13963. integer in the range 0-2. Default value is 0, which disables any
  13964. visualization.
  13965. @end table
  13966. @subsection Examples
  13967. @itemize
  13968. @item
  13969. Use default values:
  13970. @example
  13971. vidstabdetect
  13972. @end example
  13973. @item
  13974. Analyze strongly shaky movie and put the results in file
  13975. @file{mytransforms.trf}:
  13976. @example
  13977. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13978. @end example
  13979. @item
  13980. Visualize the result of internal transformations in the resulting
  13981. video:
  13982. @example
  13983. vidstabdetect=show=1
  13984. @end example
  13985. @item
  13986. Analyze a video with medium shakiness using @command{ffmpeg}:
  13987. @example
  13988. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13989. @end example
  13990. @end itemize
  13991. @anchor{vidstabtransform}
  13992. @section vidstabtransform
  13993. Video stabilization/deshaking: pass 2 of 2,
  13994. see @ref{vidstabdetect} for pass 1.
  13995. Read a file with transform information for each frame and
  13996. apply/compensate them. Together with the @ref{vidstabdetect}
  13997. filter this can be used to deshake videos. See also
  13998. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13999. the @ref{unsharp} filter, see below.
  14000. To enable compilation of this filter you need to configure FFmpeg with
  14001. @code{--enable-libvidstab}.
  14002. @subsection Options
  14003. @table @option
  14004. @item input
  14005. Set path to the file used to read the transforms. Default value is
  14006. @file{transforms.trf}.
  14007. @item smoothing
  14008. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14009. camera movements. Default value is 10.
  14010. For example a number of 10 means that 21 frames are used (10 in the
  14011. past and 10 in the future) to smoothen the motion in the video. A
  14012. larger value leads to a smoother video, but limits the acceleration of
  14013. the camera (pan/tilt movements). 0 is a special case where a static
  14014. camera is simulated.
  14015. @item optalgo
  14016. Set the camera path optimization algorithm.
  14017. Accepted values are:
  14018. @table @samp
  14019. @item gauss
  14020. gaussian kernel low-pass filter on camera motion (default)
  14021. @item avg
  14022. averaging on transformations
  14023. @end table
  14024. @item maxshift
  14025. Set maximal number of pixels to translate frames. Default value is -1,
  14026. meaning no limit.
  14027. @item maxangle
  14028. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14029. value is -1, meaning no limit.
  14030. @item crop
  14031. Specify how to deal with borders that may be visible due to movement
  14032. compensation.
  14033. Available values are:
  14034. @table @samp
  14035. @item keep
  14036. keep image information from previous frame (default)
  14037. @item black
  14038. fill the border black
  14039. @end table
  14040. @item invert
  14041. Invert transforms if set to 1. Default value is 0.
  14042. @item relative
  14043. Consider transforms as relative to previous frame if set to 1,
  14044. absolute if set to 0. Default value is 0.
  14045. @item zoom
  14046. Set percentage to zoom. A positive value will result in a zoom-in
  14047. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14048. zoom).
  14049. @item optzoom
  14050. Set optimal zooming to avoid borders.
  14051. Accepted values are:
  14052. @table @samp
  14053. @item 0
  14054. disabled
  14055. @item 1
  14056. optimal static zoom value is determined (only very strong movements
  14057. will lead to visible borders) (default)
  14058. @item 2
  14059. optimal adaptive zoom value is determined (no borders will be
  14060. visible), see @option{zoomspeed}
  14061. @end table
  14062. Note that the value given at zoom is added to the one calculated here.
  14063. @item zoomspeed
  14064. Set percent to zoom maximally each frame (enabled when
  14065. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14066. 0.25.
  14067. @item interpol
  14068. Specify type of interpolation.
  14069. Available values are:
  14070. @table @samp
  14071. @item no
  14072. no interpolation
  14073. @item linear
  14074. linear only horizontal
  14075. @item bilinear
  14076. linear in both directions (default)
  14077. @item bicubic
  14078. cubic in both directions (slow)
  14079. @end table
  14080. @item tripod
  14081. Enable virtual tripod mode if set to 1, which is equivalent to
  14082. @code{relative=0:smoothing=0}. Default value is 0.
  14083. Use also @code{tripod} option of @ref{vidstabdetect}.
  14084. @item debug
  14085. Increase log verbosity if set to 1. Also the detected global motions
  14086. are written to the temporary file @file{global_motions.trf}. Default
  14087. value is 0.
  14088. @end table
  14089. @subsection Examples
  14090. @itemize
  14091. @item
  14092. Use @command{ffmpeg} for a typical stabilization with default values:
  14093. @example
  14094. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14095. @end example
  14096. Note the use of the @ref{unsharp} filter which is always recommended.
  14097. @item
  14098. Zoom in a bit more and load transform data from a given file:
  14099. @example
  14100. vidstabtransform=zoom=5:input="mytransforms.trf"
  14101. @end example
  14102. @item
  14103. Smoothen the video even more:
  14104. @example
  14105. vidstabtransform=smoothing=30
  14106. @end example
  14107. @end itemize
  14108. @section vflip
  14109. Flip the input video vertically.
  14110. For example, to vertically flip a video with @command{ffmpeg}:
  14111. @example
  14112. ffmpeg -i in.avi -vf "vflip" out.avi
  14113. @end example
  14114. @section vfrdet
  14115. Detect variable frame rate video.
  14116. This filter tries to detect if the input is variable or constant frame rate.
  14117. At end it will output number of frames detected as having variable delta pts,
  14118. and ones with constant delta pts.
  14119. If there was frames with variable delta, than it will also show min and max delta
  14120. encountered.
  14121. @section vibrance
  14122. Boost or alter saturation.
  14123. The filter accepts the following options:
  14124. @table @option
  14125. @item intensity
  14126. Set strength of boost if positive value or strength of alter if negative value.
  14127. Default is 0. Allowed range is from -2 to 2.
  14128. @item rbal
  14129. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14130. @item gbal
  14131. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14132. @item bbal
  14133. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14134. @item rlum
  14135. Set the red luma coefficient.
  14136. @item glum
  14137. Set the green luma coefficient.
  14138. @item blum
  14139. Set the blue luma coefficient.
  14140. @item alternate
  14141. If @code{intensity} is negative and this is set to 1, colors will change,
  14142. otherwise colors will be less saturated, more towards gray.
  14143. @end table
  14144. @anchor{vignette}
  14145. @section vignette
  14146. Make or reverse a natural vignetting effect.
  14147. The filter accepts the following options:
  14148. @table @option
  14149. @item angle, a
  14150. Set lens angle expression as a number of radians.
  14151. The value is clipped in the @code{[0,PI/2]} range.
  14152. Default value: @code{"PI/5"}
  14153. @item x0
  14154. @item y0
  14155. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14156. by default.
  14157. @item mode
  14158. Set forward/backward mode.
  14159. Available modes are:
  14160. @table @samp
  14161. @item forward
  14162. The larger the distance from the central point, the darker the image becomes.
  14163. @item backward
  14164. The larger the distance from the central point, the brighter the image becomes.
  14165. This can be used to reverse a vignette effect, though there is no automatic
  14166. detection to extract the lens @option{angle} and other settings (yet). It can
  14167. also be used to create a burning effect.
  14168. @end table
  14169. Default value is @samp{forward}.
  14170. @item eval
  14171. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14172. It accepts the following values:
  14173. @table @samp
  14174. @item init
  14175. Evaluate expressions only once during the filter initialization.
  14176. @item frame
  14177. Evaluate expressions for each incoming frame. This is way slower than the
  14178. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14179. allows advanced dynamic expressions.
  14180. @end table
  14181. Default value is @samp{init}.
  14182. @item dither
  14183. Set dithering to reduce the circular banding effects. Default is @code{1}
  14184. (enabled).
  14185. @item aspect
  14186. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14187. Setting this value to the SAR of the input will make a rectangular vignetting
  14188. following the dimensions of the video.
  14189. Default is @code{1/1}.
  14190. @end table
  14191. @subsection Expressions
  14192. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14193. following parameters.
  14194. @table @option
  14195. @item w
  14196. @item h
  14197. input width and height
  14198. @item n
  14199. the number of input frame, starting from 0
  14200. @item pts
  14201. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14202. @var{TB} units, NAN if undefined
  14203. @item r
  14204. frame rate of the input video, NAN if the input frame rate is unknown
  14205. @item t
  14206. the PTS (Presentation TimeStamp) of the filtered video frame,
  14207. expressed in seconds, NAN if undefined
  14208. @item tb
  14209. time base of the input video
  14210. @end table
  14211. @subsection Examples
  14212. @itemize
  14213. @item
  14214. Apply simple strong vignetting effect:
  14215. @example
  14216. vignette=PI/4
  14217. @end example
  14218. @item
  14219. Make a flickering vignetting:
  14220. @example
  14221. vignette='PI/4+random(1)*PI/50':eval=frame
  14222. @end example
  14223. @end itemize
  14224. @section vmafmotion
  14225. Obtain the average vmaf motion score of a video.
  14226. It is one of the component filters of VMAF.
  14227. The obtained average motion score is printed through the logging system.
  14228. In the below example the input file @file{ref.mpg} is being processed and score
  14229. is computed.
  14230. @example
  14231. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  14232. @end example
  14233. @section vstack
  14234. Stack input videos vertically.
  14235. All streams must be of same pixel format and of same width.
  14236. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14237. to create same output.
  14238. The filter accept the following option:
  14239. @table @option
  14240. @item inputs
  14241. Set number of input streams. Default is 2.
  14242. @item shortest
  14243. If set to 1, force the output to terminate when the shortest input
  14244. terminates. Default value is 0.
  14245. @end table
  14246. @section w3fdif
  14247. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14248. Deinterlacing Filter").
  14249. Based on the process described by Martin Weston for BBC R&D, and
  14250. implemented based on the de-interlace algorithm written by Jim
  14251. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14252. uses filter coefficients calculated by BBC R&D.
  14253. This filter use field-dominance information in frame to decide which
  14254. of each pair of fields to place first in the output.
  14255. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14256. There are two sets of filter coefficients, so called "simple":
  14257. and "complex". Which set of filter coefficients is used can
  14258. be set by passing an optional parameter:
  14259. @table @option
  14260. @item filter
  14261. Set the interlacing filter coefficients. Accepts one of the following values:
  14262. @table @samp
  14263. @item simple
  14264. Simple filter coefficient set.
  14265. @item complex
  14266. More-complex filter coefficient set.
  14267. @end table
  14268. Default value is @samp{complex}.
  14269. @item deint
  14270. Specify which frames to deinterlace. Accept one of the following values:
  14271. @table @samp
  14272. @item all
  14273. Deinterlace all frames,
  14274. @item interlaced
  14275. Only deinterlace frames marked as interlaced.
  14276. @end table
  14277. Default value is @samp{all}.
  14278. @end table
  14279. @section waveform
  14280. Video waveform monitor.
  14281. The waveform monitor plots color component intensity. By default luminance
  14282. only. Each column of the waveform corresponds to a column of pixels in the
  14283. source video.
  14284. It accepts the following options:
  14285. @table @option
  14286. @item mode, m
  14287. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14288. In row mode, the graph on the left side represents color component value 0 and
  14289. the right side represents value = 255. In column mode, the top side represents
  14290. color component value = 0 and bottom side represents value = 255.
  14291. @item intensity, i
  14292. Set intensity. Smaller values are useful to find out how many values of the same
  14293. luminance are distributed across input rows/columns.
  14294. Default value is @code{0.04}. Allowed range is [0, 1].
  14295. @item mirror, r
  14296. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14297. In mirrored mode, higher values will be represented on the left
  14298. side for @code{row} mode and at the top for @code{column} mode. Default is
  14299. @code{1} (mirrored).
  14300. @item display, d
  14301. Set display mode.
  14302. It accepts the following values:
  14303. @table @samp
  14304. @item overlay
  14305. Presents information identical to that in the @code{parade}, except
  14306. that the graphs representing color components are superimposed directly
  14307. over one another.
  14308. This display mode makes it easier to spot relative differences or similarities
  14309. in overlapping areas of the color components that are supposed to be identical,
  14310. such as neutral whites, grays, or blacks.
  14311. @item stack
  14312. Display separate graph for the color components side by side in
  14313. @code{row} mode or one below the other in @code{column} mode.
  14314. @item parade
  14315. Display separate graph for the color components side by side in
  14316. @code{column} mode or one below the other in @code{row} mode.
  14317. Using this display mode makes it easy to spot color casts in the highlights
  14318. and shadows of an image, by comparing the contours of the top and the bottom
  14319. graphs of each waveform. Since whites, grays, and blacks are characterized
  14320. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14321. should display three waveforms of roughly equal width/height. If not, the
  14322. correction is easy to perform by making level adjustments the three waveforms.
  14323. @end table
  14324. Default is @code{stack}.
  14325. @item components, c
  14326. Set which color components to display. Default is 1, which means only luminance
  14327. or red color component if input is in RGB colorspace. If is set for example to
  14328. 7 it will display all 3 (if) available color components.
  14329. @item envelope, e
  14330. @table @samp
  14331. @item none
  14332. No envelope, this is default.
  14333. @item instant
  14334. Instant envelope, minimum and maximum values presented in graph will be easily
  14335. visible even with small @code{step} value.
  14336. @item peak
  14337. Hold minimum and maximum values presented in graph across time. This way you
  14338. can still spot out of range values without constantly looking at waveforms.
  14339. @item peak+instant
  14340. Peak and instant envelope combined together.
  14341. @end table
  14342. @item filter, f
  14343. @table @samp
  14344. @item lowpass
  14345. No filtering, this is default.
  14346. @item flat
  14347. Luma and chroma combined together.
  14348. @item aflat
  14349. Similar as above, but shows difference between blue and red chroma.
  14350. @item xflat
  14351. Similar as above, but use different colors.
  14352. @item chroma
  14353. Displays only chroma.
  14354. @item color
  14355. Displays actual color value on waveform.
  14356. @item acolor
  14357. Similar as above, but with luma showing frequency of chroma values.
  14358. @end table
  14359. @item graticule, g
  14360. Set which graticule to display.
  14361. @table @samp
  14362. @item none
  14363. Do not display graticule.
  14364. @item green
  14365. Display green graticule showing legal broadcast ranges.
  14366. @item orange
  14367. Display orange graticule showing legal broadcast ranges.
  14368. @end table
  14369. @item opacity, o
  14370. Set graticule opacity.
  14371. @item flags, fl
  14372. Set graticule flags.
  14373. @table @samp
  14374. @item numbers
  14375. Draw numbers above lines. By default enabled.
  14376. @item dots
  14377. Draw dots instead of lines.
  14378. @end table
  14379. @item scale, s
  14380. Set scale used for displaying graticule.
  14381. @table @samp
  14382. @item digital
  14383. @item millivolts
  14384. @item ire
  14385. @end table
  14386. Default is digital.
  14387. @item bgopacity, b
  14388. Set background opacity.
  14389. @end table
  14390. @section weave, doubleweave
  14391. The @code{weave} takes a field-based video input and join
  14392. each two sequential fields into single frame, producing a new double
  14393. height clip with half the frame rate and half the frame count.
  14394. The @code{doubleweave} works same as @code{weave} but without
  14395. halving frame rate and frame count.
  14396. It accepts the following option:
  14397. @table @option
  14398. @item first_field
  14399. Set first field. Available values are:
  14400. @table @samp
  14401. @item top, t
  14402. Set the frame as top-field-first.
  14403. @item bottom, b
  14404. Set the frame as bottom-field-first.
  14405. @end table
  14406. @end table
  14407. @subsection Examples
  14408. @itemize
  14409. @item
  14410. Interlace video using @ref{select} and @ref{separatefields} filter:
  14411. @example
  14412. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14413. @end example
  14414. @end itemize
  14415. @section xbr
  14416. Apply the xBR high-quality magnification filter which is designed for pixel
  14417. art. It follows a set of edge-detection rules, see
  14418. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14419. It accepts the following option:
  14420. @table @option
  14421. @item n
  14422. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14423. @code{3xBR} and @code{4} for @code{4xBR}.
  14424. Default is @code{3}.
  14425. @end table
  14426. @section xmedian
  14427. Pick median pixels from several input videos.
  14428. The filter accept the following options:
  14429. @table @option
  14430. @item inputs
  14431. Set number of inputs.
  14432. Default is 3. Allowed range is from 3 to 255.
  14433. If number of inputs is even number, than result will be mean value between two median values.
  14434. @item planes
  14435. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14436. @end table
  14437. @section xstack
  14438. Stack video inputs into custom layout.
  14439. All streams must be of same pixel format.
  14440. The filter accept the following option:
  14441. @table @option
  14442. @item inputs
  14443. Set number of input streams. Default is 2.
  14444. @item layout
  14445. Specify layout of inputs.
  14446. This option requires the desired layout configuration to be explicitly set by the user.
  14447. This sets position of each video input in output. Each input
  14448. is separated by '|'.
  14449. The first number represents the column, and the second number represents the row.
  14450. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14451. where X is video input from which to take width or height.
  14452. Multiple values can be used when separated by '+'. In such
  14453. case values are summed together.
  14454. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14455. a layout must be set by the user.
  14456. @item shortest
  14457. If set to 1, force the output to terminate when the shortest input
  14458. terminates. Default value is 0.
  14459. @end table
  14460. @subsection Examples
  14461. @itemize
  14462. @item
  14463. Display 4 inputs into 2x2 grid,
  14464. note that if inputs are of different sizes unused gaps might appear,
  14465. as not all of output video is used.
  14466. @example
  14467. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14468. @end example
  14469. @item
  14470. Display 4 inputs into 1x4 grid,
  14471. note that if inputs are of different sizes unused gaps might appear,
  14472. as not all of output video is used.
  14473. @example
  14474. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14475. @end example
  14476. @item
  14477. Display 9 inputs into 3x3 grid,
  14478. note that if inputs are of different sizes unused gaps might appear,
  14479. as not all of output video is used.
  14480. @example
  14481. 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
  14482. @end example
  14483. @end itemize
  14484. @anchor{yadif}
  14485. @section yadif
  14486. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14487. filter").
  14488. It accepts the following parameters:
  14489. @table @option
  14490. @item mode
  14491. The interlacing mode to adopt. It accepts one of the following values:
  14492. @table @option
  14493. @item 0, send_frame
  14494. Output one frame for each frame.
  14495. @item 1, send_field
  14496. Output one frame for each field.
  14497. @item 2, send_frame_nospatial
  14498. Like @code{send_frame}, but it skips the spatial interlacing check.
  14499. @item 3, send_field_nospatial
  14500. Like @code{send_field}, but it skips the spatial interlacing check.
  14501. @end table
  14502. The default value is @code{send_frame}.
  14503. @item parity
  14504. The picture field parity assumed for the input interlaced video. It accepts one
  14505. of the following values:
  14506. @table @option
  14507. @item 0, tff
  14508. Assume the top field is first.
  14509. @item 1, bff
  14510. Assume the bottom field is first.
  14511. @item -1, auto
  14512. Enable automatic detection of field parity.
  14513. @end table
  14514. The default value is @code{auto}.
  14515. If the interlacing is unknown or the decoder does not export this information,
  14516. top field first will be assumed.
  14517. @item deint
  14518. Specify which frames to deinterlace. Accept one of the following
  14519. values:
  14520. @table @option
  14521. @item 0, all
  14522. Deinterlace all frames.
  14523. @item 1, interlaced
  14524. Only deinterlace frames marked as interlaced.
  14525. @end table
  14526. The default value is @code{all}.
  14527. @end table
  14528. @section yadif_cuda
  14529. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14530. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14531. and/or nvenc.
  14532. It accepts the following parameters:
  14533. @table @option
  14534. @item mode
  14535. The interlacing mode to adopt. It accepts one of the following values:
  14536. @table @option
  14537. @item 0, send_frame
  14538. Output one frame for each frame.
  14539. @item 1, send_field
  14540. Output one frame for each field.
  14541. @item 2, send_frame_nospatial
  14542. Like @code{send_frame}, but it skips the spatial interlacing check.
  14543. @item 3, send_field_nospatial
  14544. Like @code{send_field}, but it skips the spatial interlacing check.
  14545. @end table
  14546. The default value is @code{send_frame}.
  14547. @item parity
  14548. The picture field parity assumed for the input interlaced video. It accepts one
  14549. of the following values:
  14550. @table @option
  14551. @item 0, tff
  14552. Assume the top field is first.
  14553. @item 1, bff
  14554. Assume the bottom field is first.
  14555. @item -1, auto
  14556. Enable automatic detection of field parity.
  14557. @end table
  14558. The default value is @code{auto}.
  14559. If the interlacing is unknown or the decoder does not export this information,
  14560. top field first will be assumed.
  14561. @item deint
  14562. Specify which frames to deinterlace. Accept one of the following
  14563. values:
  14564. @table @option
  14565. @item 0, all
  14566. Deinterlace all frames.
  14567. @item 1, interlaced
  14568. Only deinterlace frames marked as interlaced.
  14569. @end table
  14570. The default value is @code{all}.
  14571. @end table
  14572. @section zoompan
  14573. Apply Zoom & Pan effect.
  14574. This filter accepts the following options:
  14575. @table @option
  14576. @item zoom, z
  14577. Set the zoom expression. Range is 1-10. Default is 1.
  14578. @item x
  14579. @item y
  14580. Set the x and y expression. Default is 0.
  14581. @item d
  14582. Set the duration expression in number of frames.
  14583. This sets for how many number of frames effect will last for
  14584. single input image.
  14585. @item s
  14586. Set the output image size, default is 'hd720'.
  14587. @item fps
  14588. Set the output frame rate, default is '25'.
  14589. @end table
  14590. Each expression can contain the following constants:
  14591. @table @option
  14592. @item in_w, iw
  14593. Input width.
  14594. @item in_h, ih
  14595. Input height.
  14596. @item out_w, ow
  14597. Output width.
  14598. @item out_h, oh
  14599. Output height.
  14600. @item in
  14601. Input frame count.
  14602. @item on
  14603. Output frame count.
  14604. @item x
  14605. @item y
  14606. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14607. for current input frame.
  14608. @item px
  14609. @item py
  14610. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14611. not yet such frame (first input frame).
  14612. @item zoom
  14613. Last calculated zoom from 'z' expression for current input frame.
  14614. @item pzoom
  14615. Last calculated zoom of last output frame of previous input frame.
  14616. @item duration
  14617. Number of output frames for current input frame. Calculated from 'd' expression
  14618. for each input frame.
  14619. @item pduration
  14620. number of output frames created for previous input frame
  14621. @item a
  14622. Rational number: input width / input height
  14623. @item sar
  14624. sample aspect ratio
  14625. @item dar
  14626. display aspect ratio
  14627. @end table
  14628. @subsection Examples
  14629. @itemize
  14630. @item
  14631. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14632. @example
  14633. 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
  14634. @end example
  14635. @item
  14636. Zoom-in up to 1.5 and pan always at center of picture:
  14637. @example
  14638. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14639. @end example
  14640. @item
  14641. Same as above but without pausing:
  14642. @example
  14643. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14644. @end example
  14645. @end itemize
  14646. @anchor{zscale}
  14647. @section zscale
  14648. Scale (resize) the input video, using the z.lib library:
  14649. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14650. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14651. The zscale filter forces the output display aspect ratio to be the same
  14652. as the input, by changing the output sample aspect ratio.
  14653. If the input image format is different from the format requested by
  14654. the next filter, the zscale filter will convert the input to the
  14655. requested format.
  14656. @subsection Options
  14657. The filter accepts the following options.
  14658. @table @option
  14659. @item width, w
  14660. @item height, h
  14661. Set the output video dimension expression. Default value is the input
  14662. dimension.
  14663. If the @var{width} or @var{w} value is 0, the input width is used for
  14664. the output. If the @var{height} or @var{h} value is 0, the input height
  14665. is used for the output.
  14666. If one and only one of the values is -n with n >= 1, the zscale filter
  14667. will use a value that maintains the aspect ratio of the input image,
  14668. calculated from the other specified dimension. After that it will,
  14669. however, make sure that the calculated dimension is divisible by n and
  14670. adjust the value if necessary.
  14671. If both values are -n with n >= 1, the behavior will be identical to
  14672. both values being set to 0 as previously detailed.
  14673. See below for the list of accepted constants for use in the dimension
  14674. expression.
  14675. @item size, s
  14676. Set the video size. For the syntax of this option, check the
  14677. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14678. @item dither, d
  14679. Set the dither type.
  14680. Possible values are:
  14681. @table @var
  14682. @item none
  14683. @item ordered
  14684. @item random
  14685. @item error_diffusion
  14686. @end table
  14687. Default is none.
  14688. @item filter, f
  14689. Set the resize filter type.
  14690. Possible values are:
  14691. @table @var
  14692. @item point
  14693. @item bilinear
  14694. @item bicubic
  14695. @item spline16
  14696. @item spline36
  14697. @item lanczos
  14698. @end table
  14699. Default is bilinear.
  14700. @item range, r
  14701. Set the color range.
  14702. Possible values are:
  14703. @table @var
  14704. @item input
  14705. @item limited
  14706. @item full
  14707. @end table
  14708. Default is same as input.
  14709. @item primaries, p
  14710. Set the color primaries.
  14711. Possible values are:
  14712. @table @var
  14713. @item input
  14714. @item 709
  14715. @item unspecified
  14716. @item 170m
  14717. @item 240m
  14718. @item 2020
  14719. @end table
  14720. Default is same as input.
  14721. @item transfer, t
  14722. Set the transfer characteristics.
  14723. Possible values are:
  14724. @table @var
  14725. @item input
  14726. @item 709
  14727. @item unspecified
  14728. @item 601
  14729. @item linear
  14730. @item 2020_10
  14731. @item 2020_12
  14732. @item smpte2084
  14733. @item iec61966-2-1
  14734. @item arib-std-b67
  14735. @end table
  14736. Default is same as input.
  14737. @item matrix, m
  14738. Set the colorspace matrix.
  14739. Possible value are:
  14740. @table @var
  14741. @item input
  14742. @item 709
  14743. @item unspecified
  14744. @item 470bg
  14745. @item 170m
  14746. @item 2020_ncl
  14747. @item 2020_cl
  14748. @end table
  14749. Default is same as input.
  14750. @item rangein, rin
  14751. Set the input color range.
  14752. Possible values are:
  14753. @table @var
  14754. @item input
  14755. @item limited
  14756. @item full
  14757. @end table
  14758. Default is same as input.
  14759. @item primariesin, pin
  14760. Set the input color primaries.
  14761. Possible values are:
  14762. @table @var
  14763. @item input
  14764. @item 709
  14765. @item unspecified
  14766. @item 170m
  14767. @item 240m
  14768. @item 2020
  14769. @end table
  14770. Default is same as input.
  14771. @item transferin, tin
  14772. Set the input transfer characteristics.
  14773. Possible values are:
  14774. @table @var
  14775. @item input
  14776. @item 709
  14777. @item unspecified
  14778. @item 601
  14779. @item linear
  14780. @item 2020_10
  14781. @item 2020_12
  14782. @end table
  14783. Default is same as input.
  14784. @item matrixin, min
  14785. Set the input colorspace matrix.
  14786. Possible value are:
  14787. @table @var
  14788. @item input
  14789. @item 709
  14790. @item unspecified
  14791. @item 470bg
  14792. @item 170m
  14793. @item 2020_ncl
  14794. @item 2020_cl
  14795. @end table
  14796. @item chromal, c
  14797. Set the output chroma location.
  14798. Possible values are:
  14799. @table @var
  14800. @item input
  14801. @item left
  14802. @item center
  14803. @item topleft
  14804. @item top
  14805. @item bottomleft
  14806. @item bottom
  14807. @end table
  14808. @item chromalin, cin
  14809. Set the input chroma location.
  14810. Possible values are:
  14811. @table @var
  14812. @item input
  14813. @item left
  14814. @item center
  14815. @item topleft
  14816. @item top
  14817. @item bottomleft
  14818. @item bottom
  14819. @end table
  14820. @item npl
  14821. Set the nominal peak luminance.
  14822. @end table
  14823. The values of the @option{w} and @option{h} options are expressions
  14824. containing the following constants:
  14825. @table @var
  14826. @item in_w
  14827. @item in_h
  14828. The input width and height
  14829. @item iw
  14830. @item ih
  14831. These are the same as @var{in_w} and @var{in_h}.
  14832. @item out_w
  14833. @item out_h
  14834. The output (scaled) width and height
  14835. @item ow
  14836. @item oh
  14837. These are the same as @var{out_w} and @var{out_h}
  14838. @item a
  14839. The same as @var{iw} / @var{ih}
  14840. @item sar
  14841. input sample aspect ratio
  14842. @item dar
  14843. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14844. @item hsub
  14845. @item vsub
  14846. horizontal and vertical input chroma subsample values. For example for the
  14847. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14848. @item ohsub
  14849. @item ovsub
  14850. horizontal and vertical output chroma subsample values. For example for the
  14851. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14852. @end table
  14853. @table @option
  14854. @end table
  14855. @c man end VIDEO FILTERS
  14856. @chapter OpenCL Video Filters
  14857. @c man begin OPENCL VIDEO FILTERS
  14858. Below is a description of the currently available OpenCL video filters.
  14859. To enable compilation of these filters you need to configure FFmpeg with
  14860. @code{--enable-opencl}.
  14861. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14862. @table @option
  14863. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14864. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14865. given device parameters.
  14866. @item -filter_hw_device @var{name}
  14867. Pass the hardware device called @var{name} to all filters in any filter graph.
  14868. @end table
  14869. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14870. @itemize
  14871. @item
  14872. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14873. @example
  14874. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14875. @end example
  14876. @end itemize
  14877. 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.
  14878. @section avgblur_opencl
  14879. Apply average blur filter.
  14880. The filter accepts the following options:
  14881. @table @option
  14882. @item sizeX
  14883. Set horizontal radius size.
  14884. Range is @code{[1, 1024]} and default value is @code{1}.
  14885. @item planes
  14886. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14887. @item sizeY
  14888. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14889. @end table
  14890. @subsection Example
  14891. @itemize
  14892. @item
  14893. 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.
  14894. @example
  14895. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14896. @end example
  14897. @end itemize
  14898. @section boxblur_opencl
  14899. Apply a boxblur algorithm to the input video.
  14900. It accepts the following parameters:
  14901. @table @option
  14902. @item luma_radius, lr
  14903. @item luma_power, lp
  14904. @item chroma_radius, cr
  14905. @item chroma_power, cp
  14906. @item alpha_radius, ar
  14907. @item alpha_power, ap
  14908. @end table
  14909. A description of the accepted options follows.
  14910. @table @option
  14911. @item luma_radius, lr
  14912. @item chroma_radius, cr
  14913. @item alpha_radius, ar
  14914. Set an expression for the box radius in pixels used for blurring the
  14915. corresponding input plane.
  14916. The radius value must be a non-negative number, and must not be
  14917. greater than the value of the expression @code{min(w,h)/2} for the
  14918. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14919. planes.
  14920. Default value for @option{luma_radius} is "2". If not specified,
  14921. @option{chroma_radius} and @option{alpha_radius} default to the
  14922. corresponding value set for @option{luma_radius}.
  14923. The expressions can contain the following constants:
  14924. @table @option
  14925. @item w
  14926. @item h
  14927. The input width and height in pixels.
  14928. @item cw
  14929. @item ch
  14930. The input chroma image width and height in pixels.
  14931. @item hsub
  14932. @item vsub
  14933. The horizontal and vertical chroma subsample values. For example, for the
  14934. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14935. @end table
  14936. @item luma_power, lp
  14937. @item chroma_power, cp
  14938. @item alpha_power, ap
  14939. Specify how many times the boxblur filter is applied to the
  14940. corresponding plane.
  14941. Default value for @option{luma_power} is 2. If not specified,
  14942. @option{chroma_power} and @option{alpha_power} default to the
  14943. corresponding value set for @option{luma_power}.
  14944. A value of 0 will disable the effect.
  14945. @end table
  14946. @subsection Examples
  14947. 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.
  14948. @itemize
  14949. @item
  14950. Apply a boxblur filter with the luma, chroma, and alpha radius
  14951. 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.
  14952. @example
  14953. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14954. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14955. @end example
  14956. @item
  14957. 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.
  14958. For the luma plane, a 2x2 box radius will be run once.
  14959. For the chroma plane, a 4x4 box radius will be run 5 times.
  14960. For the alpha plane, a 3x3 box radius will be run 7 times.
  14961. @example
  14962. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14963. @end example
  14964. @end itemize
  14965. @section convolution_opencl
  14966. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14967. The filter accepts the following options:
  14968. @table @option
  14969. @item 0m
  14970. @item 1m
  14971. @item 2m
  14972. @item 3m
  14973. Set matrix for each plane.
  14974. Matrix is sequence of 9, 25 or 49 signed numbers.
  14975. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14976. @item 0rdiv
  14977. @item 1rdiv
  14978. @item 2rdiv
  14979. @item 3rdiv
  14980. Set multiplier for calculated value for each plane.
  14981. If unset or 0, it will be sum of all matrix elements.
  14982. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14983. @item 0bias
  14984. @item 1bias
  14985. @item 2bias
  14986. @item 3bias
  14987. Set bias for each plane. This value is added to the result of the multiplication.
  14988. Useful for making the overall image brighter or darker.
  14989. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14990. @end table
  14991. @subsection Examples
  14992. @itemize
  14993. @item
  14994. Apply sharpen:
  14995. @example
  14996. -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
  14997. @end example
  14998. @item
  14999. Apply blur:
  15000. @example
  15001. -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
  15002. @end example
  15003. @item
  15004. Apply edge enhance:
  15005. @example
  15006. -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
  15007. @end example
  15008. @item
  15009. Apply edge detect:
  15010. @example
  15011. -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
  15012. @end example
  15013. @item
  15014. Apply laplacian edge detector which includes diagonals:
  15015. @example
  15016. -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
  15017. @end example
  15018. @item
  15019. Apply emboss:
  15020. @example
  15021. -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
  15022. @end example
  15023. @end itemize
  15024. @section dilation_opencl
  15025. Apply dilation effect to the video.
  15026. This filter replaces the pixel by the local(3x3) maximum.
  15027. It accepts the following options:
  15028. @table @option
  15029. @item threshold0
  15030. @item threshold1
  15031. @item threshold2
  15032. @item threshold3
  15033. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15034. If @code{0}, plane will remain unchanged.
  15035. @item coordinates
  15036. Flag which specifies the pixel to refer to.
  15037. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15038. Flags to local 3x3 coordinates region centered on @code{x}:
  15039. 1 2 3
  15040. 4 x 5
  15041. 6 7 8
  15042. @end table
  15043. @subsection Example
  15044. @itemize
  15045. @item
  15046. 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.
  15047. @example
  15048. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15049. @end example
  15050. @end itemize
  15051. @section erosion_opencl
  15052. Apply erosion effect to the video.
  15053. This filter replaces the pixel by the local(3x3) minimum.
  15054. It accepts the following options:
  15055. @table @option
  15056. @item threshold0
  15057. @item threshold1
  15058. @item threshold2
  15059. @item threshold3
  15060. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15061. If @code{0}, plane will remain unchanged.
  15062. @item coordinates
  15063. Flag which specifies the pixel to refer to.
  15064. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15065. Flags to local 3x3 coordinates region centered on @code{x}:
  15066. 1 2 3
  15067. 4 x 5
  15068. 6 7 8
  15069. @end table
  15070. @subsection Example
  15071. @itemize
  15072. @item
  15073. 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.
  15074. @example
  15075. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15076. @end example
  15077. @end itemize
  15078. @section colorkey_opencl
  15079. RGB colorspace color keying.
  15080. The filter accepts the following options:
  15081. @table @option
  15082. @item color
  15083. The color which will be replaced with transparency.
  15084. @item similarity
  15085. Similarity percentage with the key color.
  15086. 0.01 matches only the exact key color, while 1.0 matches everything.
  15087. @item blend
  15088. Blend percentage.
  15089. 0.0 makes pixels either fully transparent, or not transparent at all.
  15090. Higher values result in semi-transparent pixels, with a higher transparency
  15091. the more similar the pixels color is to the key color.
  15092. @end table
  15093. @subsection Examples
  15094. @itemize
  15095. @item
  15096. Make every semi-green pixel in the input transparent with some slight blending:
  15097. @example
  15098. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15099. @end example
  15100. @end itemize
  15101. @section deshake_opencl
  15102. Feature-point based video stabilization filter.
  15103. The filter accepts the following options:
  15104. @table @option
  15105. @item tripod
  15106. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15107. @item debug
  15108. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15109. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15110. Viewing point matches in the output video is only supported for RGB input.
  15111. Defaults to @code{0}.
  15112. @item adaptive_crop
  15113. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15114. Defaults to @code{1}.
  15115. @item refine_features
  15116. Whether or not feature points should be refined at a sub-pixel level.
  15117. This can be turned off for a slight performance gain at the cost of precision.
  15118. Defaults to @code{1}.
  15119. @item smooth_strength
  15120. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15121. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15122. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15123. Defaults to @code{0.0}.
  15124. @item smooth_window_multiplier
  15125. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15126. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15127. Acceptable values range from @code{0.1} to @code{10.0}.
  15128. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15129. potentially improving smoothness, but also increase latency and memory usage.
  15130. Defaults to @code{2.0}.
  15131. @end table
  15132. @subsection Examples
  15133. @itemize
  15134. @item
  15135. Stabilize a video with a fixed, medium smoothing strength:
  15136. @example
  15137. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15138. @end example
  15139. @item
  15140. Stabilize a video with debugging (both in console and in rendered video):
  15141. @example
  15142. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15143. @end example
  15144. @end itemize
  15145. @section nlmeans_opencl
  15146. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15147. @section overlay_opencl
  15148. Overlay one video on top of another.
  15149. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15150. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15151. The filter accepts the following options:
  15152. @table @option
  15153. @item x
  15154. Set the x coordinate of the overlaid video on the main video.
  15155. Default value is @code{0}.
  15156. @item y
  15157. Set the x coordinate of the overlaid video on the main video.
  15158. Default value is @code{0}.
  15159. @end table
  15160. @subsection Examples
  15161. @itemize
  15162. @item
  15163. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15164. @example
  15165. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15166. @end example
  15167. @item
  15168. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15169. @example
  15170. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15171. @end example
  15172. @end itemize
  15173. @section prewitt_opencl
  15174. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15175. The filter accepts the following option:
  15176. @table @option
  15177. @item planes
  15178. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15179. @item scale
  15180. Set value which will be multiplied with filtered result.
  15181. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15182. @item delta
  15183. Set value which will be added to filtered result.
  15184. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15185. @end table
  15186. @subsection Example
  15187. @itemize
  15188. @item
  15189. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15190. @example
  15191. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15192. @end example
  15193. @end itemize
  15194. @section roberts_opencl
  15195. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15196. The filter accepts the following option:
  15197. @table @option
  15198. @item planes
  15199. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15200. @item scale
  15201. Set value which will be multiplied with filtered result.
  15202. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15203. @item delta
  15204. Set value which will be added to filtered result.
  15205. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15206. @end table
  15207. @subsection Example
  15208. @itemize
  15209. @item
  15210. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15211. @example
  15212. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15213. @end example
  15214. @end itemize
  15215. @section sobel_opencl
  15216. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15217. The filter accepts the following option:
  15218. @table @option
  15219. @item planes
  15220. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15221. @item scale
  15222. Set value which will be multiplied with filtered result.
  15223. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15224. @item delta
  15225. Set value which will be added to filtered result.
  15226. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15227. @end table
  15228. @subsection Example
  15229. @itemize
  15230. @item
  15231. Apply sobel operator with scale set to 2 and delta set to 10
  15232. @example
  15233. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15234. @end example
  15235. @end itemize
  15236. @section tonemap_opencl
  15237. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15238. It accepts the following parameters:
  15239. @table @option
  15240. @item tonemap
  15241. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15242. @item param
  15243. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15244. @item desat
  15245. Apply desaturation for highlights that exceed this level of brightness. The
  15246. higher the parameter, the more color information will be preserved. This
  15247. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15248. (smoothly) turning into white instead. This makes images feel more natural,
  15249. at the cost of reducing information about out-of-range colors.
  15250. The default value is 0.5, and the algorithm here is a little different from
  15251. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15252. @item threshold
  15253. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15254. is used to detect whether the scene has changed or not. If the distance between
  15255. the current frame average brightness and the current running average exceeds
  15256. a threshold value, we would re-calculate scene average and peak brightness.
  15257. The default value is 0.2.
  15258. @item format
  15259. Specify the output pixel format.
  15260. Currently supported formats are:
  15261. @table @var
  15262. @item p010
  15263. @item nv12
  15264. @end table
  15265. @item range, r
  15266. Set the output color range.
  15267. Possible values are:
  15268. @table @var
  15269. @item tv/mpeg
  15270. @item pc/jpeg
  15271. @end table
  15272. Default is same as input.
  15273. @item primaries, p
  15274. Set the output color primaries.
  15275. Possible values are:
  15276. @table @var
  15277. @item bt709
  15278. @item bt2020
  15279. @end table
  15280. Default is same as input.
  15281. @item transfer, t
  15282. Set the output transfer characteristics.
  15283. Possible values are:
  15284. @table @var
  15285. @item bt709
  15286. @item bt2020
  15287. @end table
  15288. Default is bt709.
  15289. @item matrix, m
  15290. Set the output colorspace matrix.
  15291. Possible value are:
  15292. @table @var
  15293. @item bt709
  15294. @item bt2020
  15295. @end table
  15296. Default is same as input.
  15297. @end table
  15298. @subsection Example
  15299. @itemize
  15300. @item
  15301. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15302. @example
  15303. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15304. @end example
  15305. @end itemize
  15306. @section unsharp_opencl
  15307. Sharpen or blur the input video.
  15308. It accepts the following parameters:
  15309. @table @option
  15310. @item luma_msize_x, lx
  15311. Set the luma matrix horizontal size.
  15312. Range is @code{[1, 23]} and default value is @code{5}.
  15313. @item luma_msize_y, ly
  15314. Set the luma matrix vertical size.
  15315. Range is @code{[1, 23]} and default value is @code{5}.
  15316. @item luma_amount, la
  15317. Set the luma effect strength.
  15318. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15319. Negative values will blur the input video, while positive values will
  15320. sharpen it, a value of zero will disable the effect.
  15321. @item chroma_msize_x, cx
  15322. Set the chroma matrix horizontal size.
  15323. Range is @code{[1, 23]} and default value is @code{5}.
  15324. @item chroma_msize_y, cy
  15325. Set the chroma matrix vertical size.
  15326. Range is @code{[1, 23]} and default value is @code{5}.
  15327. @item chroma_amount, ca
  15328. Set the chroma effect strength.
  15329. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15330. Negative values will blur the input video, while positive values will
  15331. sharpen it, a value of zero will disable the effect.
  15332. @end table
  15333. All parameters are optional and default to the equivalent of the
  15334. string '5:5:1.0:5:5:0.0'.
  15335. @subsection Examples
  15336. @itemize
  15337. @item
  15338. Apply strong luma sharpen effect:
  15339. @example
  15340. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15341. @end example
  15342. @item
  15343. Apply a strong blur of both luma and chroma parameters:
  15344. @example
  15345. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15346. @end example
  15347. @end itemize
  15348. @c man end OPENCL VIDEO FILTERS
  15349. @chapter Video Sources
  15350. @c man begin VIDEO SOURCES
  15351. Below is a description of the currently available video sources.
  15352. @section buffer
  15353. Buffer video frames, and make them available to the filter chain.
  15354. This source is mainly intended for a programmatic use, in particular
  15355. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15356. It accepts the following parameters:
  15357. @table @option
  15358. @item video_size
  15359. Specify the size (width and height) of the buffered video frames. For the
  15360. syntax of this option, check the
  15361. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15362. @item width
  15363. The input video width.
  15364. @item height
  15365. The input video height.
  15366. @item pix_fmt
  15367. A string representing the pixel format of the buffered video frames.
  15368. It may be a number corresponding to a pixel format, or a pixel format
  15369. name.
  15370. @item time_base
  15371. Specify the timebase assumed by the timestamps of the buffered frames.
  15372. @item frame_rate
  15373. Specify the frame rate expected for the video stream.
  15374. @item pixel_aspect, sar
  15375. The sample (pixel) aspect ratio of the input video.
  15376. @item sws_param
  15377. Specify the optional parameters to be used for the scale filter which
  15378. is automatically inserted when an input change is detected in the
  15379. input size or format.
  15380. @item hw_frames_ctx
  15381. When using a hardware pixel format, this should be a reference to an
  15382. AVHWFramesContext describing input frames.
  15383. @end table
  15384. For example:
  15385. @example
  15386. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15387. @end example
  15388. will instruct the source to accept video frames with size 320x240 and
  15389. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15390. square pixels (1:1 sample aspect ratio).
  15391. Since the pixel format with name "yuv410p" corresponds to the number 6
  15392. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15393. this example corresponds to:
  15394. @example
  15395. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15396. @end example
  15397. Alternatively, the options can be specified as a flat string, but this
  15398. syntax is deprecated:
  15399. @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}]
  15400. @section cellauto
  15401. Create a pattern generated by an elementary cellular automaton.
  15402. The initial state of the cellular automaton can be defined through the
  15403. @option{filename} and @option{pattern} options. If such options are
  15404. not specified an initial state is created randomly.
  15405. At each new frame a new row in the video is filled with the result of
  15406. the cellular automaton next generation. The behavior when the whole
  15407. frame is filled is defined by the @option{scroll} option.
  15408. This source accepts the following options:
  15409. @table @option
  15410. @item filename, f
  15411. Read the initial cellular automaton state, i.e. the starting row, from
  15412. the specified file.
  15413. In the file, each non-whitespace character is considered an alive
  15414. cell, a newline will terminate the row, and further characters in the
  15415. file will be ignored.
  15416. @item pattern, p
  15417. Read the initial cellular automaton state, i.e. the starting row, from
  15418. the specified string.
  15419. Each non-whitespace character in the string is considered an alive
  15420. cell, a newline will terminate the row, and further characters in the
  15421. string will be ignored.
  15422. @item rate, r
  15423. Set the video rate, that is the number of frames generated per second.
  15424. Default is 25.
  15425. @item random_fill_ratio, ratio
  15426. Set the random fill ratio for the initial cellular automaton row. It
  15427. is a floating point number value ranging from 0 to 1, defaults to
  15428. 1/PHI.
  15429. This option is ignored when a file or a pattern is specified.
  15430. @item random_seed, seed
  15431. Set the seed for filling randomly the initial row, must be an integer
  15432. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15433. set to -1, the filter will try to use a good random seed on a best
  15434. effort basis.
  15435. @item rule
  15436. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15437. Default value is 110.
  15438. @item size, s
  15439. Set the size of the output video. For the syntax of this option, check the
  15440. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15441. If @option{filename} or @option{pattern} is specified, the size is set
  15442. by default to the width of the specified initial state row, and the
  15443. height is set to @var{width} * PHI.
  15444. If @option{size} is set, it must contain the width of the specified
  15445. pattern string, and the specified pattern will be centered in the
  15446. larger row.
  15447. If a filename or a pattern string is not specified, the size value
  15448. defaults to "320x518" (used for a randomly generated initial state).
  15449. @item scroll
  15450. If set to 1, scroll the output upward when all the rows in the output
  15451. have been already filled. If set to 0, the new generated row will be
  15452. written over the top row just after the bottom row is filled.
  15453. Defaults to 1.
  15454. @item start_full, full
  15455. If set to 1, completely fill the output with generated rows before
  15456. outputting the first frame.
  15457. This is the default behavior, for disabling set the value to 0.
  15458. @item stitch
  15459. If set to 1, stitch the left and right row edges together.
  15460. This is the default behavior, for disabling set the value to 0.
  15461. @end table
  15462. @subsection Examples
  15463. @itemize
  15464. @item
  15465. Read the initial state from @file{pattern}, and specify an output of
  15466. size 200x400.
  15467. @example
  15468. cellauto=f=pattern:s=200x400
  15469. @end example
  15470. @item
  15471. Generate a random initial row with a width of 200 cells, with a fill
  15472. ratio of 2/3:
  15473. @example
  15474. cellauto=ratio=2/3:s=200x200
  15475. @end example
  15476. @item
  15477. Create a pattern generated by rule 18 starting by a single alive cell
  15478. centered on an initial row with width 100:
  15479. @example
  15480. cellauto=p=@@:s=100x400:full=0:rule=18
  15481. @end example
  15482. @item
  15483. Specify a more elaborated initial pattern:
  15484. @example
  15485. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15486. @end example
  15487. @end itemize
  15488. @anchor{coreimagesrc}
  15489. @section coreimagesrc
  15490. Video source generated on GPU using Apple's CoreImage API on OSX.
  15491. This video source is a specialized version of the @ref{coreimage} video filter.
  15492. Use a core image generator at the beginning of the applied filterchain to
  15493. generate the content.
  15494. The coreimagesrc video source accepts the following options:
  15495. @table @option
  15496. @item list_generators
  15497. List all available generators along with all their respective options as well as
  15498. possible minimum and maximum values along with the default values.
  15499. @example
  15500. list_generators=true
  15501. @end example
  15502. @item size, s
  15503. Specify the size of the sourced video. For the syntax of this option, check the
  15504. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15505. The default value is @code{320x240}.
  15506. @item rate, r
  15507. Specify the frame rate of the sourced video, as the number of frames
  15508. generated per second. It has to be a string in the format
  15509. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15510. number or a valid video frame rate abbreviation. The default value is
  15511. "25".
  15512. @item sar
  15513. Set the sample aspect ratio of the sourced video.
  15514. @item duration, d
  15515. Set the duration of the sourced video. See
  15516. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15517. for the accepted syntax.
  15518. If not specified, or the expressed duration is negative, the video is
  15519. supposed to be generated forever.
  15520. @end table
  15521. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15522. A complete filterchain can be used for further processing of the
  15523. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15524. and examples for details.
  15525. @subsection Examples
  15526. @itemize
  15527. @item
  15528. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15529. given as complete and escaped command-line for Apple's standard bash shell:
  15530. @example
  15531. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15532. @end example
  15533. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15534. need for a nullsrc video source.
  15535. @end itemize
  15536. @section mandelbrot
  15537. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15538. point specified with @var{start_x} and @var{start_y}.
  15539. This source accepts the following options:
  15540. @table @option
  15541. @item end_pts
  15542. Set the terminal pts value. Default value is 400.
  15543. @item end_scale
  15544. Set the terminal scale value.
  15545. Must be a floating point value. Default value is 0.3.
  15546. @item inner
  15547. Set the inner coloring mode, that is the algorithm used to draw the
  15548. Mandelbrot fractal internal region.
  15549. It shall assume one of the following values:
  15550. @table @option
  15551. @item black
  15552. Set black mode.
  15553. @item convergence
  15554. Show time until convergence.
  15555. @item mincol
  15556. Set color based on point closest to the origin of the iterations.
  15557. @item period
  15558. Set period mode.
  15559. @end table
  15560. Default value is @var{mincol}.
  15561. @item bailout
  15562. Set the bailout value. Default value is 10.0.
  15563. @item maxiter
  15564. Set the maximum of iterations performed by the rendering
  15565. algorithm. Default value is 7189.
  15566. @item outer
  15567. Set outer coloring mode.
  15568. It shall assume one of following values:
  15569. @table @option
  15570. @item iteration_count
  15571. Set iteration count mode.
  15572. @item normalized_iteration_count
  15573. set normalized iteration count mode.
  15574. @end table
  15575. Default value is @var{normalized_iteration_count}.
  15576. @item rate, r
  15577. Set frame rate, expressed as number of frames per second. Default
  15578. value is "25".
  15579. @item size, s
  15580. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15581. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15582. @item start_scale
  15583. Set the initial scale value. Default value is 3.0.
  15584. @item start_x
  15585. Set the initial x position. Must be a floating point value between
  15586. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15587. @item start_y
  15588. Set the initial y position. Must be a floating point value between
  15589. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15590. @end table
  15591. @section mptestsrc
  15592. Generate various test patterns, as generated by the MPlayer test filter.
  15593. The size of the generated video is fixed, and is 256x256.
  15594. This source is useful in particular for testing encoding features.
  15595. This source accepts the following options:
  15596. @table @option
  15597. @item rate, r
  15598. Specify the frame rate of the sourced video, as the number of frames
  15599. generated per second. It has to be a string in the format
  15600. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15601. number or a valid video frame rate abbreviation. The default value is
  15602. "25".
  15603. @item duration, d
  15604. Set the duration of the sourced video. See
  15605. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15606. for the accepted syntax.
  15607. If not specified, or the expressed duration is negative, the video is
  15608. supposed to be generated forever.
  15609. @item test, t
  15610. Set the number or the name of the test to perform. Supported tests are:
  15611. @table @option
  15612. @item dc_luma
  15613. @item dc_chroma
  15614. @item freq_luma
  15615. @item freq_chroma
  15616. @item amp_luma
  15617. @item amp_chroma
  15618. @item cbp
  15619. @item mv
  15620. @item ring1
  15621. @item ring2
  15622. @item all
  15623. @end table
  15624. Default value is "all", which will cycle through the list of all tests.
  15625. @end table
  15626. Some examples:
  15627. @example
  15628. mptestsrc=t=dc_luma
  15629. @end example
  15630. will generate a "dc_luma" test pattern.
  15631. @section frei0r_src
  15632. Provide a frei0r source.
  15633. To enable compilation of this filter you need to install the frei0r
  15634. header and configure FFmpeg with @code{--enable-frei0r}.
  15635. This source accepts the following parameters:
  15636. @table @option
  15637. @item size
  15638. The size of the video to generate. For the syntax of this option, check the
  15639. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15640. @item framerate
  15641. The framerate of the generated video. It may be a string of the form
  15642. @var{num}/@var{den} or a frame rate abbreviation.
  15643. @item filter_name
  15644. The name to the frei0r source to load. For more information regarding frei0r and
  15645. how to set the parameters, read the @ref{frei0r} section in the video filters
  15646. documentation.
  15647. @item filter_params
  15648. A '|'-separated list of parameters to pass to the frei0r source.
  15649. @end table
  15650. For example, to generate a frei0r partik0l source with size 200x200
  15651. and frame rate 10 which is overlaid on the overlay filter main input:
  15652. @example
  15653. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15654. @end example
  15655. @section life
  15656. Generate a life pattern.
  15657. This source is based on a generalization of John Conway's life game.
  15658. The sourced input represents a life grid, each pixel represents a cell
  15659. which can be in one of two possible states, alive or dead. Every cell
  15660. interacts with its eight neighbours, which are the cells that are
  15661. horizontally, vertically, or diagonally adjacent.
  15662. At each interaction the grid evolves according to the adopted rule,
  15663. which specifies the number of neighbor alive cells which will make a
  15664. cell stay alive or born. The @option{rule} option allows one to specify
  15665. the rule to adopt.
  15666. This source accepts the following options:
  15667. @table @option
  15668. @item filename, f
  15669. Set the file from which to read the initial grid state. In the file,
  15670. each non-whitespace character is considered an alive cell, and newline
  15671. is used to delimit the end of each row.
  15672. If this option is not specified, the initial grid is generated
  15673. randomly.
  15674. @item rate, r
  15675. Set the video rate, that is the number of frames generated per second.
  15676. Default is 25.
  15677. @item random_fill_ratio, ratio
  15678. Set the random fill ratio for the initial random grid. It is a
  15679. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15680. It is ignored when a file is specified.
  15681. @item random_seed, seed
  15682. Set the seed for filling the initial random grid, must be an integer
  15683. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15684. set to -1, the filter will try to use a good random seed on a best
  15685. effort basis.
  15686. @item rule
  15687. Set the life rule.
  15688. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15689. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15690. @var{NS} specifies the number of alive neighbor cells which make a
  15691. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15692. which make a dead cell to become alive (i.e. to "born").
  15693. "s" and "b" can be used in place of "S" and "B", respectively.
  15694. Alternatively a rule can be specified by an 18-bits integer. The 9
  15695. high order bits are used to encode the next cell state if it is alive
  15696. for each number of neighbor alive cells, the low order bits specify
  15697. the rule for "borning" new cells. Higher order bits encode for an
  15698. higher number of neighbor cells.
  15699. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15700. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15701. Default value is "S23/B3", which is the original Conway's game of life
  15702. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15703. cells, and will born a new cell if there are three alive cells around
  15704. a dead cell.
  15705. @item size, s
  15706. Set the size of the output video. For the syntax of this option, check the
  15707. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15708. If @option{filename} is specified, the size is set by default to the
  15709. same size of the input file. If @option{size} is set, it must contain
  15710. the size specified in the input file, and the initial grid defined in
  15711. that file is centered in the larger resulting area.
  15712. If a filename is not specified, the size value defaults to "320x240"
  15713. (used for a randomly generated initial grid).
  15714. @item stitch
  15715. If set to 1, stitch the left and right grid edges together, and the
  15716. top and bottom edges also. Defaults to 1.
  15717. @item mold
  15718. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15719. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15720. value from 0 to 255.
  15721. @item life_color
  15722. Set the color of living (or new born) cells.
  15723. @item death_color
  15724. Set the color of dead cells. If @option{mold} is set, this is the first color
  15725. used to represent a dead cell.
  15726. @item mold_color
  15727. Set mold color, for definitely dead and moldy cells.
  15728. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15729. ffmpeg-utils manual,ffmpeg-utils}.
  15730. @end table
  15731. @subsection Examples
  15732. @itemize
  15733. @item
  15734. Read a grid from @file{pattern}, and center it on a grid of size
  15735. 300x300 pixels:
  15736. @example
  15737. life=f=pattern:s=300x300
  15738. @end example
  15739. @item
  15740. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15741. @example
  15742. life=ratio=2/3:s=200x200
  15743. @end example
  15744. @item
  15745. Specify a custom rule for evolving a randomly generated grid:
  15746. @example
  15747. life=rule=S14/B34
  15748. @end example
  15749. @item
  15750. Full example with slow death effect (mold) using @command{ffplay}:
  15751. @example
  15752. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15753. @end example
  15754. @end itemize
  15755. @anchor{allrgb}
  15756. @anchor{allyuv}
  15757. @anchor{color}
  15758. @anchor{haldclutsrc}
  15759. @anchor{nullsrc}
  15760. @anchor{pal75bars}
  15761. @anchor{pal100bars}
  15762. @anchor{rgbtestsrc}
  15763. @anchor{smptebars}
  15764. @anchor{smptehdbars}
  15765. @anchor{testsrc}
  15766. @anchor{testsrc2}
  15767. @anchor{yuvtestsrc}
  15768. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15769. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15770. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15771. The @code{color} source provides an uniformly colored input.
  15772. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15773. @ref{haldclut} filter.
  15774. The @code{nullsrc} source returns unprocessed video frames. It is
  15775. mainly useful to be employed in analysis / debugging tools, or as the
  15776. source for filters which ignore the input data.
  15777. The @code{pal75bars} source generates a color bars pattern, based on
  15778. EBU PAL recommendations with 75% color levels.
  15779. The @code{pal100bars} source generates a color bars pattern, based on
  15780. EBU PAL recommendations with 100% color levels.
  15781. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15782. detecting RGB vs BGR issues. You should see a red, green and blue
  15783. stripe from top to bottom.
  15784. The @code{smptebars} source generates a color bars pattern, based on
  15785. the SMPTE Engineering Guideline EG 1-1990.
  15786. The @code{smptehdbars} source generates a color bars pattern, based on
  15787. the SMPTE RP 219-2002.
  15788. The @code{testsrc} source generates a test video pattern, showing a
  15789. color pattern, a scrolling gradient and a timestamp. This is mainly
  15790. intended for testing purposes.
  15791. The @code{testsrc2} source is similar to testsrc, but supports more
  15792. pixel formats instead of just @code{rgb24}. This allows using it as an
  15793. input for other tests without requiring a format conversion.
  15794. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15795. see a y, cb and cr stripe from top to bottom.
  15796. The sources accept the following parameters:
  15797. @table @option
  15798. @item level
  15799. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15800. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15801. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15802. coded on a @code{1/(N*N)} scale.
  15803. @item color, c
  15804. Specify the color of the source, only available in the @code{color}
  15805. source. For the syntax of this option, check the
  15806. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15807. @item size, s
  15808. Specify the size of the sourced video. For the syntax of this option, check the
  15809. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15810. The default value is @code{320x240}.
  15811. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15812. @code{haldclutsrc} filters.
  15813. @item rate, r
  15814. Specify the frame rate of the sourced video, as the number of frames
  15815. generated per second. It has to be a string in the format
  15816. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15817. number or a valid video frame rate abbreviation. The default value is
  15818. "25".
  15819. @item duration, d
  15820. Set the duration of the sourced video. See
  15821. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15822. for the accepted syntax.
  15823. If not specified, or the expressed duration is negative, the video is
  15824. supposed to be generated forever.
  15825. @item sar
  15826. Set the sample aspect ratio of the sourced video.
  15827. @item alpha
  15828. Specify the alpha (opacity) of the background, only available in the
  15829. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15830. 255 (fully opaque, the default).
  15831. @item decimals, n
  15832. Set the number of decimals to show in the timestamp, only available in the
  15833. @code{testsrc} source.
  15834. The displayed timestamp value will correspond to the original
  15835. timestamp value multiplied by the power of 10 of the specified
  15836. value. Default value is 0.
  15837. @end table
  15838. @subsection Examples
  15839. @itemize
  15840. @item
  15841. Generate a video with a duration of 5.3 seconds, with size
  15842. 176x144 and a frame rate of 10 frames per second:
  15843. @example
  15844. testsrc=duration=5.3:size=qcif:rate=10
  15845. @end example
  15846. @item
  15847. The following graph description will generate a red source
  15848. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15849. frames per second:
  15850. @example
  15851. color=c=red@@0.2:s=qcif:r=10
  15852. @end example
  15853. @item
  15854. If the input content is to be ignored, @code{nullsrc} can be used. The
  15855. following command generates noise in the luminance plane by employing
  15856. the @code{geq} filter:
  15857. @example
  15858. nullsrc=s=256x256, geq=random(1)*255:128:128
  15859. @end example
  15860. @end itemize
  15861. @subsection Commands
  15862. The @code{color} source supports the following commands:
  15863. @table @option
  15864. @item c, color
  15865. Set the color of the created image. Accepts the same syntax of the
  15866. corresponding @option{color} option.
  15867. @end table
  15868. @section openclsrc
  15869. Generate video using an OpenCL program.
  15870. @table @option
  15871. @item source
  15872. OpenCL program source file.
  15873. @item kernel
  15874. Kernel name in program.
  15875. @item size, s
  15876. Size of frames to generate. This must be set.
  15877. @item format
  15878. Pixel format to use for the generated frames. This must be set.
  15879. @item rate, r
  15880. Number of frames generated every second. Default value is '25'.
  15881. @end table
  15882. For details of how the program loading works, see the @ref{program_opencl}
  15883. filter.
  15884. Example programs:
  15885. @itemize
  15886. @item
  15887. Generate a colour ramp by setting pixel values from the position of the pixel
  15888. in the output image. (Note that this will work with all pixel formats, but
  15889. the generated output will not be the same.)
  15890. @verbatim
  15891. __kernel void ramp(__write_only image2d_t dst,
  15892. unsigned int index)
  15893. {
  15894. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15895. float4 val;
  15896. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15897. write_imagef(dst, loc, val);
  15898. }
  15899. @end verbatim
  15900. @item
  15901. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15902. @verbatim
  15903. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15904. unsigned int index)
  15905. {
  15906. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15907. float4 value = 0.0f;
  15908. int x = loc.x + index;
  15909. int y = loc.y + index;
  15910. while (x > 0 || y > 0) {
  15911. if (x % 3 == 1 && y % 3 == 1) {
  15912. value = 1.0f;
  15913. break;
  15914. }
  15915. x /= 3;
  15916. y /= 3;
  15917. }
  15918. write_imagef(dst, loc, value);
  15919. }
  15920. @end verbatim
  15921. @end itemize
  15922. @c man end VIDEO SOURCES
  15923. @chapter Video Sinks
  15924. @c man begin VIDEO SINKS
  15925. Below is a description of the currently available video sinks.
  15926. @section buffersink
  15927. Buffer video frames, and make them available to the end of the filter
  15928. graph.
  15929. This sink is mainly intended for programmatic use, in particular
  15930. through the interface defined in @file{libavfilter/buffersink.h}
  15931. or the options system.
  15932. It accepts a pointer to an AVBufferSinkContext structure, which
  15933. defines the incoming buffers' formats, to be passed as the opaque
  15934. parameter to @code{avfilter_init_filter} for initialization.
  15935. @section nullsink
  15936. Null video sink: do absolutely nothing with the input video. It is
  15937. mainly useful as a template and for use in analysis / debugging
  15938. tools.
  15939. @c man end VIDEO SINKS
  15940. @chapter Multimedia Filters
  15941. @c man begin MULTIMEDIA FILTERS
  15942. Below is a description of the currently available multimedia filters.
  15943. @section abitscope
  15944. Convert input audio to a video output, displaying the audio bit scope.
  15945. The filter accepts the following options:
  15946. @table @option
  15947. @item rate, r
  15948. Set frame rate, expressed as number of frames per second. Default
  15949. value is "25".
  15950. @item size, s
  15951. Specify the video size for the output. For the syntax of this option, check the
  15952. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15953. Default value is @code{1024x256}.
  15954. @item colors
  15955. Specify list of colors separated by space or by '|' which will be used to
  15956. draw channels. Unrecognized or missing colors will be replaced
  15957. by white color.
  15958. @end table
  15959. @section ahistogram
  15960. Convert input audio to a video output, displaying the volume histogram.
  15961. The filter accepts the following options:
  15962. @table @option
  15963. @item dmode
  15964. Specify how histogram is calculated.
  15965. It accepts the following values:
  15966. @table @samp
  15967. @item single
  15968. Use single histogram for all channels.
  15969. @item separate
  15970. Use separate histogram for each channel.
  15971. @end table
  15972. Default is @code{single}.
  15973. @item rate, r
  15974. Set frame rate, expressed as number of frames per second. Default
  15975. value is "25".
  15976. @item size, s
  15977. Specify the video size for the output. For the syntax of this option, check the
  15978. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15979. Default value is @code{hd720}.
  15980. @item scale
  15981. Set display scale.
  15982. It accepts the following values:
  15983. @table @samp
  15984. @item log
  15985. logarithmic
  15986. @item sqrt
  15987. square root
  15988. @item cbrt
  15989. cubic root
  15990. @item lin
  15991. linear
  15992. @item rlog
  15993. reverse logarithmic
  15994. @end table
  15995. Default is @code{log}.
  15996. @item ascale
  15997. Set amplitude scale.
  15998. It accepts the following values:
  15999. @table @samp
  16000. @item log
  16001. logarithmic
  16002. @item lin
  16003. linear
  16004. @end table
  16005. Default is @code{log}.
  16006. @item acount
  16007. Set how much frames to accumulate in histogram.
  16008. Default is 1. Setting this to -1 accumulates all frames.
  16009. @item rheight
  16010. Set histogram ratio of window height.
  16011. @item slide
  16012. Set sonogram sliding.
  16013. It accepts the following values:
  16014. @table @samp
  16015. @item replace
  16016. replace old rows with new ones.
  16017. @item scroll
  16018. scroll from top to bottom.
  16019. @end table
  16020. Default is @code{replace}.
  16021. @end table
  16022. @section aphasemeter
  16023. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16024. representing mean phase of current audio frame. A video output can also be produced and is
  16025. enabled by default. The audio is passed through as first output.
  16026. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16027. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16028. and @code{1} means channels are in phase.
  16029. The filter accepts the following options, all related to its video output:
  16030. @table @option
  16031. @item rate, r
  16032. Set the output frame rate. Default value is @code{25}.
  16033. @item size, s
  16034. Set the video size for the output. For the syntax of this option, check the
  16035. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16036. Default value is @code{800x400}.
  16037. @item rc
  16038. @item gc
  16039. @item bc
  16040. Specify the red, green, blue contrast. Default values are @code{2},
  16041. @code{7} and @code{1}.
  16042. Allowed range is @code{[0, 255]}.
  16043. @item mpc
  16044. Set color which will be used for drawing median phase. If color is
  16045. @code{none} which is default, no median phase value will be drawn.
  16046. @item video
  16047. Enable video output. Default is enabled.
  16048. @end table
  16049. @section avectorscope
  16050. Convert input audio to a video output, representing the audio vector
  16051. scope.
  16052. The filter is used to measure the difference between channels of stereo
  16053. audio stream. A monoaural signal, consisting of identical left and right
  16054. signal, results in straight vertical line. Any stereo separation is visible
  16055. as a deviation from this line, creating a Lissajous figure.
  16056. If the straight (or deviation from it) but horizontal line appears this
  16057. indicates that the left and right channels are out of phase.
  16058. The filter accepts the following options:
  16059. @table @option
  16060. @item mode, m
  16061. Set the vectorscope mode.
  16062. Available values are:
  16063. @table @samp
  16064. @item lissajous
  16065. Lissajous rotated by 45 degrees.
  16066. @item lissajous_xy
  16067. Same as above but not rotated.
  16068. @item polar
  16069. Shape resembling half of circle.
  16070. @end table
  16071. Default value is @samp{lissajous}.
  16072. @item size, s
  16073. Set the video size for the output. For the syntax of this option, check the
  16074. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16075. Default value is @code{400x400}.
  16076. @item rate, r
  16077. Set the output frame rate. Default value is @code{25}.
  16078. @item rc
  16079. @item gc
  16080. @item bc
  16081. @item ac
  16082. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16083. @code{160}, @code{80} and @code{255}.
  16084. Allowed range is @code{[0, 255]}.
  16085. @item rf
  16086. @item gf
  16087. @item bf
  16088. @item af
  16089. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16090. @code{10}, @code{5} and @code{5}.
  16091. Allowed range is @code{[0, 255]}.
  16092. @item zoom
  16093. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16094. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16095. @item draw
  16096. Set the vectorscope drawing mode.
  16097. Available values are:
  16098. @table @samp
  16099. @item dot
  16100. Draw dot for each sample.
  16101. @item line
  16102. Draw line between previous and current sample.
  16103. @end table
  16104. Default value is @samp{dot}.
  16105. @item scale
  16106. Specify amplitude scale of audio samples.
  16107. Available values are:
  16108. @table @samp
  16109. @item lin
  16110. Linear.
  16111. @item sqrt
  16112. Square root.
  16113. @item cbrt
  16114. Cubic root.
  16115. @item log
  16116. Logarithmic.
  16117. @end table
  16118. @item swap
  16119. Swap left channel axis with right channel axis.
  16120. @item mirror
  16121. Mirror axis.
  16122. @table @samp
  16123. @item none
  16124. No mirror.
  16125. @item x
  16126. Mirror only x axis.
  16127. @item y
  16128. Mirror only y axis.
  16129. @item xy
  16130. Mirror both axis.
  16131. @end table
  16132. @end table
  16133. @subsection Examples
  16134. @itemize
  16135. @item
  16136. Complete example using @command{ffplay}:
  16137. @example
  16138. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16139. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16140. @end example
  16141. @end itemize
  16142. @section bench, abench
  16143. Benchmark part of a filtergraph.
  16144. The filter accepts the following options:
  16145. @table @option
  16146. @item action
  16147. Start or stop a timer.
  16148. Available values are:
  16149. @table @samp
  16150. @item start
  16151. Get the current time, set it as frame metadata (using the key
  16152. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16153. @item stop
  16154. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16155. the input frame metadata to get the time difference. Time difference, average,
  16156. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16157. @code{min}) are then printed. The timestamps are expressed in seconds.
  16158. @end table
  16159. @end table
  16160. @subsection Examples
  16161. @itemize
  16162. @item
  16163. Benchmark @ref{selectivecolor} filter:
  16164. @example
  16165. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16166. @end example
  16167. @end itemize
  16168. @section concat
  16169. Concatenate audio and video streams, joining them together one after the
  16170. other.
  16171. The filter works on segments of synchronized video and audio streams. All
  16172. segments must have the same number of streams of each type, and that will
  16173. also be the number of streams at output.
  16174. The filter accepts the following options:
  16175. @table @option
  16176. @item n
  16177. Set the number of segments. Default is 2.
  16178. @item v
  16179. Set the number of output video streams, that is also the number of video
  16180. streams in each segment. Default is 1.
  16181. @item a
  16182. Set the number of output audio streams, that is also the number of audio
  16183. streams in each segment. Default is 0.
  16184. @item unsafe
  16185. Activate unsafe mode: do not fail if segments have a different format.
  16186. @end table
  16187. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16188. @var{a} audio outputs.
  16189. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16190. segment, in the same order as the outputs, then the inputs for the second
  16191. segment, etc.
  16192. Related streams do not always have exactly the same duration, for various
  16193. reasons including codec frame size or sloppy authoring. For that reason,
  16194. related synchronized streams (e.g. a video and its audio track) should be
  16195. concatenated at once. The concat filter will use the duration of the longest
  16196. stream in each segment (except the last one), and if necessary pad shorter
  16197. audio streams with silence.
  16198. For this filter to work correctly, all segments must start at timestamp 0.
  16199. All corresponding streams must have the same parameters in all segments; the
  16200. filtering system will automatically select a common pixel format for video
  16201. streams, and a common sample format, sample rate and channel layout for
  16202. audio streams, but other settings, such as resolution, must be converted
  16203. explicitly by the user.
  16204. Different frame rates are acceptable but will result in variable frame rate
  16205. at output; be sure to configure the output file to handle it.
  16206. @subsection Examples
  16207. @itemize
  16208. @item
  16209. Concatenate an opening, an episode and an ending, all in bilingual version
  16210. (video in stream 0, audio in streams 1 and 2):
  16211. @example
  16212. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16213. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16214. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16215. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16216. @end example
  16217. @item
  16218. Concatenate two parts, handling audio and video separately, using the
  16219. (a)movie sources, and adjusting the resolution:
  16220. @example
  16221. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16222. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16223. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16224. @end example
  16225. Note that a desync will happen at the stitch if the audio and video streams
  16226. do not have exactly the same duration in the first file.
  16227. @end itemize
  16228. @subsection Commands
  16229. This filter supports the following commands:
  16230. @table @option
  16231. @item next
  16232. Close the current segment and step to the next one
  16233. @end table
  16234. @section drawgraph, adrawgraph
  16235. Draw a graph using input video or audio metadata.
  16236. It accepts the following parameters:
  16237. @table @option
  16238. @item m1
  16239. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  16240. @item fg1
  16241. Set 1st foreground color expression.
  16242. @item m2
  16243. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  16244. @item fg2
  16245. Set 2nd foreground color expression.
  16246. @item m3
  16247. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  16248. @item fg3
  16249. Set 3rd foreground color expression.
  16250. @item m4
  16251. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  16252. @item fg4
  16253. Set 4th foreground color expression.
  16254. @item min
  16255. Set minimal value of metadata value.
  16256. @item max
  16257. Set maximal value of metadata value.
  16258. @item bg
  16259. Set graph background color. Default is white.
  16260. @item mode
  16261. Set graph mode.
  16262. Available values for mode is:
  16263. @table @samp
  16264. @item bar
  16265. @item dot
  16266. @item line
  16267. @end table
  16268. Default is @code{line}.
  16269. @item slide
  16270. Set slide mode.
  16271. Available values for slide is:
  16272. @table @samp
  16273. @item frame
  16274. Draw new frame when right border is reached.
  16275. @item replace
  16276. Replace old columns with new ones.
  16277. @item scroll
  16278. Scroll from right to left.
  16279. @item rscroll
  16280. Scroll from left to right.
  16281. @item picture
  16282. Draw single picture.
  16283. @end table
  16284. Default is @code{frame}.
  16285. @item size
  16286. Set size of graph video. For the syntax of this option, check the
  16287. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16288. The default value is @code{900x256}.
  16289. The foreground color expressions can use the following variables:
  16290. @table @option
  16291. @item MIN
  16292. Minimal value of metadata value.
  16293. @item MAX
  16294. Maximal value of metadata value.
  16295. @item VAL
  16296. Current metadata key value.
  16297. @end table
  16298. The color is defined as 0xAABBGGRR.
  16299. @end table
  16300. Example using metadata from @ref{signalstats} filter:
  16301. @example
  16302. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  16303. @end example
  16304. Example using metadata from @ref{ebur128} filter:
  16305. @example
  16306. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  16307. @end example
  16308. @anchor{ebur128}
  16309. @section ebur128
  16310. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16311. level. By default, it logs a message at a frequency of 10Hz with the
  16312. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16313. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16314. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16315. sample format is double-precision floating point. The input stream will be converted to
  16316. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16317. after this filter to obtain the original parameters.
  16318. The filter also has a video output (see the @var{video} option) with a real
  16319. time graph to observe the loudness evolution. The graphic contains the logged
  16320. message mentioned above, so it is not printed anymore when this option is set,
  16321. unless the verbose logging is set. The main graphing area contains the
  16322. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16323. the momentary loudness (400 milliseconds), but can optionally be configured
  16324. to instead display short-term loudness (see @var{gauge}).
  16325. The green area marks a +/- 1LU target range around the target loudness
  16326. (-23LUFS by default, unless modified through @var{target}).
  16327. More information about the Loudness Recommendation EBU R128 on
  16328. @url{http://tech.ebu.ch/loudness}.
  16329. The filter accepts the following options:
  16330. @table @option
  16331. @item video
  16332. Activate the video output. The audio stream is passed unchanged whether this
  16333. option is set or no. The video stream will be the first output stream if
  16334. activated. Default is @code{0}.
  16335. @item size
  16336. Set the video size. This option is for video only. For the syntax of this
  16337. option, check the
  16338. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16339. Default and minimum resolution is @code{640x480}.
  16340. @item meter
  16341. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16342. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16343. other integer value between this range is allowed.
  16344. @item metadata
  16345. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16346. into 100ms output frames, each of them containing various loudness information
  16347. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16348. Default is @code{0}.
  16349. @item framelog
  16350. Force the frame logging level.
  16351. Available values are:
  16352. @table @samp
  16353. @item info
  16354. information logging level
  16355. @item verbose
  16356. verbose logging level
  16357. @end table
  16358. By default, the logging level is set to @var{info}. If the @option{video} or
  16359. the @option{metadata} options are set, it switches to @var{verbose}.
  16360. @item peak
  16361. Set peak mode(s).
  16362. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16363. values are:
  16364. @table @samp
  16365. @item none
  16366. Disable any peak mode (default).
  16367. @item sample
  16368. Enable sample-peak mode.
  16369. Simple peak mode looking for the higher sample value. It logs a message
  16370. for sample-peak (identified by @code{SPK}).
  16371. @item true
  16372. Enable true-peak mode.
  16373. If enabled, the peak lookup is done on an over-sampled version of the input
  16374. stream for better peak accuracy. It logs a message for true-peak.
  16375. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16376. This mode requires a build with @code{libswresample}.
  16377. @end table
  16378. @item dualmono
  16379. Treat mono input files as "dual mono". If a mono file is intended for playback
  16380. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16381. If set to @code{true}, this option will compensate for this effect.
  16382. Multi-channel input files are not affected by this option.
  16383. @item panlaw
  16384. Set a specific pan law to be used for the measurement of dual mono files.
  16385. This parameter is optional, and has a default value of -3.01dB.
  16386. @item target
  16387. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16388. This parameter is optional and has a default value of -23LUFS as specified
  16389. by EBU R128. However, material published online may prefer a level of -16LUFS
  16390. (e.g. for use with podcasts or video platforms).
  16391. @item gauge
  16392. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16393. @code{shortterm}. By default the momentary value will be used, but in certain
  16394. scenarios it may be more useful to observe the short term value instead (e.g.
  16395. live mixing).
  16396. @item scale
  16397. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16398. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16399. video output, not the summary or continuous log output.
  16400. @end table
  16401. @subsection Examples
  16402. @itemize
  16403. @item
  16404. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16405. @example
  16406. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16407. @end example
  16408. @item
  16409. Run an analysis with @command{ffmpeg}:
  16410. @example
  16411. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16412. @end example
  16413. @end itemize
  16414. @section interleave, ainterleave
  16415. Temporally interleave frames from several inputs.
  16416. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16417. These filters read frames from several inputs and send the oldest
  16418. queued frame to the output.
  16419. Input streams must have well defined, monotonically increasing frame
  16420. timestamp values.
  16421. In order to submit one frame to output, these filters need to enqueue
  16422. at least one frame for each input, so they cannot work in case one
  16423. input is not yet terminated and will not receive incoming frames.
  16424. For example consider the case when one input is a @code{select} filter
  16425. which always drops input frames. The @code{interleave} filter will keep
  16426. reading from that input, but it will never be able to send new frames
  16427. to output until the input sends an end-of-stream signal.
  16428. Also, depending on inputs synchronization, the filters will drop
  16429. frames in case one input receives more frames than the other ones, and
  16430. the queue is already filled.
  16431. These filters accept the following options:
  16432. @table @option
  16433. @item nb_inputs, n
  16434. Set the number of different inputs, it is 2 by default.
  16435. @end table
  16436. @subsection Examples
  16437. @itemize
  16438. @item
  16439. Interleave frames belonging to different streams using @command{ffmpeg}:
  16440. @example
  16441. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16442. @end example
  16443. @item
  16444. Add flickering blur effect:
  16445. @example
  16446. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16447. @end example
  16448. @end itemize
  16449. @section metadata, ametadata
  16450. Manipulate frame metadata.
  16451. This filter accepts the following options:
  16452. @table @option
  16453. @item mode
  16454. Set mode of operation of the filter.
  16455. Can be one of the following:
  16456. @table @samp
  16457. @item select
  16458. If both @code{value} and @code{key} is set, select frames
  16459. which have such metadata. If only @code{key} is set, select
  16460. every frame that has such key in metadata.
  16461. @item add
  16462. Add new metadata @code{key} and @code{value}. If key is already available
  16463. do nothing.
  16464. @item modify
  16465. Modify value of already present key.
  16466. @item delete
  16467. If @code{value} is set, delete only keys that have such value.
  16468. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16469. the frame.
  16470. @item print
  16471. Print key and its value if metadata was found. If @code{key} is not set print all
  16472. metadata values available in frame.
  16473. @end table
  16474. @item key
  16475. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16476. @item value
  16477. Set metadata value which will be used. This option is mandatory for
  16478. @code{modify} and @code{add} mode.
  16479. @item function
  16480. Which function to use when comparing metadata value and @code{value}.
  16481. Can be one of following:
  16482. @table @samp
  16483. @item same_str
  16484. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16485. @item starts_with
  16486. Values are interpreted as strings, returns true if metadata value starts with
  16487. the @code{value} option string.
  16488. @item less
  16489. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16490. @item equal
  16491. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16492. @item greater
  16493. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16494. @item expr
  16495. Values are interpreted as floats, returns true if expression from option @code{expr}
  16496. evaluates to true.
  16497. @end table
  16498. @item expr
  16499. Set expression which is used when @code{function} is set to @code{expr}.
  16500. The expression is evaluated through the eval API and can contain the following
  16501. constants:
  16502. @table @option
  16503. @item VALUE1
  16504. Float representation of @code{value} from metadata key.
  16505. @item VALUE2
  16506. Float representation of @code{value} as supplied by user in @code{value} option.
  16507. @end table
  16508. @item file
  16509. If specified in @code{print} mode, output is written to the named file. Instead of
  16510. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16511. for standard output. If @code{file} option is not set, output is written to the log
  16512. with AV_LOG_INFO loglevel.
  16513. @end table
  16514. @subsection Examples
  16515. @itemize
  16516. @item
  16517. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16518. between 0 and 1.
  16519. @example
  16520. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16521. @end example
  16522. @item
  16523. Print silencedetect output to file @file{metadata.txt}.
  16524. @example
  16525. silencedetect,ametadata=mode=print:file=metadata.txt
  16526. @end example
  16527. @item
  16528. Direct all metadata to a pipe with file descriptor 4.
  16529. @example
  16530. metadata=mode=print:file='pipe\:4'
  16531. @end example
  16532. @end itemize
  16533. @section perms, aperms
  16534. Set read/write permissions for the output frames.
  16535. These filters are mainly aimed at developers to test direct path in the
  16536. following filter in the filtergraph.
  16537. The filters accept the following options:
  16538. @table @option
  16539. @item mode
  16540. Select the permissions mode.
  16541. It accepts the following values:
  16542. @table @samp
  16543. @item none
  16544. Do nothing. This is the default.
  16545. @item ro
  16546. Set all the output frames read-only.
  16547. @item rw
  16548. Set all the output frames directly writable.
  16549. @item toggle
  16550. Make the frame read-only if writable, and writable if read-only.
  16551. @item random
  16552. Set each output frame read-only or writable randomly.
  16553. @end table
  16554. @item seed
  16555. Set the seed for the @var{random} mode, must be an integer included between
  16556. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16557. @code{-1}, the filter will try to use a good random seed on a best effort
  16558. basis.
  16559. @end table
  16560. Note: in case of auto-inserted filter between the permission filter and the
  16561. following one, the permission might not be received as expected in that
  16562. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16563. perms/aperms filter can avoid this problem.
  16564. @section realtime, arealtime
  16565. Slow down filtering to match real time approximately.
  16566. These filters will pause the filtering for a variable amount of time to
  16567. match the output rate with the input timestamps.
  16568. They are similar to the @option{re} option to @code{ffmpeg}.
  16569. They accept the following options:
  16570. @table @option
  16571. @item limit
  16572. Time limit for the pauses. Any pause longer than that will be considered
  16573. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16574. @item speed
  16575. Speed factor for processing. The value must be a float larger than zero.
  16576. Values larger than 1.0 will result in faster than realtime processing,
  16577. smaller will slow processing down. The @var{limit} is automatically adapted
  16578. accordingly. Default is 1.0.
  16579. A processing speed faster than what is possible without these filters cannot
  16580. be achieved.
  16581. @end table
  16582. @anchor{select}
  16583. @section select, aselect
  16584. Select frames to pass in output.
  16585. This filter accepts the following options:
  16586. @table @option
  16587. @item expr, e
  16588. Set expression, which is evaluated for each input frame.
  16589. If the expression is evaluated to zero, the frame is discarded.
  16590. If the evaluation result is negative or NaN, the frame is sent to the
  16591. first output; otherwise it is sent to the output with index
  16592. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16593. For example a value of @code{1.2} corresponds to the output with index
  16594. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16595. @item outputs, n
  16596. Set the number of outputs. The output to which to send the selected
  16597. frame is based on the result of the evaluation. Default value is 1.
  16598. @end table
  16599. The expression can contain the following constants:
  16600. @table @option
  16601. @item n
  16602. The (sequential) number of the filtered frame, starting from 0.
  16603. @item selected_n
  16604. The (sequential) number of the selected frame, starting from 0.
  16605. @item prev_selected_n
  16606. The sequential number of the last selected frame. It's NAN if undefined.
  16607. @item TB
  16608. The timebase of the input timestamps.
  16609. @item pts
  16610. The PTS (Presentation TimeStamp) of the filtered video frame,
  16611. expressed in @var{TB} units. It's NAN if undefined.
  16612. @item t
  16613. The PTS of the filtered video frame,
  16614. expressed in seconds. It's NAN if undefined.
  16615. @item prev_pts
  16616. The PTS of the previously filtered video frame. It's NAN if undefined.
  16617. @item prev_selected_pts
  16618. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16619. @item prev_selected_t
  16620. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16621. @item start_pts
  16622. The PTS of the first video frame in the video. It's NAN if undefined.
  16623. @item start_t
  16624. The time of the first video frame in the video. It's NAN if undefined.
  16625. @item pict_type @emph{(video only)}
  16626. The type of the filtered frame. It can assume one of the following
  16627. values:
  16628. @table @option
  16629. @item I
  16630. @item P
  16631. @item B
  16632. @item S
  16633. @item SI
  16634. @item SP
  16635. @item BI
  16636. @end table
  16637. @item interlace_type @emph{(video only)}
  16638. The frame interlace type. It can assume one of the following values:
  16639. @table @option
  16640. @item PROGRESSIVE
  16641. The frame is progressive (not interlaced).
  16642. @item TOPFIRST
  16643. The frame is top-field-first.
  16644. @item BOTTOMFIRST
  16645. The frame is bottom-field-first.
  16646. @end table
  16647. @item consumed_sample_n @emph{(audio only)}
  16648. the number of selected samples before the current frame
  16649. @item samples_n @emph{(audio only)}
  16650. the number of samples in the current frame
  16651. @item sample_rate @emph{(audio only)}
  16652. the input sample rate
  16653. @item key
  16654. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16655. @item pos
  16656. the position in the file of the filtered frame, -1 if the information
  16657. is not available (e.g. for synthetic video)
  16658. @item scene @emph{(video only)}
  16659. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16660. probability for the current frame to introduce a new scene, while a higher
  16661. value means the current frame is more likely to be one (see the example below)
  16662. @item concatdec_select
  16663. The concat demuxer can select only part of a concat input file by setting an
  16664. inpoint and an outpoint, but the output packets may not be entirely contained
  16665. in the selected interval. By using this variable, it is possible to skip frames
  16666. generated by the concat demuxer which are not exactly contained in the selected
  16667. interval.
  16668. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16669. and the @var{lavf.concat.duration} packet metadata values which are also
  16670. present in the decoded frames.
  16671. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16672. start_time and either the duration metadata is missing or the frame pts is less
  16673. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16674. missing.
  16675. That basically means that an input frame is selected if its pts is within the
  16676. interval set by the concat demuxer.
  16677. @end table
  16678. The default value of the select expression is "1".
  16679. @subsection Examples
  16680. @itemize
  16681. @item
  16682. Select all frames in input:
  16683. @example
  16684. select
  16685. @end example
  16686. The example above is the same as:
  16687. @example
  16688. select=1
  16689. @end example
  16690. @item
  16691. Skip all frames:
  16692. @example
  16693. select=0
  16694. @end example
  16695. @item
  16696. Select only I-frames:
  16697. @example
  16698. select='eq(pict_type\,I)'
  16699. @end example
  16700. @item
  16701. Select one frame every 100:
  16702. @example
  16703. select='not(mod(n\,100))'
  16704. @end example
  16705. @item
  16706. Select only frames contained in the 10-20 time interval:
  16707. @example
  16708. select=between(t\,10\,20)
  16709. @end example
  16710. @item
  16711. Select only I-frames contained in the 10-20 time interval:
  16712. @example
  16713. select=between(t\,10\,20)*eq(pict_type\,I)
  16714. @end example
  16715. @item
  16716. Select frames with a minimum distance of 10 seconds:
  16717. @example
  16718. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16719. @end example
  16720. @item
  16721. Use aselect to select only audio frames with samples number > 100:
  16722. @example
  16723. aselect='gt(samples_n\,100)'
  16724. @end example
  16725. @item
  16726. Create a mosaic of the first scenes:
  16727. @example
  16728. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16729. @end example
  16730. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16731. choice.
  16732. @item
  16733. Send even and odd frames to separate outputs, and compose them:
  16734. @example
  16735. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16736. @end example
  16737. @item
  16738. Select useful frames from an ffconcat file which is using inpoints and
  16739. outpoints but where the source files are not intra frame only.
  16740. @example
  16741. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16742. @end example
  16743. @end itemize
  16744. @section sendcmd, asendcmd
  16745. Send commands to filters in the filtergraph.
  16746. These filters read commands to be sent to other filters in the
  16747. filtergraph.
  16748. @code{sendcmd} must be inserted between two video filters,
  16749. @code{asendcmd} must be inserted between two audio filters, but apart
  16750. from that they act the same way.
  16751. The specification of commands can be provided in the filter arguments
  16752. with the @var{commands} option, or in a file specified by the
  16753. @var{filename} option.
  16754. These filters accept the following options:
  16755. @table @option
  16756. @item commands, c
  16757. Set the commands to be read and sent to the other filters.
  16758. @item filename, f
  16759. Set the filename of the commands to be read and sent to the other
  16760. filters.
  16761. @end table
  16762. @subsection Commands syntax
  16763. A commands description consists of a sequence of interval
  16764. specifications, comprising a list of commands to be executed when a
  16765. particular event related to that interval occurs. The occurring event
  16766. is typically the current frame time entering or leaving a given time
  16767. interval.
  16768. An interval is specified by the following syntax:
  16769. @example
  16770. @var{START}[-@var{END}] @var{COMMANDS};
  16771. @end example
  16772. The time interval is specified by the @var{START} and @var{END} times.
  16773. @var{END} is optional and defaults to the maximum time.
  16774. The current frame time is considered within the specified interval if
  16775. it is included in the interval [@var{START}, @var{END}), that is when
  16776. the time is greater or equal to @var{START} and is lesser than
  16777. @var{END}.
  16778. @var{COMMANDS} consists of a sequence of one or more command
  16779. specifications, separated by ",", relating to that interval. The
  16780. syntax of a command specification is given by:
  16781. @example
  16782. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16783. @end example
  16784. @var{FLAGS} is optional and specifies the type of events relating to
  16785. the time interval which enable sending the specified command, and must
  16786. be a non-null sequence of identifier flags separated by "+" or "|" and
  16787. enclosed between "[" and "]".
  16788. The following flags are recognized:
  16789. @table @option
  16790. @item enter
  16791. The command is sent when the current frame timestamp enters the
  16792. specified interval. In other words, the command is sent when the
  16793. previous frame timestamp was not in the given interval, and the
  16794. current is.
  16795. @item leave
  16796. The command is sent when the current frame timestamp leaves the
  16797. specified interval. In other words, the command is sent when the
  16798. previous frame timestamp was in the given interval, and the
  16799. current is not.
  16800. @end table
  16801. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16802. assumed.
  16803. @var{TARGET} specifies the target of the command, usually the name of
  16804. the filter class or a specific filter instance name.
  16805. @var{COMMAND} specifies the name of the command for the target filter.
  16806. @var{ARG} is optional and specifies the optional list of argument for
  16807. the given @var{COMMAND}.
  16808. Between one interval specification and another, whitespaces, or
  16809. sequences of characters starting with @code{#} until the end of line,
  16810. are ignored and can be used to annotate comments.
  16811. A simplified BNF description of the commands specification syntax
  16812. follows:
  16813. @example
  16814. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16815. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16816. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16817. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16818. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16819. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16820. @end example
  16821. @subsection Examples
  16822. @itemize
  16823. @item
  16824. Specify audio tempo change at second 4:
  16825. @example
  16826. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16827. @end example
  16828. @item
  16829. Target a specific filter instance:
  16830. @example
  16831. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16832. @end example
  16833. @item
  16834. Specify a list of drawtext and hue commands in a file.
  16835. @example
  16836. # show text in the interval 5-10
  16837. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16838. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16839. # desaturate the image in the interval 15-20
  16840. 15.0-20.0 [enter] hue s 0,
  16841. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16842. [leave] hue s 1,
  16843. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16844. # apply an exponential saturation fade-out effect, starting from time 25
  16845. 25 [enter] hue s exp(25-t)
  16846. @end example
  16847. A filtergraph allowing to read and process the above command list
  16848. stored in a file @file{test.cmd}, can be specified with:
  16849. @example
  16850. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16851. @end example
  16852. @end itemize
  16853. @anchor{setpts}
  16854. @section setpts, asetpts
  16855. Change the PTS (presentation timestamp) of the input frames.
  16856. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16857. This filter accepts the following options:
  16858. @table @option
  16859. @item expr
  16860. The expression which is evaluated for each frame to construct its timestamp.
  16861. @end table
  16862. The expression is evaluated through the eval API and can contain the following
  16863. constants:
  16864. @table @option
  16865. @item FRAME_RATE, FR
  16866. frame rate, only defined for constant frame-rate video
  16867. @item PTS
  16868. The presentation timestamp in input
  16869. @item N
  16870. The count of the input frame for video or the number of consumed samples,
  16871. not including the current frame for audio, starting from 0.
  16872. @item NB_CONSUMED_SAMPLES
  16873. The number of consumed samples, not including the current frame (only
  16874. audio)
  16875. @item NB_SAMPLES, S
  16876. The number of samples in the current frame (only audio)
  16877. @item SAMPLE_RATE, SR
  16878. The audio sample rate.
  16879. @item STARTPTS
  16880. The PTS of the first frame.
  16881. @item STARTT
  16882. the time in seconds of the first frame
  16883. @item INTERLACED
  16884. State whether the current frame is interlaced.
  16885. @item T
  16886. the time in seconds of the current frame
  16887. @item POS
  16888. original position in the file of the frame, or undefined if undefined
  16889. for the current frame
  16890. @item PREV_INPTS
  16891. The previous input PTS.
  16892. @item PREV_INT
  16893. previous input time in seconds
  16894. @item PREV_OUTPTS
  16895. The previous output PTS.
  16896. @item PREV_OUTT
  16897. previous output time in seconds
  16898. @item RTCTIME
  16899. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16900. instead.
  16901. @item RTCSTART
  16902. The wallclock (RTC) time at the start of the movie in microseconds.
  16903. @item TB
  16904. The timebase of the input timestamps.
  16905. @end table
  16906. @subsection Examples
  16907. @itemize
  16908. @item
  16909. Start counting PTS from zero
  16910. @example
  16911. setpts=PTS-STARTPTS
  16912. @end example
  16913. @item
  16914. Apply fast motion effect:
  16915. @example
  16916. setpts=0.5*PTS
  16917. @end example
  16918. @item
  16919. Apply slow motion effect:
  16920. @example
  16921. setpts=2.0*PTS
  16922. @end example
  16923. @item
  16924. Set fixed rate of 25 frames per second:
  16925. @example
  16926. setpts=N/(25*TB)
  16927. @end example
  16928. @item
  16929. Set fixed rate 25 fps with some jitter:
  16930. @example
  16931. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16932. @end example
  16933. @item
  16934. Apply an offset of 10 seconds to the input PTS:
  16935. @example
  16936. setpts=PTS+10/TB
  16937. @end example
  16938. @item
  16939. Generate timestamps from a "live source" and rebase onto the current timebase:
  16940. @example
  16941. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16942. @end example
  16943. @item
  16944. Generate timestamps by counting samples:
  16945. @example
  16946. asetpts=N/SR/TB
  16947. @end example
  16948. @end itemize
  16949. @section setrange
  16950. Force color range for the output video frame.
  16951. The @code{setrange} filter marks the color range property for the
  16952. output frames. It does not change the input frame, but only sets the
  16953. corresponding property, which affects how the frame is treated by
  16954. following filters.
  16955. The filter accepts the following options:
  16956. @table @option
  16957. @item range
  16958. Available values are:
  16959. @table @samp
  16960. @item auto
  16961. Keep the same color range property.
  16962. @item unspecified, unknown
  16963. Set the color range as unspecified.
  16964. @item limited, tv, mpeg
  16965. Set the color range as limited.
  16966. @item full, pc, jpeg
  16967. Set the color range as full.
  16968. @end table
  16969. @end table
  16970. @section settb, asettb
  16971. Set the timebase to use for the output frames timestamps.
  16972. It is mainly useful for testing timebase configuration.
  16973. It accepts the following parameters:
  16974. @table @option
  16975. @item expr, tb
  16976. The expression which is evaluated into the output timebase.
  16977. @end table
  16978. The value for @option{tb} is an arithmetic expression representing a
  16979. rational. The expression can contain the constants "AVTB" (the default
  16980. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16981. audio only). Default value is "intb".
  16982. @subsection Examples
  16983. @itemize
  16984. @item
  16985. Set the timebase to 1/25:
  16986. @example
  16987. settb=expr=1/25
  16988. @end example
  16989. @item
  16990. Set the timebase to 1/10:
  16991. @example
  16992. settb=expr=0.1
  16993. @end example
  16994. @item
  16995. Set the timebase to 1001/1000:
  16996. @example
  16997. settb=1+0.001
  16998. @end example
  16999. @item
  17000. Set the timebase to 2*intb:
  17001. @example
  17002. settb=2*intb
  17003. @end example
  17004. @item
  17005. Set the default timebase value:
  17006. @example
  17007. settb=AVTB
  17008. @end example
  17009. @end itemize
  17010. @section showcqt
  17011. Convert input audio to a video output representing frequency spectrum
  17012. logarithmically using Brown-Puckette constant Q transform algorithm with
  17013. direct frequency domain coefficient calculation (but the transform itself
  17014. is not really constant Q, instead the Q factor is actually variable/clamped),
  17015. with musical tone scale, from E0 to D#10.
  17016. The filter accepts the following options:
  17017. @table @option
  17018. @item size, s
  17019. Specify the video size for the output. It must be even. For the syntax of this option,
  17020. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17021. Default value is @code{1920x1080}.
  17022. @item fps, rate, r
  17023. Set the output frame rate. Default value is @code{25}.
  17024. @item bar_h
  17025. Set the bargraph height. It must be even. Default value is @code{-1} which
  17026. computes the bargraph height automatically.
  17027. @item axis_h
  17028. Set the axis height. It must be even. Default value is @code{-1} which computes
  17029. the axis height automatically.
  17030. @item sono_h
  17031. Set the sonogram height. It must be even. Default value is @code{-1} which
  17032. computes the sonogram height automatically.
  17033. @item fullhd
  17034. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17035. instead. Default value is @code{1}.
  17036. @item sono_v, volume
  17037. Specify the sonogram volume expression. It can contain variables:
  17038. @table @option
  17039. @item bar_v
  17040. the @var{bar_v} evaluated expression
  17041. @item frequency, freq, f
  17042. the frequency where it is evaluated
  17043. @item timeclamp, tc
  17044. the value of @var{timeclamp} option
  17045. @end table
  17046. and functions:
  17047. @table @option
  17048. @item a_weighting(f)
  17049. A-weighting of equal loudness
  17050. @item b_weighting(f)
  17051. B-weighting of equal loudness
  17052. @item c_weighting(f)
  17053. C-weighting of equal loudness.
  17054. @end table
  17055. Default value is @code{16}.
  17056. @item bar_v, volume2
  17057. Specify the bargraph volume expression. It can contain variables:
  17058. @table @option
  17059. @item sono_v
  17060. the @var{sono_v} evaluated expression
  17061. @item frequency, freq, f
  17062. the frequency where it is evaluated
  17063. @item timeclamp, tc
  17064. the value of @var{timeclamp} option
  17065. @end table
  17066. and functions:
  17067. @table @option
  17068. @item a_weighting(f)
  17069. A-weighting of equal loudness
  17070. @item b_weighting(f)
  17071. B-weighting of equal loudness
  17072. @item c_weighting(f)
  17073. C-weighting of equal loudness.
  17074. @end table
  17075. Default value is @code{sono_v}.
  17076. @item sono_g, gamma
  17077. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17078. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17079. Acceptable range is @code{[1, 7]}.
  17080. @item bar_g, gamma2
  17081. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17082. @code{[1, 7]}.
  17083. @item bar_t
  17084. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17085. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17086. @item timeclamp, tc
  17087. Specify the transform timeclamp. At low frequency, there is trade-off between
  17088. accuracy in time domain and frequency domain. If timeclamp is lower,
  17089. event in time domain is represented more accurately (such as fast bass drum),
  17090. otherwise event in frequency domain is represented more accurately
  17091. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17092. @item attack
  17093. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17094. limits future samples by applying asymmetric windowing in time domain, useful
  17095. when low latency is required. Accepted range is @code{[0, 1]}.
  17096. @item basefreq
  17097. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17098. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17099. @item endfreq
  17100. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17101. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17102. @item coeffclamp
  17103. This option is deprecated and ignored.
  17104. @item tlength
  17105. Specify the transform length in time domain. Use this option to control accuracy
  17106. trade-off between time domain and frequency domain at every frequency sample.
  17107. It can contain variables:
  17108. @table @option
  17109. @item frequency, freq, f
  17110. the frequency where it is evaluated
  17111. @item timeclamp, tc
  17112. the value of @var{timeclamp} option.
  17113. @end table
  17114. Default value is @code{384*tc/(384+tc*f)}.
  17115. @item count
  17116. Specify the transform count for every video frame. Default value is @code{6}.
  17117. Acceptable range is @code{[1, 30]}.
  17118. @item fcount
  17119. Specify the transform count for every single pixel. Default value is @code{0},
  17120. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17121. @item fontfile
  17122. Specify font file for use with freetype to draw the axis. If not specified,
  17123. use embedded font. Note that drawing with font file or embedded font is not
  17124. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17125. option instead.
  17126. @item font
  17127. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  17128. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  17129. @item fontcolor
  17130. Specify font color expression. This is arithmetic expression that should return
  17131. integer value 0xRRGGBB. It can contain variables:
  17132. @table @option
  17133. @item frequency, freq, f
  17134. the frequency where it is evaluated
  17135. @item timeclamp, tc
  17136. the value of @var{timeclamp} option
  17137. @end table
  17138. and functions:
  17139. @table @option
  17140. @item midi(f)
  17141. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17142. @item r(x), g(x), b(x)
  17143. red, green, and blue value of intensity x.
  17144. @end table
  17145. Default value is @code{st(0, (midi(f)-59.5)/12);
  17146. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17147. r(1-ld(1)) + b(ld(1))}.
  17148. @item axisfile
  17149. Specify image file to draw the axis. This option override @var{fontfile} and
  17150. @var{fontcolor} option.
  17151. @item axis, text
  17152. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17153. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17154. Default value is @code{1}.
  17155. @item csp
  17156. Set colorspace. The accepted values are:
  17157. @table @samp
  17158. @item unspecified
  17159. Unspecified (default)
  17160. @item bt709
  17161. BT.709
  17162. @item fcc
  17163. FCC
  17164. @item bt470bg
  17165. BT.470BG or BT.601-6 625
  17166. @item smpte170m
  17167. SMPTE-170M or BT.601-6 525
  17168. @item smpte240m
  17169. SMPTE-240M
  17170. @item bt2020ncl
  17171. BT.2020 with non-constant luminance
  17172. @end table
  17173. @item cscheme
  17174. Set spectrogram color scheme. This is list of floating point values with format
  17175. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17176. The default is @code{1|0.5|0|0|0.5|1}.
  17177. @end table
  17178. @subsection Examples
  17179. @itemize
  17180. @item
  17181. Playing audio while showing the spectrum:
  17182. @example
  17183. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17184. @end example
  17185. @item
  17186. Same as above, but with frame rate 30 fps:
  17187. @example
  17188. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17189. @end example
  17190. @item
  17191. Playing at 1280x720:
  17192. @example
  17193. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17194. @end example
  17195. @item
  17196. Disable sonogram display:
  17197. @example
  17198. sono_h=0
  17199. @end example
  17200. @item
  17201. A1 and its harmonics: A1, A2, (near)E3, A3:
  17202. @example
  17203. 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),
  17204. asplit[a][out1]; [a] showcqt [out0]'
  17205. @end example
  17206. @item
  17207. Same as above, but with more accuracy in frequency domain:
  17208. @example
  17209. 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),
  17210. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17211. @end example
  17212. @item
  17213. Custom volume:
  17214. @example
  17215. bar_v=10:sono_v=bar_v*a_weighting(f)
  17216. @end example
  17217. @item
  17218. Custom gamma, now spectrum is linear to the amplitude.
  17219. @example
  17220. bar_g=2:sono_g=2
  17221. @end example
  17222. @item
  17223. Custom tlength equation:
  17224. @example
  17225. 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)))'
  17226. @end example
  17227. @item
  17228. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17229. @example
  17230. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17231. @end example
  17232. @item
  17233. Custom font using fontconfig:
  17234. @example
  17235. font='Courier New,Monospace,mono|bold'
  17236. @end example
  17237. @item
  17238. Custom frequency range with custom axis using image file:
  17239. @example
  17240. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17241. @end example
  17242. @end itemize
  17243. @section showfreqs
  17244. Convert input audio to video output representing the audio power spectrum.
  17245. Audio amplitude is on Y-axis while frequency is on X-axis.
  17246. The filter accepts the following options:
  17247. @table @option
  17248. @item size, s
  17249. Specify size of video. For the syntax of this option, check the
  17250. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17251. Default is @code{1024x512}.
  17252. @item mode
  17253. Set display mode.
  17254. This set how each frequency bin will be represented.
  17255. It accepts the following values:
  17256. @table @samp
  17257. @item line
  17258. @item bar
  17259. @item dot
  17260. @end table
  17261. Default is @code{bar}.
  17262. @item ascale
  17263. Set amplitude scale.
  17264. It accepts the following values:
  17265. @table @samp
  17266. @item lin
  17267. Linear scale.
  17268. @item sqrt
  17269. Square root scale.
  17270. @item cbrt
  17271. Cubic root scale.
  17272. @item log
  17273. Logarithmic scale.
  17274. @end table
  17275. Default is @code{log}.
  17276. @item fscale
  17277. Set frequency scale.
  17278. It accepts the following values:
  17279. @table @samp
  17280. @item lin
  17281. Linear scale.
  17282. @item log
  17283. Logarithmic scale.
  17284. @item rlog
  17285. Reverse logarithmic scale.
  17286. @end table
  17287. Default is @code{lin}.
  17288. @item win_size
  17289. Set window size. Allowed range is from 16 to 65536.
  17290. Default is @code{2048}
  17291. @item win_func
  17292. Set windowing function.
  17293. It accepts the following values:
  17294. @table @samp
  17295. @item rect
  17296. @item bartlett
  17297. @item hanning
  17298. @item hamming
  17299. @item blackman
  17300. @item welch
  17301. @item flattop
  17302. @item bharris
  17303. @item bnuttall
  17304. @item bhann
  17305. @item sine
  17306. @item nuttall
  17307. @item lanczos
  17308. @item gauss
  17309. @item tukey
  17310. @item dolph
  17311. @item cauchy
  17312. @item parzen
  17313. @item poisson
  17314. @item bohman
  17315. @end table
  17316. Default is @code{hanning}.
  17317. @item overlap
  17318. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17319. which means optimal overlap for selected window function will be picked.
  17320. @item averaging
  17321. Set time averaging. Setting this to 0 will display current maximal peaks.
  17322. Default is @code{1}, which means time averaging is disabled.
  17323. @item colors
  17324. Specify list of colors separated by space or by '|' which will be used to
  17325. draw channel frequencies. Unrecognized or missing colors will be replaced
  17326. by white color.
  17327. @item cmode
  17328. Set channel display mode.
  17329. It accepts the following values:
  17330. @table @samp
  17331. @item combined
  17332. @item separate
  17333. @end table
  17334. Default is @code{combined}.
  17335. @item minamp
  17336. Set minimum amplitude used in @code{log} amplitude scaler.
  17337. @end table
  17338. @section showspatial
  17339. Convert stereo input audio to a video output, representing the spatial relationship
  17340. between two channels.
  17341. The filter accepts the following options:
  17342. @table @option
  17343. @item size, s
  17344. Specify the video size for the output. For the syntax of this option, check the
  17345. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17346. Default value is @code{512x512}.
  17347. @item win_size
  17348. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17349. @item win_func
  17350. Set window function.
  17351. It accepts the following values:
  17352. @table @samp
  17353. @item rect
  17354. @item bartlett
  17355. @item hann
  17356. @item hanning
  17357. @item hamming
  17358. @item blackman
  17359. @item welch
  17360. @item flattop
  17361. @item bharris
  17362. @item bnuttall
  17363. @item bhann
  17364. @item sine
  17365. @item nuttall
  17366. @item lanczos
  17367. @item gauss
  17368. @item tukey
  17369. @item dolph
  17370. @item cauchy
  17371. @item parzen
  17372. @item poisson
  17373. @item bohman
  17374. @end table
  17375. Default value is @code{hann}.
  17376. @item overlap
  17377. Set ratio of overlap window. Default value is @code{0.5}.
  17378. When value is @code{1} overlap is set to recommended size for specific
  17379. window function currently used.
  17380. @end table
  17381. @anchor{showspectrum}
  17382. @section showspectrum
  17383. Convert input audio to a video output, representing the audio frequency
  17384. spectrum.
  17385. The filter accepts the following options:
  17386. @table @option
  17387. @item size, s
  17388. Specify the video size for the output. For the syntax of this option, check the
  17389. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17390. Default value is @code{640x512}.
  17391. @item slide
  17392. Specify how the spectrum should slide along the window.
  17393. It accepts the following values:
  17394. @table @samp
  17395. @item replace
  17396. the samples start again on the left when they reach the right
  17397. @item scroll
  17398. the samples scroll from right to left
  17399. @item fullframe
  17400. frames are only produced when the samples reach the right
  17401. @item rscroll
  17402. the samples scroll from left to right
  17403. @end table
  17404. Default value is @code{replace}.
  17405. @item mode
  17406. Specify display mode.
  17407. It accepts the following values:
  17408. @table @samp
  17409. @item combined
  17410. all channels are displayed in the same row
  17411. @item separate
  17412. all channels are displayed in separate rows
  17413. @end table
  17414. Default value is @samp{combined}.
  17415. @item color
  17416. Specify display color mode.
  17417. It accepts the following values:
  17418. @table @samp
  17419. @item channel
  17420. each channel is displayed in a separate color
  17421. @item intensity
  17422. each channel is displayed using the same color scheme
  17423. @item rainbow
  17424. each channel is displayed using the rainbow color scheme
  17425. @item moreland
  17426. each channel is displayed using the moreland color scheme
  17427. @item nebulae
  17428. each channel is displayed using the nebulae color scheme
  17429. @item fire
  17430. each channel is displayed using the fire color scheme
  17431. @item fiery
  17432. each channel is displayed using the fiery color scheme
  17433. @item fruit
  17434. each channel is displayed using the fruit color scheme
  17435. @item cool
  17436. each channel is displayed using the cool color scheme
  17437. @item magma
  17438. each channel is displayed using the magma color scheme
  17439. @item green
  17440. each channel is displayed using the green color scheme
  17441. @item viridis
  17442. each channel is displayed using the viridis color scheme
  17443. @item plasma
  17444. each channel is displayed using the plasma color scheme
  17445. @item cividis
  17446. each channel is displayed using the cividis color scheme
  17447. @item terrain
  17448. each channel is displayed using the terrain color scheme
  17449. @end table
  17450. Default value is @samp{channel}.
  17451. @item scale
  17452. Specify scale used for calculating intensity color values.
  17453. It accepts the following values:
  17454. @table @samp
  17455. @item lin
  17456. linear
  17457. @item sqrt
  17458. square root, default
  17459. @item cbrt
  17460. cubic root
  17461. @item log
  17462. logarithmic
  17463. @item 4thrt
  17464. 4th root
  17465. @item 5thrt
  17466. 5th root
  17467. @end table
  17468. Default value is @samp{sqrt}.
  17469. @item fscale
  17470. Specify frequency scale.
  17471. It accepts the following values:
  17472. @table @samp
  17473. @item lin
  17474. linear
  17475. @item log
  17476. logarithmic
  17477. @end table
  17478. Default value is @samp{lin}.
  17479. @item saturation
  17480. Set saturation modifier for displayed colors. Negative values provide
  17481. alternative color scheme. @code{0} is no saturation at all.
  17482. Saturation must be in [-10.0, 10.0] range.
  17483. Default value is @code{1}.
  17484. @item win_func
  17485. Set window function.
  17486. It accepts the following values:
  17487. @table @samp
  17488. @item rect
  17489. @item bartlett
  17490. @item hann
  17491. @item hanning
  17492. @item hamming
  17493. @item blackman
  17494. @item welch
  17495. @item flattop
  17496. @item bharris
  17497. @item bnuttall
  17498. @item bhann
  17499. @item sine
  17500. @item nuttall
  17501. @item lanczos
  17502. @item gauss
  17503. @item tukey
  17504. @item dolph
  17505. @item cauchy
  17506. @item parzen
  17507. @item poisson
  17508. @item bohman
  17509. @end table
  17510. Default value is @code{hann}.
  17511. @item orientation
  17512. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17513. @code{horizontal}. Default is @code{vertical}.
  17514. @item overlap
  17515. Set ratio of overlap window. Default value is @code{0}.
  17516. When value is @code{1} overlap is set to recommended size for specific
  17517. window function currently used.
  17518. @item gain
  17519. Set scale gain for calculating intensity color values.
  17520. Default value is @code{1}.
  17521. @item data
  17522. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17523. @item rotation
  17524. Set color rotation, must be in [-1.0, 1.0] range.
  17525. Default value is @code{0}.
  17526. @item start
  17527. Set start frequency from which to display spectrogram. Default is @code{0}.
  17528. @item stop
  17529. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17530. @item fps
  17531. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17532. @item legend
  17533. Draw time and frequency axes and legends. Default is disabled.
  17534. @end table
  17535. The usage is very similar to the showwaves filter; see the examples in that
  17536. section.
  17537. @subsection Examples
  17538. @itemize
  17539. @item
  17540. Large window with logarithmic color scaling:
  17541. @example
  17542. showspectrum=s=1280x480:scale=log
  17543. @end example
  17544. @item
  17545. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17546. @example
  17547. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17548. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17549. @end example
  17550. @end itemize
  17551. @section showspectrumpic
  17552. Convert input audio to a single video frame, representing the audio frequency
  17553. spectrum.
  17554. The filter accepts the following options:
  17555. @table @option
  17556. @item size, s
  17557. Specify the video size for the output. For the syntax of this option, check the
  17558. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17559. Default value is @code{4096x2048}.
  17560. @item mode
  17561. Specify display mode.
  17562. It accepts the following values:
  17563. @table @samp
  17564. @item combined
  17565. all channels are displayed in the same row
  17566. @item separate
  17567. all channels are displayed in separate rows
  17568. @end table
  17569. Default value is @samp{combined}.
  17570. @item color
  17571. Specify display color mode.
  17572. It accepts the following values:
  17573. @table @samp
  17574. @item channel
  17575. each channel is displayed in a separate color
  17576. @item intensity
  17577. each channel is displayed using the same color scheme
  17578. @item rainbow
  17579. each channel is displayed using the rainbow color scheme
  17580. @item moreland
  17581. each channel is displayed using the moreland color scheme
  17582. @item nebulae
  17583. each channel is displayed using the nebulae color scheme
  17584. @item fire
  17585. each channel is displayed using the fire color scheme
  17586. @item fiery
  17587. each channel is displayed using the fiery color scheme
  17588. @item fruit
  17589. each channel is displayed using the fruit color scheme
  17590. @item cool
  17591. each channel is displayed using the cool color scheme
  17592. @item magma
  17593. each channel is displayed using the magma color scheme
  17594. @item green
  17595. each channel is displayed using the green color scheme
  17596. @item viridis
  17597. each channel is displayed using the viridis color scheme
  17598. @item plasma
  17599. each channel is displayed using the plasma color scheme
  17600. @item cividis
  17601. each channel is displayed using the cividis color scheme
  17602. @item terrain
  17603. each channel is displayed using the terrain color scheme
  17604. @end table
  17605. Default value is @samp{intensity}.
  17606. @item scale
  17607. Specify scale used for calculating intensity color values.
  17608. It accepts the following values:
  17609. @table @samp
  17610. @item lin
  17611. linear
  17612. @item sqrt
  17613. square root, default
  17614. @item cbrt
  17615. cubic root
  17616. @item log
  17617. logarithmic
  17618. @item 4thrt
  17619. 4th root
  17620. @item 5thrt
  17621. 5th root
  17622. @end table
  17623. Default value is @samp{log}.
  17624. @item fscale
  17625. Specify frequency scale.
  17626. It accepts the following values:
  17627. @table @samp
  17628. @item lin
  17629. linear
  17630. @item log
  17631. logarithmic
  17632. @end table
  17633. Default value is @samp{lin}.
  17634. @item saturation
  17635. Set saturation modifier for displayed colors. Negative values provide
  17636. alternative color scheme. @code{0} is no saturation at all.
  17637. Saturation must be in [-10.0, 10.0] range.
  17638. Default value is @code{1}.
  17639. @item win_func
  17640. Set window function.
  17641. It accepts the following values:
  17642. @table @samp
  17643. @item rect
  17644. @item bartlett
  17645. @item hann
  17646. @item hanning
  17647. @item hamming
  17648. @item blackman
  17649. @item welch
  17650. @item flattop
  17651. @item bharris
  17652. @item bnuttall
  17653. @item bhann
  17654. @item sine
  17655. @item nuttall
  17656. @item lanczos
  17657. @item gauss
  17658. @item tukey
  17659. @item dolph
  17660. @item cauchy
  17661. @item parzen
  17662. @item poisson
  17663. @item bohman
  17664. @end table
  17665. Default value is @code{hann}.
  17666. @item orientation
  17667. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17668. @code{horizontal}. Default is @code{vertical}.
  17669. @item gain
  17670. Set scale gain for calculating intensity color values.
  17671. Default value is @code{1}.
  17672. @item legend
  17673. Draw time and frequency axes and legends. Default is enabled.
  17674. @item rotation
  17675. Set color rotation, must be in [-1.0, 1.0] range.
  17676. Default value is @code{0}.
  17677. @item start
  17678. Set start frequency from which to display spectrogram. Default is @code{0}.
  17679. @item stop
  17680. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17681. @end table
  17682. @subsection Examples
  17683. @itemize
  17684. @item
  17685. Extract an audio spectrogram of a whole audio track
  17686. in a 1024x1024 picture using @command{ffmpeg}:
  17687. @example
  17688. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17689. @end example
  17690. @end itemize
  17691. @section showvolume
  17692. Convert input audio volume to a video output.
  17693. The filter accepts the following options:
  17694. @table @option
  17695. @item rate, r
  17696. Set video rate.
  17697. @item b
  17698. Set border width, allowed range is [0, 5]. Default is 1.
  17699. @item w
  17700. Set channel width, allowed range is [80, 8192]. Default is 400.
  17701. @item h
  17702. Set channel height, allowed range is [1, 900]. Default is 20.
  17703. @item f
  17704. Set fade, allowed range is [0, 1]. Default is 0.95.
  17705. @item c
  17706. Set volume color expression.
  17707. The expression can use the following variables:
  17708. @table @option
  17709. @item VOLUME
  17710. Current max volume of channel in dB.
  17711. @item PEAK
  17712. Current peak.
  17713. @item CHANNEL
  17714. Current channel number, starting from 0.
  17715. @end table
  17716. @item t
  17717. If set, displays channel names. Default is enabled.
  17718. @item v
  17719. If set, displays volume values. Default is enabled.
  17720. @item o
  17721. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17722. default is @code{h}.
  17723. @item s
  17724. Set step size, allowed range is [0, 5]. Default is 0, which means
  17725. step is disabled.
  17726. @item p
  17727. Set background opacity, allowed range is [0, 1]. Default is 0.
  17728. @item m
  17729. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17730. default is @code{p}.
  17731. @item ds
  17732. Set display scale, can be linear: @code{lin} or log: @code{log},
  17733. default is @code{lin}.
  17734. @item dm
  17735. In second.
  17736. If set to > 0., display a line for the max level
  17737. in the previous seconds.
  17738. default is disabled: @code{0.}
  17739. @item dmc
  17740. The color of the max line. Use when @code{dm} option is set to > 0.
  17741. default is: @code{orange}
  17742. @end table
  17743. @section showwaves
  17744. Convert input audio to a video output, representing the samples waves.
  17745. The filter accepts the following options:
  17746. @table @option
  17747. @item size, s
  17748. Specify the video size for the output. For the syntax of this option, check the
  17749. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17750. Default value is @code{600x240}.
  17751. @item mode
  17752. Set display mode.
  17753. Available values are:
  17754. @table @samp
  17755. @item point
  17756. Draw a point for each sample.
  17757. @item line
  17758. Draw a vertical line for each sample.
  17759. @item p2p
  17760. Draw a point for each sample and a line between them.
  17761. @item cline
  17762. Draw a centered vertical line for each sample.
  17763. @end table
  17764. Default value is @code{point}.
  17765. @item n
  17766. Set the number of samples which are printed on the same column. A
  17767. larger value will decrease the frame rate. Must be a positive
  17768. integer. This option can be set only if the value for @var{rate}
  17769. is not explicitly specified.
  17770. @item rate, r
  17771. Set the (approximate) output frame rate. This is done by setting the
  17772. option @var{n}. Default value is "25".
  17773. @item split_channels
  17774. Set if channels should be drawn separately or overlap. Default value is 0.
  17775. @item colors
  17776. Set colors separated by '|' which are going to be used for drawing of each channel.
  17777. @item scale
  17778. Set amplitude scale.
  17779. Available values are:
  17780. @table @samp
  17781. @item lin
  17782. Linear.
  17783. @item log
  17784. Logarithmic.
  17785. @item sqrt
  17786. Square root.
  17787. @item cbrt
  17788. Cubic root.
  17789. @end table
  17790. Default is linear.
  17791. @item draw
  17792. Set the draw mode. This is mostly useful to set for high @var{n}.
  17793. Available values are:
  17794. @table @samp
  17795. @item scale
  17796. Scale pixel values for each drawn sample.
  17797. @item full
  17798. Draw every sample directly.
  17799. @end table
  17800. Default value is @code{scale}.
  17801. @end table
  17802. @subsection Examples
  17803. @itemize
  17804. @item
  17805. Output the input file audio and the corresponding video representation
  17806. at the same time:
  17807. @example
  17808. amovie=a.mp3,asplit[out0],showwaves[out1]
  17809. @end example
  17810. @item
  17811. Create a synthetic signal and show it with showwaves, forcing a
  17812. frame rate of 30 frames per second:
  17813. @example
  17814. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17815. @end example
  17816. @end itemize
  17817. @section showwavespic
  17818. Convert input audio to a single video frame, representing the samples waves.
  17819. The filter accepts the following options:
  17820. @table @option
  17821. @item size, s
  17822. Specify the video size for the output. For the syntax of this option, check the
  17823. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17824. Default value is @code{600x240}.
  17825. @item split_channels
  17826. Set if channels should be drawn separately or overlap. Default value is 0.
  17827. @item colors
  17828. Set colors separated by '|' which are going to be used for drawing of each channel.
  17829. @item scale
  17830. Set amplitude scale.
  17831. Available values are:
  17832. @table @samp
  17833. @item lin
  17834. Linear.
  17835. @item log
  17836. Logarithmic.
  17837. @item sqrt
  17838. Square root.
  17839. @item cbrt
  17840. Cubic root.
  17841. @end table
  17842. Default is linear.
  17843. @item draw
  17844. Set the draw mode.
  17845. Available values are:
  17846. @table @samp
  17847. @item scale
  17848. Scale pixel values for each drawn sample.
  17849. @item full
  17850. Draw every sample directly.
  17851. @end table
  17852. Default value is @code{scale}.
  17853. @end table
  17854. @subsection Examples
  17855. @itemize
  17856. @item
  17857. Extract a channel split representation of the wave form of a whole audio track
  17858. in a 1024x800 picture using @command{ffmpeg}:
  17859. @example
  17860. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17861. @end example
  17862. @end itemize
  17863. @section sidedata, asidedata
  17864. Delete frame side data, or select frames based on it.
  17865. This filter accepts the following options:
  17866. @table @option
  17867. @item mode
  17868. Set mode of operation of the filter.
  17869. Can be one of the following:
  17870. @table @samp
  17871. @item select
  17872. Select every frame with side data of @code{type}.
  17873. @item delete
  17874. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17875. data in the frame.
  17876. @end table
  17877. @item type
  17878. Set side data type used with all modes. Must be set for @code{select} mode. For
  17879. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17880. in @file{libavutil/frame.h}. For example, to choose
  17881. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17882. @end table
  17883. @section spectrumsynth
  17884. Sythesize audio from 2 input video spectrums, first input stream represents
  17885. magnitude across time and second represents phase across time.
  17886. The filter will transform from frequency domain as displayed in videos back
  17887. to time domain as presented in audio output.
  17888. This filter is primarily created for reversing processed @ref{showspectrum}
  17889. filter outputs, but can synthesize sound from other spectrograms too.
  17890. But in such case results are going to be poor if the phase data is not
  17891. available, because in such cases phase data need to be recreated, usually
  17892. it's just recreated from random noise.
  17893. For best results use gray only output (@code{channel} color mode in
  17894. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17895. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17896. @code{data} option. Inputs videos should generally use @code{fullframe}
  17897. slide mode as that saves resources needed for decoding video.
  17898. The filter accepts the following options:
  17899. @table @option
  17900. @item sample_rate
  17901. Specify sample rate of output audio, the sample rate of audio from which
  17902. spectrum was generated may differ.
  17903. @item channels
  17904. Set number of channels represented in input video spectrums.
  17905. @item scale
  17906. Set scale which was used when generating magnitude input spectrum.
  17907. Can be @code{lin} or @code{log}. Default is @code{log}.
  17908. @item slide
  17909. Set slide which was used when generating inputs spectrums.
  17910. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17911. Default is @code{fullframe}.
  17912. @item win_func
  17913. Set window function used for resynthesis.
  17914. @item overlap
  17915. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17916. which means optimal overlap for selected window function will be picked.
  17917. @item orientation
  17918. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17919. Default is @code{vertical}.
  17920. @end table
  17921. @subsection Examples
  17922. @itemize
  17923. @item
  17924. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17925. then resynthesize videos back to audio with spectrumsynth:
  17926. @example
  17927. 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
  17928. 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
  17929. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17930. @end example
  17931. @end itemize
  17932. @section split, asplit
  17933. Split input into several identical outputs.
  17934. @code{asplit} works with audio input, @code{split} with video.
  17935. The filter accepts a single parameter which specifies the number of outputs. If
  17936. unspecified, it defaults to 2.
  17937. @subsection Examples
  17938. @itemize
  17939. @item
  17940. Create two separate outputs from the same input:
  17941. @example
  17942. [in] split [out0][out1]
  17943. @end example
  17944. @item
  17945. To create 3 or more outputs, you need to specify the number of
  17946. outputs, like in:
  17947. @example
  17948. [in] asplit=3 [out0][out1][out2]
  17949. @end example
  17950. @item
  17951. Create two separate outputs from the same input, one cropped and
  17952. one padded:
  17953. @example
  17954. [in] split [splitout1][splitout2];
  17955. [splitout1] crop=100:100:0:0 [cropout];
  17956. [splitout2] pad=200:200:100:100 [padout];
  17957. @end example
  17958. @item
  17959. Create 5 copies of the input audio with @command{ffmpeg}:
  17960. @example
  17961. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17962. @end example
  17963. @end itemize
  17964. @section zmq, azmq
  17965. Receive commands sent through a libzmq client, and forward them to
  17966. filters in the filtergraph.
  17967. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17968. must be inserted between two video filters, @code{azmq} between two
  17969. audio filters. Both are capable to send messages to any filter type.
  17970. To enable these filters you need to install the libzmq library and
  17971. headers and configure FFmpeg with @code{--enable-libzmq}.
  17972. For more information about libzmq see:
  17973. @url{http://www.zeromq.org/}
  17974. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17975. receives messages sent through a network interface defined by the
  17976. @option{bind_address} (or the abbreviation "@option{b}") option.
  17977. Default value of this option is @file{tcp://localhost:5555}. You may
  17978. want to alter this value to your needs, but do not forget to escape any
  17979. ':' signs (see @ref{filtergraph escaping}).
  17980. The received message must be in the form:
  17981. @example
  17982. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17983. @end example
  17984. @var{TARGET} specifies the target of the command, usually the name of
  17985. the filter class or a specific filter instance name. The default
  17986. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17987. but you can override this by using the @samp{filter_name@@id} syntax
  17988. (see @ref{Filtergraph syntax}).
  17989. @var{COMMAND} specifies the name of the command for the target filter.
  17990. @var{ARG} is optional and specifies the optional argument list for the
  17991. given @var{COMMAND}.
  17992. Upon reception, the message is processed and the corresponding command
  17993. is injected into the filtergraph. Depending on the result, the filter
  17994. will send a reply to the client, adopting the format:
  17995. @example
  17996. @var{ERROR_CODE} @var{ERROR_REASON}
  17997. @var{MESSAGE}
  17998. @end example
  17999. @var{MESSAGE} is optional.
  18000. @subsection Examples
  18001. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18002. be used to send commands processed by these filters.
  18003. Consider the following filtergraph generated by @command{ffplay}.
  18004. In this example the last overlay filter has an instance name. All other
  18005. filters will have default instance names.
  18006. @example
  18007. ffplay -dumpgraph 1 -f lavfi "
  18008. color=s=100x100:c=red [l];
  18009. color=s=100x100:c=blue [r];
  18010. nullsrc=s=200x100, zmq [bg];
  18011. [bg][l] overlay [bg+l];
  18012. [bg+l][r] overlay@@my=x=100 "
  18013. @end example
  18014. To change the color of the left side of the video, the following
  18015. command can be used:
  18016. @example
  18017. echo Parsed_color_0 c yellow | tools/zmqsend
  18018. @end example
  18019. To change the right side:
  18020. @example
  18021. echo Parsed_color_1 c pink | tools/zmqsend
  18022. @end example
  18023. To change the position of the right side:
  18024. @example
  18025. echo overlay@@my x 150 | tools/zmqsend
  18026. @end example
  18027. @c man end MULTIMEDIA FILTERS
  18028. @chapter Multimedia Sources
  18029. @c man begin MULTIMEDIA SOURCES
  18030. Below is a description of the currently available multimedia sources.
  18031. @section amovie
  18032. This is the same as @ref{movie} source, except it selects an audio
  18033. stream by default.
  18034. @anchor{movie}
  18035. @section movie
  18036. Read audio and/or video stream(s) from a movie container.
  18037. It accepts the following parameters:
  18038. @table @option
  18039. @item filename
  18040. The name of the resource to read (not necessarily a file; it can also be a
  18041. device or a stream accessed through some protocol).
  18042. @item format_name, f
  18043. Specifies the format assumed for the movie to read, and can be either
  18044. the name of a container or an input device. If not specified, the
  18045. format is guessed from @var{movie_name} or by probing.
  18046. @item seek_point, sp
  18047. Specifies the seek point in seconds. The frames will be output
  18048. starting from this seek point. The parameter is evaluated with
  18049. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18050. postfix. The default value is "0".
  18051. @item streams, s
  18052. Specifies the streams to read. Several streams can be specified,
  18053. separated by "+". The source will then have as many outputs, in the
  18054. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18055. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18056. respectively the default (best suited) video and audio stream. Default
  18057. is "dv", or "da" if the filter is called as "amovie".
  18058. @item stream_index, si
  18059. Specifies the index of the video stream to read. If the value is -1,
  18060. the most suitable video stream will be automatically selected. The default
  18061. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18062. audio instead of video.
  18063. @item loop
  18064. Specifies how many times to read the stream in sequence.
  18065. If the value is 0, the stream will be looped infinitely.
  18066. Default value is "1".
  18067. Note that when the movie is looped the source timestamps are not
  18068. changed, so it will generate non monotonically increasing timestamps.
  18069. @item discontinuity
  18070. Specifies the time difference between frames above which the point is
  18071. considered a timestamp discontinuity which is removed by adjusting the later
  18072. timestamps.
  18073. @end table
  18074. It allows overlaying a second video on top of the main input of
  18075. a filtergraph, as shown in this graph:
  18076. @example
  18077. input -----------> deltapts0 --> overlay --> output
  18078. ^
  18079. |
  18080. movie --> scale--> deltapts1 -------+
  18081. @end example
  18082. @subsection Examples
  18083. @itemize
  18084. @item
  18085. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18086. on top of the input labelled "in":
  18087. @example
  18088. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18089. [in] setpts=PTS-STARTPTS [main];
  18090. [main][over] overlay=16:16 [out]
  18091. @end example
  18092. @item
  18093. Read from a video4linux2 device, and overlay it on top of the input
  18094. labelled "in":
  18095. @example
  18096. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18097. [in] setpts=PTS-STARTPTS [main];
  18098. [main][over] overlay=16:16 [out]
  18099. @end example
  18100. @item
  18101. Read the first video stream and the audio stream with id 0x81 from
  18102. dvd.vob; the video is connected to the pad named "video" and the audio is
  18103. connected to the pad named "audio":
  18104. @example
  18105. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18106. @end example
  18107. @end itemize
  18108. @subsection Commands
  18109. Both movie and amovie support the following commands:
  18110. @table @option
  18111. @item seek
  18112. Perform seek using "av_seek_frame".
  18113. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18114. @itemize
  18115. @item
  18116. @var{stream_index}: If stream_index is -1, a default
  18117. stream is selected, and @var{timestamp} is automatically converted
  18118. from AV_TIME_BASE units to the stream specific time_base.
  18119. @item
  18120. @var{timestamp}: Timestamp in AVStream.time_base units
  18121. or, if no stream is specified, in AV_TIME_BASE units.
  18122. @item
  18123. @var{flags}: Flags which select direction and seeking mode.
  18124. @end itemize
  18125. @item get_duration
  18126. Get movie duration in AV_TIME_BASE units.
  18127. @end table
  18128. @c man end MULTIMEDIA SOURCES